Subversion Repositories Applications.papyrus

Rev

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

Rev 395 Rev 408
Line 1... Line 1...
1
<?php
1
<?php
2
// $Id: Motcles.php,v 1.3 2005-06-08 18:43:34 jpm Exp $
2
// $Id: Motcles.php,v 1.4 2005-07-08 15:14:51 alexandre_tb 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="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';
18
    var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: categorie="(.+?)"|)(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';
19
    
19
    
20
    /**
20
    /**
21
    * 
21
    * 
Line 35... Line 35...
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],
39
            'condition' => $matches[2],
-
 
40
            'categorie' => $matches[3],
-
 
41
            'condition2' => $matches[4],
40
            'ordre' => $matches[3]
42
            'ordre' => $matches[5]
41
        );
43
        );
-
 
44
        
-
 
45
        // Les conditions étant écrites en français, ce qui suit les traduit, "et" devient "AND" etc.
42
        if (isset($options['condition'])) {
46
        if (isset($options['condition'])) {
43
            if ($options['condition'] == 'ET' || $options['condition'] == 'et') {
47
            if ($options['condition'] == 'ET' || $options['condition'] == 'et') {
44
                $options['condition'] = 'AND';
48
                $options['condition'] = 'AND';
45
            } elseif ($options['condition'] == 'OU' || $options['condition'] == 'ou') {
49
            } elseif ($options['condition'] == 'OU' || $options['condition'] == 'ou') {
46
                $options['condition'] = 'OR';
50
                $options['condition'] = 'OR';
47
            }
51
            }
48
        }
52
        }
-
 
53
        if (isset($options['condition2'])) {
-
 
54
            if ($options['condition2'] == 'ET' || $options['condition2'] == 'et') {
-
 
55
                $options['condition2'] = 'AND';
-
 
56
            } elseif ($options['condition2'] == 'OU' || $options['condition2'] == 'ou') {
-
 
57
                $options['condition2'] = 'OR';
-
 
58
            }
-
 
59
        }
Line 49... Line 60...
49
        
60
        
50
        return $this->wiki->addToken($this->rule, $options);
61
        return $this->wiki->addToken($this->rule, $options);
Line 51... Line 62...
51
    }
62
    }