]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow the toggling of XMLWriter's indenting on and off
authorZach Copley <zach@controlyourself.ca>
Sun, 23 Nov 2008 21:13:48 +0000 (16:13 -0500)
committerZach Copley <zach@controlyourself.ca>
Sun, 23 Nov 2008 21:13:48 +0000 (16:13 -0500)
IE needs and unindented XML response in for ajax calls.

darcs-hash:20081123211348-7b5ce-426c07ee1d1884c691b659e8a9b359bb95afc61e.gz

actions/newnotice.php
lib/util.php

index 3c9c499c237fbed09857beea50ad4cb5def2e90e..a24925ec3872de0614aa42949498a529c2b876c1 100644 (file)
@@ -84,7 +84,7 @@ class NewnoticeAction extends Action {
                common_broadcast_notice($notice);
 
                if ($this->boolean('ajax')) {
-                       common_start_html('text/xml;charset=utf-8');
+                       common_start_html('text/xml;charset=utf-8', false);
                        common_element_start('head');
                        common_element('title', null, _('Notice posted'));
                        common_element_end('head');
@@ -107,7 +107,7 @@ class NewnoticeAction extends Action {
        }
 
        function ajax_error_msg($msg) {
-               common_start_html('text/xml;charset=utf-8');
+               common_start_html('text/xml;charset=utf-8', false);
                common_element_start('head');
                common_element('title', null, _('Ajax Error'));
                common_element_end('head');
index 18e65be8b65465698f84ee25c8211d3754349aca..ec62a46522c954d7365664bc89d0380a0ec88968 100644 (file)
@@ -114,11 +114,11 @@ function common_element($tag, $attrs=NULL, $content=NULL) {
        common_element_end($tag);
 }
 
-function common_start_xml($doc=NULL, $public=NULL, $system=NULL) {
+function common_start_xml($doc=NULL, $public=NULL, $system=NULL, $indent=true) {
        global $xw;
        $xw = new XMLWriter();
        $xw->openURI('php://output');
-       $xw->setIndent(true);
+       $xw->setIndent($indent);
        $xw->startDocument('1.0', 'UTF-8');
        if ($doc) {
                $xw->writeDTD($doc, $public, $system);
@@ -235,7 +235,7 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall=
        common_element_start('div', array('id' => 'content'));
 }
 
-function common_start_html($type=NULL) {
+function common_start_html($type=NULL, $indent=true) {
        
        if (!$type) {
                $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : NULL;
@@ -255,7 +255,7 @@ function common_start_html($type=NULL) {
 
        common_start_xml('html',
                                         '-//W3C//DTD XHTML 1.0 Strict//EN',
-                                        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd');
+                                        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd', $indent);
 
        # FIXME: correct language for interface