. * * @license https://www.gnu.org/licenses/gpl-2.0.html GPL2 * @author Tim Ruffing * @author Robert Rackl * @author Elan Ruusamäe * @author Jannes Drost-Tenfelde * */ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/'); require_once DOKU_PLUGIN . 'syntax.php'; // We require at least PHP 5.5.5. // The following base class implements just the basics and an error message for older PHP versions. // Then we define the actual class by extending the base class depending on the PHP version. class syntax_plugin_icalevents_base extends DokuWiki_Syntax_Plugin { const ERROR_PREFIX = '
Error in Plugin iCalEvents: '; function getType() { return 'substition'; } function getPType() { return 'block'; } function getSort() { // The iCalendar plugin (and older versions of iCalEvents) used 42 here. // So we need be stay below 42 to ensure an easy upgrade from iCalendar to iCalEvents. return 41; } function connectTo($mode) { // Subpatterns such as (iCalEvents|iCalendar) are not allowed // see https://www.dokuwiki.org/devel:parser#subpatterns_not_allowed $this->Lexer->addSpecialPattern('(?i:\{\{iCalEvents>.*?\}\})', $mode, 'plugin_icalevents'); $this->Lexer->addSpecialPattern('(?i:\{\{iCalendar>.*?\}\})', $mode, 'plugin_icalevents'); } function handle($match, $state, $pos, Doku_Handler $handler) { } function render($mode, Doku_Renderer $renderer, $data) { $renderer->doc .= static::ERROR_PREFIX . 'The plugin requires at least PHP 5.5.5.'; return false; } } // An 'require' ensures that older PHP versions do not even try to parse the actual code. if (PHP_VERSION_ID >= 50505) { require __DIR__ . '/syntax-impl.php'; } else { class syntax_plugin_icalevents extends syntax_plugin_icalevents_base { } }