From 74568df4ff7b7788991636f6fb2ed62012f85c3b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 22 Sep 2020 09:04:33 +0300 Subject: remove a lot of stuff from global context (functions.php), add a few helper classes instead --- plugins/af_comics/filters/af_comics_cad.php | 2 +- plugins/af_comics/filters/af_comics_comicclass.php | 2 +- plugins/af_comics/filters/af_comics_comicpress.php | 4 ++-- plugins/af_comics/filters/af_comics_darklegacy.php | 2 +- plugins/af_comics/filters/af_comics_dilbert.php | 2 +- plugins/af_comics/filters/af_comics_explosm.php | 2 +- plugins/af_comics/filters/af_comics_gocomics.php | 2 +- plugins/af_comics/filters/af_comics_gocomics_farside.php | 2 +- plugins/af_comics/filters/af_comics_pa.php | 4 ++-- plugins/af_comics/filters/af_comics_pvp.php | 2 +- plugins/af_comics/filters/af_comics_tfd.php | 4 ++-- plugins/af_comics/filters/af_comics_twp.php | 2 +- plugins/af_comics/filters/af_comics_whomp.php | 2 +- 13 files changed, 16 insertions(+), 16 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 cbd9ae3fb..5da82ae3f 100644 --- a/plugins/af_comics/filters/af_comics_cad.php +++ b/plugins/af_comics/filters/af_comics_cad.php @@ -13,7 +13,7 @@ class Af_Comics_Cad extends Af_ComicFilter { $doc = new DOMDocument(); - $res = fetch_file_contents($article["link"], false, false, 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"); diff --git a/plugins/af_comics/filters/af_comics_comicclass.php b/plugins/af_comics/filters/af_comics_comicclass.php index 07b4be712..ff32375d3 100644 --- a/plugins/af_comics/filters/af_comics_comicclass.php +++ b/plugins/af_comics/filters/af_comics_comicclass.php @@ -11,7 +11,7 @@ class Af_Comics_ComicClass extends Af_ComicFilter { // lol at people who block clients by user agent // oh noes my ad revenue Q_Q - $res = fetch_file_contents($article["link"], false, false, 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)"); diff --git a/plugins/af_comics/filters/af_comics_comicpress.php b/plugins/af_comics/filters/af_comics_comicpress.php index 6a2036645..29b064612 100755 --- a/plugins/af_comics/filters/af_comics_comicpress.php +++ b/plugins/af_comics/filters/af_comics_comicpress.php @@ -18,7 +18,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter { // lol at people who block clients by user agent // oh noes my ad revenue Q_Q - $res = fetch_file_contents(["url" => $article["link"], + $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(); @@ -37,7 +37,7 @@ class Af_Comics_ComicPress extends Af_ComicFilter { if ($webtoon_link) { - $res = fetch_file_contents(["url" => $webtoon_link->getAttribute("href"), + $res = UrlHelper::fetch(["url" => $webtoon_link->getAttribute("href"), "useragent" => "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)"]); if (@$doc->loadHTML($res)) { diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php index ee9ce2d77..978545431 100644 --- a/plugins/af_comics/filters/af_comics_darklegacy.php +++ b/plugins/af_comics/filters/af_comics_darklegacy.php @@ -9,7 +9,7 @@ class Af_Comics_DarkLegacy extends Af_ComicFilter { if (strpos($article["guid"], "darklegacycomics.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, 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)"); diff --git a/plugins/af_comics/filters/af_comics_dilbert.php b/plugins/af_comics/filters/af_comics_dilbert.php index 6b194960c..31a72d88d 100644 --- a/plugins/af_comics/filters/af_comics_dilbert.php +++ b/plugins/af_comics/filters/af_comics_dilbert.php @@ -10,7 +10,7 @@ class Af_Comics_Dilbert extends Af_ComicFilter { if (strpos($article["link"], "dilbert.com") !== false || strpos($article["link"], "/DilbertDailyStrip") !== false) { - $res = fetch_file_contents($article["link"], false, false, 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"); diff --git a/plugins/af_comics/filters/af_comics_explosm.php b/plugins/af_comics/filters/af_comics_explosm.php index dd1c8e723..bfe38e53b 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(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0); diff --git a/plugins/af_comics/filters/af_comics_gocomics.php b/plugins/af_comics/filters/af_comics_gocomics.php index 2cb49b9bc..949b7a235 100644 --- a/plugins/af_comics/filters/af_comics_gocomics.php +++ b/plugins/af_comics/filters/af_comics_gocomics.php @@ -29,7 +29,7 @@ class Af_Comics_Gocomics extends Af_ComicFilter { $article_link = $site_url . date('/Y/m/d'); - $body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false)); + $body = UrlHelper::fetch(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false)); $feed_title = htmlspecialchars($comic[1]); $site_url = htmlspecialchars($site_url); diff --git a/plugins/af_comics/filters/af_comics_gocomics_farside.php b/plugins/af_comics/filters/af_comics_gocomics_farside.php index 71c5e0059..9663da8f9 100644 --- a/plugins/af_comics/filters/af_comics_gocomics_farside.php +++ b/plugins/af_comics/filters/af_comics_gocomics_farside.php @@ -37,7 +37,7 @@ class Af_Comics_Gocomics_FarSide extends Af_ComicFilter { $tpl->setVariable('FEED_URL', htmlspecialchars($url), true); $tpl->setVariable('SELF_URL', htmlspecialchars($url), true); - $body = fetch_file_contents(['url' => $article_link, 'type' => 'text/html', 'followlocation' => false]); + $body = UrlHelper::fetch(['url' => $article_link, 'type' => 'text/html', 'followlocation' => false]); if ($body) { $doc = new DOMDocument(); diff --git a/plugins/af_comics/filters/af_comics_pa.php b/plugins/af_comics/filters/af_comics_pa.php index c70a39f6e..380e84596 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(fetch_file_contents($article["link"]))) { + if ($doc->loadHTML(UrlHelper::fetch($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(); - if ($doc->loadHTML(fetch_file_contents($article["link"]))) { + if ($doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $entries = $xpath->query('(//div[@class="post"])'); diff --git a/plugins/af_comics/filters/af_comics_pvp.php b/plugins/af_comics/filters/af_comics_pvp.php index e3a92de6b..105d3f490 100644 --- a/plugins/af_comics/filters/af_comics_pvp.php +++ b/plugins/af_comics/filters/af_comics_pvp.php @@ -8,7 +8,7 @@ class Af_Comics_Pvp extends Af_ComicFilter { function process(&$article) { if (strpos($article["guid"], "pvponline.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, 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)"); diff --git a/plugins/af_comics/filters/af_comics_tfd.php b/plugins/af_comics/filters/af_comics_tfd.php index 38ac054c0..e0216705c 100644 --- a/plugins/af_comics/filters/af_comics_tfd.php +++ b/plugins/af_comics/filters/af_comics_tfd.php @@ -8,7 +8,7 @@ class Af_Comics_Tfd extends Af_ComicFilter { function process(&$article) { if (strpos($article["link"], "toothpastefordinner.com") !== false || strpos($article["link"], "marriedtothesea.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, 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)"); @@ -16,7 +16,7 @@ class Af_Comics_Tfd extends Af_ComicFilter { $doc = new DOMDocument(); - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXPath($doc); $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0); diff --git a/plugins/af_comics/filters/af_comics_twp.php b/plugins/af_comics/filters/af_comics_twp.php index 84e5ce428..38a8ca32b 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(); - if (@$doc->loadHTML(fetch_file_contents($article["link"]))) { + if (@$doc->loadHTML(UrlHelper::fetch($article["link"]))) { $xpath = new DOMXpath($doc); $basenode = $xpath->query("//td/center/img")->item(0); diff --git a/plugins/af_comics/filters/af_comics_whomp.php b/plugins/af_comics/filters/af_comics_whomp.php index ddd80a0ee..021a2952a 100644 --- a/plugins/af_comics/filters/af_comics_whomp.php +++ b/plugins/af_comics/filters/af_comics_whomp.php @@ -8,7 +8,7 @@ class Af_Comics_Whomp extends Af_ComicFilter { function process(&$article) { if (strpos($article["guid"], "whompcomic.com") !== false) { - $res = fetch_file_contents($article["link"], false, false, 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)"); -- cgit v1.2.3