This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsyntax.php
87 lines (72 loc) · 2.91 KB
/
syntax.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Plugin iCalEvents: Renders an iCalendar file, e.g., as a table.
*
* Copyright (C) 2010-2012, 2015-2016
* Tim Ruffing, Robert Rackl, Elan Ruusamäe, Jannes Drost-Tenfelde
*
* This file is part of the DokuWiki iCalEvents plugin.
*
* The DokuWiki iCalEvents plugin program is free software:
* you can redistribute it and/or modify it under the terms of the
* GNU General Public License version 2 as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* version 2 along with the DokuWiki iCalEvents plugin program. If
* not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
*
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL2
* @author Tim Ruffing <tim@timruffing.de>
* @author Robert Rackl <wiki@doogie.de>
* @author Elan Ruusamäe <glen@delfi.ee>
* @author Jannes Drost-Tenfelde <info@drost-tenfelde.de>
*
*/
// 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 = '<br/ >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 {
}
}