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 / Center.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.4 KB  |  78 lines

  1. <?php
  2.  
  3. /**
  4. * Parses for centered lines of text.
  5. * @category Text
  6. * @package Text_Wiki
  7. * @author Paul M. Jones <pmjones@php.net>
  8. * @license LGPL
  9. * @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
  10. */
  11.  
  12. /**
  13. * Parses for centered lines of text.
  14. * This class implements a Text_Wiki_Parse to find lines marked for centering.
  15. * The line must start with "= " (i.e., an equal-sign followed by a space).
  16. *
  17. * @category Text
  18. * @package Text_Wiki
  19. * @author Paul M. Jones <pmjones@php.net>
  20. */
  21.  
  22. class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
  23.     
  24.     
  25.     /**
  26.     * 
  27.     * The regular expression used to find source text matching this
  28.     * rule.
  29.     * 
  30.     * @access public
  31.     * 
  32.     * @var string
  33.     * 
  34.     */
  35.     
  36.     var $regex = '/\n\= (.*?)\n/';
  37.     
  38.     /**
  39.     * 
  40.     * Generates a token entry for the matched text.
  41.     * 
  42.     * @access public
  43.     *
  44.     * @param array &$matches The array of matches from parse().
  45.     *
  46.     * @return A delimited token number to be used as a placeholder in
  47.     * the source text.
  48.     *
  49.     */
  50.     
  51.     function process(&$matches)
  52.     {
  53.         $start = $this->wiki->addToken(
  54.             $this->rule,
  55.             array('type' => 'start')
  56.         );
  57.         
  58.         $end = $this->wiki->addToken(
  59.             $this->rule,
  60.             array('type' => 'end')
  61.         );
  62.         
  63.         return "\n" . $start . $matches[1] . $end . "\n";
  64.     }
  65. }
  66. ?>