]> git.mxchange.org Git - friendica.git/blob - library/Smarty/libs/plugins/modifiercompiler.strip.php
Merge pull request #1122 from tugelbend/master
[friendica.git] / library / Smarty / libs / 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  * 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 {
28     if (!isset($params[1])) {
29         $params[1] = "' '";
30     }
31
32     return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
33 }