calendarimporter 2.0.2:
- fixed crash when public store does not exist - check if temporary directory is writeable - disabled display_error with ini_set - fixed exporter: now really exporting the chosen calendar - improved parser (timezone detection)
This commit is contained in:
@@ -188,8 +188,8 @@ class ICal {
|
||||
//$keyword = $keyword[0]; // remove additional content like VALUE=DATE
|
||||
//}
|
||||
|
||||
if (stristr($keyword, "TIMEZONE") && !$this->timezone_set) { // check if timezone already set...
|
||||
$this->default_timezone = $value; // store the calendertimezone
|
||||
if ((stristr($keyword, "TIMEZONE") || stristr($keyword, "TZID")) && !$this->timezone_set) { // check if timezone already set...
|
||||
$this->default_timezone = $this->trimTimeZone($value); // store the calendertimezone
|
||||
}
|
||||
|
||||
switch ($component) {
|
||||
@@ -238,6 +238,24 @@ class ICal {
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim a Timezone String
|
||||
*
|
||||
* @param {string} $timezone timezone string which should be trimmed
|
||||
* @return {string} trimmed value
|
||||
*/
|
||||
private function trimTimeZone($timezone) {
|
||||
if(preg_match('~([?<=/]*)([^/]*[/|-][^/]*$)~', $timezone, $matches)) { // detects tzurls in tzids
|
||||
if ($matches[2] != "") {
|
||||
return $matches[2]; // 2 = extracted timezone
|
||||
} else {
|
||||
return $timezone;
|
||||
}
|
||||
}
|
||||
|
||||
return $timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a key-value pair of a string.
|
||||
*
|
||||
@@ -277,6 +295,7 @@ class ICal {
|
||||
if($pos !== false && $propvalue != false) {
|
||||
$timezone = str_replace('"', '', $propvalue);
|
||||
$timezone = str_replace('\'', '', $timezone);
|
||||
$timezone = $this->trimTimeZone($timezone);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +433,15 @@ class ICal {
|
||||
$array = $this->cal;
|
||||
return $array['VCALENDAR'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default or set timezone
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
public function timezone() {
|
||||
return $this->default_timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean value whether thr current calendar has events or not
|
||||
|
Reference in New Issue
Block a user