Passed
Push — master ( a3c0d0...678db7 )
by Cody
06:27 queued 03:12
created
plugins/af_comics/init.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -1,187 +1,187 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics extends Plugin {
3 3
 
4
-	private $host;
5
-	private $filters = array();
4
+    private $host;
5
+    private $filters = array();
6 6
 
7
-	public function about() {
8
-		return array(2.0,
9
-			"Fixes RSS feeds of assorted comic strips",
10
-			"fox");
11
-	}
7
+    public function about() {
8
+        return array(2.0,
9
+            "Fixes RSS feeds of assorted comic strips",
10
+            "fox");
11
+    }
12 12
 
13
-	public function init($host) {
14
-		$this->host = $host;
13
+    public function init($host) {
14
+        $this->host = $host;
15 15
 
16
-		$host->add_hook($host::HOOK_FETCH_FEED, $this);
17
-		$host->add_hook($host::HOOK_FEED_BASIC_INFO, $this);
18
-		$host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
19
-		$host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
20
-		$host->add_hook($host::HOOK_PREFS_TAB, $this);
16
+        $host->add_hook($host::HOOK_FETCH_FEED, $this);
17
+        $host->add_hook($host::HOOK_FEED_BASIC_INFO, $this);
18
+        $host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this);
19
+        $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
20
+        $host->add_hook($host::HOOK_PREFS_TAB, $this);
21 21
 
22
-		require_once __DIR__ . "/filter_base.php";
22
+        require_once __DIR__ . "/filter_base.php";
23 23
 
24
-		$filters = array_merge(glob(__DIR__ . "/filters.local/*.php"), glob(__DIR__ . "/filters/*.php"));
25
-		$names = [];
24
+        $filters = array_merge(glob(__DIR__ . "/filters.local/*.php"), glob(__DIR__ . "/filters/*.php"));
25
+        $names = [];
26 26
 
27
-		foreach ($filters as $file) {
28
-			$filter_name = preg_replace("/\..*$/", "", basename($file));
27
+        foreach ($filters as $file) {
28
+            $filter_name = preg_replace("/\..*$/", "", basename($file));
29 29
 
30
-			if (array_search($filter_name, $names) === false) {
31
-				if (!class_exists($filter_name)) {
32
-					require_once $file;
33
-				}
30
+            if (array_search($filter_name, $names) === false) {
31
+                if (!class_exists($filter_name)) {
32
+                    require_once $file;
33
+                }
34 34
 
35
-				array_push($names, $filter_name);
35
+                array_push($names, $filter_name);
36 36
 
37
-				$filter = new $filter_name();
37
+                $filter = new $filter_name();
38 38
 
39
-				if (is_subclass_of($filter, "Af_ComicFilter")) {
40
-					array_push($this->filters, $filter);
41
-					array_push($names, $filter_name);
42
-				}
43
-			}
44
-		}
45
-	}
39
+                if (is_subclass_of($filter, "Af_ComicFilter")) {
40
+                    array_push($this->filters, $filter);
41
+                    array_push($names, $filter_name);
42
+                }
43
+            }
44
+        }
45
+    }
46 46
 
47
-	public function hook_prefs_tab($args) {
48
-		if ($args != "prefFeeds") return;
47
+    public function hook_prefs_tab($args) {
48
+        if ($args != "prefFeeds") return;
49 49
 
50
-		print "<div dojoType=\"dijit.layout.AccordionPane\"
50
+        print "<div dojoType=\"dijit.layout.AccordionPane\"
51 51
 			title=\"<i class='material-icons'>photo</i> ".__('Feeds supported by af_comics')."\">";
52 52
 
53
-		print "<p>" . __("The following comics are currently supported:") . "</p>";
53
+        print "<p>" . __("The following comics are currently supported:") . "</p>";
54 54
 
55
-		$comics = array("GoComics");
55
+        $comics = array("GoComics");
56 56
 
57
-		foreach ($this->filters as $f) {
58
-			foreach ($f->supported() as $comic) {
59
-				array_push($comics, $comic);
60
-			}
61
-		}
57
+        foreach ($this->filters as $f) {
58
+            foreach ($f->supported() as $comic) {
59
+                array_push($comics, $comic);
60
+            }
61
+        }
62 62
 
63
-		asort($comics);
63
+        asort($comics);
64 64
 
65
-		print "<ul class='panel panel-scrollable list list-unstyled'>";
66
-		foreach ($comics as $comic) {
67
-			print "<li>$comic</li>";
68
-		}
69
-		print "</ul>";
65
+        print "<ul class='panel panel-scrollable list list-unstyled'>";
66
+        foreach ($comics as $comic) {
67
+            print "<li>$comic</li>";
68
+        }
69
+        print "</ul>";
70 70
 
71
-		print "<p>".__("To subscribe to GoComics use the comic's regular web page as the feed URL (e.g. for the <em>Garfield</em> comic use <code>http://www.gocomics.com/garfield</code>).")."</p>";
71
+        print "<p>".__("To subscribe to GoComics use the comic's regular web page as the feed URL (e.g. for the <em>Garfield</em> comic use <code>http://www.gocomics.com/garfield</code>).")."</p>";
72 72
 
73
-		print "<p>".__('Drop any updated filters into <code>filters.local</code> in plugin directory.')."</p>";
73
+        print "<p>".__('Drop any updated filters into <code>filters.local</code> in plugin directory.')."</p>";
74 74
 
75
-		print "</div>";
76
-	}
75
+        print "</div>";
76
+    }
77 77
 
78
-	public function hook_article_filter($article) {
79
-		foreach ($this->filters as $f) {
80
-			if ($f->process($article))
81
-				break;
82
-		}
78
+    public function hook_article_filter($article) {
79
+        foreach ($this->filters as $f) {
80
+            if ($f->process($article))
81
+                break;
82
+        }
83 83
 
84
-		return $article;
85
-	}
84
+        return $article;
85
+    }
86 86
 
87
-	// GoComics dropped feed support so it needs to be handled when fetching the feed.
88
-	/**
89
-	 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
90
-	 */
91
-	public function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
92
-		if ($auth_login || $auth_pass)
93
-			return $feed_data;
87
+    // GoComics dropped feed support so it needs to be handled when fetching the feed.
88
+    /**
89
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
90
+     */
91
+    public function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
92
+        if ($auth_login || $auth_pass)
93
+            return $feed_data;
94 94
 
95
-		if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
96
-			$site_url = 'https://www.gocomics.com/' . $comic[1];
95
+        if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
96
+            $site_url = 'https://www.gocomics.com/' . $comic[1];
97 97
 
98
-			$article_link = $site_url . date('/Y/m/d');
98
+            $article_link = $site_url . date('/Y/m/d');
99 99
 
100
-			$body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false));
100
+            $body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false));
101 101
 
102
-			require_once 'lib/MiniTemplator.class.php';
102
+            require_once 'lib/MiniTemplator.class.php';
103 103
 
104
-			$feed_title = htmlspecialchars($comic[1]);
105
-			$site_url = htmlspecialchars($site_url);
106
-			$article_link = htmlspecialchars($article_link);
104
+            $feed_title = htmlspecialchars($comic[1]);
105
+            $site_url = htmlspecialchars($site_url);
106
+            $article_link = htmlspecialchars($article_link);
107 107
 
108
-			$tpl = new MiniTemplator();
108
+            $tpl = new MiniTemplator();
109 109
 
110
-			$tpl->readTemplateFromFile('templates/generated_feed.txt');
110
+            $tpl->readTemplateFromFile('templates/generated_feed.txt');
111 111
 
112
-			$tpl->setVariable('FEED_TITLE', $feed_title, true);
113
-			$tpl->setVariable('VERSION', get_version(), true);
114
-			$tpl->setVariable('FEED_URL', htmlspecialchars($fetch_url), true);
115
-			$tpl->setVariable('SELF_URL', $site_url, true);
112
+            $tpl->setVariable('FEED_TITLE', $feed_title, true);
113
+            $tpl->setVariable('VERSION', get_version(), true);
114
+            $tpl->setVariable('FEED_URL', htmlspecialchars($fetch_url), true);
115
+            $tpl->setVariable('SELF_URL', $site_url, true);
116 116
 
117
-			if ($body) {
118
-				$doc = new DOMDocument();
117
+            if ($body) {
118
+                $doc = new DOMDocument();
119 119
 
120
-				if (@$doc->loadHTML($body)) {
121
-					$xpath = new DOMXPath($doc);
120
+                if (@$doc->loadHTML($body)) {
121
+                    $xpath = new DOMXPath($doc);
122 122
 
123
-					$node = $xpath->query('//picture[contains(@class, "item-comic-image")]/img')->item(0);
123
+                    $node = $xpath->query('//picture[contains(@class, "item-comic-image")]/img')->item(0);
124 124
 
125
-					if ($node) {
126
-						$title = $xpath->query('//h1')->item(0);
125
+                    if ($node) {
126
+                        $title = $xpath->query('//h1')->item(0);
127 127
 
128
-						if ($title) {
129
-							$title = clean(trim($title->nodeValue));
130
-						} else {
131
-							$title = date('l, F d, Y');
132
-						}
128
+                        if ($title) {
129
+                            $title = clean(trim($title->nodeValue));
130
+                        } else {
131
+                            $title = date('l, F d, Y');
132
+                        }
133 133
 
134
-						foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr ) {
135
-							$node->removeAttribute($attr);
136
-						}
134
+                        foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr ) {
135
+                            $node->removeAttribute($attr);
136
+                        }
137 137
 
138
-						$tpl->setVariable('ARTICLE_ID', $article_link, true);
139
-						$tpl->setVariable('ARTICLE_LINK', $article_link, true);
140
-						$tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', mktime(11, 0, 0)), true);
141
-						$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($title), true);
142
-						$tpl->setVariable('ARTICLE_EXCERPT', '', true);
143
-						$tpl->setVariable('ARTICLE_CONTENT', $doc->saveHTML($node), true);
138
+                        $tpl->setVariable('ARTICLE_ID', $article_link, true);
139
+                        $tpl->setVariable('ARTICLE_LINK', $article_link, true);
140
+                        $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', mktime(11, 0, 0)), true);
141
+                        $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($title), true);
142
+                        $tpl->setVariable('ARTICLE_EXCERPT', '', true);
143
+                        $tpl->setVariable('ARTICLE_CONTENT', $doc->saveHTML($node), true);
144 144
 
145
-						$tpl->setVariable('ARTICLE_AUTHOR', '', true);
146
-						$tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
147
-						$tpl->setVariable('ARTICLE_SOURCE_TITLE', $feed_title, true);
145
+                        $tpl->setVariable('ARTICLE_AUTHOR', '', true);
146
+                        $tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
147
+                        $tpl->setVariable('ARTICLE_SOURCE_TITLE', $feed_title, true);
148 148
 
149
-						$tpl->addBlock('entry');
150
-					}
151
-				}
152
-			}
149
+                        $tpl->addBlock('entry');
150
+                    }
151
+                }
152
+            }
153 153
 
154
-			$tpl->addBlock('feed');
154
+            $tpl->addBlock('feed');
155 155
 
156
-			if ($tpl->generateOutputToString($tmp_data))
157
-				$feed_data = $tmp_data;
158
-		}
156
+            if ($tpl->generateOutputToString($tmp_data))
157
+                $feed_data = $tmp_data;
158
+        }
159 159
 
160
-		return $feed_data;
161
-	}
160
+        return $feed_data;
161
+    }
162 162
 
163
-	public function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
164
-		if ($auth_login || $auth_pass)
165
-			return $contents;
163
+    public function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
164
+        if ($auth_login || $auth_pass)
165
+            return $contents;
166 166
 
167
-		if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url))
168
-			return '<?xml version="1.0" encoding="utf-8"?>'; // Get is_html() to return false.
167
+        if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url))
168
+            return '<?xml version="1.0" encoding="utf-8"?>'; // Get is_html() to return false.
169 169
 
170
-		return $contents;
171
-	}
170
+        return $contents;
171
+    }
172 172
 
173
-	public function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
174
-		if ($auth_login || $auth_pass)
175
-			return $basic_info;
173
+    public function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
174
+        if ($auth_login || $auth_pass)
175
+            return $basic_info;
176 176
 
177
-		if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches))
178
-			$basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
177
+        if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches))
178
+            $basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
179 179
 
180
-		return $basic_info;
181
-	}
180
+        return $basic_info;
181
+    }
182 182
 
183
-	public function api_version() {
184
-		return 2;
185
-	}
183
+    public function api_version() {
184
+        return 2;
185
+    }
186 186
 
187 187
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_whomp.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Whomp extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Whomp!");
6
-	}
4
+    public function supported() {
5
+        return array("Whomp!");
6
+    }
7 7
 
8
-	public function process(&$article) {
9
-		if (strpos($article["guid"], "whompcomic.com") !== false) {
8
+    public function process(&$article) {
9
+        if (strpos($article["guid"], "whompcomic.com") !== false) {
10 10
 
11
-			$res = fetch_file_contents($article["link"], false, false, false,
12
-				 false, false, 0,
13
-				 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
11
+            $res = fetch_file_contents($article["link"], false, false, false,
12
+                    false, false, 0,
13
+                    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
14 14
 
15
-			global $fetch_last_error_content;
15
+            global $fetch_last_error_content;
16 16
 
17
-			if (!$res && $fetch_last_error_content)
18
-				$res = $fetch_last_error_content;
17
+            if (!$res && $fetch_last_error_content)
18
+                $res = $fetch_last_error_content;
19 19
 
20
-			$doc = new DOMDocument();
20
+            $doc = new DOMDocument();
21 21
 
22
-			if (@$doc->loadHTML($res)) {
23
-				$xpath = new DOMXPath($doc);
24
-				$basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);
22
+            if (@$doc->loadHTML($res)) {
23
+                $xpath = new DOMXPath($doc);
24
+                $basenode = $xpath->query('//img[@id="cc-comic"]')->item(0);
25 25
 
26
-				if ($basenode) {
27
-					$article["content"] = $doc->saveHTML($basenode);
28
-				}
29
-			}
26
+                if ($basenode) {
27
+                    $article["content"] = $doc->saveHTML($basenode);
28
+                }
29
+            }
30 30
 
31
-			return true;
32
-		}
31
+            return true;
32
+        }
33 33
 
34
-		return false;
35
-	}
34
+        return false;
35
+    }
36 36
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_twp.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Twp extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Three Word Phrase");
6
-	}
4
+    public function supported() {
5
+        return array("Three Word Phrase");
6
+    }
7 7
 
8
-	public function process(&$article) {
8
+    public function process(&$article) {
9 9
 
10
-		if (strpos($article["link"], "threewordphrase.com") !== false) {
10
+        if (strpos($article["link"], "threewordphrase.com") !== false) {
11 11
 
12
-				$doc = new DOMDocument();
12
+                $doc = new DOMDocument();
13 13
 
14
-				if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
15
-					$xpath = new DOMXpath($doc);
14
+                if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
15
+                    $xpath = new DOMXpath($doc);
16 16
 
17
-					$basenode = $xpath->query("//td/center/img")->item(0);
17
+                    $basenode = $xpath->query("//td/center/img")->item(0);
18 18
 
19
-					if ($basenode) {
20
-						$article["content"] = $doc->saveHTML($basenode);
21
-					}
22
-				}
19
+                    if ($basenode) {
20
+                        $article["content"] = $doc->saveHTML($basenode);
21
+                    }
22
+                }
23 23
 
24
-			return true;
25
-		}
24
+            return true;
25
+        }
26 26
 
27
-		return false;
28
-	}
27
+        return false;
28
+    }
29 29
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_darklegacy.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,38 +1,38 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_DarkLegacy extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Dark Legacy Comics");
6
-	}
4
+    public function supported() {
5
+        return array("Dark Legacy Comics");
6
+    }
7 7
 
8
-	public function process(&$article) {
8
+    public function process(&$article) {
9 9
 
10
-		if (strpos($article["guid"], "darklegacycomics.com") !== false) {
10
+        if (strpos($article["guid"], "darklegacycomics.com") !== false) {
11 11
 
12
-				$res = fetch_file_contents($article["link"], false, false, false,
13
-					 false, false, 0,
14
-					 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
12
+                $res = fetch_file_contents($article["link"], false, false, false,
13
+                        false, false, 0,
14
+                        "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
15 15
 
16
-				global $fetch_last_error_content;
16
+                global $fetch_last_error_content;
17 17
 
18
-				if (!$res && $fetch_last_error_content)
19
-					$res = $fetch_last_error_content;
18
+                if (!$res && $fetch_last_error_content)
19
+                    $res = $fetch_last_error_content;
20 20
 
21
-				$doc = new DOMDocument();
21
+                $doc = new DOMDocument();
22 22
 
23
-				if (@$doc->loadHTML($res)) {
24
-					$xpath = new DOMXPath($doc);
25
-					$basenode = $xpath->query('//div[@class="comic"]')->item(0);
23
+                if (@$doc->loadHTML($res)) {
24
+                    $xpath = new DOMXPath($doc);
25
+                    $basenode = $xpath->query('//div[@class="comic"]')->item(0);
26 26
 
27
-					if ($basenode) {
27
+                    if ($basenode) {
28 28
 
29
-						$article["content"] = $doc->saveHTML($basenode);
30
-					}
31
-				}
29
+                        $article["content"] = $doc->saveHTML($basenode);
30
+                    }
31
+                }
32 32
 
33
-			 return true;
34
-		}
33
+                return true;
34
+        }
35 35
 
36
-		return false;
37
-	}
36
+        return false;
37
+    }
38 38
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_tfd.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,32 +1,32 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Tfd extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Toothpaste For Dinner", "Married to the Sea");
6
-	}
4
+    public function supported() {
5
+        return array("Toothpaste For Dinner", "Married to the Sea");
6
+    }
7 7
 
8
-	public function process(&$article) {
9
-		if (strpos($article["link"], "toothpastefordinner.com") !== false ||
10
-		    strpos($article["link"], "marriedtothesea.com") !== false) {
11
-			$res = fetch_file_contents($article["link"], false, false, false,
12
-				false, false, 0,
13
-				"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
8
+    public function process(&$article) {
9
+        if (strpos($article["link"], "toothpastefordinner.com") !== false ||
10
+            strpos($article["link"], "marriedtothesea.com") !== false) {
11
+            $res = fetch_file_contents($article["link"], false, false, false,
12
+                false, false, 0,
13
+                "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
14 14
 
15
-			if (!$res) return $article;
15
+            if (!$res) return $article;
16 16
 
17
-			$doc = new DOMDocument();
17
+            $doc = new DOMDocument();
18 18
 
19
-			if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
20
-				$xpath = new DOMXPath($doc);
21
-				$basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
19
+            if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
20
+                $xpath = new DOMXPath($doc);
21
+                $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
22 22
 
23
-				if ($basenode) {
24
-					$article["content"] = $doc->saveHTML($basenode);
25
-					return true;
26
-				}
27
-			}
28
-		}
23
+                if ($basenode) {
24
+                    $article["content"] = $doc->saveHTML($basenode);
25
+                    return true;
26
+                }
27
+            }
28
+        }
29 29
 
30
-		return false;
31
-	}
30
+        return false;
31
+    }
32 32
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_explosm.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Explosm extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Cyanide and Happiness");
6
-	}
4
+    public function supported() {
5
+        return array("Cyanide and Happiness");
6
+    }
7 7
 
8
-	public function process(&$article) {
8
+    public function process(&$article) {
9 9
 
10
-		if (strpos($article["link"], "explosm.net/comics") !== false) {
10
+        if (strpos($article["link"], "explosm.net/comics") !== false) {
11 11
 
12
-				$doc = new DOMDocument();
12
+                $doc = new DOMDocument();
13 13
 
14
-				if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
15
-					$xpath = new DOMXPath($doc);
16
-					$basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
14
+                if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
15
+                    $xpath = new DOMXPath($doc);
16
+                    $basenode = $xpath->query('(//img[@id="main-comic"])')->item(0);
17 17
 
18
-					if ($basenode) {
19
-						$article["content"] = $doc->saveHTML($basenode);
20
-					}
21
-				}
18
+                    if ($basenode) {
19
+                        $article["content"] = $doc->saveHTML($basenode);
20
+                    }
21
+                }
22 22
 
23
-			return true;
24
-		}
23
+            return true;
24
+        }
25 25
 
26
-		return false;
27
-	}
26
+        return false;
27
+    }
28 28
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_dilbert.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -2,72 +2,72 @@
 block discarded – undo
2 2
 
3 3
 class Af_Comics_Dilbert extends Af_ComicFilter {
4 4
 
5
-	public function supported() {
6
-		return array("Dilbert");
7
-	}
5
+    public function supported() {
6
+        return array("Dilbert");
7
+    }
8 8
 
9
-	public function process(&$article) {
10
-		if (strpos($article["link"], "dilbert.com") !== false ||
11
-			strpos($article["link"], "/DilbertDailyStrip") !== false) {
9
+    public function process(&$article) {
10
+        if (strpos($article["link"], "dilbert.com") !== false ||
11
+            strpos($article["link"], "/DilbertDailyStrip") !== false) {
12 12
 
13
-				$res = fetch_file_contents($article["link"], false, false, false,
14
-					 false, false, 0,
15
-					 "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
13
+                $res = fetch_file_contents($article["link"], false, false, false,
14
+                        false, false, 0,
15
+                        "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
16 16
 
17
-				global $fetch_last_error_content;
17
+                global $fetch_last_error_content;
18 18
 
19
-				if (!$res && $fetch_last_error_content)
20
-					$res = $fetch_last_error_content;
19
+                if (!$res && $fetch_last_error_content)
20
+                    $res = $fetch_last_error_content;
21 21
 
22
-				$doc = new DOMDocument();
22
+                $doc = new DOMDocument();
23 23
 
24
-				if (@$doc->loadHTML($res)) {
25
-					$xpath = new DOMXPath($doc);
24
+                if (@$doc->loadHTML($res)) {
25
+                    $xpath = new DOMXPath($doc);
26 26
 
27
-					// Get the image container
28
-					$basenode = $xpath->query('(//div[@class="img-comic-container"]/a[@class="img-comic-link"])')->item(0);
27
+                    // Get the image container
28
+                    $basenode = $xpath->query('(//div[@class="img-comic-container"]/a[@class="img-comic-link"])')->item(0);
29 29
 
30
-					// Get the comic title
31
-					$comic_title = $xpath->query('(//span[@class="comic-title-name"])')->item(0)->textContent;
30
+                    // Get the comic title
31
+                    $comic_title = $xpath->query('(//span[@class="comic-title-name"])')->item(0)->textContent;
32 32
 
33
-					// Get tags from the article
34
-					$matches = $xpath->query('(//p[contains(@class, "comic-tags")][1]//a)');
35
-					$tags = array();
33
+                    // Get tags from the article
34
+                    $matches = $xpath->query('(//p[contains(@class, "comic-tags")][1]//a)');
35
+                    $tags = array();
36 36
 
37
-					foreach ($matches as $tag) {
38
-						// Only strings starting with a number sign are considered tags
39
-						if ( substr($tag->textContent, 0, 1) == '#' ) {
40
-							$tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8');
41
-						}
42
-					}
37
+                    foreach ($matches as $tag) {
38
+                        // Only strings starting with a number sign are considered tags
39
+                        if ( substr($tag->textContent, 0, 1) == '#' ) {
40
+                            $tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8');
41
+                        }
42
+                    }
43 43
 
44
-					// Get the current comics transcript and set it
45
-					// as the title so it will be visible on mousover
46
-					$transcript = $xpath->query('(//div[starts-with(@id, "js-toggle-transcript-")]//p)')->item(0);
47
-					if ($transcript) {
48
-						$basenode->setAttribute("title", $transcript->textContent);
49
-					}
44
+                    // Get the current comics transcript and set it
45
+                    // as the title so it will be visible on mousover
46
+                    $transcript = $xpath->query('(//div[starts-with(@id, "js-toggle-transcript-")]//p)')->item(0);
47
+                    if ($transcript) {
48
+                        $basenode->setAttribute("title", $transcript->textContent);
49
+                    }
50 50
 
51
-					if ($basenode) {
52
-						$article["content"] = $doc->saveHTML($basenode);
53
-					}
51
+                    if ($basenode) {
52
+                        $article["content"] = $doc->saveHTML($basenode);
53
+                    }
54 54
 
55
-					// Add comic title to article type if not empty (mostly Sunday strips)
56
-					if ($comic_title) {
57
-						$article["title"] = $article["title"] . " - " . $comic_title;
58
-					}
55
+                    // Add comic title to article type if not empty (mostly Sunday strips)
56
+                    if ($comic_title) {
57
+                        $article["title"] = $article["title"] . " - " . $comic_title;
58
+                    }
59 59
 
60
-					if (!empty($tags)) {
61
-						// Ignore existing tags and just replace them all
62
-						$article["tags"] = array_unique($tags);
63
-					}
60
+                    if (!empty($tags)) {
61
+                        // Ignore existing tags and just replace them all
62
+                        $article["tags"] = array_unique($tags);
63
+                    }
64 64
 
65
-				}
65
+                }
66 66
 
67
-			return true;
68
-		}
67
+            return true;
68
+        }
69 69
 
70
-		return false;
71
-	}
70
+        return false;
71
+    }
72 72
 }
73 73
 ?>
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_cad.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,39 +1,39 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Cad extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Ctrl+Alt+Del");
6
-	}
4
+    public function supported() {
5
+        return array("Ctrl+Alt+Del");
6
+    }
7 7
 
8
-	public function process(&$article) {
9
-		if (strpos($article["link"], "cad-comic.com") !== false) {
10
-			if (strpos($article["title"], "News:") === false) {
8
+    public function process(&$article) {
9
+        if (strpos($article["link"], "cad-comic.com") !== false) {
10
+            if (strpos($article["title"], "News:") === false) {
11 11
 
12
-				global $fetch_last_error_content;
12
+                global $fetch_last_error_content;
13 13
 
14
-				$doc = new DOMDocument();
14
+                $doc = new DOMDocument();
15 15
 
16
-				$res = fetch_file_contents($article["link"], false, false, false,
17
-					false, false, 0,
18
-					"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
16
+                $res = fetch_file_contents($article["link"], false, false, false,
17
+                    false, false, 0,
18
+                    "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0");
19 19
 
20
-				if (!$res && $fetch_last_error_content)
21
-					$res = $fetch_last_error_content;
20
+                if (!$res && $fetch_last_error_content)
21
+                    $res = $fetch_last_error_content;
22 22
 
23
-				if (@$doc->loadHTML($res)) {
24
-					$xpath = new DOMXPath($doc);
25
-					$basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
23
+                if (@$doc->loadHTML($res)) {
24
+                    $xpath = new DOMXPath($doc);
25
+                    $basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
26 26
 
27
-					if ($basenode) {
28
-						$article["content"] = $doc->saveHTML($basenode);
29
-					}
30
-				}
27
+                    if ($basenode) {
28
+                        $article["content"] = $doc->saveHTML($basenode);
29
+                    }
30
+                }
31 31
 
32
-			}
32
+            }
33 33
 
34
-			return true;
35
-		}
34
+            return true;
35
+        }
36 36
 
37
-		return false;
38
-	}
37
+        return false;
38
+    }
39 39
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_comicclass.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_ComicClass extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Loading Artist");
6
-	}
4
+    public function supported() {
5
+        return array("Loading Artist");
6
+    }
7 7
 
8
-	public function process(&$article) {
9
-		if (strpos($article["guid"], "loadingartist.com") !== false) {
8
+    public function process(&$article) {
9
+        if (strpos($article["guid"], "loadingartist.com") !== false) {
10 10
 
11
-				// lol at people who block clients by user agent
12
-				// oh noes my ad revenue Q_Q
11
+                // lol at people who block clients by user agent
12
+                // oh noes my ad revenue Q_Q
13 13
 
14
-				$res = fetch_file_contents($article["link"], false, false, false,
15
-					 false, false, 0,
16
-					 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
14
+                $res = fetch_file_contents($article["link"], false, false, false,
15
+                        false, false, 0,
16
+                        "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
17 17
 
18
-				$doc = new DOMDocument();
18
+                $doc = new DOMDocument();
19 19
 
20
-				if (@$doc->loadHTML($res)) {
21
-					$xpath = new DOMXPath($doc);
22
-					$basenode = $xpath->query('//div[@class="comic"]')->item(0);
20
+                if (@$doc->loadHTML($res)) {
21
+                    $xpath = new DOMXPath($doc);
22
+                    $basenode = $xpath->query('//div[@class="comic"]')->item(0);
23 23
 
24
-					if ($basenode) {
25
-						$article["content"] = $doc->saveHTML($basenode);
26
-					}
27
-				}
24
+                    if ($basenode) {
25
+                        $article["content"] = $doc->saveHTML($basenode);
26
+                    }
27
+                }
28 28
 
29
-			 return true;
30
-		}
29
+                return true;
30
+        }
31 31
 
32
-		return false;
33
-	}
32
+        return false;
33
+    }
34 34
 }
Please login to merge, or discard this patch.