From 90e7bf7cc385a64e3a91f30a6415a598ae0d0e99 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sat, 30 Dec 2023 15:38:41 +0000 Subject: Update all UrlHelper::fetch() calls to use the associative array approach. The other approach (passing in individual params) was marked as deprecated a few years ago. --- plugins/af_comics/filters/af_comics_cad.php | 7 ++++--- plugins/af_comics/filters/af_comics_comicclass.php | 7 ++++--- plugins/af_comics/filters/af_comics_darklegacy.php | 8 ++++---- plugins/af_comics/filters/af_comics_dilbert.php | 8 ++++---- plugins/af_comics/filters/af_comics_explosm.php | 2 +- plugins/af_comics/filters/af_comics_pa.php | 4 ++-- plugins/af_comics/filters/af_comics_pvp.php | 8 ++++---- plugins/af_comics/filters/af_comics_tfd.php | 9 +++++---- plugins/af_comics/filters/af_comics_twp.php | 2 +- plugins/af_comics/filters/af_comics_whomp.php | 8 ++++---- 10 files changed, 33 insertions(+), 30 deletions(-) (limited to 'plugins/af_comics') diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php index b2b65ee05..780aaabf9 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -10,9 +10,10 @@ class Af_Comics_Cad extends Af_ComicFilter { if (strpos($article["title"], "News:") === false) { $doc = new DOMDocument(); - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0', + ]); if (!$res && UrlHelper::$fetch_last_error_content) $res = UrlHelper::$fetch_last_error_content; diff --git a/plugins/af_comics/filters/af_comics_comicclass.php b/plugins/af_comics/filters/af_comics_comicclass.php index 5e14ea930..6a8811fd4 100644 --- a/plugins/af_comics/filters/af_comics_comicclass.php +++ b/plugins/af_comics/filters/af_comics_comicclass.php @@ -11,9 +11,10 @@ class Af_Comics_ComicClass extends Af_ComicFilter { // lol at people who block clients by user agent // oh noes my ad revenue Q_Q - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); $doc = new DOMDocument(); diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php index d1f6016cb..7cdc48e25 100644 --- a/plugins/af_comics/filters/af_comics_darklegacy.php +++ b/plugins/af_comics/filters/af_comics_darklegacy.php @@ -8,10 +8,10 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter { function process(&$article) { if (strpos($article["guid"], "darklegacycomics.com") !== false) { - - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); if (!$res && UrlHelper::$fetch_last_error_content) $res = UrlHelper::$fetch_last_error_content; diff --git a/plugins/af_comics/filters/af_comics_dilbert.php b/plugins/af_comics/filters/af_comics_dilbert.php index a1c59b94c..bbd936621 100644 --- a/plugins/af_comics/filters/af_comics_dilbert.php +++ b/plugins/af_comics/filters/af_comics_dilbert.php @@ -9,10 +9,10 @@ class Af_Comics_Dilbert extends Af_ComicFilter { function process(&$article) { if (strpos($article["link"], "dilbert.com") !== false || strpos($article["link"], "/DilbertDailyStrip") !== false) { - - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0', + ]); if (!$res && UrlHelper::$fetch_last_error_content) $res = UrlHelper::$fetch_last_error_content; diff --git a/plugins/af_comics/filters/af_comics_explosm.php b/plugins/af_comics/filters/af_comics_explosm.php index 3f8b49726..65691ae2b 100644 --- a/plugins/af_comics/filters/af_comics_explosm.php +++ b/plugins/af_comics/filters/af_comics_explosm.php @@ -11,7 +11,7 @@ class Af_Comics_Explosm extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch(['url' => $article['link']]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//div[contains(@class, "MainComic__ComicImage")]//img')->item(0); diff --git a/plugins/af_comics/filters/af_comics_pa.php b/plugins/af_comics/filters/af_comics_pa.php index a5a81edcb..f4283be77 100644 --- a/plugins/af_comics/filters/af_comics_pa.php +++ b/plugins/af_comics/filters/af_comics_pa.php @@ -10,7 +10,7 @@ class Af_Comics_Pa extends Af_ComicFilter { $doc = new DOMDocument(); - if ($doc->loadHTML(UrlHelper::fetch($article["link"]))) { + if ($doc->loadHTML(UrlHelper::fetch(['url' => $article['link']]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0); @@ -25,7 +25,7 @@ class Af_Comics_Pa extends Af_ComicFilter { if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "News Post:") !== false) { $doc = new DOMDocument(); - $res = UrlHelper::fetch($article["link"]); + $res = UrlHelper::fetch(['url' => $article['link']]); if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); diff --git a/plugins/af_comics/filters/af_comics_pvp.php b/plugins/af_comics/filters/af_comics_pvp.php index a27fbca87..e938f1501 100644 --- a/plugins/af_comics/filters/af_comics_pvp.php +++ b/plugins/af_comics/filters/af_comics_pvp.php @@ -7,10 +7,10 @@ class Af_Comics_Pvp extends Af_ComicFilter { function process(&$article) { if (strpos($article["guid"], "pvponline.com") !== false) { - - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); $doc = new DOMDocument(); diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index 2010da37e..ec245ef94 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -8,15 +8,16 @@ class Af_Comics_Tfd extends Af_ComicFilter { function process(&$article) { if (strpos($article["link"], "toothpastefordinner.com") !== false || strpos($article["link"], "marriedtothesea.com") !== false) { - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); if (!$res) return false; $doc = new DOMDocument(); - $res = UrlHelper::fetch($article["link"]); + $res = UrlHelper::fetch(['url' => $article["link"]]); if ($res && $doc->loadHTML($res)) { $xpath = new DOMXPath($doc); diff --git a/plugins/af_comics/filters/af_comics_twp.php b/plugins/af_comics/filters/af_comics_twp.php index 6715be3c2..8f0077883 100644 --- a/plugins/af_comics/filters/af_comics_twp.php +++ b/plugins/af_comics/filters/af_comics_twp.php @@ -11,7 +11,7 @@ class Af_Comics_Twp extends Af_ComicFilter { $doc = new DOMDocument(); - $res = UrlHelper::fetch($article["link"]); + $res = UrlHelper::fetch(['url' => $article['link']]); if ($res && $doc->loadHTML($res)) { $xpath = new DOMXpath($doc); diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php index 712388449..fbdf0a049 100644 --- a/plugins/af_comics/filters/af_comics_whomp.php +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -7,10 +7,10 @@ class Af_Comics_Whomp extends Af_ComicFilter { function process(&$article) { if (strpos($article["guid"], "whompcomic.com") !== false) { - - $res = UrlHelper::fetch($article["link"], false, false, false, - false, false, 0, - "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"); + $res = UrlHelper::fetch([ + 'url' => $article['link'], + 'useragent' => 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', + ]); if (!$res && UrlHelper::$fetch_last_error_content) $res = UrlHelper::$fetch_last_error_content; -- cgit v1.2.3