本文整理匯總了PHP中CMS::load_components方法的典型用法代碼示例。如果您正苦於以下問題:PHP CMS::load_components方法的具體用法?PHP CMS::load_components怎麽用?PHP CMS::load_components使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CMS
的用法示例。
在下文中一共展示了CMS::load_components方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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();
}
}