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