Blame www/smarty/plugins/modifier.strip.php
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/**
|
|
Chris PeBenito |
696b41 |
* Smarty plugin
|
|
Chris PeBenito |
696b41 |
* @package Smarty
|
|
Chris PeBenito |
696b41 |
* @subpackage plugins
|
|
Chris PeBenito |
696b41 |
*/
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/**
|
|
Chris PeBenito |
696b41 |
* Smarty strip modifier plugin
|
|
Chris PeBenito |
696b41 |
*
|
|
Chris PeBenito |
696b41 |
* Type: modifier
|
|
Chris PeBenito |
696b41 |
* Name: strip
|
|
Chris PeBenito |
696b41 |
* Purpose: Replace all repeated spaces, newlines, tabs
|
|
Chris PeBenito |
696b41 |
* with a single space or supplied replacement string.
|
|
Chris PeBenito |
696b41 |
* Example: {$var|strip} {$var|strip:" "}
|
|
Chris PeBenito |
696b41 |
* Date: September 25th, 2002
|
|
Chris PeBenito |
696b41 |
* @link http://smarty.php.net/manual/en/language.modifier.strip.php
|
|
Chris PeBenito |
696b41 |
* strip (Smarty online manual)
|
|
Chris PeBenito |
696b41 |
* @author Monte Ohrt <monte at ohrt dot com>
|
|
Chris PeBenito |
696b41 |
* @version 1.0
|
|
Chris PeBenito |
696b41 |
* @param string
|
|
Chris PeBenito |
696b41 |
* @param string
|
|
Chris PeBenito |
696b41 |
* @return string
|
|
Chris PeBenito |
696b41 |
*/
|
|
Chris PeBenito |
696b41 |
function smarty_modifier_strip($text, $replace = ' ')
|
|
Chris PeBenito |
696b41 |
{
|
|
Chris PeBenito |
696b41 |
return preg_replace('!\s+!', $replace, $text);
|
|
Chris PeBenito |
696b41 |
}
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
/* vim: set expandtab: */
|
|
Chris PeBenito |
696b41 |
|
|
Chris PeBenito |
696b41 |
?>
|