From: Alexander Ebert Date: Tue, 23 Aug 2011 14:20:56 +0000 (+0200) Subject: Implemented modifier fixes from pull request #133 X-Git-Tag: 2.0.0_Beta_1~1830 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fad5ab684d2c9c0cb2cc2a9810c4f4c607d6e342;p=GitHub%2FWoltLab%2FWCF.git Implemented modifier fixes from pull request #133 I've omitted the pull request, since we do want to keep 'encodeJS' for better reading. Anyway, credits for this fix go to TimWolla. --- diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index 7078500cca..2e7eef0502 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -18,7 +18,7 @@ diff --git a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php index 5a14c7f9df..219ef32c8a 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateEngine.class.php @@ -482,7 +482,7 @@ class TemplateEngine extends SingletonFactory { * @return string class name */ public function getPluginClassName($type, $tag) { - return $this->pluginNamespace.StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($tag)).StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($type)).'TemplatePlugin'; + return $this->pluginNamespace.StringUtil::firstCharToUpperCase($tag).StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($type)).'TemplatePlugin'; } /** diff --git a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php index b0ba8138e9..1e32b2f283 100644 --- a/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php +++ b/wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php @@ -1093,7 +1093,7 @@ class TemplateScriptingCompiler { } // handle modifier name - $modifierData['name'] = StringUtil::toLowerCase($values[$i]); + $modifierData['name'] = $values[$i]; $className = $this->template->getPluginClassName('modifier', $modifierData['name']); if (class_exists($className)) { $modifierData['className'] = $className; diff --git a/wcfsetup/install/files/lib/system/template/plugin/EncodeJSModifierTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/EncodeJSModifierTemplatePlugin.class.php new file mode 100644 index 0000000000..8a5b66e763 --- /dev/null +++ b/wcfsetup/install/files/lib/system/template/plugin/EncodeJSModifierTemplatePlugin.class.php @@ -0,0 +1,40 @@ + + * @package com.woltlab.wcf + * @subpackage system.template.plugin + * @category Community Framework + */ +class EncodeJSModifierTemplatePlugin implements IModifierTemplatePlugin { + /** + * @see wcf\system\template\IModifierTemplatePlugin::execute() + */ + public function execute($tagArgs, TemplateEngine $tplObj) { + // escape backslash + $tagArgs[0] = StringUtil::replace("\\", "\\\\", $tagArgs[0]); + + // escape singe quote + $tagArgs[0] = StringUtil::replace("'", "\'", $tagArgs[0]); + + // escape new lines + $tagArgs[0] = StringUtil::replace("\n", '\n', $tagArgs[0]); + + // escape slashes + $tagArgs[0] = StringUtil::replace("/", '\/', $tagArgs[0]); + + return $tagArgs[0]; + } +} diff --git a/wcfsetup/install/files/lib/system/template/plugin/EncodejsModifierTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/EncodejsModifierTemplatePlugin.class.php deleted file mode 100644 index eb517f2b82..0000000000 --- a/wcfsetup/install/files/lib/system/template/plugin/EncodejsModifierTemplatePlugin.class.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.template.plugin - * @category Community Framework - */ -class EncodejsModifierTemplatePlugin implements IModifierTemplatePlugin { - /** - * @see wcf\system\template\IModifierTemplatePlugin::execute() - */ - public function execute($tagArgs, TemplateEngine $tplObj) { - // escape backslash - $tagArgs[0] = StringUtil::replace("\\", "\\\\", $tagArgs[0]); - - // escape singe quote - $tagArgs[0] = StringUtil::replace("'", "\'", $tagArgs[0]); - - // escape new lines - $tagArgs[0] = StringUtil::replace("\n", '\n', $tagArgs[0]); - - // escape slashes - $tagArgs[0] = StringUtil::replace("/", '\/', $tagArgs[0]); - - return $tagArgs[0]; - } -}