diff options
author | wn_ <[email protected]> | 2022-08-12 15:31:19 +0000 |
---|---|---|
committer | wn_ <[email protected]> | 2022-08-12 17:58:38 +0000 |
commit | 3487c922b3f34449fecdddebe1fd2ee3b8c42e65 (patch) | |
tree | 57b18bf1a6ec210aa26a80cf1f2d2fdf0888f5da /plugins/af_redditimgur | |
parent | a63c949a5522a8fdeae2dfa77bb39565727f7a0a (diff) |
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
Diffstat (limited to 'plugins/af_redditimgur')
-rwxr-xr-x | plugins/af_redditimgur/init.php | 6 |
1 files changed, 3 insertions, 3 deletions
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; } |