Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
180 jpm 1
<?php
2
// $Id: Inclure.php,v 1.1 2004-11-26 12:13:28 jpm Exp $
3
 
4
 
5
/**
6
*
7
* This class implements a Text_Wiki_Parse to find source text marked as
8
* an Interwiki link.  See the regex for a detailed explanation of the
9
* text matching procedure; e.g., "InterWikiName:PageName".
10
*
11
* @author Paul M. Jones <pmjones@ciaweb.net>
12
*
13
* @package Text_Wiki
14
*
15
*/
16
class Text_Wiki_Parse_Inclure extends Text_Wiki_Parse {
17
 
18
    var $regex = '/\{\{inclure page="([A-Za-z0-9_]+)"(?: interwiki="([A-Za-z0-9_]+)"|)\}\}/';
19
 
20
    /**
21
    *
22
    * Generates a replacement for the matched standalone interwiki text.
23
    * Token options are:
24
    *
25
    * 'site' => The key name for the Text_Wiki interwiki array map,
26
    * usually the name of the interwiki site.
27
    *
28
    * 'page' => The page on the target interwiki to link to.
29
    *
30
    * 'text' => The text to display as the link.
31
    *
32
    * @access public
33
    *
34
    * @param array &$matches The array of matches from parse().
35
    *
36
    * @return A delimited token to be used as a placeholder in
37
    * the source text, plus any text priot to the match.
38
    *
39
    */
40
    function process(&$matches)
41
    {
42
        $options = array(
43
            'page' => $matches[1],
44
            'site' => $matches[2],
45
            'text' => $matches[0]
46
        );
47
 
48
        return $this->wiki->addToken($this->rule, $options);
49
    }
50
 
51
}
52
?>