includes/wikiengine/Parse/Default/Html.php
changeset 1027 98c052fc3337
parent 1026 f0431eb8161e
child 1028 dde4416dea00
equal deleted inserted replaced
1026:f0431eb8161e 1027:98c052fc3337
     1 <?php
       
     2 
       
     3 /**
       
     4 * 
       
     5 * Parses for blocks of HTML code.
       
     6 * 
       
     7 * @category Text
       
     8 * 
       
     9 * @package Text_Wiki
       
    10 * 
       
    11 * @author Paul M. Jones <pmjones@php.net>
       
    12 * 
       
    13 * @license LGPL
       
    14 * 
       
    15 * @version $Id: Html.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
       
    16 * 
       
    17 */
       
    18 
       
    19 /**
       
    20 * 
       
    21 * Parses for blocks of HTML code.
       
    22 * 
       
    23 * This class implements a Text_Wiki_Parse to find source text marked as
       
    24 * HTML to be redndred as-is.  The block start is marked by <html> on its
       
    25 * own line, and the block end is marked by </html> on its own line.
       
    26 *
       
    27 * @category Text
       
    28 * 
       
    29 * @package Text_Wiki
       
    30 * 
       
    31 * @author Paul M. Jones <pmjones@php.net>
       
    32 * 
       
    33 */
       
    34 
       
    35 class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
       
    36     
       
    37     
       
    38     /**
       
    39     * 
       
    40     * The regular expression used to parse the source text and find
       
    41     * matches conforming to this rule.  Used by the parse() method.
       
    42     * 
       
    43     * @access public
       
    44     * 
       
    45     * @var string
       
    46     * 
       
    47     * @see parse()
       
    48     * 
       
    49     */
       
    50     
       
    51     var $regex = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
       
    52     
       
    53     
       
    54     /**
       
    55     * 
       
    56     * Generates a replacement for the matched text.  Token options are:
       
    57     * 
       
    58     * 'text' => The text of the HTML to be rendered as-is.
       
    59     * 
       
    60     * @access public
       
    61     *
       
    62     * @param array &$matches The array of matches from parse().
       
    63     *
       
    64     * @return A delimited token to be used as a placeholder in
       
    65     * the source text, plus any text following the HTML block.
       
    66     *
       
    67     */
       
    68     
       
    69     function process(&$matches)
       
    70     {    
       
    71         $options = array('text' => $matches[1]);
       
    72         return $this->wiki->addToken($this->rule, $options) . $matches[2];
       
    73     }
       
    74 }
       
    75 ?>