From 0b02a6d123b2014705998c94ddf3d460948d3eac Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 10 May 2016 17:26:44 -0700 Subject: initial sabre upgrade (needs lots of work - to wit: authentication, redo the browser interface, and rework event export/import) --- vendor/sabre/vobject/lib/Writer.php | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 vendor/sabre/vobject/lib/Writer.php (limited to 'vendor/sabre/vobject/lib/Writer.php') diff --git a/vendor/sabre/vobject/lib/Writer.php b/vendor/sabre/vobject/lib/Writer.php new file mode 100644 index 000000000..f8a58758d --- /dev/null +++ b/vendor/sabre/vobject/lib/Writer.php @@ -0,0 +1,81 @@ +serialize(); + + } + + /** + * Serializes a jCal or jCard object. + * + * @param Component $component + * @param int $options + * + * @return string + */ + static function writeJson(Component $component, $options = 0) { + + return json_encode($component, $options); + + } + + /** + * Serializes a xCal or xCard object. + * + * @param Component $component + * + * @return string + */ + static function writeXml(Component $component) { + + $writer = new Xml\Writer(); + $writer->openMemory(); + $writer->setIndent(true); + + $writer->startDocument('1.0', 'utf-8'); + + if ($component instanceof Component\VCalendar) { + + $writer->startElement('icalendar'); + $writer->writeAttribute('xmlns', Parser\Xml::XCAL_NAMESPACE); + + } else { + + $writer->startElement('vcards'); + $writer->writeAttribute('xmlns', Parser\Xml::XCARD_NAMESPACE); + + } + + $component->xmlSerialize($writer); + + $writer->endElement(); + + return $writer->outputMemory(); + + } + +} -- cgit v1.2.3