X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fxmloutputter.php;h=15b18e7d90738f8ac3a348dd1b41931396d6c339;hb=f3b08461bd476d368d444d48025709fb6a111b7d;hp=9a7d12e4c93e1b5fa438ef56b0a4b1378b83f9c2;hpb=2ff7bcfc5d05fc0bd01201af33f80dae2f9cd688;p=quix0rs-gnu-social.git diff --git a/lib/xmloutputter.php b/lib/xmloutputter.php index 9a7d12e4c9..15b18e7d90 100644 --- a/lib/xmloutputter.php +++ b/lib/xmloutputter.php @@ -1,6 +1,6 @@ . * * @category Output - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli - * @copyright 2008 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,11 +40,11 @@ if (!defined('LACONICA')) { * an element. * * @category Output - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ * @see Action * @see HTMLOutputter */ @@ -63,16 +63,18 @@ class XMLOutputter * * Initializes the wrapped XMLWriter. * - * @param $output URL for outputting, defaults to stdout - * @param $indent Whether to indent output, default true + * @param string $output URL for outputting, defaults to stdout + * @param boolean $indent Whether to indent output, default true */ - function __construct($output='php://output', $indent=true) + function __construct($output='php://output', $indent=null) { $this->xw = new XMLWriter(); $this->xw->openURI($output); + if(is_null($indent)) { + $indent = common_config('site', 'indent'); + } $this->xw->setIndent($indent); - $this->xw->startDocument('1.0', 'UTF-8'); } /** @@ -87,6 +89,7 @@ class XMLOutputter function startXML($doc=null, $public=null, $system=null) { + $this->xw->startDocument('1.0', 'UTF-8'); if ($doc) { $this->xw->writeDTD($doc, $public, $system); } @@ -119,6 +122,9 @@ class XMLOutputter * raw output, use elementStart() and elementEnd() with a call * to raw() in the middle. * + * If $attrs is a string instead of an array, it will be treated + * as the class attribute of the element. + * * @param string $tag Element type or tagname * @param array $attrs Array of element attributes, as * key-value pairs @@ -142,6 +148,9 @@ class XMLOutputter * Mostly used for when an element has content that's * not a simple string. * + * If $attrs is a string instead of an array, it will be treated + * as the class attribute of the element. + * * @param string $tag Element type or tagname * @param array $attrs Array of element attributes * @@ -220,4 +229,17 @@ class XMLOutputter { $this->xw->writeRaw($xml); } + + /** + * output a comment + * + * @param string $txt text of the comment + * + * @return void + */ + + function comment($txt) + { + $this->xw->writeComment($txt); + } }