* * Plugin Schedule: manage events per wiki @groups */ if (!defined ('DOKU_INC')) define ('DOKU_INC', realpath (__DIR__.'/../../../').'/'); if (!defined ('DOKU_PLUGIN')) define ('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); require_once (realpath (__DIR__.'/..').'/scheduleInseeCities.php'); // ============================================================ class syntax_plugin_schedule_display extends DokuWiki_Syntax_Plugin { // ============================================================ function getInfo() { return confToHash (__DIR__.'/../INFO.txt'); } function getType () { return 'substition'; } function getPType () { return 'block'; } function getSort () { return 299; } function connectTo ($mode) { $this->Lexer->addEntryPattern (']*>', $mode, 'plugin_schedule_display'); } function postConnect () { $this->Lexer->addExitPattern ('', 'plugin_schedule_display'); } // ============================================================ function handle ($match, $state, $pos, Doku_Handler $handler) { switch ($state) { case DOKU_LEXER_ENTER: return array ($state, trim (substr ($match, 8, -1))); // " 8 ">" => 1 case DOKU_LEXER_UNMATCHED: return array ($state, $match); case DOKU_LEXER_EXIT: return array ($state, ''); } return false; } // ============================================================ function render ($mode, Doku_Renderer $renderer, $indata) { if (empty($indata)) return false; if ($mode != 'xhtml') return false; list ($instr, $data) = $indata; switch ($instr) { case DOKU_LEXER_ENTER : $args = strtolower (" ".$data." "); $mapId = "scheduleMapPOI"; $width = ""; $height = ""; if (preg_match_all ('/("[^"]*")* id="(?[0-9a-zA-Z_]+)" ("[^"]*")*/', $args, $dumy) > 0) for ($i = 0; $i < count ($dumy['id']); $i++) $mapId = $dumy ['id'][$i]; if (preg_match_all ('/.* width=(?[0-9]+) .*/', $args, $dumy) > 0) for ($i = 0; $i < count ($dumy['width']); $i++) $width=' width="'.$dumy ['width'][$i].'"'; if (preg_match_all ('/.* height=(?[0-9]+) .*/', $args, $dumy) > 0) for ($i = 0; $i < count ($dumy['height']); $i++) $height=' height="'.$dumy ['height'][$i].'"'; $renderer->doc .= '
'.NL. '
'.NL; if ($this->getConf ('useMap')) { if (!is_dir (realpath (__DIR__.'/../../ol3'))) $renderer->doc .= '

ol3 plugin not installed (see doc)

'; $renderer->doc .= '
'.NL; } break; case DOKU_LEXER_UNMATCHED : $data = trim ($data); $address =""; if ($this->getConf ('useMap')) $renderer->doc .= ''.$this->getLang ('reactiveMap').''.NL; $renderer->doc .= ' '.NL. '
'.NL. '
'.NL. $address. '
'.NL; break; case DOKU_LEXER_EXIT : break; } return true; } // ============================================================ }