[Pkg-owncloud-commits] [php-sabre-vobject] 63/341: !xml <period> is a key-value element.

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 13:35:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabre-vobject.

commit fcd1646c07d3dad309fd8fd2bc497ccaa7804f26
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Tue Nov 18 12:05:09 2014 +0100

    !xml <period> is a key-value element.
---
 lib/Parser/XML.php                  |  2 ++
 lib/Parser/XML/Element/KeyValue.php | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/lib/Parser/XML.php b/lib/Parser/XML.php
index 3d82c1a..ae09921 100644
--- a/lib/Parser/XML.php
+++ b/lib/Parser/XML.php
@@ -148,6 +148,8 @@ class XML extends Parser {
         if(is_string($input)) {
 
             $reader = new SabreXML\Reader();
+            $reader->elementMap['{urn:ietf:params:xml:ns:icalendar-2.0}period']
+                = 'Sabre\VObject\Parser\XML\Element\KeyValue';
             $reader->xml($input);
             $input  = $reader->parse();
         }
diff --git a/lib/Parser/XML/Element/KeyValue.php b/lib/Parser/XML/Element/KeyValue.php
new file mode 100644
index 0000000..6ada96a
--- /dev/null
+++ b/lib/Parser/XML/Element/KeyValue.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Sabre\VObject\Parser\XML\Element;
+
+use Sabre\XML as SabreXML;
+
+/**
+ * Our own sabre/xml key-value element.
+ *
+ * It just removes the clark notation.
+ *
+ * @copyright Copyright (C) 2007-2014 fruux GmbH. All rights reserved.
+ * @author Ivan Enderlin
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class KeyValue extends SabreXML\Element\KeyValue {
+
+    /**
+     * Get element name.
+     *
+     * The serializeXml and deserializeXml method will call this method to
+     * compute the element name.
+     *
+     * @param SabreXML\Reader $reader
+     * @return string
+     */
+    static function getElementName(SabreXML\Reader $reader) {
+
+        return $reader->localName;
+
+    }
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git



More information about the Pkg-owncloud-commits mailing list