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 / Html.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.5 KB  |  75 lines

  1. <?php
  2.  
  3. /**
  4. * Parses for blocks of HTML code.
  5. * @category Text
  6. * @package Text_Wiki
  7. * @author Paul M. Jones <pmjones@php.net>
  8. * @license LGPL
  9. * @version $Id: Html.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
  10. */
  11.  
  12. /**
  13. * Parses for blocks of HTML code.
  14. * This class implements a Text_Wiki_Parse to find source text marked as
  15. * HTML to be redndred as-is.  The block start is marked by <html> on its
  16. * own line, and the block end is marked by </html> on its own line.
  17. *
  18. * @category Text
  19. * @package Text_Wiki
  20. * @author Paul M. Jones <pmjones@php.net>
  21. */
  22.  
  23. class Text_Wiki_Parse_Html 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 = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
  40.     
  41.     
  42.     /**
  43.     * 
  44.     * Generates a replacement for the matched text.  Token options are:
  45.     * 
  46.     * 'text' => The text of the HTML to be rendered as-is.
  47.     * 
  48.     * @access public
  49.     *
  50.     * @param array &$matches The array of matches from parse().
  51.     *
  52.     * @return A delimited token to be used as a placeholder in
  53.     * the source text, plus any text following the HTML block.
  54.     *
  55.     */
  56.     
  57.     function process(&$matches)
  58.     {    
  59.         $options = array('text' => $matches[1]);
  60.         return $this->wiki->addToken($this->rule, $options) . $matches[2];
  61.     }
  62. }
  63. ?>