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


PHP loader::with_composer方法代码示例

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


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

示例1: autoload

 /**
  * Load basic classes files
  * and nothing more
  */
 public static function autoload()
 {
     if (empty(self::$root_path) || !is_dir(self::$root_path)) {
         throw new exception('Bad root! Use loader::set_root()');
     }
     // composer autoload
     $autoloader_path = self::get_root('vendor/autoload.php');
     if (file_exists($autoloader_path)) {
         self::$composer = (require $autoloader_path);
         self::$with_composer = true;
     }
     /** @todo cache compiled core to apc/memcached */
     if (self::$with_composer) {
         self::preload_core_with_composer(self::$composer);
         // 0.2210 -- 0.2320
     } else {
         self::preload_core(self::$compile);
         // 0.2090 -- 0.2110
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:24,代码来源:loader.php

示例2: init0

 /**
  * INIT0 - call right after create an instance of core
  * create basic stuff
  * @throws core_exception
  */
 public function init0()
 {
     if ($this->initialized) {
         throw new core_exception('Already initialized');
     }
     $this->initialized = self::IS_LOADING;
     self::dprint(array("core::init0 %s", loader::with_composer() ? '+composer' : ''), self::E_DEBUG2);
     // templates setup
     self::register_lib('tpl_parser', function () {
         return tpl_loader::factory(core::selfie()->cfg('lib_tpl_parser'));
     });
     // renderer
     self::register_lib('renderer', function () {
         return 0 ? new \SatCMS\Modules\Core\Base\ObjectMock() : new tf_renderer(core::selfie()->cfg('template'), core::lib('tpl_parser'));
     });
     // database setup (database-`mysql`)
     $this->configure_database($this->cfg('database'));
     // set default timezone
     $tz = $this->cfg('default_timezone');
     date_default_timezone_set($tz ? $tz : 'Europe/Moscow');
     // load core config
     $this->dyn_config = $this->model('config', array('render_by_key' => true))->load()->merge_with($this->config);
     // content-types
     $ctype_config = loader::get_docs() . 'ctypes.cfg';
     $ctype_array = fs::file_exists($ctype_config) ? parse_ini_file($ctype_config, true) : array();
     $this->_ctypes = $this->get_ctype_handle();
     $this->_ctypes->from_array($ctype_array);
     // add libs
     self::register_lib('logger', function () {
         return tf_logger::get_instance()->enable(!core::get_instance()->cfg('disable_logs', false));
     });
     self::register_lib('manager', new tf_manager());
     self::register_lib('request', new tf_request());
     $modules_config = array();
     if ('file' == $this->cfg('modules_config', '') && ($modules_config_file = loader::get_docs() . 'modules.cfg') && fs::file_exists($modules_config_file)) {
         $modules_config = parse_ini_file($modules_config_file, true);
     } else {
         try {
             $modules_config = $this->module('modules', array('key' => 'tag'))->as_array();
         } catch (module_exception $e) {
             // misconfigured modules, some of modules not exists
             throw new core_exception($e->getMessage(), tf_exception::CRITICAL);
         }
     }
     // site init %domain%
     // config/%domain%/init.php
     $site_config = array();
     $site_config_path = $this->cfg('site_config');
     if (!empty($site_config_path)) {
         $host = @$_SERVER['HTTP_HOST'];
         if ('%domain%' == $site_config_path) {
             $site_config_path = strpos($host, 'www.') === 0 ? substr($host, 4) : $host;
         }
         $mod_config_file = loader::get_docs() . $site_config_path . '/init.php';
         if ($site_config_path && file_exists($mod_config_file)) {
             $site_config = (include $mod_config_file);
         }
     }
     // import module config `mod_{module}`
     // allow overrides modules.cfg
     foreach ($this->config as $cfg_key => $cfg) {
         if (strpos($cfg_key, 'mod_') === 0) {
             $cfg_key = substr($cfg_key, 4);
             $modules_config[$cfg_key] = @$modules_config[$cfg_key] ?: array();
             $modules_config[$cfg_key] = functions::array_merge_recursive_distinct($modules_config[$cfg_key], $cfg);
         }
     }
     // module manager
     self::$modules = new core_modules($modules_config, $site_config);
     // finish core init0 proccess
     parent::init0();
     // check bans
     if (!$this->cfg('no_bans_check') && isset($_SERVER['REQUEST_URI']) && ($_uri = $_SERVER['REQUEST_URI']) && !empty($_uri)) {
         if ($this->get_bans_handle()->check_spam($_uri)) {
             throw new core_exception(i18n::T('you_are_banned'), tf_exception::CRITICAL);
         }
     }
     self::register_lib('auth', new tf_auth(loader::in_shell()))->start_session();
     if (self::in_editor()) {
         // editor kickstart
         $this->lib('editor');
     }
     register_shutdown_function(array($this, 'halt'));
     $this->initialized = true;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:90,代码来源:core.php


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