diff options
author | friendica <info@friendica.com> | 2014-12-12 00:28:46 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-12-12 00:28:46 -0800 |
commit | b30ea4c2c51f893bf0cffbea38e875cb01c6c431 (patch) | |
tree | 07c6f125256c73bfa29fe2dfed0f601def167adc /library/Smarty/libs/plugins/modifiercompiler.unescape.php | |
parent | d3465802d6433bcd4cf24971951e0633161b0665 (diff) | |
parent | 967ab871b836f618107fe144978bd1453c3c6634 (diff) | |
download | volse-hubzilla-b30ea4c2c51f893bf0cffbea38e875cb01c6c431.tar.gz volse-hubzilla-b30ea4c2c51f893bf0cffbea38e875cb01c6c431.tar.bz2 volse-hubzilla-b30ea4c2c51f893bf0cffbea38e875cb01c6c431.zip |
Merge https://github.com/friendica/red into pending_merge
Diffstat (limited to 'library/Smarty/libs/plugins/modifiercompiler.unescape.php')
-rw-r--r-- | library/Smarty/libs/plugins/modifiercompiler.unescape.php | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/library/Smarty/libs/plugins/modifiercompiler.unescape.php b/library/Smarty/libs/plugins/modifiercompiler.unescape.php index 4321ff18d..3b17ea2e1 100644 --- a/library/Smarty/libs/plugins/modifiercompiler.unescape.php +++ b/library/Smarty/libs/plugins/modifiercompiler.unescape.php @@ -1,51 +1,50 @@ -<?php
-/**
- * Smarty plugin
- *
- * @package Smarty
- * @subpackage PluginsModifierCompiler
- */
-
-/**
- * Smarty unescape modifier plugin
- *
- * Type: modifier<br>
- * Name: unescape<br>
- * Purpose: unescape html entities
- *
- * @author Rodney Rehm
- * @param array $params parameters
- * @return string with compiled code
- */
-function smarty_modifiercompiler_unescape($params, $compiler)
-{
- if (!isset($params[1])) {
- $params[1] = 'html';
- }
- if (!isset($params[2])) {
- $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
- } else {
- $params[2] = "'" . $params[2] . "'";
- }
-
- switch (trim($params[1], '"\'')) {
- case 'entity':
- case 'htmlall':
- if (Smarty::$_MBSTRING) {
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
- }
-
- return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
-
- case 'html':
- return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
-
- case 'url':
- return 'rawurldecode(' . $params[0] . ')';
-
- default:
- return $params[0];
- }
-}
-
-?>
\ No newline at end of file +<?php +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ + +/** + * Smarty unescape modifier plugin + * Type: modifier<br> + * Name: unescape<br> + * Purpose: unescape html entities + * + * @author Rodney Rehm + * + * @param array $params parameters + * + * @return string with compiled code + */ +function smarty_modifiercompiler_unescape($params) +{ + if (!isset($params[1])) { + $params[1] = 'html'; + } + if (!isset($params[2])) { + $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\''; + } else { + $params[2] = "'" . $params[2] . "'"; + } + + switch (trim($params[1], '"\'')) { + case 'entity': + case 'htmlall': + if (Smarty::$_MBSTRING) { + return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')'; + } + + return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')'; + + case 'html': + return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)'; + + case 'url': + return 'rawurldecode(' . $params[0] . ')'; + + default: + return $params[0]; + } +} |