From b35122f7a6ad42756c35bb60ba1f06c3dcd45c77 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 21 Oct 2013 15:46:31 -0700 Subject: add sabre (1.8.x) via composer in the !@#$ place it wants to be --- .../lib/Sabre/VObject/Splitter/ICalendar.php | 111 +++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 vendor/sabre/vobject/lib/Sabre/VObject/Splitter/ICalendar.php (limited to 'vendor/sabre/vobject/lib/Sabre/VObject/Splitter/ICalendar.php') diff --git a/vendor/sabre/vobject/lib/Sabre/VObject/Splitter/ICalendar.php b/vendor/sabre/vobject/lib/Sabre/VObject/Splitter/ICalendar.php new file mode 100644 index 000000000..657cfb810 --- /dev/null +++ b/vendor/sabre/vobject/lib/Sabre/VObject/Splitter/ICalendar.php @@ -0,0 +1,111 @@ +children as $component) { + if (!$component instanceof VObject\Component) { + continue; + } + + // Get all timezones + if ($component->name === 'VTIMEZONE') { + $this->vtimezones[(string)$component->TZID] = $component; + continue; + } + + // Get component UID for recurring Events search + if($component->UID) { + $uid = (string)$component->UID; + } else { + // Generating a random UID + $uid = sha1(microtime()) . '-vobjectimport'; + } + + // Take care of recurring events + if (!array_key_exists($uid, $this->objects)) { + $this->objects[$uid] = VObject\Component::create('VCALENDAR'); + } + + $this->objects[$uid]->add(clone $component); + } + + } + + /** + * Every time getNext() is called, a new object will be parsed, until we + * hit the end of the stream. + * + * When the end is reached, null will be returned. + * + * @return Sabre\VObject\Component|null + */ + public function getNext() { + + if($object=array_shift($this->objects)) { + + // create our baseobject + $object->version = '2.0'; + $object->prodid = '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN'; + $object->calscale = 'GREGORIAN'; + + // add vtimezone information to obj (if we have it) + foreach ($this->vtimezones as $vtimezone) { + $object->add($vtimezone); + } + + return $object; + + } else { + + return null; + + } + + } + +} -- cgit v1.2.3