当前位置: 首页>>代码示例>>PHP>>正文


PHP pick函数代码示例

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


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


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