From 60383ef3c26960ac83ab02240dc13f18f94f15e1 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Thu, 15 Nov 2007 16:35:29 +1300 Subject: [PATCH] Improved formatting of namespace details for arbitrary properties. --- inc/caldav-PROPFIND.php | 10 +++++++++- .../tests/regression-suite/843-Spec-PROPFIND.result | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 1034acb5..0a00d29d 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -336,7 +336,15 @@ function collection_to_xml( $collection ) { if ( count($collection->properties) > 0 ) { foreach( $collection->properties AS $k => $v ) { - $prop->NewElement($k, $v ); + if ( preg_match('/^(.*):([^:]+)$/', $k, $matches) ) { + $namespace = $matches[1]; + $tag = $matches[2]; + } + else { + $namespace = ""; + $tag = $k; + } + $prop->NewElement(strtolower($tag), $v, array("xmlns" => strtolower($namespace)) ); } } diff --git a/testing/tests/regression-suite/843-Spec-PROPFIND.result b/testing/tests/regression-suite/843-Spec-PROPFIND.result index 881a0ca6..3825c211 100644 --- a/testing/tests/regression-suite/843-Spec-PROPFIND.result +++ b/testing/tests/regression-suite/843-Spec-PROPFIND.result @@ -5,7 +5,7 @@ User One's Calendar - A completely bogus property which should be saved. + A completely bogus property which should be saved. HTTP/1.1 200 OK