- if ($attachment->isEnclosure()) {
- // DO NOT move xmlns declaration to root element. Making it
- // the default namespace here improves compatibility with
- // real-world feed readers.
- $attribs = array(
- 'rdf:resource' => $attachment->url,
- 'url' => $attachment->url,
- 'xmlns' => 'http://purl.oclc.org/net/rss_2.0/enc#'
- );
- if ($attachment->title) {
- $attribs['dc:title'] = $attachment->title;
+ $enclosure=$attachment->getEnclosure();
+ if ($enclosure) {
+ $attribs = array('rdf:resource' => $enclosure->url);
+ if ($enclosure->title) {
+ $attribs['dc:title'] = $enclosure->title;