| 1 |
joko |
1.1 |
<?php |
| 2 |
|
|
|
| 3 |
|
|
/* |
| 4 |
|
|
* Smarty plugin |
| 5 |
|
|
* ------------------------------------------------------------- |
| 6 |
|
|
* Type: modifier |
| 7 |
|
|
* Name: strip |
| 8 |
|
|
* Purpose: Replace all repeated spaces, newlines, tabs |
| 9 |
|
|
* with a single space or supplied replacement string. |
| 10 |
|
|
* Example: {$var|strip} {$var|strip:" "} |
| 11 |
|
|
* Author: Monte Ohrt <monte@ispi.net> |
| 12 |
|
|
* Version: 1.0 |
| 13 |
|
|
* Date: September 25th, 2002 |
| 14 |
|
|
* ------------------------------------------------------------- |
| 15 |
|
|
*/ |
| 16 |
|
|
function smarty_modifier_strip($text, $replace = ' ') |
| 17 |
|
|
{ |
| 18 |
|
|
return preg_replace('!\s+!', $replace, $text); |
| 19 |
|
|
} |
| 20 |
|
|
|
| 21 |
|
|
/* vim: set expandtab: */ |
| 22 |
|
|
|
| 23 |
|
|
?> |