library/smarty/libs/plugins/modifiercompiler.strip.php
changeset 0 4869aea77e21
equal deleted inserted replaced
-1:000000000000 0:4869aea77e21
       
     1 <?php
       
     2 /**
       
     3  * Smarty plugin
       
     4  *
       
     5  * @package    Smarty
       
     6  * @subpackage PluginsModifierCompiler
       
     7  */
       
     8 
       
     9 /**
       
    10  * Smarty strip modifier plugin
       
    11  * Type:     modifier<br>
       
    12  * Name:     strip<br>
       
    13  * Purpose:  Replace all repeated spaces, newlines, tabs
       
    14  *              with a single space or supplied replacement string.<br>
       
    15  * Example:  {$var|strip} {$var|strip:"&nbsp;"}<br>
       
    16  * Date:     September 25th, 2002
       
    17  *
       
    18  * @link   http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
       
    19  * @author Uwe Tews
       
    20  *
       
    21  * @param array $params parameters
       
    22  *
       
    23  * @return string with compiled code
       
    24  */
       
    25 
       
    26 function smarty_modifiercompiler_strip($params) {
       
    27     if (!isset($params[1])) {
       
    28         $params[1] = "' '";
       
    29     }
       
    30 
       
    31     return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
       
    32 }