[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Text/Wiki/Rule/ -> delimiter.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: delimiter.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 instances of the delimiter
  25  * character already embedded in the source text; it extracts them and replaces
  26  * them with a delimited token, then renders them as the delimiter itself
  27  * when the target format is XHTML.
  28  *
  29  * @author Paul M. Jones <pmjones@ciaweb.net>
  30  *
  31  * @package Text_Wiki
  32  *
  33  */
  34  
  35  class Text_Wiki_Rule_delimiter extends Text_Wiki_Rule {
  36      
  37      /**
  38      * 
  39      * Constructor.  Overrides the Text_Wiki_Rule constructor so that we
  40      * can set the $regex property dynamically (we need to include the
  41      * Text_Wiki $delim character.
  42      * 
  43      * @param object &$obj The calling "parent" Text_Wiki object.
  44      * 
  45      * @param string $name The token name to use for this rule.
  46      * 
  47      */
  48      
  49      function Text_Wiki_Rule_delimiter(&$obj, $name)
  50      {
  51          parent::Text_Wiki_Rule($obj, $name);
  52          $this->regex = '/' . $this->_wiki->delim . '/';
  53      }
  54      
  55      
  56      /**
  57      * 
  58      * Generates a token entry for the matched text.  Token options are:
  59      * 
  60      * 'text' => The full matched text.
  61      * 
  62      * @access public
  63      *
  64      * @param array &$matches The array of matches from parse().
  65      *
  66      * @return A delimited token number to be used as a placeholder in
  67      * the source text.
  68      *
  69      */
  70      
  71      function process(&$matches)
  72      {    
  73          return $this->addToken();
  74      }
  75      
  76      
  77      /**
  78      * 
  79      * Renders a token into text matching the requested format.
  80      * 
  81      * @access public
  82      * 
  83      * @param array $options The "options" portion of the token (second
  84      * element).
  85      * 
  86      * @return string The text rendered from the token options.
  87      * 
  88      */
  89      
  90      function renderXhtml($options)
  91      {
  92          return $this->_wiki->delim;
  93      }
  94  }
  95  ?>


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