[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Text/Wiki/Parse/Default/ -> Colortext.php (source)

   1  <?php
   2  // $Id: Colortext.php,v 1.1 2005/01/31 15:46:52 pmjones Exp $
   3  
   4  
   5  /**
   6  * 
   7  * This class implements a Text_Wiki_Parse to find source text marked for
   8  * coloring.
   9  *
  10  * @author Paul M. Jones <pmjones@ciaweb.net>
  11  *
  12  * @package Text_Wiki
  13  *
  14  */
  15  
  16  class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
  17      
  18      /**
  19      * 
  20      * The regular expression used to parse the source text and find
  21      * matches conforming to this rule.  Used by the parse() method.
  22      * 
  23      * @access public
  24      * 
  25      * @var string
  26      * 
  27      * @see parse()
  28      * 
  29      */
  30      
  31      var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
  32      
  33      
  34      /**
  35      * 
  36      * Generates a replacement for the matched text.  Token options are:
  37      * 
  38      * 'type' => ['start'|'end'] The starting or ending point of the
  39      * emphasized text.  The text itself is left in the source.
  40      * 
  41      * 'color' => the color indicator
  42      * 
  43      * @access public
  44      *
  45      * @param array &$matches The array of matches from parse().
  46      *
  47      * @return string A pair of delimited tokens to be used as a
  48      * placeholder in the source text surrounding the text to be
  49      * emphasized.
  50      *
  51      */
  52      
  53      function process(&$matches)
  54      {
  55          $start = $this->wiki->addToken(
  56              $this->rule, 
  57              array(
  58                  'type' => 'start',
  59                  'color' => $matches[1]
  60              )
  61          );
  62          
  63          $end = $this->wiki->addToken(
  64              $this->rule, 
  65              array(
  66                  'type' => 'end',
  67                  'color' => $matches[1]
  68              )
  69          );
  70          
  71          return $start . $matches[2] . $end;
  72      }
  73  }
  74  ?>


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