_format_enclosures: always return entries array

This commit is contained in:
Andrew Dolgov 2021-02-16 10:18:50 +03:00
parent 88f7c4f1a5
commit cca84aedfd
1 changed files with 8 additions and 5 deletions

View File

@ -322,7 +322,6 @@ class Article extends Handler_Protected {
$hide_images = false) { $hide_images = false) {
$enclosures = self::_get_enclosures($id); $enclosures = self::_get_enclosures($id);
$rv = [];
$enclosures_formatted = ""; $enclosures_formatted = "";
/*foreach ($enclosures as &$enc) { /*foreach ($enclosures as &$enc) {
@ -348,10 +347,16 @@ class Article extends Handler_Protected {
$enclosures_formatted, $enclosures, $id, $always_display_enclosures, $article_content, $hide_images); $enclosures_formatted, $enclosures, $id, $always_display_enclosures, $article_content, $hide_images);
if (!empty($enclosures_formatted)) { if (!empty($enclosures_formatted)) {
$rv['formatted'] = $enclosures_formatted; return [
return $rv; 'formatted' => $enclosures_formatted,
'entries' => []
];
} }
$rv = [
'entries' => []
];
$rv['can_inline'] = isset($_SESSION["uid"]) && $rv['can_inline'] = isset($_SESSION["uid"]) &&
empty($_SESSION["bw_limit"]) && empty($_SESSION["bw_limit"]) &&
!get_pref("STRIP_IMAGES") && !get_pref("STRIP_IMAGES") &&
@ -359,8 +364,6 @@ class Article extends Handler_Protected {
$rv['inline_text_only'] = $hide_images && $rv['can_inline']; $rv['inline_text_only'] = $hide_images && $rv['can_inline'];
$rv['entries'] = [];
foreach ($enclosures as $enc) { foreach ($enclosures as $enc) {
// this is highly approximate // this is highly approximate