From 6e01d5d930f52f95ad0c095b995ed2aae8e093f5 Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 12 Aug 2022 14:18:43 +0000 Subject: minor: remove a PHP >= 5.6 check in 'af_redditimgur' --- plugins/af_redditimgur/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/af_redditimgur') diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 8a0d7d99e..65a753056 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -903,7 +903,7 @@ class Af_RedditImgur extends Plugin { // do not try to embed posts linking back to other reddit posts // readability.php requires PHP 5.6 - if ($url && strpos($url, "reddit.com") === false && version_compare(PHP_VERSION, '5.6.0', '>=')) { + if ($url && strpos($url, "reddit.com") === false) { /* link may lead to a huge video file or whatever, we need to check content type before trying to parse it which p much requires curl */ -- cgit v1.2.3 From 3487c922b3f34449fecdddebe1fd2ee3b8c42e65 Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 12 Aug 2022 15:31:19 +0000 Subject: Replace use of 'array_merge' with the spread operator and 'array_push' in various places. This isn't supported for arrays with string keys until PHP 8.1. https://wiki.php.net/rfc/spread_operator_for_array --- plugins/af_redditimgur/init.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/af_redditimgur') diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 65a753056..898f0b49c 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -376,11 +376,11 @@ class Af_RedditImgur extends Plugin { } if ($post_is_nsfw && count($apply_nsfw_tags) > 0) { - $article["tags"] = array_merge($article["tags"], $apply_nsfw_tags); + array_push($article["tags"], ...$apply_nsfw_tags); } if (count($link_flairs) > 0) { - $article["tags"] = array_merge($article["tags"], FeedItem_Common::normalize_categories($link_flairs)); + array_push($article["tags"], ...FeedItem_Common::normalize_categories($link_flairs)); } $article["num_comments"] = $num_comments; @@ -937,7 +937,7 @@ class Af_RedditImgur extends Plugin { $src_domain = parse_url($src, PHP_URL_HOST); if ($src_domain) - foreach (array_merge($this->domain_blacklist, $also_blacklist) as $domain) { + foreach ([...$this->domain_blacklist, ...$also_blacklist] as $domain) { if (strstr($src_domain, $domain) !== false) { return true; } -- cgit v1.2.3