From 3e9def1a69a2dcc11d2dabfa19283511b04e5ab5 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 27 Oct 2011 17:49:19 +0200 Subject: [PATCH] Fixed icon prefilter --- wcfsetup/install/files/lib/system/WCF.class.php | 2 +- .../template/plugin/IconPrefilterTemplatePlugin.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index c754e06534..5b5df17a3d 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -467,7 +467,7 @@ class WCF { * Assigns some default variables to the template engine. */ protected function assignDefaultTemplateVariables() { - self::getTPL()->registerPrefilter(array('event', 'hascontent', 'lang')); + self::getTPL()->registerPrefilter(array('event', 'hascontent', 'lang', 'icon')); self::getTPL()->assign(array('__wcf' => $this)); } diff --git a/wcfsetup/install/files/lib/system/template/plugin/IconPrefilterTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/IconPrefilterTemplatePlugin.class.php index 6d290afc96..fbfb7f5d3c 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/IconPrefilterTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/IconPrefilterTemplatePlugin.class.php @@ -6,7 +6,7 @@ use wcf\system\template\TemplateScriptingCompiler; * The 'icon' prefilter compiles static icon paths. * * Usage: - * {icon}iconS.png{/icon} + * {icon size='L'}iconS.png{/icon} * * @author Marcel Werk * @copyright 2001-2011 WoltLab GmbH @@ -19,10 +19,10 @@ class IconPrefilterTemplatePlugin implements IPrefilterTemplatePlugin { /** * @see wcf\system\template\ITemplatePluginPrefilter::execute() */ - public function execute($sourceContent, TemplateScriptingCompiler $compiler) { + public function execute($templateName, $sourceContent, TemplateScriptingCompiler $compiler) { $ldq = preg_quote($compiler->getLeftDelimiter(), '~'); $rdq = preg_quote($compiler->getRightDelimiter(), '~'); - $sourceContent = preg_replace("~{$ldq}icon{$rdq}([\w\.]+){$ldq}/icon{$rdq}~", '{literal}getStyle()->getIconPath(\'$1\'); ?>{/literal}', $sourceContent); + $sourceContent = preg_replace("~{$ldq}icon size='?(S|M|L)'?{$rdq}([\w\.]+){$ldq}/icon{$rdq}~", '{literal}getStyle()->getIconPath(\'$2\', \'$1\'); ?>{/literal}', $sourceContent); return $sourceContent; } -- 2.20.1