2002-09-25 15:54:46 +00:00
|
|
|
<?php
|
2003-04-20 21:12:13 +00:00
|
|
|
/**
|
2002-09-25 15:54:46 +00:00
|
|
|
* Smarty plugin
|
2003-04-20 21:12:13 +00:00
|
|
|
* @package Smarty
|
|
|
|
|
* @subpackage plugins
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Smarty strip modifier plugin
|
|
|
|
|
*
|
|
|
|
|
* Type: modifier<br>
|
|
|
|
|
* Name: strip<br>
|
2002-09-25 15:54:46 +00:00
|
|
|
* Purpose: Replace all repeated spaces, newlines, tabs
|
2003-04-20 21:12:13 +00:00
|
|
|
* with a single space or supplied replacement string.<br>
|
2002-09-25 15:54:46 +00:00
|
|
|
* Example: {$var|strip} {$var|strip:" "}
|
|
|
|
|
* Date: September 25th, 2002
|
2003-04-20 21:12:13 +00:00
|
|
|
* @link http://smarty.php.net/manual/en/language.modifier.strip.php
|
|
|
|
|
* strip (Smarty online manual)
|
|
|
|
|
* @author Monte Ohrt <monte@ispi.net>
|
|
|
|
|
* @version 1.0
|
|
|
|
|
* @param string
|
|
|
|
|
* @param string
|
|
|
|
|
* @return string
|
2002-09-25 15:54:46 +00:00
|
|
|
*/
|
|
|
|
|
function smarty_modifier_strip($text, $replace = ' ')
|
|
|
|
|
{
|
2003-12-19 17:18:56 +00:00
|
|
|
return preg_replace('!\s+!', $replace, $text);
|
2002-09-25 15:54:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* vim: set expandtab: */
|
|
|
|
|
|
|
|
|
|
?>
|