summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-21 10:33:51 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-21 10:33:51 -0400
commitcb45529d8d773690c86f0274cd3a560f066b0a05 (patch)
tree34b78c995973dc6b939e452ccb770f7406a8d6a9 /lib/util.php
parentb86a51ec8afff2181867823f8330a8bf3e267cf7 (diff)
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
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php29
1 files changed, 21 insertions, 8 deletions
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) {