"Fossies" - the Fresh Open Source Software Archive 
Member "serendipity/bundled-libs/Text/Wiki/Parse/Default/Anchor.php" (20 Nov 2022, 1475 Bytes) of package /linux/www/serendipity-2.4.0.zip:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "Anchor.php" see the
Fossies "Dox" file reference documentation.
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 class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
17
18
19 /**
20 *
21 * The regular expression used to find source text matching this
22 * rule. Looks like a macro: [[# anchor_name]]
23 *
24 * @access public
25 *
26 * @var string
27 *
28 */
29
30 var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
31
32
33 /**
34 *
35 * Generates a token entry for the matched text. Token options are:
36 *
37 * 'text' => The full matched text, not including the <code></code> tags.
38 *
39 * @access public
40 *
41 * @param array &$matches The array of matches from parse().
42 *
43 * @return A delimited token number to be used as a placeholder in
44 * the source text.
45 *
46 */
47
48 function process(&$matches) {
49
50 $name = $matches[2];
51 $text = $matches[3];
52
53 $start = $this->wiki->addToken(
54 $this->rule,
55 array('type' => 'start', 'name' => $name)
56 );
57
58 $end = $this->wiki->addToken(
59 $this->rule,
60 array('type' => 'end', 'name' => $name)
61 );
62
63 // done, place the script output directly in the source
64 return $start . trim($text) . $end;
65 }
66 }
67 ?>