gluon-web-remote

Web remote Administration for big size of gluon routers
git clone git://archive.git.mtrnord.blog/MTRNord/gluon-web-remote.git
Log | Files | Refs | README

modifiercompiler.unescape.php (1182B)


      1 <?php
      2 /**
      3  * Smarty plugin
      4  *
      5  * @package    Smarty
      6  * @subpackage PluginsModifierCompiler
      7  */
      8 
      9 /**
     10  * Smarty unescape modifier plugin
     11  * Type:     modifier<br>
     12  * Name:     unescape<br>
     13  * Purpose:  unescape html entities
     14  *
     15  * @author Rodney Rehm
     16  *
     17  * @param array $params parameters
     18  *
     19  * @return string with compiled code
     20  */
     21 function smarty_modifiercompiler_unescape($params)
     22 {
     23     if (!isset($params[1])) {
     24         $params[1] = 'html';
     25     }
     26     if (!isset($params[2])) {
     27         $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
     28     } else {
     29         $params[2] = "'" . $params[2] . "'";
     30     }
     31 
     32     switch (trim($params[1], '"\'')) {
     33         case 'entity':
     34         case 'htmlall':
     35             if (Smarty::$_MBSTRING) {
     36                 return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
     37             }
     38 
     39             return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
     40 
     41         case 'html':
     42             return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
     43 
     44         case 'url':
     45             return 'rawurldecode(' . $params[0] . ')';
     46 
     47         default:
     48             return $params[0];
     49     }
     50 }