PageRenderTime 28ms CodeModel.GetById 22ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/framework/vendor/smarty2/lib/plugins/modifier.strip.php

http://zoop.googlecode.com/
PHP | 33 lines | 6 code | 4 blank | 23 comment | 0 complexity | b1281f77297db8c1e50bc1fd883ebd78 MD5 | raw file
 1<?php
 2/**
 3 * Smarty plugin
 4 * @package Smarty
 5 * @subpackage plugins
 6 */
 7
 8
 9/**
10 * Smarty strip modifier plugin
11 *
12 * Type:     modifier<br>
13 * Name:     strip<br>
14 * Purpose:  Replace all repeated spaces, newlines, tabs
15 *           with a single space or supplied replacement string.<br>
16 * Example:  {$var|strip} {$var|strip:"&nbsp;"}
17 * Date:     September 25th, 2002
18 * @link http://smarty.php.net/manual/en/language.modifier.strip.php
19 *          strip (Smarty online manual)
20 * @author   Monte Ohrt <monte at ohrt dot com>
21 * @version  1.0
22 * @param string
23 * @param string
24 * @return string
25 */
26function smarty_modifier_strip($text, $replace = ' ')
27{
28    return preg_replace('!\s+!', $replace, $text);
29}
30
31/* vim: set expandtab: */
32
33?>