summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-08-26 15:40:51 -0400
committerCraig Andrews <candrews@integralblue.com>2009-08-26 15:40:51 -0400
commit6d60d74093005992701418edda5be4422e46262f (patch)
tree73db603d3b8573a8ef374a21c70c4adae58165a7 /lib
parentd9e8dabaf4c5b38712a3e3ce97b45c5effee4bad (diff)
Display linked oembed resources as enclosures if they are of non-html mime types
Diffstat (limited to 'lib')
-rw-r--r--lib/rssaction.php23
-rw-r--r--lib/twitterapi.php9
2 files changed, 17 insertions, 15 deletions
diff --git a/lib/rssaction.php b/lib/rssaction.php
index 0aca96566..7e317010d 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -258,26 +258,27 @@ class Rss10Action extends Action
$attachments = $notice->attachments();
if($attachments){
foreach($attachments as $attachment){
- if ($attachment->isEnclosure()) {
+ $enclosure=$attachment->getEnclosure();
+ if ($enclosure) {
// 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,
+ 'rdf:resource' => $enclosure->url,
+ 'url' => $enclosure->url,
'xmlns' => 'http://purl.oclc.org/net/rss_2.0/enc#'
);
- if ($attachment->title) {
- $attribs['dc:title'] = $attachment->title;
+ if ($enclosure->title) {
+ $attribs['dc:title'] = $enclosure->title;
}
- if ($attachment->modified) {
- $attribs['dc:date'] = common_date_w3dtf($attachment->modified);
+ if ($enclosure->modified) {
+ $attribs['dc:date'] = common_date_w3dtf($enclosure->modified);
}
- if ($attachment->size) {
- $attribs['length'] = $attachment->size;
+ if ($enclosure->size) {
+ $attribs['length'] = $enclosure->size;
}
- if ($attachment->mimetype) {
- $attribs['type'] = $attachment->mimetype;
+ if ($enclosure->mimetype) {
+ $attribs['type'] = $enclosure->mimetype;
}
$this->element('enclosure', $attribs);
}
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 583007208..e0087e689 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -274,11 +274,12 @@ class TwitterapiAction extends Action
$enclosures = array();
foreach ($attachments as $attachment) {
- if ($attachment->isEnclosure()) {
+ $enclosure_o=$attachment->getEnclosure();
+ if ($enclosure_o) {
$enclosure = array();
- $enclosure['url'] = $attachment->url;
- $enclosure['mimetype'] = $attachment->mimetype;
- $enclosure['size'] = $attachment->size;
+ $enclosure['url'] = $enclosure_o->url;
+ $enclosure['mimetype'] = $enclosure_o->mimetype;
+ $enclosure['size'] = $enclosure_o->size;
$enclosures[] = $enclosure;
}
}