Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 169 → Rev 170

/trunk/api/text/wiki_wikini/Parse/Include.php
New file
0,0 → 1,54
<?php
// $Id: Include.php,v 1.1 2004-11-24 18:34:35 jpm Exp $
 
 
/**
*
* This class implements a Text_Wiki_Parse to find source text marked as
* an Interwiki link. See the regex for a detailed explanation of the
* text matching procedure; e.g., "InterWikiName:PageName".
*
* @author Paul M. Jones <pmjones@ciaweb.net>
*
* @package Text_Wiki
*
*/
 
class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
var $regex = '/\{\{include page="([A-Za-z0-9_]+)"(?: interwiki="([A-Za-z0-9_]+)"|)\}\}/';
//var $regex = '{{include .*}}';
/**
*
* Generates a replacement for the matched standalone interwiki text.
* Token options are:
*
* 'site' => The key name for the Text_Wiki interwiki array map,
* usually the name of the interwiki site.
*
* 'page' => The page on the target interwiki to link to.
*
* 'text' => The text to display as the link.
*
* @access public
*
* @param array &$matches The array of matches from parse().
*
* @return A delimited token to be used as a placeholder in
* the source text, plus any text priot to the match.
*
*/
function process(&$matches)
{
$options = array(
'page' => $matches[1],
'site' => $matches[2],
'text' => $matches[0]
);
return $this->wiki->addToken($this->rule, $options);
}
}
?>