modifier.clean_text.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2015 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 
12 /*
13 * Smarty plugin
14 * -------------------------------------------------------------
15 * File: modifier.clean_text.php
16 * Type: function
17 * Name: clean_text
18 * Purpose: remove all html tags, &nbsp; and outer whitespace
19 * Usage: e.g. {$text|clean_text}
20 * -------------------------------------------------------------
21 */
22 function smarty_modifier_clean_text($text) {
23  $text = strip_tags($text);
24  $text = preg_replace('/&nbsp;/', '', $text);
25  return trim($text);
26 }
27 ?>