Merge pull request #3587 from annando/1706-ostatus-attach
Attached picture from OStatus posts are now displayed
This commit is contained in:
commit
f71bd4f1f7
1 changed files with 13 additions and 20 deletions
|
@ -1374,7 +1374,6 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
||||||
$vhead = false;
|
$vhead = false;
|
||||||
$arr = explode('[/attach],', $item['attach']);
|
$arr = explode('[/attach],', $item['attach']);
|
||||||
if (count($arr)) {
|
if (count($arr)) {
|
||||||
$as .= '<div class="body-attach">';
|
|
||||||
foreach ($arr as $r) {
|
foreach ($arr as $r) {
|
||||||
$matches = false;
|
$matches = false;
|
||||||
$icon = '';
|
$icon = '';
|
||||||
|
@ -1411,39 +1410,33 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$filetype = strtolower(substr( $mime, 0, strpos($mime,'/') ));
|
$filetype = strtolower(substr($mime, 0, strpos($mime,'/')));
|
||||||
if ($filetype) {
|
if ($filetype) {
|
||||||
$filesubtype = strtolower(substr( $mime, strpos($mime,'/') + 1 ));
|
$filesubtype = strtolower(substr($mime, strpos($mime,'/') + 1));
|
||||||
$filesubtype = str_replace('.', '-', $filesubtype);
|
$filesubtype = str_replace('.', '-', $filesubtype);
|
||||||
} else {
|
} else {
|
||||||
$filetype = 'unkn';
|
$filetype = 'unkn';
|
||||||
$filesubtype = 'unkn';
|
$filesubtype = 'unkn';
|
||||||
}
|
}
|
||||||
|
|
||||||
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
|
|
||||||
/*$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/')));
|
|
||||||
switch($icontype) {
|
|
||||||
case 'video':
|
|
||||||
case 'audio':
|
|
||||||
case 'image':
|
|
||||||
case 'text':
|
|
||||||
$icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$icon = '<div class="attachtype icon s22 type-unkn"></div>';
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
|
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
|
||||||
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
|
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
|
||||||
|
|
||||||
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
|
if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) {
|
||||||
|
$icon = '<img class="attached" src="'.$the_url.'" alt="" title="'.$title.'">';
|
||||||
|
$s .= '<br><a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attached" target="_blank" >' . $icon . '</a>';
|
||||||
|
} else {
|
||||||
|
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
|
||||||
|
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$as .= '<div class="clear"></div></div>';
|
|
||||||
}
|
}
|
||||||
$s = $s . $as;
|
if ($as != '') {
|
||||||
|
$s .= '<div class="body-attach">'.$as.'<div class="clear"></div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
// map
|
// map
|
||||||
if (strpos($s, '<div class="map">') !== false && x($item, 'coord')) {
|
if (strpos($s, '<div class="map">') !== false && x($item, 'coord')) {
|
||||||
|
|
Loading…
Reference in a new issue