I've omitted the pull request, since we do want to keep 'encodeJS' for better reading. Anyway, credits for this fix go to TimWolla.
<script type="text/javascript" src="{@RELATIVE_WCF_DIR}acp/js/WCF.ACP.js"></script>
<script type="text/javascript">
//<![CDATA[
- WCF.User.init({$__wcf->user->userID}, '{@$__wcf->user->username|encodejs}');
+ WCF.User.init({$__wcf->user->userID}, '{@$__wcf->user->username|encodeJS}');
//]]>
</script>
* @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';
}
/**
}
// 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;
--- /dev/null
+<?php
+namespace wcf\system\template\plugin;
+use wcf\system\template\TemplateEngine;
+use wcf\util\StringUtil;
+
+/**
+ * The 'encodeJS' modifier formats a string for usage in a single quoted javascript string.
+ * Escapes single quotes and new lines.
+ *
+ * Usage:
+ * {$string|encodeJS}
+ * {"bl''ah"|encodeJS}
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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];
+ }
+}
+++ /dev/null
-<?php
-namespace wcf\system\template\plugin;
-use wcf\system\template\TemplateEngine;
-use wcf\util\StringUtil;
-
-/**
- * The 'encodejs' modifier formats a string for usage in a single quoted javascript string.
- * Escapes single quotes and new lines.
- *
- * Usage:
- * {$string|encodejs}
- * {"bl''ah"|encodejs}
- *
- * @author Marcel Werk
- * @copyright 2001-2011 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @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];
- }
-}