a25df36069289c6eeedb793d1dff0db31f3c768b
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / plugins / block.strip.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  * @package Smarty\r
5  * @subpackage plugins\r
6  */\r
7 \r
8 /**\r
9  * Smarty {strip}{/strip} block plugin\r
10  *\r
11  * Type:     block function<br>\r
12  * Name:     strip<br>\r
13  * Purpose:  strip unwanted white space from text<br>\r
14  * @link http://smarty.php.net/manual/en/language.function.strip.php {strip}\r
15  *       (Smarty online manual)\r
16  * @param array unused, no parameters for this block\r
17  * @param string content of {strip}{/strip} tags\r
18  * @param Smarty clever method emulation\r
19  * @return string $content stripped of whitespace\r
20  */\r
21 function smarty_block_strip($params, $content, &$this)\r
22 {\r
23         /* Reformat data between 'strip' and '/strip' tags, removing spaces, tabs and newlines. */\r
24         $_strip_search = array(\r
25                 "![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars\r
26                 '%[\r\n]+%m'); // remove CRs and newlines\r
27         $_strip_replace = array(\r
28                 '',\r
29                 '');\r
30         return preg_replace($_strip_search, $_strip_replace, $content);\r
31 }\r
32 \r
33 /* vim: set expandtab: */\r
34 \r
35 ?>\r