tobyink's RDF compatibility patch

This commit is contained in:
Craig Andrews 2009-11-19 12:16:15 -05:00
parent 4463768bae
commit ee22b2ccf9

View File

@ -270,14 +270,7 @@ class Rss10Action extends Action
foreach($attachments as $attachment){ foreach($attachments as $attachment){
$enclosure=$attachment->getEnclosure(); $enclosure=$attachment->getEnclosure();
if ($enclosure) { if ($enclosure) {
// DO NOT move xmlns declaration to root element. Making it $attribs = array('rdf:resource' => $enclosure->url);
// the default namespace here improves compatibility with
// real-world feed readers.
$attribs = array(
'rdf:resource' => $enclosure->url,
'url' => $enclosure->url,
'xmlns' => 'http://purl.oclc.org/net/rss_2.0/enc#'
);
if ($enclosure->title) { if ($enclosure->title) {
$attribs['dc:title'] = $enclosure->title; $attribs['dc:title'] = $enclosure->title;
} }
@ -285,12 +278,12 @@ class Rss10Action extends Action
$attribs['dc:date'] = common_date_w3dtf($enclosure->modified); $attribs['dc:date'] = common_date_w3dtf($enclosure->modified);
} }
if ($enclosure->size) { if ($enclosure->size) {
$attribs['length'] = $enclosure->size; $attribs['enc:length'] = $enclosure->size;
} }
if ($enclosure->mimetype) { if ($enclosure->mimetype) {
$attribs['type'] = $enclosure->mimetype; $attribs['enc:type'] = $enclosure->mimetype;
} }
$this->element('enclosure', $attribs); $this->element('enc:enclosure', $attribs);
} }
$this->element('sioc:links_to', array('rdf:resource'=>$attachment->url)); $this->element('sioc:links_to', array('rdf:resource'=>$attachment->url));
} }
@ -358,6 +351,8 @@ class Rss10Action extends Action
'http://commontag.org/ns#', 'http://commontag.org/ns#',
'xmlns:foaf' => 'xmlns:foaf' =>
'http://xmlns.com/foaf/0.1/', 'http://xmlns.com/foaf/0.1/',
'xmlns:enc' =>
'http://purl.oclc.org/net/rss_2.0/enc#',
'xmlns:sioc' => 'xmlns:sioc' =>
'http://rdfs.org/sioc/ns#', 'http://rdfs.org/sioc/ns#',
'xmlns:sioct' => 'xmlns:sioct' =>