/trunk/api/text/wiki_papyrus/Render/Xhtml/Motcles.php |
---|
24,7 → 24,14 |
} else { |
return '<p>'.' Aucun mot-clés passé en paramêtre! '.'</p>'; |
} |
$condition = 'OR'; |
if (isset($options['condition'])) { |
$condition = $options['condition']; |
} |
$ordre = 'ASC'; |
if (isset($options['ordre'])) { |
$ordre = $options['ordre']; |
} |
// Récupération des infos |
$tab_mots = explode(',', $mots); |
for ($i = 0; $i < count($tab_mots); $i++) { |
31,7 → 38,7 |
// Suppression des espaces, tabulations... en début et fin de chaine |
$tab_mots[$i] = trim($tab_mots[$i]); |
} |
$aso_info_menu = GEN_lireInfoMenuMotsCles($GLOBALS['_GEN_commun']['pear_db'], $tab_mots); |
$aso_info_menu = GEN_lireInfoMenuMotsCles($GLOBALS['_GEN_commun']['pear_db'], $tab_mots, $condition, $ordre); |
// Formatage des infos en XHTML |
$sortie .= '<ul class="page_liste">'."\n"; |
/trunk/api/text/wiki_papyrus/Parse/Motcles.php |
---|
1,5 → 1,5 |
<?php |
// $Id: Motcles.php,v 1.2 2005-05-27 13:41:24 jpm Exp $ |
// $Id: Motcles.php,v 1.3 2005-06-08 18:43:34 jpm Exp $ |
/** |
15,7 → 15,7 |
*/ |
class Text_Wiki_Parse_Motcles extends Text_Wiki_Parse { |
var $regex = '/\{\{MotCles mots="(.+?)"\}\}/'; |
var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/'; |
/** |
* |
35,8 → 35,17 |
function process(&$matches) |
{ |
$options = array( |
'mots' => $matches[1] |
'mots' => $matches[1], |
'condition' => $matches[2], |
'ordre' => $matches[3] |
); |
if (isset($options['condition'])) { |
if ($options['condition'] == 'ET' || $options['condition'] == 'et') { |
$options['condition'] = 'AND'; |
} elseif ($options['condition'] == 'OU' || $options['condition'] == 'ou') { |
$options['condition'] = 'OR'; |
} |
} |
return $this->wiki->addToken($this->rule, $options); |
} |