array( 'Wikipedia' => array('preg' => '/(.*)/Umsi', 'url' => 'http://fr.wikipedia.org/wiki/%s'), 'Wikipedia_fr' => array('preg' => '/(.*)/Umsi', 'url' => 'http://fr.wikipedia.org/wiki/%s'), 'Wikipedia_en' => array('preg' => '/(.*)/Umsi', 'url' => 'http://en.wikipedia.org/wiki/%s'), 'Wikini_eFlore' => array('preg' => '/
(.*)<\/div>.*
/Umsi', 'url' => 'http://wiki.tela-botanica.org/eflore/wakka.php?wiki=%s') ), 'css' => null, 'encodage' => 'iso-8859-15' ); /** * * Renders a token into text matching the requested format. * * @access public * * @param array $options The "options" portion of the token (second * element). * * @return string The text rendered from the token options. * */ function token($options) { $site = $options['site']; $page = $options['page']; $text = $options['text']; $css = $this->formatConf(' class="%s"', 'css'); if (isset($this->conf['sites'][$site])) { $href = $this->conf['sites'][$site]['url']; } else { return $text; } // old form where page is at end, // or new form with %s placeholder for sprintf()? if (strpos($href, '%s') === false) { // use the old form $href = $href . $page; } else { // use the new form $href = sprintf($href, $page); } $output = ''; $contenu = file_get_contents($href); $tab_matches=''; preg_match($this->conf['sites'][$site]['preg'], $contenu, $tab_matches); $tab_encodage=''; preg_match('//Ui', $contenu, $tab_encodage); if (preg_match('/^(?:iso-8859-1|iso-8859-15)$/i', $this->conf['encodage']) && preg_match('/utf-8/i', $tab_encodage[1])) { $output = utf8_decode($tab_matches[1]); } else { $output = $tab_matches[1]; } return $output; } } ?>