diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-05-21 10:59:16 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-05-21 10:59:16 -0400 |
commit | 7352cab8ee8dd37c76ac2492695cc4c347d9564c (patch) | |
tree | b0b1480267400083c7e0a5b14ccd1b5105276f02 | |
parent | cb45529d8d773690c86f0274cd3a560f066b0a05 (diff) |
add w3dtf date to rss 1.0 items
darcs-hash:20080521145916-84dde-4a5e04edb1bdcdb5e33bed7497dcf93be88636f8.gz
-rw-r--r-- | actions/rss10.php | 5 | ||||
-rw-r--r-- | lib/util.php | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/actions/rss10.php b/actions/rss10.php index f717f17cf..bae4e8652 100644 --- a/actions/rss10.php +++ b/actions/rss10.php @@ -50,6 +50,8 @@ class Rss10Action extends Action { common_start_xml(); common_element_start('rdf:RDF', array('xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', + 'xmlns:dc' => + 'http://purl.org/dc/elements/1.1/', 'xmlns' => 'http://purl.org/rss/1.0/')); $notices = $this->get_notices($user, $limit); @@ -120,11 +122,12 @@ class Rss10Action extends Action { } function show_item($notice) { - $nurl = common_local_url('shownotice', array('notice' => $n->id)); + $nurl = common_local_url('shownotice', array('notice' => $notice->id)); common_element_start('item', array('rdf:about' => $nurl)); common_element('title', NULL, $notice->created); common_element('link', NULL, $nurl); common_element('description', NULL, common_render_content($notice->content)); + common_element('dc:date', NULL, common_date_w3dtf($notice->created)); common_element_end('item'); } }
\ No newline at end of file diff --git a/lib/util.php b/lib/util.php index 8b013c645..052f35fdd 100644 --- a/lib/util.php +++ b/lib/util.php @@ -380,6 +380,11 @@ function common_date_string($dt) { return $dt; } +function common_date_w3dtf($dt) { + $t = strtotime($dt); + return date(DATE_W3C, $t); +} + function common_redirect($url, $code=307) { static $status = array(301 => "Moved Permanently", 302 => "Found", |