* 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));
}
* 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
/**
* @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}<?php echo wcf\system\style\StyleHandler::getInstance()->getStyle()->getIconPath(\'$1\'); ?>{/literal}', $sourceContent);
+ $sourceContent = preg_replace("~{$ldq}icon size='?(S|M|L)'?{$rdq}([\w\.]+){$ldq}/icon{$rdq}~", '{literal}<?php echo \wcf\system\style\StyleHandler::getInstance()->getStyle()->getIconPath(\'$2\', \'$1\'); ?>{/literal}', $sourceContent);
return $sourceContent;
}