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 / Delimiter.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.8 KB  |  80 lines

  1. <?php
  2.  
  3. /**
  4. * Parses for Text_Wiki delimiter characters already in the source text.
  5. * @category Text
  6. * @package Text_Wiki
  7. * @author Paul M. Jones <pmjones@php.net>
  8. * @license LGPL
  9. * @version $Id: Delimiter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
  10. */
  11.  
  12. /**
  13. * Parses for Text_Wiki delimiter characters already in the source text.
  14. * This class implements a Text_Wiki_Parse to find instances of the delimiter
  15. * character already embedded in the source text; it extracts them and replaces
  16. * them with a delimited token, then renders them as the delimiter itself
  17. * when the target format is XHTML.
  18. *
  19. * @category Text
  20. * @package Text_Wiki
  21. * @author Paul M. Jones <pmjones@php.net>
  22. */
  23.  
  24. class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
  25.     
  26.     /**
  27.     * 
  28.     * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
  29.     * can set the $regex property dynamically (we need to include the
  30.     * Text_Wiki $delim character.
  31.     * 
  32.     * @param object &$obj The calling "parent" Text_Wiki object.
  33.     * 
  34.     * @param string $name The token name to use for this rule.
  35.     * 
  36.     */
  37.     
  38.     function Text_Wiki_Parse_delimiter(&$obj)
  39.     {
  40.         parent::Text_Wiki_Parse($obj);
  41.         $this->regex = '/' . $this->wiki->delim . '/';
  42.     }
  43.     
  44.     
  45.     /**
  46.     * 
  47.     * Generates a token entry for the matched text.  Token options are:
  48.     * 
  49.     * 'text' => The full matched text.
  50.     * 
  51.     * @access public
  52.     *
  53.     * @param array &$matches The array of matches from parse().
  54.     *
  55.     * @return A delimited token number to be used as a placeholder in
  56.     * the source text.
  57.     *
  58.     */
  59.     
  60.     function process(&$matches)
  61.     {    
  62.         return $this->wiki->addToken(
  63.             $this->rule,
  64.             array('text' => $this->wiki->delim)
  65.         );
  66.     }
  67. }
  68. ?>