本文整理汇总了PHP中CMS::is_lazy_components方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::is_lazy_components方法的具体用法?PHP CMS::is_lazy_components怎么用?PHP CMS::is_lazy_components使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::is_lazy_components方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_helperes_from_cache
protected function load_helperes_from_cache($helpers)
{
if (!CMS::is_lazy_components()) {
return;
}
if ($this->is_cache_loaded) {
return;
}
$this->is_cache_loaded = true;
if ($classes = WS::env()->cache->get('cms:viwes:helpers_classes')) {
foreach ($classes as $name => $class) {
$helpers->append($class, $name);
}
} else {
Events::add_once('cms.load_components', function () use($helpers) {
WS::env()->cache->set('cms:viwes:helpers_classes', $helpers->classes, 0);
});
CMS::load_components();
}
}
示例2: load_cache
protected function load_cache()
{
if (!CMS::is_lazy_components()) {
return;
}
if ($this->is_cache_loaded) {
return;
}
$this->is_cache_loaded = true;
if ($classes = $this->cache->get('cms:orm:classes')) {
$this->mappers = array_replace_recursive($classes, $this->mappers, self::$classes);
} else {
$self = $this;
$cache = $this->cache;
Events::add_once('cms.load_components', function () use($self, $cache) {
$mappers = array_replace_recursive(CMS_ORM_Root::$classes, $self->get_mappers());
$cache->set('cms:orm:classes', $mappers, 0);
});
CMS::load_components();
}
}
示例3: initialize
/**
* @param array $config
*/
static function initialize($config = array())
{
try {
self::$globals = new ArrayObject();
foreach ($config as $key => $value) {
self::${$key} = $value;
}
self::add_listeners();
foreach (array('files_path', 'stdfiles_cache', 'assets_dir') as $key) {
self::${$key} = str_replace('%files%', Core::option('files_name'), self::${$key});
}
self::configure_paths();
self::configure_loader();
Core::load('Events');
/**
*
* @event cms.initialize.start
* Вызывается в начале инициализации при загрузке модуля CMS. Если возвращено значение, отличное от null, то дальнейшая инициализация произведена не будет.
*
*/
$rc = Events::call('cms.initialize.start');
if (!is_null($rc)) {
return $rc;
}
Core::load('WS.DSL');
self::$common_application = WS_DSL::application();
self::$web_application = WS_DSL::application();
self::common_application()->cms_static();
self::dummy_run();
if (CMS::is_lazy_components()) {
Core::option('spl_autoload', true);
Core::register_spl_autoload();
}
if (!Core::option('spl_autoload')) {
spl_autoload_register('CMS::spl_autoload');
self::load();
} else {
self::load();
}
if (self::$enable_rest) {
Core::load('WS.Services.REST');
Core::load('CMS.Application');
self::$dispatcher = new CMS_Application_Dispatcher();
WS_DSL::add_middleware('dispatcher', self::$dispatcher);
}
self::common_application()->config(self::$cfg_file)->cache()->db()->orm(self::$orm_root ? self::$orm_root : 'CMS.ORM.Root')->cms_configure();
//FIXME: не запускать сразу
self::dummy_run();
/**
*
* @event cms.initialize.ready
* Вызывается в конце инициализации при загрузке модуля CMS
*
*/
$rc = Events::call('cms.initialize.ready');
if (!is_null($rc)) {
return $rc;
}
Core::load(self::vars_module());
self::application()->session()->status(array(404 => '404', 500), 'status', true)->cms_std()->auth_apache(self::build_apache_auth_module())->auth_basic(CMS_Handlers::AuthModule(), array('env_name' => 'admin_auth'))->cms_realm_auth();
} catch (Exception $e) {
self::root_catcher($e);
}
}