Rev 1087 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php// $Id: Motcles.php,v 1.4 2005-07-08 15:14:51 alexandre_tb Exp $/**** This class implements a Text_Wiki_Parse to find source text marked as* an Interwiki link. See the regex for a detailed explanation of the* text matching procedure; e.g., "InterWikiName:PageName".** @author Paul M. Jones <pmjones@ciaweb.net>** @package Text_Wiki**/class Text_Wiki_Parse_Motcles extends Text_Wiki_Parse {var $regex = '/\{\{MotCles mots="(.+?)"(?: condition="(ET|OU|et|ou)"|)(?: categorie="(.+?)"|)(?: condition="(ET|OU|et|ou)"|)(?: ordre="(ASC|DESC|asc|desc)"|)\}\}/';/**** Remplace l'action par une liste des pages contenant les mots clés choisis* Les options sont:** 'mots' => les mots clés séparés par des virgules** @access public** @param array &$matches The array of matches from parse().** @return A delimited token to be used as a placeholder in* the source text, plus any text priot to the match.**/function process(&$matches){$options = array('mots' => $matches[1],'condition' => $matches[2],'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';} elseif ($options['condition'] == 'OU' || $options['condition'] == 'ou') {$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);}}?>