source: trunk/include/smarty/libs/plugins/modifiercompiler.strip.php @ 23384

Last change on this file since 23384 was 23384, checked in by rvelices, 11 years ago

smarty 3 - first pass for tests

File size: 850 bytes
Line 
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;"}<br>
17 * Date:     September 25th, 2002
18 *
19 * @link http://www.smarty.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
25function smarty_modifiercompiler_strip($params, $compiler)
26{
27    if (!isset($params[1])) {
28        $params[1] = "' '";
29    }
30    return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
31}
32
33?>
Note: See TracBrowser for help on using the repository browser.