Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
170 jpm 1
<?php
2
// $Id: Include.php,v 1.1 2004-11-24 18:34:35 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
 
17
class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
18
 
19
    var $regex = '/\{\{include page="([A-Za-z0-9_]+)"(?: interwiki="([A-Za-z0-9_]+)"|)\}\}/';
20
    //var $regex = '{{include .*}}';
21
 
22
    /**
23
    *
24
    * Generates a replacement for the matched standalone interwiki text.
25
    * Token options are:
26
    *
27
    * 'site' => The key name for the Text_Wiki interwiki array map,
28
    * usually the name of the interwiki site.
29
    *
30
    * 'page' => The page on the target interwiki to link to.
31
    *
32
    * 'text' => The text to display as the link.
33
    *
34
    * @access public
35
    *
36
    * @param array &$matches The array of matches from parse().
37
    *
38
    * @return A delimited token to be used as a placeholder in
39
    * the source text, plus any text priot to the match.
40
    *
41
    */
42
    function process(&$matches)
43
    {
44
        $options = array(
45
            'page' => $matches[1],
46
            'site' => $matches[2],
47
            'text' => $matches[0]
48
        );
49
 
50
        return $this->wiki->addToken($this->rule, $options);
51
    }
52
 
53
}
54
?>