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

Source for file Anchor.php

Documentation is available at Anchor.php

  1. <?php
  2.  
  3. /**
  4. * This class implements a Text_Wiki_Parse to add an anchor target name
  5. * in the wiki page.
  6. *
  7. @author Manuel Holtgrewe <purestorm at ggnore dot net>
  8. *
  9. @author Paul M. Jones <pmjones at ciaweb dot net>
  10. *
  11. @package Text_Wiki
  12. *
  13. */
  14.  
  15.     
  16.     
  17.     /**
  18.     * 
  19.     * The regular expression used to find source text matching this
  20.     * rule.
  21.     * 
  22.     * @access public
  23.     * 
  24.     * @var string 
  25.     * 
  26.     */
  27.     
  28.     var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
  29.     
  30.     
  31.     /**
  32.     * 
  33.     * Generates a token entry for the matched text.  Token options are:
  34.     * 
  35.     * 'text' => The full matched text, not including the <code></code> tags.
  36.     * 
  37.     * @access public
  38.     *
  39.     * @param array &$matches The array of matches from parse().
  40.     *
  41.     * @return delimited token number to be used as a placeholder in
  42.     *  the source text.
  43.     *
  44.     */
  45.     
  46.     function process(&$matches{
  47.     
  48.         $name $matches[2];
  49.         $text $matches[3];
  50.         
  51.         $start $this->wiki->addToken(
  52.             $this->rule,
  53.             array('type' => 'start''name' => $name)
  54.         );
  55.         
  56.         $end $this->wiki->addToken(
  57.             $this->rule,
  58.             array('type' => 'end''name' => $name)
  59.         );
  60.         
  61.         // done, place the script output directly in the source
  62.         return $start trim($text$end;
  63.     }
  64. }
  65. ?>

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