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


PHP Configure::listobjects方法代码示例

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


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

示例1: initialize

 /**
  * Configuration method.
  *
  * In addition to configuring the settings (see $__defaults above for settings explanation),
  * this function also loops through the installed plugins and 'registers' those that have a
  * PluginNameCallback class.
  *
  * @param object $controller    Controller object
  * @param array $settings       Component settings
  * @access public
  * @return void
  */
 public function initialize(&$controller, $settings = array())
 {
     $this->__controller =& $controller;
     $this->settings = array_merge($this->__defaults, $settings);
     if (empty($this->settings['priority'])) {
         $this->settings['priority'] = Configure::listobjects('plugin');
     } else {
         foreach (Configure::listobjects('plugin') as $plugin) {
             if (!in_array($plugin, $this->settings['priority'])) {
                 array_push($this->settings['priority'], $plugin);
             }
         }
     }
     foreach ($this->settings['priority'] as $plugin) {
         $file = Inflector::underscore($plugin) . '_callback';
         $className = $plugin . 'Callback';
         if (App::import('File', $className, true, array(APP . 'plugins' . DS . Inflector::underscore($plugin)), $file . '.php')) {
             if (class_exists($className)) {
                 $class = new $className();
                 ClassRegistry::addObject($className, $class);
                 $this->__registered[] = $className;
             }
         }
     }
     /**
      * Called before the controller's beforeFilter method.
      */
     $this->executeCallbacks('initialize');
 }
开发者ID:jamienay,项目名称:register_callbacks_component,代码行数:41,代码来源:register_callbacks.php

示例2: initialize

 /**
  * Initializes component by loading all configuration files from 
  * all plugins found in application. Configuration files should be
  * placed in \app\plugins\your_plugin\config\ directory. Be careful,
  * it will overwrite all settings loaded from \app\config if the 
  * setting name matches.
  * At the end it will execute an 'initialize' callback method loaded
  * from \plugins\your_plugin\{your_plugin}_auto_loader.php file
  * 
  * @param object $controller - reference to the controller
  * @param array $settings - component settings, list of autoload files
  * @return void
  * @access public
  */
 function initialize(&$controller, $settings = array())
 {
     $this->__controller =& $controller;
     $this->__settings = Set::merge($this->__settings, $this->__settingsUnique((array) $settings));
     if (empty($this->__settings['priority'])) {
         $this->__settings['priority'] = Configure::listobjects('plugin');
     } else {
         foreach (Configure::listobjects('plugin') as $plugin) {
             if (!in_array($plugin, $this->__settings['priority'])) {
                 array_push($this->__settings['priority'], $plugin);
             }
         }
     }
     foreach ($this->__settings['priority'] as $plugin) {
         $is_parent_class = strpos(get_parent_class($controller), Inflector::classify($plugin)) !== false;
         if ($this->__settings['permanently'] || !$this->__settings['permanently'] && $is_parent_class) {
             foreach ($this->__settings['autoload'] as $type) {
                 App::import('Plugin', Inflector::classify("{$plugin}_{$type}"), array('file' => Inflector::underscore($plugin) . DS . 'config' . DS . $type . '.php'));
             }
         }
     }
     if ($this->__settings['primary']) {
         $ordering = $this->__controller->Component->_primary;
         $new_ordering[] = 'PluginHandler';
         foreach ($ordering as $component_name) {
             if (!in_array($component_name, $new_ordering)) {
                 $new_ordering[] = $component_name;
             }
         }
         $this->__controller->Component->_primary = $new_ordering;
     }
     $this->loaderExecute('initialize');
 }
开发者ID:analogrithems,项目名称:idbroker,代码行数:47,代码来源:plugin_handler.php


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