From: Marcel Werk Date: Fri, 23 Sep 2011 18:51:15 +0000 (+0200) Subject: Front end template overhaul; new template events added X-Git-Tag: 2.0.0_Beta_1~1773 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=829ec05e0446619e6c22a7cb984ff0ee832f5373;p=GitHub%2FWoltLab%2FWCF.git Front end template overhaul; new template events added --- diff --git a/com.woltlab.wcf/template/footer.tpl b/com.woltlab.wcf/template/footer.tpl index 88357a63ec..e1eb0af66d 100644 --- a/com.woltlab.wcf/template/footer.tpl +++ b/com.woltlab.wcf/template/footer.tpl @@ -9,7 +9,7 @@
{include file=footerMenu}
- Copyright © 2001-2011 WoltLab® GmbH + {event name='copyright'} diff --git a/com.woltlab.wcf/template/headInclude.tpl b/com.woltlab.wcf/template/headInclude.tpl index 2b7746d8ad..957130304b 100644 --- a/com.woltlab.wcf/template/headInclude.tpl +++ b/com.woltlab.wcf/template/headInclude.tpl @@ -19,21 +19,43 @@ WCF.User.init({@$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}'); //]]> - -{* -{if $specialStyles|isset} - - {@$specialStyles} -{/if} -*} +{event name='javascriptInclude'} + + \ No newline at end of file diff --git a/com.woltlab.wcf/template/header.tpl b/com.woltlab.wcf/template/header.tpl index 3a8a3d9231..dd1b18e349 100644 --- a/com.woltlab.wcf/template/header.tpl +++ b/com.woltlab.wcf/template/header.tpl @@ -1,11 +1,48 @@ diff --git a/com.woltlab.wcf/template/headerMenu.tpl b/com.woltlab.wcf/template/headerMenu.tpl deleted file mode 100644 index 83e3a74d53..0000000000 --- a/com.woltlab.wcf/template/headerMenu.tpl +++ /dev/null @@ -1,19 +0,0 @@ -{if $__wcf->getPageMenu()->getMenuItems('header')|count > 0} - -{/if} diff --git a/com.woltlab.wcf/template/mainMenu.tpl b/com.woltlab.wcf/template/mainMenu.tpl new file mode 100644 index 0000000000..83e3a74d53 --- /dev/null +++ b/com.woltlab.wcf/template/mainMenu.tpl @@ -0,0 +1,19 @@ +{if $__wcf->getPageMenu()->getMenuItems('header')|count > 0} + +{/if} diff --git a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php index f203d51818..b9757dbc2f 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php @@ -732,7 +732,7 @@ class TemplateEngine extends SingletonFactory { */ protected function loadTemplateListenerCode($templateName) { // cache was already loaded - if (count($this->templateListeners[$templateName])) return; + if (!isset($this->templateListeners[$templateName]) || count($this->templateListeners[$templateName])) return; $cacheName = PACKAGE_ID.'-'.$this->environment.'-'.$templateName; CacheHandler::getInstance()->addResource( diff --git a/wcfsetup/install/files/lib/system/template/plugin/EventPrefilterTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/EventPrefilterTemplatePlugin.class.php index d30a3e5559..85c4f7d69b 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/EventPrefilterTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/EventPrefilterTemplatePlugin.class.php @@ -1,6 +1,7 @@ getLeftDelimiter(), '~'); $rdq = preg_quote($compiler->getRightDelimiter(), '~'); - $sourceContent = preg_replace("~{$ldq}event\ name\=\'([\w]+)\'{$rdq}~e", 'wcf\system\WCF::getTPL()->getTemplateListenerCode(\''.$templateName.'\', \'$1\')', $sourceContent); + $sourceContent = preg_replace_callback("~{$ldq}event\ name\=\'([\w]+)\'{$rdq}~", function ($match) use ($templateName) { + return WCF::getTPL()->getTemplateListenerCode($templateName, $match[1]); + }, $sourceContent); return $sourceContent; }