Subversion Repositories Applications.papyrus

Rev

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

Rev 384 Rev 395
Line 1... Line 1...
1
<?php
1
<?php
2
// $Id: Motcles.php,v 1.2 2005-05-27 13:41:24 jpm Exp $
2
// $Id: Motcles.php,v 1.3 2005-06-08 18:43:34 jpm 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_Motcles extends Text_Wiki_Parse {
16
class Text_Wiki_Parse_Motcles extends Text_Wiki_Parse {
Line 17... Line 17...
17
    
17
    
Line 18... Line 18...
18
    var $regex = '/\{\{MotCles mots="(.+?)"\}\}/';
18
    var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';
19
    
19
    
20
    /**
20
    /**
21
    * 
21
    * 
Line 33... Line 33...
33
    *
33
    *
34
    */
34
    */
35
    function process(&$matches)
35
    function process(&$matches)
36
    {
36
    {
37
        $options = array(
37
        $options = array(
38
            'mots' => $matches[1]
38
            'mots' => $matches[1],
-
 
39
            'condition' => $matches[2],
-
 
40
            'ordre' => $matches[3]
39
        );
41
        );
-
 
42
        if (isset($options['condition'])) {
-
 
43
            if ($options['condition'] == 'ET' || $options['condition'] == 'et') {
-
 
44
                $options['condition'] = 'AND';
-
 
45
            } elseif ($options['condition'] == 'OU' || $options['condition'] == 'ou') {
-
 
46
                $options['condition'] = 'OR';
-
 
47
            }
-
 
48
        }
Line 40... Line 49...
40
        
49
        
41
        return $this->wiki->addToken($this->rule, $options);
50
        return $this->wiki->addToken($this->rule, $options);
Line 42... Line 51...
42
    }
51
    }