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

Source for file Prefilter.php

Documentation is available at Prefilter.php

  1. <?php
  2.  
  3. /**
  4.  *
  5.  * "Pre-filter" the source text.
  6.  *
  7.  * Convert DOS and Mac line endings to Unix, convert tabs to 4-spaces,
  8.  * add newlines to the top and end of the source text.
  9.  *
  10.  * @category Text
  11.  *
  12.  * @package Text_Wiki
  13.  *
  14.  * @author Paul M. Jones <pmjones@php.net>
  15.  * @author Michele Tomaiuolo <tomamic@yahoo.it>
  16.  *
  17.  * @license LGPL
  18.  *
  19.  * @version $Id: Prefilter.php 222265 2006-10-23 13:11:27Z mic $
  20.  *
  21.  */
  22.  
  23. class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
  24.  
  25.  
  26.     /**
  27.      *
  28.      * Simple parsing method.
  29.      *
  30.      * @access public
  31.      *
  32.      */
  33.  
  34.     function parse()
  35.     {
  36.         // convert DOS line endings
  37.         $this->wiki->source = str_replace("\r\n""\n",
  38.             $this->wiki->source);
  39.  
  40.         // convert Macintosh line endings
  41.         $this->wiki->source = str_replace("\r""\n",
  42.             $this->wiki->source);
  43.  
  44.         // convert tabs to four-spaces
  45.         $this->wiki->source = str_replace("\t""    ",
  46.             $this->wiki->source);
  47.  
  48.         // add extra newlines at the top and end; this
  49.         // seems to help many rules.
  50.         $this->wiki->source = "\n\n" $this->wiki->source . "\n\n";
  51.     }
  52.  
  53. }
  54. ?>

Documentation generated on Mon, 11 Mar 2019 15:40:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.