本文整理汇总了PHP中vmc::get_themes_root_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP vmc::get_themes_root_dir方法的具体用法?PHP vmc::get_themes_root_dir怎么用?PHP vmc::get_themes_root_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmc
的用法示例。
在下文中一共展示了vmc::get_themes_root_dir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: monitor_change
public function monitor_change($theme)
{
$config_file_path = vmc::get_themes_root_dir() . '/' . $theme . '/config.xml';
$last_modify_time = filemtime($config_file_path);
if (!$last_modify_time) {
return false;
}
$exist_last_time = app::get('site')->getConf($theme . '_theme_last_config');
$exist_last_time = $exist_last_time ? $exist_last_time : 0;
if ($exist_last_time - $last_modify_time == 0) {
return true;
} else {
app::get('site')->setConf($theme . '_theme_last_config', $last_modify_time);
}
$config_xml_content = file_get_contents($config_file_path);
if ($config_xml_content) {
$theme_info = vmc::singleton('site_utility_xml')->xml2arrayValues($config_xml_content);
}
if (empty($theme_info)) {
return false;
}
$config = $theme_info;
$theme_sdf = array('theme_id' => $config['theme']['id']['value'], 'theme_dir' => $theme, 'name' => $config['theme']['name']['value'], 'version' => $config['theme']['version']['value'], 'info' => $config['theme']['info']['value'], 'author' => $config['theme']['author']['value'], 'config' => array());
$theme_sdf = vmc_('site', 'theme_install_config', $theme_sdf, $config);
if (!vmc::singleton('site_theme_base')->update_theme($theme_sdf)) {
return false;
}
return $theme_sdf;
}
示例2: display_tmpl
public final function display_tmpl($tmpl, $fetch = false, $is_preview = false)
{
vmc::singleton('site_theme_install')->monitor_change($this->get_theme());
array_unshift($this->_files, $this->get_theme() . '/' . $tmpl);
$this->_vars = $this->pagedata;
$this->_vars['base_url'] = vmc::base_url(true);
$this->_vars['site_theme_url'] = vmc::get_themes_host_url() . '/' . $this->get_theme();
//title description
$title = $this->title ? $this->title : app::get('site')->getConf('site_name', app::get('site')->getConf('page_default_title'));
$keywords = $this->keywords ? $this->keywords : app::get('site')->getConf('page_default_keywords', $title);
$description = $this->description ? $this->description : app::get('site')->getConf('page_default_description', $title);
$this->pagedata = array_merge($this->pagedata, array('title' => htmlspecialchars($title), 'keywords' => htmlspecialchars($keywords), 'description' => htmlspecialchars($description)));
$this->_vars = array_merge($this->_vars, array('title' => htmlspecialchars($title), 'keywords' => htmlspecialchars($keywords), 'description' => htmlspecialchars($description)));
$tmpl_file = realpath(vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/' . $tmpl);
if (!$tmpl_file) {
$tmpl_file = realpath(vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/default.html');
if (!$tmpl_file) {
$unexists_path = vmc::get_themes_root_dir() . '/' . $this->get_theme() . '/' . $tmpl;
setcookie('CURRENT_THEME', '', time() - 1000, '/');
unset($_COOKIE['CURRENT_THEME']);
setcookie('CURRENT_THEME_M', '', time() - 1000, '/');
unset($_COOKIE['CURRENT_THEME_M']);
setcookie('THEME_DIR', '', time() - 1000, '/');
unset($_COOKIE['THEME_DIR']);
setcookie('THEME_M_DIR', '', time() - 1000, '/');
unset($_COOKIE['THEME_M_DIR']);
trigger_error('File not exists [' . $unexists_path . ']', E_USER_ERROR);
}
}
$tmpl_content = file_get_contents($tmpl_file);
$compile_code = $this->_compiler()->compile($tmpl_content);
if ($compile_code !== false) {
$compile_code = $this->fix_statics_dir($compile_code);
}
$theme_url = vmc::get_themes_host_url();
ob_start();
eval('?>' . $compile_code);
$content = ob_get_contents();
ob_end_clean();
array_shift($this->_files);
$this->pre_display($content);
if ($fetch === true) {
return $content;
} else {
echo $content;
}
}