Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add to new serializers needed for JSON output

  • Loading branch information...
commit edf163b10b34bc8825a92a219760a768d2cc8ab2 1 parent c29e841
planet-php authored
View
60 libs/popoon/components/serializers/json.php
@@ -0,0 +1,60 @@
+<?php
+// +----------------------------------------------------------------------+
+// | popoon |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2001,2002,2003,2004 Bitflux GmbH |
+// +----------------------------------------------------------------------+
+// | Licensed under the Apache License, Version 2.0 (the "License"); |
+// | you may not use this file except in compliance with the License. |
+// | You may obtain a copy of the License at |
+// | http://www.apache.org/licenses/LICENSE-2.0 |
+// | Unless required by applicable law or agreed to in writing, software |
+// | distributed under the License is distributed on an "AS IS" BASIS, |
+// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
+// | implied. See the License for the specific language governing |
+// | permissions and limitations under the License. |
+// +----------------------------------------------------------------------+
+// | Author: Christian Stocker <chregu@bitflux.ch> |
+// +----------------------------------------------------------------------+
+//
+// $Id: xml.php 3558 2005-02-01 08:15:44Z chregu $
+
+/**
+* Outputs the XML-Document as text
+*
+* @author Christian Stocker <chregu@bitflux.ch>
+* @version $Id: xml.php 3558 2005-02-01 08:15:44Z chregu $
+* @package popoon
+*/
+class popoon_components_serializers_json extends popoon_components_serializer {
+
+ public $XmlFormat = "Own";
+ protected $contentType = "text/plain";
+
+ function __construct (&$sitemap) {
+ $this->sitemap = &$sitemap;
+ }
+
+ function init($attribs) {
+ parent::init($attribs);
+ }
+
+ function DomStart(&$xml)
+ {
+ parent::DomStart($xml);
+ if (is_object($xml))
+ {
+ $this->sitemap->hasFinalDom = true;
+ $xml = str_replace("HTML","html",$xml->saveXML());
+ }
+
+ $xmlstring = '<?xml version="1.0"?>';
+ if (substr($xml,0,strlen($xmlstring)) == $xmlstring) {
+ $xml = substr($xml,strlen($xmlstring));
+ }
+ print str_replace("\n"," ",$xml);
+ }
+}
+
+
+?>
View
60 libs/popoon/components/serializers/text.php
@@ -0,0 +1,60 @@
+<?php
+// +----------------------------------------------------------------------+
+// | popoon |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2001,2002,2003,2004 Bitflux GmbH |
+// +----------------------------------------------------------------------+
+// | Licensed under the Apache License, Version 2.0 (the "License"); |
+// | you may not use this file except in compliance with the License. |
+// | You may obtain a copy of the License at |
+// | http://www.apache.org/licenses/LICENSE-2.0 |
+// | Unless required by applicable law or agreed to in writing, software |
+// | distributed under the License is distributed on an "AS IS" BASIS, |
+// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
+// | implied. See the License for the specific language governing |
+// | permissions and limitations under the License. |
+// +----------------------------------------------------------------------+
+// | Author: Christian Stocker <chregu@bitflux.ch> |
+// +----------------------------------------------------------------------+
+//
+// $Id: xml.php 3558 2005-02-01 08:15:44Z chregu $
+
+/**
+* Outputs the XML-Document as text
+*
+* @author Christian Stocker <chregu@bitflux.ch>
+* @version $Id: xml.php 3558 2005-02-01 08:15:44Z chregu $
+* @package popoon
+*/
+class popoon_components_serializers_text extends popoon_components_serializer {
+
+ public $XmlFormat = "Own";
+ protected $contentType = "text/plain";
+
+ function __construct (&$sitemap) {
+ $this->sitemap = &$sitemap;
+ }
+
+ function init($attribs) {
+ parent::init($attribs);
+ }
+
+ function DomStart(&$xml)
+ {
+ parent::DomStart($xml);
+ if (is_object($xml))
+ {
+ $this->sitemap->hasFinalDom = true;
+ $xml = str_replace("HTML","html",$xml->saveXML());
+ }
+
+ $xmlstring = '<?xml version="1.0"?>';
+ if (substr($xml,0,strlen($xmlstring)) == $xmlstring) {
+ $xml = substr($xml,strlen($xmlstring));
+ }
+ print $xml;
+ }
+}
+
+
+?>
Please sign in to comment.
Something went wrong with that request. Please try again.