Text_Wiki
[ class tree: Text_Wiki ] [ index: Text_Wiki ] [ all elements ]

Source for file Colortext.php

Documentation is available at Colortext.php

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

Documentation generated on Mon, 11 Mar 2019 13:56:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.