[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Text/Wiki/Rule/ -> html.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4: */
   3  // +----------------------------------------------------------------------+
   4  // | PHP version 4                                                        |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 1997-2003 The PHP Group                                |
   7  // +----------------------------------------------------------------------+
   8  // | This source file is subject to version 2.0 of the PHP license,       |
   9  // | that is bundled with this package in the file LICENSE, and is        |
  10  // | available through the world-wide-web at                              |
  11  // | http://www.php.net/license/2_02.txt.                                 |
  12  // | If you did not receive a copy of the PHP license and are unable to   |
  13  // | obtain it through the world-wide-web, please send a note to          |
  14  // | license@php.net so we can mail you a copy immediately.               |
  15  // +----------------------------------------------------------------------+
  16  // | Authors: Paul M. Jones <pmjones@ciaweb.net>                          |
  17  // +----------------------------------------------------------------------+
  18  //
  19  // $Id: html.php,v 1.3 2004/12/02 10:54:32 nohn Exp $
  20  
  21  
  22  /**
  23  * 
  24  * This class implements a Text_Wiki_Rule to find source text marked as
  25  * HTML to be redndred as-is.  The block start is marked by <html> on its
  26  * own line, and the block end is marked by </html> on its own line.
  27  *
  28  * @author Paul M. Jones <pmjones@ciaweb.net>
  29  *
  30  * @package Text_Wiki
  31  *
  32  */
  33  
  34  class Text_Wiki_Rule_html extends Text_Wiki_Rule {
  35      
  36      
  37      /**
  38      * 
  39      * The regular expression used to parse the source text and find
  40      * matches conforming to this rule.  Used by the parse() method.
  41      * 
  42      * @access public
  43      * 
  44      * @var string
  45      * 
  46      * @see parse()
  47      * 
  48      */
  49      
  50      var $regex = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
  51      
  52      
  53      /**
  54      * 
  55      * Generates a replacement for the matched text.  Token options are:
  56      * 
  57      * 'text' => The text of the HTML to be rendered as-is.
  58      * 
  59      * @access public
  60      *
  61      * @param array &$matches The array of matches from parse().
  62      *
  63      * @return A delimited token to be used as a placeholder in
  64      * the source text, plus any text following the HTML block.
  65      *
  66      */
  67      
  68      function process(&$matches)
  69      {    
  70          $options = array('text' => $matches[1]);
  71          return $this->addToken($options) . $matches[2];
  72      }
  73      
  74      
  75      /**
  76      * 
  77      * Renders a token into text matching the requested format.
  78      * 
  79      * @access public
  80      * 
  81      * @param array $options The "options" portion of the token (second
  82      * element).
  83      * 
  84      * @return string The text rendered from the token options.
  85      * 
  86      */
  87      
  88      function renderXhtml($options)
  89      {
  90          return $options['text'];
  91      }
  92  }
  93  ?>


Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics