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


PHP modules::find方法代码示例

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


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

示例1: load

 public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
 {
     // first we need to check if this is called before CI_controller
     // if yes, well just use default
     if (!class_exists('CI_controller')) {
         return parent::load($file, $use_sections, $fail_gracefully);
     }
     if (in_array($file, $this->is_loaded, TRUE)) {
         return $this->item($file);
     }
     $_module = Modules::$current;
     if ($path = modules::find($file, $_module, 'config')) {
         // this file expected contain $config var
         include $path;
         if (!isset($config) or !is_array($config)) {
             show_error("{$path} does not contain a valid config array");
         }
         log_message('debug', "File loaded: {$path}");
         $current_config =& $this->config;
         if ($use_sections === TRUE) {
             if (isset($current_config[$file])) {
                 $current_config[$file] = array_merge($current_config[$file], $config);
             } else {
                 $current_config[$file] = $config;
             }
         } else {
             $current_config = array_merge($current_config, $config);
         }
         $this->is_loaded[] = $file;
         unset($config);
         return $this->item($file);
     }
     return parent::load($file, $use_sections, $fail_gracefully);
 }
开发者ID:egig,项目名称:CodeIgniter-HMVC-Support,代码行数:34,代码来源:Config.php

示例2: load

 public function load($langfile, $idiom = '', $return = FALSE, $add_suffix = TRUE, $alt_path = '')
 {
     // first we need to check if this is called before CI_controller
     // if yes, well just use default
     if (!class_exists('CI_controller')) {
         return parent::load($file, $use_sections, $fail_gracefully);
     }
     if (is_array($langfile)) {
         foreach ($langfile as $_lang) {
             $this->load($_lang);
         }
         return $this->language;
     }
     $deft_lang = get_instance()->config->item('language');
     $idiom or $idiom = $deft_lang;
     if (in_array($langfile . '_lang.php', $this->is_loaded, TRUE)) {
         return $this->language;
     }
     $_module = get_instance()->router->fetch_module();
     if ($path = modules::find($langfile . '_lang', $_module, 'language/' . $idiom)) {
         include $path;
         if (!isset($lang) or !is_array($lang)) {
             show_error("{$path} does not contain a valid lang array");
         }
         if ($return) {
             return $lang;
         }
         $this->language = array_merge($this->language, $lang);
         $this->is_loaded[] = $langfile . '_lang.php';
         unset($lang);
         return $this->language;
     }
     return parent::load($langfile, $idiom, $return, $add_suffix, $alt_path);
 }
开发者ID:egig,项目名称:CodeIgniter-HMVC-Support,代码行数:34,代码来源:Lang.php

示例3: _loadModules

 private function _loadModules()
 {
     $modules = (array) $this->modules;
     if (count($modules) > 0 && defined('INIT_MODULES') && INIT_MODULES) {
         // start module init
         $_paths = array();
         require_once 'system.modules.php';
         // application users modules - lets load up the system module file.
         __log("Loading " . count($modules) . " modules.");
         // report how many modules we are loading.
         foreach ((array) $modules as $_module) {
             if (is_dir(BASE_SYSTEM . DS . DIRECTORY_MODULES . DS . '_' . $_module)) {
                 // any module contained in a directory with _ in front is considered a must load over any  modules in use directory
                 $module_directory = BASE_SYSTEM . DS . DIRECTORY_MODULES . DS . '_' . $_module;
             } else {
                 if (is_dir(APPLICATION_PATH . DS . DIRECTORY_MODULES . DS . $_module)) {
                     // rule off thumb always use modules in users application path before we use modules in system directory
                     $module_directory = APPLICATION_PATH . DS . DIRECTORY_MODULES . DS . $_module;
                 } else {
                     if (is_dir(BASE_SYSTEM . DS . DIRECTORY_MODULES . DS . $_module)) {
                         $module_directory = BASE_SYSTEM . DS . DIRECTORY_MODULES . DS . $_module;
                     } else {
                         throw new Exception('Tried loading a system module that does not exists');
                     }
                 }
             }
             if (file_exists($module_directory . DS . $_module . '.module.php')) {
                 include $module_directory . DS . $_module . '.module.php';
                 $_paths[$_module] = $module_directory . DS . $_module . '.module.php';
             } else {
                 throw new Exception("required system file was not install module.init.php was not found in {$module_directory}.");
             }
         }
         $modules = modules::find();
         // find all loaded module classes
         // interate through each module and execute
         foreach ((array) $modules as $module) {
             $module_object =& new $module();
             $name = $module_object->__name();
             if (key_exists($name, $this->_modules)) {
                 throw new Exception($module . ": fatal Conflict with the module name: " . $name . " taken by the class: " . get_class($this->modules[$name]));
             }
             __log("Loading module: {$name}");
             $module_object->attach($this);
             $this->_modules[$name] = $module_object;
             if (method_exists($module_object, '__init')) {
                 __log("Initializing module. ");
                 $module_object->__init();
             }
             // odd a module should have an init
         }
         // end of module init
     }
 }
开发者ID:jjanes,项目名称:Amber-PHP-Application-Framework,代码行数:54,代码来源:system.application.php

示例4: autoload

 /** Autload items **/
 public function autoload()
 {
     $ci = modules::$registry[$this->_class];
     /* process application autoload */
     if (!isset(self::$autoload) and self::$autoload = TRUE) {
         self::$loader->_ci_autoloader();
     }
     /* controller autoload array */
     $autoload = $ci->autoload() or $autoload = array();
     list($path, $file) = modules::find('autoload', $this->_module, 'config/');
     /* module autoload file */
     if ($path != FALSE) {
         $autoload = array_merge(modules::load_file($file, $path, 'autoload'), $autoload);
     }
     /* nothing to do? */
     if (count($autoload) == 0) {
         return;
     }
     /* autoload database & libraries */
     if (isset($autoload['libraries'])) {
         if (in_array('database', $autoload['libraries'])) {
             /* autoload database */
             if (!($db = $ci->config->item('database'))) {
                 $db['params'] = 'default';
                 $db['active_record'] = TRUE;
             }
             $ci->db = $this->database($db['params'], TRUE, $db['active_record']);
             $autoload['libraries'] = array_diff($autoload['libraries'], array('database'));
         }
         /* autoload libraries */
         foreach ($autoload['libraries'] as $library) {
             $this->library($library);
         }
     }
     /* autoload config */
     if (isset($autoload['config'])) {
         foreach ($autoload['config'] as $key => $val) {
             $this->config($val, TRUE);
         }
     }
     /* autoload helpers, plugins, scripts, languages */
     foreach (array('helper', 'plugin', 'script', 'language') as $type) {
         if (isset($autoload[$type])) {
             foreach ($autoload[$type] as $item) {
                 $this->{$type}($item);
             }
         }
     }
     /* autoload base classes */
     if (isset($autoload['class'])) {
         foreach ($autoload['class'] as $class) {
             modules::autoload($class);
         }
     }
     /* autoload models */
     if (isset($autoload['model'])) {
         foreach ($autoload['model'] as $model => $alias) {
             is_numeric($model) ? $this->model($alias) : $this->model($model, $alias);
         }
     }
     /* autoload module controllers */
     if (isset($autoload['modules']) and !in_array($this->_class, $autoload['modules'])) {
         foreach ($autoload['modules'] as $module) {
             $this->module($module);
         }
     }
 }
开发者ID:silentworks,项目名称:vaspasian,代码行数:68,代码来源:Controller.php


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