onmouseover : ouvre un popup au dessus, et affiche url contenant le texte {[url:mode!http://toto?value=]} {[url:mode!inline]} {[url:mode!wiki]} {[ignore:cam]} {[style:]} {[mode!texte|affiché]} tri dvd inversé (sort) Shift + Refresh pour raffraichir sous firefox */ if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_embedover extends DokuWiki_Syntax_Plugin { public $urls = array(); public $styles = array(); function getInfo(){ return array( 'author' => 'Rémi Peyronnet', 'email' => 'remi+embedover@via.ecp.fr', 'date' => '2009-05-03', 'name' => 'EmbedOver Plugin', 'desc' => 'Embed in an overlay a remote web/wiki page', 'url' => 'http://people.via.ecp.fr/~remi/', ); } function getType() { return 'substition'; } function getPType() { return 'normal'; } function getSort() { return 4212; } function connectTo($mode) { $this->Lexer->addSpecialPattern('{\([^}]*\)}',$mode,'plugin_embedover'); } function handle($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_SPECIAL : $data = ''; // URLs if (preg_match('/{\(url\:((?.*)!)?(?[^|]*)\)}/', $match, $matches)) { if (!$matches[mode]) $matches[mode] = 'default'; $this->urls[$matches[mode]] = $matches[text]; $data = '{[embedover_div]}'; } // Style else if (preg_match('/{\(style\:((?.*)!)?(?[^|]*)\)}/', $match, $matches)) { if (!$matches[mode]) $matches[mode] = 'default'; $this->styles[$matches[mode]] = $matches[text]; } // Items else if (preg_match('/{\(((?.*)!)?(?[^|]*)(\|(?.*))?\)}/', $match, $matches)) { if (!$matches[aff]) $matches[aff] = $matches[text]; if (!$matches[mode]) $matches[mode] = 'default'; $dest = $this->urls[$matches[mode]] . urlencode($matches[text]); $style = $this->styles[$matches[mode]]; if ($matches[aff]) $data = "${matches[aff]}"; } return array($state, $data); case DOKU_LEXER_UNMATCHED : return array($state, $match); case DOKU_LEXER_ENTRY : return array($state, ''); case DOKU_LEXER_EXIT : return array($state, ''); } return array(); } function render($mode, Doku_Renderer $renderer, $data) { if($mode == 'xhtml'){ list($state, $match) = $data; switch ($state) { case DOKU_LEXER_SPECIAL : if ($match == '{[embedover_div]}') { $renderer->doc .= ""; } else { $renderer->doc .= $match; } break; case DOKU_LEXER_UNMATCHED : $renderer->doc .= $renderer->_xmlEntities($match); break; case DOKU_LEXER_EXIT : $renderer->doc .= ""; break; } return true; } return false; } } /* Sample data : */ ?>