當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。