本文整理汇总了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();
}
}