Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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