本文整理汇总了PHP中ZLanguage::bindThemeDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::bindThemeDomain方法的具体用法?PHP ZLanguage::bindThemeDomain怎么用?PHP ZLanguage::bindThemeDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLanguage
的用法示例。
在下文中一共展示了ZLanguage::bindThemeDomain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param Zikula_ServiceManager $serviceManager ServiceManager.
* @param string $themeName Theme name.
*/
public function __construct(Zikula_ServiceManager $serviceManager, $themeName)
{
// store our theme information
$this->themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($themeName));
// prevents any case mismatch
$themeName = $this->themeinfo['name'];
foreach (array('name', 'directory', 'version', 'state', 'xhtml') as $key) {
$this->{$key} = $this->themeinfo[$key];
}
parent::__construct($serviceManager);
if ($this->themeinfo['i18n']) {
ZLanguage::bindThemeDomain($this->name);
// property for {gt} template plugin to detect language domain
$this->domain = ZLanguage::getThemeDomain($this->name);
} else {
$this->domain = null;
}
EventUtil::attachCustomHandlers("themes/{$themeName}/EventHandlers");
EventUtil::attachCustomHandlers("themes/{$themeName}/lib/{$themeName}/EventHandlers");
$event = new \Zikula\Core\Event\GenericEvent($this);
$this->eventManager->dispatch('theme.preinit', $event);
// change some base settings from our parent class
// template compilation
$this->compile_dir = CacheUtil::getLocalDir('Theme_compiled');
$this->compile_check = ModUtil::getVar('ZikulaThemeModule', 'compile_check');
$this->force_compile = ModUtil::getVar('ZikulaThemeModule', 'force_compile');
// template caching
$this->cache_dir = CacheUtil::getLocalDir('Theme_cache');
$this->caching = (int) ModUtil::getVar('ZikulaThemeModule', 'enablecache');
//if ($this->caching) {
// $this->cache_modified_check = true;
//}
// if caching and is not an admin controller
if ($this->caching && strpos($this->type, 'admin') !== 0) {
$modulesnocache = array_filter(explode(',', ModUtil::getVar('ZikulaThemeModule', 'modulesnocache')));
if (in_array($this->toplevelmodule, $modulesnocache)) {
$this->caching = Zikula_View::CACHE_DISABLED;
}
} else {
$this->caching = Zikula_View::CACHE_DISABLED;
}
// halt caching for write operations to prevent strange things happening
if (isset($_POST) && count($_POST) != 0) {
$this->caching = Zikula_View::CACHE_DISABLED;
}
// and also for GET operations with csrftoken/authkey
if (isset($_GET['csrftoken']) || isset($_GET['authkey'])) {
$this->caching = Zikula_View::CACHE_DISABLED;
}
$this->cache_lifetime = ModUtil::getVar('ZikulaThemeModule', 'cache_lifetime');
if (!$this->homepage) {
$this->cache_lifetime = ModUtil::getVar('ZikulaThemeModule', 'cache_lifetime_mods');
}
// assign all our base template variables
$this->_base_vars();
// define the plugin directories
$this->_plugin_dirs();
// load the theme configuration
$this->load_config();
// check for cached output
// turn on caching, check for cached output and then disable caching
// to prevent blocks from being cached
if ($this->caching && $this->is_cached($this->themeconfig['page'], $this->cache_id)) {
$this->display($this->themeconfig['page'], $this->cache_id);
System::shutdown();
}
// register page vars output filter
$this->load_filter('output', 'pagevars');
// register short urls output filter
if (System::getVar('shorturls')) {
$this->load_filter('output', 'shorturls');
}
// register trim whitespace output filter if requried
if (ModUtil::getVar('ZikulaThemeModule', 'trimwhitespace')) {
$this->load_filter('output', 'trimwhitespace');
}
$this->load_filter('output', 'asseturls');
$event = new \Zikula\Core\Event\GenericEvent($this);
$this->eventManager->dispatch('theme.init', $event);
$this->startOutputBuffering();
}
示例2: variables
/**
* display the theme variables
*
*/
public function variables($args)
{
// get our input
$themename = FormUtil::getPassedValue('themename', isset($args['themename']) ? $args['themename'] : null, 'GET');
$filename = FormUtil::getPassedValue('filename', isset($args['filename']) ? $args['filename'] : null, 'GET');
// check our input
if (empty($themename)) {
return LogUtil::registerArgsError(ModUtil::url('Theme', 'admin', 'view'));
}
$themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($themename));
if (!file_exists('themes/'.DataUtil::formatForOS($themeinfo['directory']).'/version.php')) {
return LogUtil::registerArgsError(ModUtil::url('Theme', 'admin', 'view'));
}
// Security check
if (!SecurityUtil::checkPermission('Theme::', "$themename::variables", ACCESS_EDIT)) {
return LogUtil::registerPermissionError();
}
if ($filename) {
$variables = ModUtil::apiFunc('Theme', 'user', 'getpageconfiguration', array('theme' => $themename, 'filename' => $filename));
$variables = ModUtil::apiFunc('Theme', 'user', 'formatvariables', array('theme' => $themename, 'variables' => $variables, 'formatting' => true));
} else {
$variables = ModUtil::apiFunc('Theme', 'user', 'getvariables', array('theme' => $themename, 'formatting' => true));
}
// load the language file
ZLanguage::bindThemeDomain($themename);
// check that we have writable files
$this->checkRunningConfig($themeinfo);
// assign variables, themename, themeinfo and return output
return $this->view->assign('variables', $variables)
->assign('themename', $themename)
->assign('themeinfo', $themeinfo)
->assign('filename', $filename)
->fetch('theme_admin_variables.tpl');
}