345 |
jpm |
1 |
<?php
|
1060 |
jp_milcent |
2 |
// $Id: Syndication.php,v 1.7 2006-11-21 13:35:19 jp_milcent Exp $
|
345 |
jpm |
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_Syndication extends Text_Wiki_Parse {
|
|
|
17 |
|
1060 |
jp_milcent |
18 |
var $regex = '/\{\{Syndication titre="([^"]+)" url="([^"]+)"( nb=(?:"|)\d+(?:"|))?( nouvellefenetre=(?:"|)(?:0|1)(?:"|))?( formatdate="[^"]+")?( template="[^"]+")?\}\}/';
|
345 |
jpm |
19 |
|
|
|
20 |
/**
|
|
|
21 |
*
|
1060 |
jp_milcent |
22 |
* Remplace l'action par une liste des dernières pages modifièes
|
345 |
jpm |
23 |
* Les options sont:
|
|
|
24 |
*
|
|
|
25 |
* 'site' => le code alphanumérique du ou des sites que l'on veut afficher
|
|
|
26 |
*
|
|
|
27 |
* @access public
|
|
|
28 |
*
|
|
|
29 |
* @param array &$matches The array of matches from parse().
|
|
|
30 |
*
|
|
|
31 |
* @return A delimited token to be used as a placeholder in
|
|
|
32 |
* the source text, plus any text priot to the match.
|
|
|
33 |
*
|
|
|
34 |
*/
|
|
|
35 |
function process(&$matches)
|
|
|
36 |
{
|
1060 |
jp_milcent |
37 |
// Gestion des paramêtres obligatoires
|
|
|
38 |
$options = array('titre' => $matches[1], 'url' => $matches[2]);
|
|
|
39 |
|
|
|
40 |
// Gestion des paramêtres optionnels
|
|
|
41 |
$tab_param_optionel = array('nb', 'nouvellefenetre', 'formatdate', 'template');
|
|
|
42 |
for ($i = 3; $i < count($matches); $i++) {
|
|
|
43 |
$tab_param = explode('=', $matches[$i]);
|
|
|
44 |
$options[trim($tab_param[0])] = str_replace('"', '', $tab_param[1]);
|
|
|
45 |
}
|
|
|
46 |
|
345 |
jpm |
47 |
return $this->wiki->addToken($this->rule, $options);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
}
|
|
|
51 |
?>
|