1 --- dokuwiki-plugin-icalevents-20100501/syntax.php 2010-12-05 22:33:33.062976306 +0200
2 +++ iCalEvents/syntax.php 2010-12-05 22:44:54.218325084 +0200
4 $previewSec = 60*24*3600; # two month
7 + # Take dateformat from params, or
8 + # If dateformat is set in plugin configuration ('dformat'), then use it.
9 + # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
10 + if (!empty($params['dformat'])) {
11 + $dateFormat = $params['dformat'];
14 + $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
17 + $showEndDates = !empty($params['showEndDates']);
19 #echo "url=$icsURL from = $from previewSec = $previewSec<br>";
21 - return array($icsURL, $from, $previewSec);
22 + return array($icsURL, $from, $previewSec, $dateFormat, $showEndDates);
26 * loads the ics file via HTTP, parses it and renders an HTML table.
28 function render($mode, &$renderer, $data) {
29 - list($url, $from, $previewSec) = $data;
30 + list($url, $from, $previewSec, $dateFormat, $showEndDates) = $data;
34 - $entries = $this->_parseIcs($url, $from, $previewSec);
35 + $entries = $this->_parseIcs($url, $from, $previewSec, $dateFormat);
37 $renderer->doc .= "Error in Plugin iCalEvents: ".$this->error;
40 foreach ($entries as $entry) {
43 - if ($this->getConf('showEndDates')) {
44 + if ($showEndDates || $this->getConf('showEndDates')) {
45 $ret .= '<td>'.$entry['startdate'].' - '.$entry['enddate'].'</td>';
47 $ret .= '<td>'.$entry['startdate'];
49 * @param previewSec preview range also in seconds
50 * @return an array of entries sorted by their startdate
52 - function _parseIcs($url, $from, $previewSec) {
55 + function _parseIcs($url, $from, $previewSec, $dateFormat) {
56 // must reset error in case we have multiple calendars on page
60 $content = $http->resp_body;
63 - # If dateformat is set in plugin configuration ('dformat'), then use it.
64 - # Otherwise fall back to dokuwiki's default dformat from the global /conf/dokuwiki.php.
65 - $dateFormat = $this->getConf('dformat') ? $this->getConf('dformat') : $conf['dformat'];
67 # regular expressions for items that we want to extract from the iCalendar file
68 $regex_vevent = '/BEGIN:VEVENT(.*?)END:VEVENT/s';
69 $regex_summary = '/SUMMARY:(.*?)\n/';