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