From cb45529d8d773690c86f0274cd3a560f066b0a05 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 21 May 2008 10:33:51 -0400 Subject: rss feed plus Added an action for creating an RSS 1.0 (RDF) feed. To make this work, added a couple of helper functions to util, and changed the HTML stuff to use the helper functions. Also, changed a bit of formatting in the profile. Yeah, not a clean changeset. darcs-hash:20080521143351-84dde-d191761c399d7f014b990585c21e916e887b3401.gz --- lib/util.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index e4699bf1a..8b013c645 100644 --- a/lib/util.php +++ b/lib/util.php @@ -65,17 +65,31 @@ function common_element($tag, $attrs=NULL, $content=NULL) { common_element_end($tag); } +function common_start_xml($doc=NULL, $public=NULL, $system=NULL) { + global $xw; + $xw = new XMLWriter(); + $xw->openURI('php://output'); + $xw->setIndent(true); + $xw->startDocument('1.0', 'UTF-8'); + if ($doc) { + $xw->writeDTD($doc, $public, $system); + } +} + +function common_end_xml() { + global $xw; + $xw->endDocument(); + $xw->flush(); +} + function common_show_header($pagetitle) { global $config, $xw; header('Content-Type: application/xhtml+xml'); - $xw = new XMLWriter(); - $xw->openURI('php://output'); - $xw->setIndent(true); - $xw->startDocument('1.0', 'UTF-8'); - $xw->writeDTD('html', '-//W3C//DTD XHTML 1.0 Strict//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); + common_start_xml('html', + '-//W3C//DTD XHTML 1.0 Strict//EN', + 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); # FIXME: correct language for interface @@ -121,8 +135,7 @@ function common_show_footer() { common_element_end('div'); common_element_end('body'); common_element_end('html'); - $xw->endDocument(); - $xw->flush(); + common_end_xml(); } function common_text($txt) { -- cgit v1.2.3-54-g00ecf