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


PHP static::items方法代码示例

本文整理汇总了PHP中static::items方法的典型用法代码示例。如果您正苦于以下问题:PHP static::items方法的具体用法?PHP static::items怎么用?PHP static::items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


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

示例1: createCollection

 /**
  * Creates collection of items.
  *
  * Override it if you need to implement
  * derived collection that requires specific initialization.
  *
  * @param array $items
  *
  * @return static
  */
 protected function createCollection(array $items)
 {
     $collection = new static();
     $itemsRef =& $collection->items();
     $itemsRef = $items;
     return $collection;
 }
开发者ID:nayjest,项目名称:collection,代码行数:17,代码来源:CollectionReadTrait.php

示例2: load

 /**
  * Loads a config file or array.
  *
  * @param    mixed    $file         string file | config array
  * @param    mixed    $group        null for no group, true for group is filename, false for not storing in the master config
  * @return   array                  the (loaded) config array
  */
 public static function load($file, $group = null)
 {
     $config = array();
     if (is_array($file)) {
         $config = $file;
     } elseif (is_string($file)) {
         $info = pathinfo($file);
         $type = 'json';
         if (isset($info['extension'])) {
             $type = $info['extension'];
         }
         $loadMethod = 'read' . ucfirst($type);
         if (method_exists(get_called_class(), $loadMethod)) {
             $config = static::$loadMethod($file);
         } else {
             throw new \Exception(sprintf('Invalid config type "%s".', $type));
         }
     } else {
         throw new \Exception('Invalid config specified.');
     }
     if ($group === null) {
         static::$items = array_merge(static::$items, $config);
     } else {
         if (!isset(static::$items[$group])) {
             static::$items[$group] = array();
         }
         static::$items[$group] = array_merge(static::$items[$group], $config);
     }
     return $config;
 }
开发者ID:aniston,项目名称:Platypus,代码行数:37,代码来源:Config.php

示例3: load

 public static function load($file, $group = null, $reload = false)
 {
     if (!is_array($file) && array_key_exists($file, static::$loaded_files) and !$reload) {
         return false;
     }
     $config = array();
     if (is_array($file)) {
         $config = $file;
     } elseif ($paths = \Fuel::find_file('config', $file, '.php', true)) {
         // Reverse the file list so that we load the core configs first and
         // the app can override anything.
         $paths = array_reverse($paths);
         foreach ($paths as $path) {
             $config = \Fuel::load($path) + $config;
         }
     }
     if ($group === null) {
         static::$items = $reload ? $config : static::$items + $config;
     } else {
         $group = $group === true ? $file : $group;
         if (!isset(static::$items[$group]) or $reload) {
             static::$items[$group] = array();
         }
         static::$items[$group] = static::$items[$group] + $config;
     }
     if (!is_array($file)) {
         static::$loaded_files[$file] = true;
     }
     return $config;
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:30,代码来源:config.php

示例4: load

 public static function load($file)
 {
     if (file_exists($file) === false) {
         return false;
     }
     static::$items = array_merge(static::$items, require $file);
     return true;
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:8,代码来源:config.php

示例5: load

 public static function load()
 {
     if (file_exists(PATH . 'config.php') === false) {
         return false;
     }
     static::$items = (require PATH . 'config.php');
     return true;
 }
开发者ID:rubenvincenten,项目名称:anchor-site,代码行数:8,代码来源:config.php

示例6: menuitems

 /**
  * Returns an array of menu items grouped by menu.
  *
  * @param   array  $config  An array of configuration options.
  *
  * @return  array
  *
  * @since   1.6
  */
 public static function menuitems($config = array())
 {
     if (empty(static::$items)) {
         $menus = static::menus();
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('a.id AS value, a.title AS text, a.level, a.menutype')->from('#__menu AS a')->where('a.parent_id > 0')->where('a.client_id = 0');
         // Filter on the published state
         if (isset($config['published'])) {
             if (is_numeric($config['published'])) {
                 $query->where('a.published = ' . (int) $config['published']);
             } elseif ($config['published'] === '') {
                 $query->where('a.published IN (0,1)');
             }
         }
         $query->order('a.lft');
         $db->setQuery($query);
         $items = $db->loadObjectList();
         // Collate menu items based on menutype
         $lookup = array();
         foreach ($items as &$item) {
             if (!isset($lookup[$item->menutype])) {
                 $lookup[$item->menutype] = array();
             }
             $lookup[$item->menutype][] =& $item;
             $item->text = str_repeat('- ', $item->level) . $item->text;
         }
         static::$items = array();
         $user = JFactory::getUser();
         $aclcheck = !empty($config['checkacl']) ? (int) $config['checkacl'] : 0;
         foreach ($menus as &$menu) {
             if ($aclcheck) {
                 $action = $aclcheck == $menu->id ? 'edit' : 'create';
                 if (!$user->authorise('core.' . $action, 'com_menus.menu.' . $menu->id)) {
                     continue;
                 }
             }
             // Start group:
             $optGroup = new stdClass();
             $optGroup->value = '<OPTGROUP>';
             $optGroup->text = $menu->text;
             static::$items[] = $optGroup;
             // Special "Add to this Menu" option:
             static::$items[] = JHtml::_('select.option', $menu->value . '.1', JText::_('JLIB_HTML_ADD_TO_THIS_MENU'));
             // Menu items:
             if (isset($lookup[$menu->value])) {
                 foreach ($lookup[$menu->value] as &$item) {
                     static::$items[] = JHtml::_('select.option', $menu->value . '.' . $item->value, $item->text);
                 }
             }
             // Finish group:
             $closeOptGroup = new stdClass();
             $closeOptGroup->value = '</OPTGROUP>';
             $closeOptGroup->text = $menu->text;
             static::$items[] = $closeOptGroup;
         }
     }
     return static::$items;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:67,代码来源:menu.php

示例7: load

 /**
  * Loads a config file.
  *
  * @param    mixed    $file         string file | config array | Config_Interface instance
  * @param    mixed    $group        null for no group, true for group is filename, false for not storing in the master config
  * @param    bool     $reload       true to force a reload even if the file is already loaded
  * @param    bool     $overwrite    true for array_merge, false for \Arr::merge
  * @return   array                  the (loaded) config array
  */
 public static function load($file, $group = null, $reload = false, $overwrite = false)
 {
     if (!$reload and !is_array($file) and !is_object($file) and array_key_exists($file, static::$loaded_files)) {
         $group === true and $group = $file;
         if ($group === null or $group === false or !isset(static::$items[$group])) {
             return false;
         }
         return static::$items[$group];
     }
     $config = array();
     if (is_array($file)) {
         $config = $file;
     } elseif (is_string($file)) {
         $info = pathinfo($file);
         $type = 'php';
         if (isset($info['extension'])) {
             $type = $info['extension'];
             // Keep extension when it's an absolute path, because the finder won't add it
             if ($file[0] !== '/' and $file[1] !== ':') {
                 $file = substr($file, 0, -(strlen($type) + 1));
             }
         }
         $class = '\\Config_' . ucfirst($type);
         if (class_exists($class)) {
             static::$loaded_files[$file] = true;
             $file = new $class($file);
         } else {
             throw new \FuelException(sprintf('Invalid config type "%s".', $type));
         }
     }
     if ($file instanceof Config_Interface) {
         try {
             $config = $file->load($overwrite, !$reload);
         } catch (\ConfigException $e) {
             $config = array();
         }
         $group = $group === true ? $file->group() : $group;
     }
     if ($group === null) {
         static::$items = $reload ? $config : ($overwrite ? array_merge(static::$items, $config) : \Arr::merge(static::$items, $config));
         static::$itemcache = array();
     } else {
         $group = $group === true ? $file : $group;
         if (!isset(static::$items[$group]) or $reload) {
             static::$items[$group] = array();
         }
         static::$items[$group] = $overwrite ? array_merge(static::$items[$group], $config) : \Arr::merge(static::$items[$group], $config);
         $group .= '.';
         foreach (static::$itemcache as $key => $value) {
             if (strpos($key, $group) === 0) {
                 unset(static::$itemcache[$key]);
             }
         }
     }
     return $config;
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:65,代码来源:config.php

示例8: loadFile

 /**
  * Load a complete config file to merge with the config class's items.
  * Only support for php files that return an array:
  * <code>
  * <?php
  * return array(
  *      'key' = 'item',
  *      'key2' = [
  *          'key' => 'item'
  *      ]
  * );
  * </code>
  *
  * @param $file
  * @throws \InvalidArgumentException
  * @throws \Exception
  * @static
  * @access public
  * @return void
  */
 public static function loadFile($file)
 {
     if (Helpers::fileExists($file) === false) {
         throw new \InvalidArgumentException(sprintf('File [%s] is not found or readable.', $file));
     }
     if (strtolower(pathinfo($file)['extension']) == 'php') {
         $data = (require_once $file);
         if (is_array($data) == false && $data instanceof \Travsersable == false) {
             throw new \Exception('Supplied file for loading should return an array.');
         }
     }
     static::$items = array_merge(static::$items, $data);
 }
开发者ID:xdbas,项目名称:restwork,代码行数:33,代码来源:Config.php

示例9: newKuesioner

 public static function newKuesioner($data)
 {
     $k = new static();
     $k->title = $data['title'];
     $k->user_id = auth()->user()->id;
     $k->gelombang_id = Gelombang::getActive()->id;
     $k->save();
     $i = 1;
     foreach ($data['pertanyaan'] as $q) {
         $p = new KuesionerItem();
         $p->label = $q;
         $p->type = 'input';
         $p->priority = $i;
         $k->items()->save($p);
         $i++;
     }
 }
开发者ID:miarizkim,项目名称:simonev,代码行数:17,代码来源:Kuesioner.php

示例10: existing

 /**
  * Get a list of the available content language items.
  *
  * @param   boolean  $all        True to include All (*)
  * @param   boolean  $translate  True to translate All
  *
  * @return  string
  *
  * @see     JFormFieldContentLanguage
  * @since   1.6
  */
 public static function existing($all = false, $translate = false)
 {
     if (empty(static::$items)) {
         // Get the database object and a new query object.
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         // Build the query.
         $query->select('a.lang_code AS value, a.title AS text, a.title_native')->from('#__languages AS a')->where('a.published >= 0')->order('a.title');
         // Set the query and load the options.
         $db->setQuery($query);
         static::$items = $db->loadObjectList();
         if ($all) {
             array_unshift(static::$items, new JObject(array('value' => '*', 'text' => $translate ? JText::alt('JALL', 'language') : 'JALL_LANGUAGE')));
         }
     }
     return static::$items;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:28,代码来源:contentlanguage.php

示例11: menuitems

 /**
  * Returns an array of menu items grouped by menu.
  *
  * @param   array  $config  An array of configuration options.
  *
  * @return  array
  *
  * @since   1.6
  */
 public static function menuitems($config = array())
 {
     if (empty(static::$items)) {
         $menus = static::menus();
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select('a.id AS value, a.title AS text, a.level, a.menutype')->from('#__menu AS a')->where('a.parent_id > 0')->where('a.client_id = 0');
         // Filter on the published state
         if (isset($config['published'])) {
             if (is_numeric($config['published'])) {
                 $query->where('a.published = ' . (int) $config['published']);
             } elseif ($config['published'] === '') {
                 $query->where('a.published IN (0,1)');
             }
         }
         $query->order('a.lft');
         $db->setQuery($query);
         $items = $db->loadObjectList();
         // Collate menu items based on menutype
         $lookup = array();
         foreach ($items as &$item) {
             if (!isset($lookup[$item->menutype])) {
                 $lookup[$item->menutype] = array();
             }
             $lookup[$item->menutype][] =& $item;
             $item->text = str_repeat('- ', $item->level) . $item->text;
         }
         static::$items = array();
         foreach ($menus as &$menu) {
             // Start group:
             static::$items[] = JHtml::_('select.optgroup', $menu->text);
             // Special "Add to this Menu" option:
             static::$items[] = JHtml::_('select.option', $menu->value . '.1', JText::_('JLIB_HTML_ADD_TO_THIS_MENU'));
             // Menu items:
             if (isset($lookup[$menu->value])) {
                 foreach ($lookup[$menu->value] as &$item) {
                     static::$items[] = JHtml::_('select.option', $menu->value . '.' . $item->value, $item->text);
                 }
             }
             // Finish group:
             static::$items[] = JHtml::_('select.optgroup', $menu->text);
         }
     }
     return static::$items;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:53,代码来源:menu.php

示例12: load

 /**
  * Loads a config file.
  *
  * @param    mixed    $file         string file | config array | Config_Interface instance
  * @param    mixed    $group        null for no group, true for group is filename, false for not storing in the master config
  * @param    bool     $overwrite    true for array_merge, false for \Arr::merge
  * @return   array                  the (loaded) config array
  */
 public static function load($file, $group = null, $reload = false, $overwrite = false)
 {
     if (!$reload and !is_array($file) and !is_object($file) and array_key_exists($file, static::$loaded_files)) {
         return false;
     }
     $config = array();
     if (is_array($file)) {
         $config = $file;
     } elseif (is_string($file)) {
         $info = pathinfo($file);
         $type = isset($info['extension']) ? $info['extension'] : 'php';
         $file = $info['filename'];
         $class = '\\Config_' . ucfirst($type);
         if (class_exists($class)) {
             static::$loaded_files[$file] = true;
             $file = new $class($file);
         } else {
             throw new \FuelException(sprintf('Invalid config type "%s".', $type));
         }
     }
     if ($file instanceof Config_Interface) {
         try {
             $config = $file->load($overwrite);
         } catch (\ConfigException $e) {
             $config = array();
         }
         $group = $group === true ? $file->group() : $group;
     }
     if ($group === null) {
         static::$items = $reload ? $config : ($overwrite ? array_merge(static::$items, $config) : \Arr::merge(static::$items, $config));
     } else {
         $group = $group === true ? $file : $group;
         if (!isset(static::$items[$group]) or $reload) {
             static::$items[$group] = array();
         }
         static::$items[$group] = $overwrite ? array_merge(static::$items[$group], $config) : \Arr::merge(static::$items[$group], $config);
     }
     return $config;
 }
开发者ID:reganhimself,项目名称:KeeleProgrammers,代码行数:47,代码来源:config.php

示例13: refresh

 public function refresh()
 {
     static::$items = [];
     static::$assignments = [];
 }
开发者ID:romeoz,项目名称:rock,代码行数:5,代码来源:RBAC.php

示例14: removeAll

 public function removeAll()
 {
     static::$items = static::$roles = static::$permissions = null;
     $this->saveToFile([], $this->path);
     return true;
 }
开发者ID:romeoz,项目名称:rock,代码行数:6,代码来源:PhpManager.php

示例15: load

 /**
  * @param $filepath Charge le fichier de configuration spécifié et définit $items
  */
 public static function load($filepath)
 {
     static::$items = (include ROOT . '/app/config/' . $filepath . '.config.php');
 }
开发者ID:Pyozer,项目名称:TwitterRemake,代码行数:7,代码来源:config.php


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