home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / block.strip.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  988 b   |  36 lines

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