Initial repo created
[timetracker.git] / WEB-INF / lib / smarty / plugins / modifiercompiler.strip_tags.php
1 <?php
2 /**
3  * Smarty plugin
4  *
5  * @package Smarty
6  * @subpackage PluginsModifierCompiler
7  */
8
9 /**
10  * Smarty strip_tags modifier plugin
11  * 
12  * Type:     modifier<br>
13  * Name:     strip_tags<br>
14  * Purpose:  strip html tags from text
15  * 
16  * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
17  * @author Uwe Tews 
18  * @param array $params parameters
19  * @return string with compiled code
20  */
21
22 function smarty_modifiercompiler_strip_tags($params, $compiler)
23 {
24    if (!isset($params[1])) {
25         $params[1] = true;
26     } 
27     if ($params[1] === true) {
28         return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
29     } else {
30         return 'strip_tags(' . $params[0] . ')';
31     } 
32
33
34 ?>