aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-26 23:06:15 -0700
committerzotlabs <mike@macgirvin.com>2017-06-26 23:06:15 -0700
commit676481de58d078c93789f696ac003936461575d7 (patch)
tree59b59a04e3d199b57913d7b306c93b412211a552
parent54c5e03b4f94e07fccf1d67078a534d2e7da99b4 (diff)
downloadvolse-hubzilla-676481de58d078c93789f696ac003936461575d7.tar.gz
volse-hubzilla-676481de58d078c93789f696ac003936461575d7.tar.bz2
volse-hubzilla-676481de58d078c93789f696ac003936461575d7.zip
support linked media (audio/video) elements in feeds as well as images
-rw-r--r--include/feedutils.php21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index 7314f69a6..2a0dba982 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -603,10 +603,17 @@ function get_atom_elements($feed, $item, &$author) {
if(! $type)
$type = 'application/octet-stream';
- if(($ostatus_protocol) && (strpos($type,'image') === 0) && (strpos($res['body'], ']' . $link . '[/img]') === false) && (strpos($link,'http') === 0)) {
- $res['body'] .= "\n\n" . '[img]' . $link . '[/img]';
+ if($ostatus_protocol) {
+ if((strpos($type,'image') === 0) && (strpos($res['body'], ']' . $link . '[/img]') === false) && (strpos($link,'http') === 0)) {
+ $res['body'] .= "\n\n" . '[img]' . $link . '[/img]';
+ }
+ if((strpos($type,'video') === 0) && (strpos($res['body'], ']' . $link . '[/video]') === false) && (strpos($link,'http') === 0)) {
+ $res['body'] .= "\n\n" . '[video]' . $link . '[/video]';
+ }
+ if((strpos($type,'audio') === 0) && (strpos($res['body'], ']' . $link . '[/audio]') === false) && (strpos($link,'http') === 0)) {
+ $res['body'] .= "\n\n" . '[audio]' . $link . '[/audio]';
+ }
}
-
$res['attach'][] = array('href' => $link, 'length' => $len, 'type' => $type, 'title' => $title );
}
}
@@ -798,9 +805,15 @@ function feed_get_reshare(&$res,$item) {
if(! $type)
$type = 'application/octet-stream';
- if((strpos($type,'image') === 0) && (strpos($body,$link) === false) && (strpos($link,'http') === 0)) {
+ if((strpos($type,'image') === 0) && (strpos($body, ']' . $link . '[/img]') === false) && (strpos($link,'http') === 0)) {
$body .= "\n\n" . '[img]' . $link . '[/img]';
}
+ if((strpos($type,'video') === 0) && (strpos($body, ']' . $link . '[/video]') === false) && (strpos($link,'http') === 0)) {
+ $body .= "\n\n" . '[video]' . $link . '[/video]';
+ }
+ if((strpos($type,'audio') === 0) && (strpos($body, ']' . $link . '[/audio]') === false) && (strpos($link,'http') === 0)) {
+ $body .= "\n\n" . '[audio]' . $link . '[/audio]';
+ }
}
}