*
* @category Output
* @package StatusNet
- * @author Evan Prodromou <evan@controlyourself.ca>
- * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @author Evan Prodromou <evan@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @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://status.net/
*/
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
*
* @category Output
* @package StatusNet
- * @author Evan Prodromou <evan@controlyourself.ca>
- * @author Sarven Capadisli <csarven@controlyourself.ca>
+ * @author Evan Prodromou <evan@status.net>
+ * @author Sarven Capadisli <csarven@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
* @see Action
* @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->elementEnd($tag);
}
+ function elementNS(array $ns, $tag, $attrs=null, $content=null)
+ {
+ $this->elementStartNS($ns, $tag, $attrs);
+ if (!is_null($content)) {
+ $this->xw->text($content);
+ }
+ $this->elementEnd($tag);
+ }
+
/**
* output a start tag for an element
*
}
}
+ function elementStartNS(array $ns, $tag, $attrs=null)
+ {
+ reset($ns); // array pointer to 0
+ $uri = key($ns);
+ $this->xw->startElementNS($ns[$uri], $tag, $uri);
+ if (is_array($attrs)) {
+ foreach ($attrs as $name => $value) {
+ $this->xw->writeAttribute($name, $value);
+ }
+ } else if (is_string($attrs)) {
+ $this->xw->writeAttribute('class', $attrs);
+ }
+ }
+
/**
* output an end tag for an element
*
{
$this->xw->writeComment($txt);
}
+
+ /**
+ * Flush output buffers
+ *
+ * @return void
+ */
+
+ function flush()
+ {
+ $this->xw->flush();
+ }
}