From c5f36fa6c561532707531cace3ea140618d5fc22 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 28 Jan 2024 14:47:51 +0300 Subject: switch to FeedEnclosure being passed instead of array in HOOK_ARTICLE_FILTER, remove check for enclosures being an array because it should be always defined of this type --- init.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/init.php b/init.php index 6a65cc5..1dd2eef 100644 --- a/init.php +++ b/init.php @@ -487,13 +487,11 @@ class Api_Resize_Media extends Plugin { $widths, true); } - if (isset($article["enclosures"]) && is_array($article["enclosures"])) { - for ($i = 0; $i < count($article["enclosures"]); $i++) { - if (preg_match("/image/", $article["enclosures"][$i][1])) { - $this->prepare_thumbnails( - UrlHelper::rewrite_relative($site_url, $article["enclosures"][$i][0]), - $widths, false); - } + foreach ($article["enclosures"] as $enc) { + if (preg_match("/image/", $enc->type)) { + $this->prepare_thumbnails( + UrlHelper::rewrite_relative($site_url, $enc->link), + $widths, false); } } } -- cgit v1.2.3