home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / Text / Wiki / Parse / Default / Subscript.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  1.5 KB  |  79 lines

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