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