Subversion Repositories Applications.papyrus

Rev

Rev 931 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 931 Rev 1060
Line 1... Line 1...
1
<?php
1
<?php
2
// $Id: Syndication.php,v 1.6 2006-09-13 09:56:02 alexandre_tb Exp $
2
// $Id: Syndication.php,v 1.7 2006-11-21 13:35:19 jp_milcent Exp $
Line 3... Line 3...
3
 
3
 
4
 
4
 
5
/**
5
/**
Line 13... Line 13...
13
* @package Text_Wiki
13
* @package Text_Wiki
14
*
14
*
15
*/
15
*/
16
class Text_Wiki_Parse_Syndication extends Text_Wiki_Parse {
16
class Text_Wiki_Parse_Syndication extends Text_Wiki_Parse {
Line 17... Line 17...
17
    
17
    
Line 18... Line 18...
18
    var $regex = '/\{\{Syndication titre="(.+?)" url="(.+?)" nb=(.+?) nouvellefenetre=(.+?) formatdate="(.+?)"( template="(.+?)")?\}\}/';
18
    var $regex = '/\{\{Syndication titre="([^"]+)" url="([^"]+)"( nb=(?:"|)\d+(?:"|))?( nouvellefenetre=(?:"|)(?:0|1)(?:"|))?( formatdate="[^"]+")?( template="[^"]+")?\}\}/';
19
    
19
    
20
    /**
20
    /**
21
    * 
21
    * 
22
    * Remplace l'action par une liste des dernières pages modifiées
22
    * Remplace l'action par une liste des dernières pages modifièes
23
    * Les options sont:
23
    * Les options sont:
24
    * 
24
    * 
25
    * 'site' => le code alphanumérique du ou des sites que l'on veut afficher
25
    * 'site' => le code alphanumérique du ou des sites que l'on veut afficher
Line 32... Line 32...
32
    * the source text, plus any text priot to the match.
32
    * the source text, plus any text priot to the match.
33
    *
33
    *
34
    */
34
    */
35
    function process(&$matches)
35
    function process(&$matches)
36
    {
36
    {
-
 
37
        // Gestion des paramêtres obligatoires
-
 
38
        $options = array('titre' => $matches[1], 'url' => $matches[2]);
-
 
39
        
37
        $options = array(
40
        // Gestion des paramêtres optionnels
38
            'titre' => $matches[1], 'url' => $matches[2], 'nb' => $matches[3], 'nouvellefenetre' => $matches[4], 'formatdate' => $matches[5],
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]);
39
        );
45
        }
40
        if (isset ($matches['7']) && $matches['7'] != "") $options['template'] = $matches[7]; 
-
 
-
 
46
        
41
        return $this->wiki->addToken($this->rule, $options);
47
        return $this->wiki->addToken($this->rule, $options);
42
    }
48
    }
Line 43... Line 49...
43
    
49
    
44
}
50
}
45
?>
51
?>