Lexer->addSpecialPattern( '^[\n\s]*BEGIN:VCALENDAR\n.*\nEND:VCALENDAR[\n\s]*$', $mode, 'plugin_calendoku_showicalendar'); } function handle($match, $state, $pos, &$handler) { global $INFO; /* Check if we handle this page at all. */ $dohandle = false; $INFO = pageinfo(); $namespaces = preg_split('/\s/', $this->getConf('icalnamespaces')); foreach ($namespaces as $namespace) { if (!strcmp($namespace, $INFO['namespace'])) { $dohandle = true; break; } } if (!$dohandle) { $handler->_addCall('cdata', array($match), $pos); return false; } /* Get the template. */ $templates = preg_split('/\s/', $this->getConf('icaltemplates')); foreach ($templates as $template) if (!strcmp($template, $INFO['id'])) { $handler->_addCall('cdata', array($match), $pos); return false; } foreach ($templates as $template) { if (!strcmp('', getNS($template))) { $mytemplate = $INFO['namespace'].':'.$template; } else if (!strcmp(getNS($template), $INFO['namespace'])) { $mytemplate = $template; break; } } if (!isset($mytemplate)) { $handler->_addCall('cdata', array($match), $pos); return false; } /* Create the calendar object. */ $object = new CalenDoku_CalendarObject($this, $match); $mytemplate = rawWiki($mytemplate); if (!preg_match('/@@/', $mytemplate)) { $handler->_addCall('cdata', array($match), $pos); return false; } foreach ($object->components as $component) { $componenttext = $mytemplate; $componenttext = preg_replace('/@@DOKUWIKIICAL@@/', $INFO['id'].'?do=ical', $componenttext); foreach ($component->renderfields as $field => $value) { $componenttext = preg_replace('/@@'.$field.'@@/', $value, $componenttext); } reHandleText($componenttext, $pos, $handler); } return true; } function render($mode, &$renderer, $data) { return true; } } //Setup VIM: ex: et ts=4 enc=utf-8 :