Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 407 → Rev 408

/trunk/api/text/wiki_papyrus/Parse/Motcles.php
1,5 → 1,5
<?php
// $Id: Motcles.php,v 1.3 2005-06-08 18:43:34 jpm Exp $
// $Id: Motcles.php,v 1.4 2005-07-08 15:14:51 alexandre_tb Exp $
 
 
/**
15,7 → 15,7
*/
class Text_Wiki_Parse_Motcles extends Text_Wiki_Parse {
var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';
var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: categorie="(.+?)"|)(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';
/**
*
37,8 → 37,12
$options = array(
'mots' => $matches[1],
'condition' => $matches[2],
'ordre' => $matches[3]
'categorie' => $matches[3],
'condition2' => $matches[4],
'ordre' => $matches[5]
);
// Les conditions étant écrites en français, ce qui suit les traduit, "et" devient "AND" etc.
if (isset($options['condition'])) {
if ($options['condition'] == 'ET' || $options['condition'] == 'et') {
$options['condition'] = 'AND';
46,6 → 50,13
$options['condition'] = 'OR';
}
}
if (isset($options['condition2'])) {
if ($options['condition2'] == 'ET' || $options['condition2'] == 'et') {
$options['condition2'] = 'AND';
} elseif ($options['condition2'] == 'OU' || $options['condition2'] == 'ou') {
$options['condition2'] = 'OR';
}
}
return $this->wiki->addToken($this->rule, $options);
}