home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Text / Wiki / Parse / Default / Newline.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.4 KB  |  75 lines

  1. <?php
  2.  
  3. /**
  4. * Parses for implied line breaks indicated by newlines.
  5. * @category Text
  6. * @package Text_Wiki
  7. * @author Paul M. Jones <pmjones@php.net>
  8. * @license LGPL
  9. * @version $Id: Newline.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
  10. */
  11.  
  12. /**
  13. * Parses for implied line breaks indicated by newlines.
  14. * This class implements a Text_Wiki_Parse to mark implied line breaks in the
  15. * source text, usually a single carriage return in the middle of a paragraph
  16. * or block-quoted text.
  17. *
  18. * @category Text
  19. * @package Text_Wiki
  20. * @author Paul M. Jones <pmjones@php.net>
  21. */
  22.  
  23. class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
  24.     
  25.     
  26.     /**
  27.     * 
  28.     * The regular expression used to parse the source text and find
  29.     * matches conforming to this rule.  Used by the parse() method.
  30.     * 
  31.     * @access public
  32.     * 
  33.     * @var string
  34.     * 
  35.     * @see parse()
  36.     * 
  37.     */
  38.     
  39.     var $regex = '/([^\n])\n([^\n])/m';
  40.     
  41.     
  42.     /**
  43.     * 
  44.     * Generates a replacement token for the matched text.
  45.     * 
  46.     * @access public
  47.     *
  48.     * @param array &$matches The array of matches from parse().
  49.     *
  50.     * @return string A delimited token to be used as a placeholder in
  51.     * the source text.
  52.     *
  53.     */
  54.     
  55.     function process(&$matches)
  56.     {    
  57.         return $matches[1] .
  58.             $this->wiki->addToken($this->rule) .
  59.             $matches[2];
  60.     }
  61. }
  62.  
  63. ?>