Hello,
I made a mod to the "htmlent" output filter code so that it defaults to having the double_encode param set to false, but also allows you to override this with a "true" param. The reason for this is that a lot of times I was running into code that had some characters in their html entity form while other characters were not. Setting the filter to default to not double encode will resolve this.
I realize this may not be appropriate to be added to the default install because apparently PHP < 5.2.3 doesn’t support the double encode param in the PHP htmlentities function.
(
http://modxcms.com/forums/index.php/topic,47796.0.html)
Usage
[[+your-tag:htmlent]] - Will not double encode htmlentities (ex. "This & That" = "This & That ")
[[+your-tag:htmlent=`true`]] - Will double encode entities (ex. "This & That" = "This &amp; That ")
Code:
In line 205 of core/model/modx/filters/modoutputfilter.class.php:
case 'htmlent':
case 'htmlentities':
/* See PHP's htmlentities - http://www.php.net/manual/en/function.htmlentities.php */
if ($m_val == 'true') {
$double_encode = true;
} else {
$double_encode = false;
}
$output = htmlentities($output,ENT_QUOTES,$encoding,$double_encode);
break;
Any thoughts suggestions or improvements welcome.