Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Trim.php

Documentation is available at Trim.php

  1. <?php
  2.  
  3. /**
  4.  *
  5.  * Trim lines in the source text and compress 3 or more newlines to
  6.  * 2 newlines.
  7.  *
  8.  * @category Text
  9.  *
  10.  * @package Text_Wiki
  11.  *
  12.  * @author Paul M. Jones <pmjones@php.net>
  13.  * @author Michele Tomaiuolo <tomamic@yahoo.it>
  14.  *
  15.  */
  16.  
  17. class Text_Wiki_Parse_Trim extends Text_Wiki_Parse {
  18.  
  19.  
  20.     /**
  21.      *
  22.      * Simple parsing method.
  23.      *
  24.      * @access public
  25.      *
  26.      */
  27.  
  28.     function parse()
  29.     {
  30.         // trim lines
  31.         $find "/ *\n */";
  32.         $replace "\n";
  33.         $this->wiki->source = preg_replace($find$replace,
  34.             $this->wiki->source);
  35.  
  36.         // finally, compress all instances of 3 or more newlines
  37.         // down to two newlines.
  38.         $find "/\n{3,}/m";
  39.         $replace "\n\n";
  40.         $this->wiki->source = preg_replace($find$replace,
  41.             $this->wiki->source);
  42.     }
  43.  
  44. }
  45. ?>

Documentation generated on Mon, 11 Mar 2019 14:49:13 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.