• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pick函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pick函数的典型用法代码示例。如果您正苦于以下问题:PHP pick函数的具体用法?PHP pick怎么用?PHP pick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pick函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _commandEdit

 /**
  * Edit Command for an entity.
  *
  * @param LibBaseTemplateObject $command The action object
  */
 protected function _commandEdit($command)
 {
     $entity = $this->getController()->getItem();
     $view = $this->getController()->getView()->getName();
     $layout = pick($command->layout, 'edit');
     $command->append(array('label' => JText::_('LIB-AN-ACTION-EDIT')))->href($entity->getURL() . '&layout=' . $layout)->setAttribute('data-action', 'edit');
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:12,代码来源:default.php


示例2: testArrayAccess

 function testArrayAccess()
 {
     $object = new \ArrayObject();
     $object['test'] = 5;
     $this->assertSame(5, pick($object, 'test'), 'Key exists');
     $this->assertSame(10, pick($object, 'dummy', 10), 'Key does not exists');
 }
开发者ID:RightThisMinute,项目名称:responsive-images-php,代码行数:7,代码来源:PickTest.php


示例3: route

 /**
  * Set the X_REQUEST header to request an output other than a full HTML page.
  */
 public function route($path)
 {
     $this->args = explode('/', $path);
     $this->model = array_shift($this->args);
     $class = ucfirst($this->model) . "Commands";
     $this->controller = new $class();
     $this->command = pick(array_shift($this->args), 'index');
     if ($_POST['returnFormat']) {
         $this->returnFormat = $_POST['returnFormat'];
         unset($_POST['returnFormat']);
     }
     $this->args[] = $_POST;
     if (!method_exists($this->controller, $this->command)) {
         throw new CommandException("Command {$command} not found.");
     }
     try {
         $this->result = call_user_func_array(array($this->controller, $this->command), $this->args);
     } catch (Exception $e) {
         $this->exception = $e;
     }
     $returnFormat = strtolower($_SERVER['HTTP_X_REQUEST']);
     $meth = "output_{$returnFormat}";
     if (method_exists($this, $meth)) {
         return $this->{$meth}();
     }
     return $this->output_full();
 }
开发者ID:acquiescence,项目名称:rabidcore,代码行数:30,代码来源:Router.php


示例4: getFederalTaxes

 /**
  * Returns an array of federal taxes
  * 
  * @return array
  */
 public function getFederalTaxes()
 {
     $taxes = pick($this->meta->federal_taxes, array());
     foreach ($taxes as &$tax) {
         $tax = new KConfig($tax);
     }
     return $taxes;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:13,代码来源:vat.php


示例5: fetchElement

 /**
  * Render a custom element.
  *
  * @param string     $name         The name of the element
  * @param string     $value        The vlaue of the element
  * @param xmlElement $node         The node xml element
  * @param string     $control_name The control name
  * 
  * @see   JElement
  * 
  * @return string
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     $data = pick(KConfig::unbox($this->_parent->template_data), array());
     $data['name'] = $name;
     $data['value'] = $value;
     $data['node'] = $node;
     $data['control_name'] = $control_name;
     return (string) $this->_template->loadString($node->data(), $data);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:21,代码来源:custom.php


示例6: onBeforeControllerGet

 /**
  * Before _actionGet controller event
  *
  * @param  KEvent $event Event object 
  * 
  * @return string
  */
 public function onBeforeControllerGet(KEvent $event)
 {
     parent::onBeforeControllerGet($event);
     if ($this->getController()->isOwnable() && $this->getController()->actor) {
         $actor = pick($this->getController()->actor, get_viewer());
         $this->setTitle(sprintf(JText::_('COM-STORIES-HEADER-STORIES'), $actor->name));
         $this->setActor($actor);
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:16,代码来源:actorbar.php


示例7: onBeforeControllerGet

 /**
  * Before controller action.
  *
  * @param KEvent $event Event object
  *
  * @return string
  */
 public function onBeforeControllerGet(KEvent $event)
 {
     parent::onBeforeControllerGet($event);
     $viewer = $this->getController()->viewer;
     $actor = pick($this->getController()->actor, $viewer);
     $layout = pick($this->getController()->layout, 'default');
     $name = $this->getController()->getIdentifier()->name;
     $this->setTitle(JText::sprintf('COM-TOPICS-HEADER-TOPICS', $actor->name));
     $this->addNavigation('topics', JText::_('COM-TOPICS-NAV-TOPICS'), array('option' => 'com_topics', 'view' => 'topics', 'oid' => $actor->id), $name == 'topic');
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:17,代码来源:actorbar.php


示例8: unserialize

 /**
  * Instantiate the set attribute with a comma seperate list of value
  *
  * @param  string $data A comma seperated list of values
  * 
  * @return AnDomainAttributeSet
  */
 public function unserialize($data)
 {
     if ($data) {
         $data = explode(',', pick($data, ''));
         $data = array_combine($data, $data);
     } else {
         $data = array();
     }
     $this->_data = $data;
     return $this;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:18,代码来源:set.php


示例9: _beforeRepositoryFetch

 /**
  * {@inheritdoc}
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     $query = $context->query;
     $repository = $query->getRepository();
     $query->privacy = pick($query->privacy, new KConfig());
     //weak link  the stories with object nodes
     //and use the object.access instead of the story access if there are ny
     $query->link('object', array('type' => 'weak', 'bind_type' => false));
     $query->privacy->append(array('use_access_column' => 'IF(@col(object.id) IS NULL,@col(story.access), @col(object.access))'));
     parent::_beforeRepositoryFetch($context);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:14,代码来源:privatable.php


示例10: onBeforeControllerGet

 /**
  * Before controller action.
  *
  * @param KEvent $event Event object
  *
  * @return string
  */
 public function onBeforeControllerGet(KEvent $event)
 {
     parent::onBeforeControllerGet($event);
     $viewer = get_viewer();
     $actor = pick($this->getController()->actor, $viewer);
     $layout = pick($this->getController()->layout, 'default');
     $name = $this->getController()->getIdentifier()->name;
     $this->setTitle(JText::sprintf('COM-PAGES-ACTOR-HEADER-' . strtoupper($name) . 'S', $actor->name));
     //create navigations
     $this->addNavigation('pages', JText::_('COM-PAGES-LINK-PAGES'), array('option' => 'com_pages', 'view' => 'pages', 'oid' => $actor->id), $name == 'page');
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:18,代码来源:actorbar.php


示例11: _beforeRepositoryFetch

 protected function _beforeRepositoryFetch($context)
 {
     if (KService::has('com:people.viewer') && is_person(get_viewer()) && get_viewer()->admin()) {
         return;
     }
     $query = $context->query;
     $config = pick($query->privacy, new KConfig());
     $config->append(array('viewer' => get_viewer()));
     $where = $this->buildCondition(get_viewer(), $config);
     $query->where($where);
 }
开发者ID:NicholasJohn16,项目名称:forums,代码行数:11,代码来源:privatable.php


示例12: __construct

 /**
  * Connects to the database or whines about how it couldn't.
  */
 private function __construct()
 {
     $this->host = pick($host, DB_HOST, 'localhost');
     $this->user = pick($user, DB_USER);
     $this->password = pick($password, DB_PASS);
     $this->database = pick($database, DB_DATA);
     $this->connection = mysql_connect($this->host, $this->user, $this->password);
     if (!mysql_select_db($this->database)) {
         throw new Exception("Could not connect to database.");
     }
 }
开发者ID:acquiescence,项目名称:rabidcore,代码行数:14,代码来源:Database.php


示例13: parse

 /**
  * (non-PHPdoc).
  *
  * @see ComBaseRouterAbstract::parse()
  */
 public function parse(&$segments)
 {
     $path = implode('/', $segments);
     if (empty($segments)) {
         $segments[] = 'email';
     }
     if (preg_match('#(connections|token)(/\\w+)?#', $path)) {
         return array('view' => array_shift($segments), 'service' => pick('facebook', array_pop($segments)));
     }
     return parent::parse($segments);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:16,代码来源:router.php


示例14: _beforeRepositoryFetch

 /**
  * {@inheritdoc}
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     if (KService::has('com:people.viewer') && is_person(get_viewer()) && get_viewer()->admin()) {
         return;
     }
     $query = $context->query;
     $repository = $query->getRepository();
     $config = pick($query->privacy, new KConfig());
     $config->append(array('visible_to_leaders' => true, 'viewer' => get_viewer(), 'graph_check' => true));
     $where = $this->buildCondition('@col(id)', $config, '@col(access)');
     $query->where($where);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:15,代码来源:privatable.php


示例15: onBeforeControllerGet

 /**
  * Before controller action
  *
  * @param  KEvent $event Event object 
  * 
  * @return string
  */
 public function onBeforeControllerGet(KEvent $event)
 {
     parent::onBeforeControllerGet($event);
     $name = $this->getController()->getIdentifier()->name;
     if ($name != 'order') {
         return;
     }
     $viewer = $this->getController()->viewer;
     $actor = pick($this->getController()->actor, $viewer);
     $this->setActor($actor);
     $this->setTitle(JText::sprintf('COM-SUBSCRIPTIONS-ACTOR-HEADER-TITLE-ORDER', $actor->name));
 }
开发者ID:walteraries,项目名称:anahita,代码行数:19,代码来源:actorbar.php


示例16: canRead

 /**
  * Authorize Read
  *
  * @return boolean
  */
 public function canRead()
 {
     $actor = pick($this->actor, get_viewer());
     //if repository is ownable then ask the actor if viewer can publish things
     if (in_array($this->getRequest()->get('layout'), array('add', 'edit', 'form', 'composer'))) {
         $result = $this->getItem() ? $this->canEdit() : $this->canAdd();
         return $result;
     }
     if (!$this->getItem()) {
         return false;
     }
     //check if an entiy authorize access
     return $this->getItem()->authorize('access');
 }
开发者ID:walteraries,项目名称:anahita,代码行数:19,代码来源:abstract.php


示例17: flatten

 /**
  * converts an array to a delimited string
  * 
  * @param array @array - the array to be flattened, used for recursion
  * @param string $delimiter - the delimiter to separate keys and values. Defaulted to "="
  * @param string $separator - a string used to separate key value pairs. Defaulted to ","
  * @access public
  * @return System_Utility_Array
  */
 public function flatten($array = false, $delimiter = '=', $separator = ',')
 {
     $array = pick($array, $this->_processed, $this->_value);
     $flattened = array();
     foreach ($array as $key => $val) {
         if (is_array($val)) {
             $flattened[] = $this->flatten($val, $delimiter, $separator);
         } else {
             $flattened[] = $key . $delimiter . $val;
         }
     }
     $this->_processed = implode($separator, $flattened);
     return $this;
 }
开发者ID:pmatsis,项目名称:JoshuaTree,代码行数:23,代码来源:Array.php


示例18: _beforeRepositoryFetch

 /**
  * Before fetch.
  *
  * @param KCommandContext $context
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     $query = $context->query;
     //$query->where('@col(comment.id) IS NULL');
     $query->where('IF(@col(target.enabled) IS NULL, 1, @col(target.enabled) <> 0) AND IF(@col(subject.enabled) IS NULL, 1, @col(subject.enabled) <> 0)')->link('target', array('type' => 'weak', 'bind_type' => false));
     //apply the privacy
     $privtable = $this->getBehavior('com://site/medium.domain.behavior.privatable');
     $query->privacy = pick($query->privacy, new KConfig());
     //weak link  the stories with object nodes
     //and use the object.access instead of the story access if there are ny
     $query->link('object', array('type' => 'weak', 'bind_type' => false));
     //we are using the object.access as the privacy reference
     $query->privacy->append(array('use_access_column' => '@col(object.access)'));
     $privtable->execute('before.fetch', $context);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:20,代码来源:story.php


示例19: define

 /**
  * defines the image and image type
  * TODO: add gd-created image support for the $file argument
  *
  * @param string $file -- the fullpath to the file to be loaded. Optional
  * @access protected
  * @return System_Utility_File_Image
  */
 protected function define($file = false)
 {
     $file = pick($file, $this->_value->get('original'));
     $this->_image_info = getimagesize($file);
     $this->_image_type = $mime = $this->_image_info['mime'];
     if (preg_match('/jpg|jpeg/i', $mime)) {
         $this->_image = imagecreatefromjpeg($file);
     } elseif (preg_match('/gif/i', $mime)) {
         $this->_image = imagecreatefromgif($file);
     } elseif (preg_match('/png/i', $mime)) {
         $this->_image = imagecreatefrompng($file);
     } elseif (preg_match('/bmp/i', $mime)) {
         $this->_image = imagecreatefromwbmp($file);
     }
     return $this;
 }
开发者ID:pmatsis,项目名称:JoshuaTree,代码行数:24,代码来源:Image.php


示例20: execute

 /**
  * Command handler.
  * 
  * @param   string      The command name
  * @param   object      The command context
  *
  * @return bool Can return both true or false.  
  */
 public function execute($name, KCommandContext $context)
 {
     $parts = explode('.', $name);
     if ($parts[0] == 'before') {
         $value = pick($this->{$this->getIdentifiableKey()}, $context->data->{$this->getIdentifiableKey()});
         if ($value) {
             $parent = $this->getParentRepository()->fetch($value);
             $this->setParent($parent);
             //set the entity owner as the context actor of the controller
             if ($parent && $this->getRepository()->isOwnable() && $this->isOwnable()) {
                 $this->setActor($parent->owner);
             }
             $context->data['parent'] = $parent;
         }
     }
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:24,代码来源:parentable.php



注:本文中的pick函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pick_date_widget2函数代码示例发布时间:2022-05-15
下一篇:
PHP pic_save函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap