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

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