Passed
Push — master ( 678db7...164b32 )
by Cody
06:12 queued 03:06
created
backend.php 1 patch
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -1,133 +1,133 @@
 block discarded – undo
1 1
 <?php
2
-	set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR.
3
-		get_include_path());
4
-
5
-	$op = $_REQUEST["op"];
6
-	@$method = $_REQUEST['subop'] ? $_REQUEST['subop'] : $_REQUEST["method"];
7
-
8
-	if (!$method) {
9
-			$method = 'index';
10
-	} else {
11
-			$method = strtolower($method);
12
-	}
13
-
14
-	/* Public calls compatibility shim */
15
-
16
-	$public_calls = array("globalUpdateFeeds", "rss", "getUnread", "getProfiles", "share",
17
-		"fbexport", "logout", "pubsub");
18
-
19
-	if (array_search($op, $public_calls) !== false) {
20
-		header("Location: public.php?".$_SERVER['QUERY_STRING']);
21
-		return;
22
-	}
23
-
24
-	@$csrf_token = $_REQUEST['csrf_token'];
25
-
26
-	require_once "autoload.php";
27
-	require_once "sessions.php";
28
-	require_once "functions.php";
29
-	require_once "config.php";
30
-	require_once "db.php";
31
-	require_once "db-prefs.php";
32
-
33
-	startup_gettext();
34
-
35
-	$script_started = microtime(true);
36
-
37
-	if (!init_plugins()) {
38
-	    return;
39
-	}
40
-
41
-	header("Content-Type: text/json; charset=utf-8");
42
-
43
-	if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
44
-		ob_start("ob_gzhandler");
45
-	}
46
-
47
-	if (SINGLE_USER_MODE) {
48
-		authenticate_user("admin", null);
49
-	}
50
-
51
-	if ($_SESSION["uid"]) {
52
-		if (!validate_session()) {
53
-			header("Content-Type: text/json");
54
-			print error_json(6);
55
-			return;
56
-		}
57
-		load_user_plugins($_SESSION["uid"]);
58
-	}
59
-
60
-	$purge_intervals = array(
61
-		0  => __("Use default"),
62
-		-1 => __("Never purge"),
63
-		5  => __("1 week old"),
64
-		14 => __("2 weeks old"),
65
-		31 => __("1 month old"),
66
-		60 => __("2 months old"),
67
-		90 => __("3 months old"));
68
-
69
-	$update_intervals = array(
70
-		0   => __("Default interval"),
71
-		-1  => __("Disable updates"),
72
-		15  => __("15 minutes"),
73
-		30  => __("30 minutes"),
74
-		60  => __("Hourly"),
75
-		240 => __("4 hours"),
76
-		720 => __("12 hours"),
77
-		1440 => __("Daily"),
78
-		10080 => __("Weekly"));
79
-
80
-	$update_intervals_nodefault = array(
81
-		-1  => __("Disable updates"),
82
-		15  => __("15 minutes"),
83
-		30  => __("30 minutes"),
84
-		60  => __("Hourly"),
85
-		240 => __("4 hours"),
86
-		720 => __("12 hours"),
87
-		1440 => __("Daily"),
88
-		10080 => __("Weekly"));
89
-
90
-	$access_level_names = array(
91
-		0 => __("User"),
92
-		5 => __("Power User"),
93
-		10 => __("Administrator"));
94
-
95
-	$op = str_replace("-", "_", $op);
96
-
97
-	$override = PluginHost::getInstance()->lookup_handler($op, $method);
98
-
99
-	if (class_exists($op) || $override) {
100
-
101
-		if ($override) {
102
-			$handler = $override;
103
-		} else {
104
-			$handler = new $op($_REQUEST);
105
-		}
106
-
107
-		if ($handler && implements_interface($handler, 'IHandler')) {
108
-			if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) {
109
-				if ($handler->before($method)) {
110
-					if ($method && method_exists($handler, $method)) {
111
-						$handler->$method();
112
-					} else {
113
-						if (method_exists($handler, "catchall")) {
114
-							$handler->catchall($method);
115
-						}
116
-					}
117
-					$handler->after();
118
-					return;
119
-				} else {
120
-					header("Content-Type: text/json");
121
-					print error_json(6);
122
-					return;
123
-				}
124
-			} else {
125
-				header("Content-Type: text/json");
126
-				print error_json(6);
127
-				return;
128
-			}
129
-		}
130
-	}
131
-
132
-	header("Content-Type: text/json");
133
-	print error_json(13);
2
+    set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR.
3
+        get_include_path());
4
+
5
+    $op = $_REQUEST["op"];
6
+    @$method = $_REQUEST['subop'] ? $_REQUEST['subop'] : $_REQUEST["method"];
7
+
8
+    if (!$method) {
9
+            $method = 'index';
10
+    } else {
11
+            $method = strtolower($method);
12
+    }
13
+
14
+    /* Public calls compatibility shim */
15
+
16
+    $public_calls = array("globalUpdateFeeds", "rss", "getUnread", "getProfiles", "share",
17
+        "fbexport", "logout", "pubsub");
18
+
19
+    if (array_search($op, $public_calls) !== false) {
20
+        header("Location: public.php?".$_SERVER['QUERY_STRING']);
21
+        return;
22
+    }
23
+
24
+    @$csrf_token = $_REQUEST['csrf_token'];
25
+
26
+    require_once "autoload.php";
27
+    require_once "sessions.php";
28
+    require_once "functions.php";
29
+    require_once "config.php";
30
+    require_once "db.php";
31
+    require_once "db-prefs.php";
32
+
33
+    startup_gettext();
34
+
35
+    $script_started = microtime(true);
36
+
37
+    if (!init_plugins()) {
38
+        return;
39
+    }
40
+
41
+    header("Content-Type: text/json; charset=utf-8");
42
+
43
+    if (ENABLE_GZIP_OUTPUT && function_exists("ob_gzhandler")) {
44
+        ob_start("ob_gzhandler");
45
+    }
46
+
47
+    if (SINGLE_USER_MODE) {
48
+        authenticate_user("admin", null);
49
+    }
50
+
51
+    if ($_SESSION["uid"]) {
52
+        if (!validate_session()) {
53
+            header("Content-Type: text/json");
54
+            print error_json(6);
55
+            return;
56
+        }
57
+        load_user_plugins($_SESSION["uid"]);
58
+    }
59
+
60
+    $purge_intervals = array(
61
+        0  => __("Use default"),
62
+        -1 => __("Never purge"),
63
+        5  => __("1 week old"),
64
+        14 => __("2 weeks old"),
65
+        31 => __("1 month old"),
66
+        60 => __("2 months old"),
67
+        90 => __("3 months old"));
68
+
69
+    $update_intervals = array(
70
+        0   => __("Default interval"),
71
+        -1  => __("Disable updates"),
72
+        15  => __("15 minutes"),
73
+        30  => __("30 minutes"),
74
+        60  => __("Hourly"),
75
+        240 => __("4 hours"),
76
+        720 => __("12 hours"),
77
+        1440 => __("Daily"),
78
+        10080 => __("Weekly"));
79
+
80
+    $update_intervals_nodefault = array(
81
+        -1  => __("Disable updates"),
82
+        15  => __("15 minutes"),
83
+        30  => __("30 minutes"),
84
+        60  => __("Hourly"),
85
+        240 => __("4 hours"),
86
+        720 => __("12 hours"),
87
+        1440 => __("Daily"),
88
+        10080 => __("Weekly"));
89
+
90
+    $access_level_names = array(
91
+        0 => __("User"),
92
+        5 => __("Power User"),
93
+        10 => __("Administrator"));
94
+
95
+    $op = str_replace("-", "_", $op);
96
+
97
+    $override = PluginHost::getInstance()->lookup_handler($op, $method);
98
+
99
+    if (class_exists($op) || $override) {
100
+
101
+        if ($override) {
102
+            $handler = $override;
103
+        } else {
104
+            $handler = new $op($_REQUEST);
105
+        }
106
+
107
+        if ($handler && implements_interface($handler, 'IHandler')) {
108
+            if (validate_csrf($csrf_token) || $handler->csrf_ignore($method)) {
109
+                if ($handler->before($method)) {
110
+                    if ($method && method_exists($handler, $method)) {
111
+                        $handler->$method();
112
+                    } else {
113
+                        if (method_exists($handler, "catchall")) {
114
+                            $handler->catchall($method);
115
+                        }
116
+                    }
117
+                    $handler->after();
118
+                    return;
119
+                } else {
120
+                    header("Content-Type: text/json");
121
+                    print error_json(6);
122
+                    return;
123
+                }
124
+            } else {
125
+                header("Content-Type: text/json");
126
+                print error_json(6);
127
+                return;
128
+            }
129
+        }
130
+    }
131
+
132
+    header("Content-Type: text/json");
133
+    print error_json(13);
Please login to merge, or discard this patch.
plugins/af_comics/init.php 1 patch
Indentation   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -1,197 +1,197 @@
 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") {
49
-		    return;
50
-		}
47
+    public function hook_prefs_tab($args) {
48
+        if ($args != "prefFeeds") {
49
+            return;
50
+        }
51 51
 
52
-		print "<div dojoType=\"dijit.layout.AccordionPane\"
52
+        print "<div dojoType=\"dijit.layout.AccordionPane\"
53 53
 			title=\"<i class='material-icons'>photo</i> ".__('Feeds supported by af_comics')."\">";
54 54
 
55
-		print "<p>".__("The following comics are currently supported:")."</p>";
55
+        print "<p>".__("The following comics are currently supported:")."</p>";
56 56
 
57
-		$comics = array("GoComics");
57
+        $comics = array("GoComics");
58 58
 
59
-		foreach ($this->filters as $f) {
60
-			foreach ($f->supported() as $comic) {
61
-				array_push($comics, $comic);
62
-			}
63
-		}
59
+        foreach ($this->filters as $f) {
60
+            foreach ($f->supported() as $comic) {
61
+                array_push($comics, $comic);
62
+            }
63
+        }
64 64
 
65
-		asort($comics);
65
+        asort($comics);
66 66
 
67
-		print "<ul class='panel panel-scrollable list list-unstyled'>";
68
-		foreach ($comics as $comic) {
69
-			print "<li>$comic</li>";
70
-		}
71
-		print "</ul>";
67
+        print "<ul class='panel panel-scrollable list list-unstyled'>";
68
+        foreach ($comics as $comic) {
69
+            print "<li>$comic</li>";
70
+        }
71
+        print "</ul>";
72 72
 
73
-		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>";
73
+        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>";
74 74
 
75
-		print "<p>".__('Drop any updated filters into <code>filters.local</code> in plugin directory.')."</p>";
75
+        print "<p>".__('Drop any updated filters into <code>filters.local</code> in plugin directory.')."</p>";
76 76
 
77
-		print "</div>";
78
-	}
77
+        print "</div>";
78
+    }
79 79
 
80
-	public function hook_article_filter($article) {
81
-		foreach ($this->filters as $f) {
82
-			if ($f->process($article)) {
83
-							break;
84
-			}
85
-		}
80
+    public function hook_article_filter($article) {
81
+        foreach ($this->filters as $f) {
82
+            if ($f->process($article)) {
83
+                            break;
84
+            }
85
+        }
86 86
 
87
-		return $article;
88
-	}
87
+        return $article;
88
+    }
89 89
 
90
-	// GoComics dropped feed support so it needs to be handled when fetching the feed.
91
-	/**
92
-	 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
93
-	 */
94
-	public function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
95
-		if ($auth_login || $auth_pass) {
96
-					return $feed_data;
97
-		}
90
+    // GoComics dropped feed support so it needs to be handled when fetching the feed.
91
+    /**
92
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
93
+     */
94
+    public function hook_fetch_feed($feed_data, $fetch_url, $owner_uid, $feed, $last_article_timestamp, $auth_login, $auth_pass) {
95
+        if ($auth_login || $auth_pass) {
96
+                    return $feed_data;
97
+        }
98 98
 
99
-		if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
100
-			$site_url = 'https://www.gocomics.com/'.$comic[1];
99
+        if (preg_match('#^https?://(?:feeds\.feedburner\.com/uclick|www\.gocomics\.com)/([-a-z0-9]+)$#i', $fetch_url, $comic)) {
100
+            $site_url = 'https://www.gocomics.com/'.$comic[1];
101 101
 
102
-			$article_link = $site_url.date('/Y/m/d');
102
+            $article_link = $site_url.date('/Y/m/d');
103 103
 
104
-			$body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false));
104
+            $body = fetch_file_contents(array('url' => $article_link, 'type' => 'text/html', 'followlocation' => false));
105 105
 
106
-			require_once 'lib/MiniTemplator.class.php';
106
+            require_once 'lib/MiniTemplator.class.php';
107 107
 
108
-			$feed_title = htmlspecialchars($comic[1]);
109
-			$site_url = htmlspecialchars($site_url);
110
-			$article_link = htmlspecialchars($article_link);
108
+            $feed_title = htmlspecialchars($comic[1]);
109
+            $site_url = htmlspecialchars($site_url);
110
+            $article_link = htmlspecialchars($article_link);
111 111
 
112
-			$tpl = new MiniTemplator();
112
+            $tpl = new MiniTemplator();
113 113
 
114
-			$tpl->readTemplateFromFile('templates/generated_feed.txt');
114
+            $tpl->readTemplateFromFile('templates/generated_feed.txt');
115 115
 
116
-			$tpl->setVariable('FEED_TITLE', $feed_title, true);
117
-			$tpl->setVariable('VERSION', get_version(), true);
118
-			$tpl->setVariable('FEED_URL', htmlspecialchars($fetch_url), true);
119
-			$tpl->setVariable('SELF_URL', $site_url, true);
116
+            $tpl->setVariable('FEED_TITLE', $feed_title, true);
117
+            $tpl->setVariable('VERSION', get_version(), true);
118
+            $tpl->setVariable('FEED_URL', htmlspecialchars($fetch_url), true);
119
+            $tpl->setVariable('SELF_URL', $site_url, true);
120 120
 
121
-			if ($body) {
122
-				$doc = new DOMDocument();
121
+            if ($body) {
122
+                $doc = new DOMDocument();
123 123
 
124
-				if (@$doc->loadHTML($body)) {
125
-					$xpath = new DOMXPath($doc);
124
+                if (@$doc->loadHTML($body)) {
125
+                    $xpath = new DOMXPath($doc);
126 126
 
127
-					$node = $xpath->query('//picture[contains(@class, "item-comic-image")]/img')->item(0);
127
+                    $node = $xpath->query('//picture[contains(@class, "item-comic-image")]/img')->item(0);
128 128
 
129
-					if ($node) {
130
-						$title = $xpath->query('//h1')->item(0);
129
+                    if ($node) {
130
+                        $title = $xpath->query('//h1')->item(0);
131 131
 
132
-						if ($title) {
133
-							$title = clean(trim($title->nodeValue));
134
-						} else {
135
-							$title = date('l, F d, Y');
136
-						}
132
+                        if ($title) {
133
+                            $title = clean(trim($title->nodeValue));
134
+                        } else {
135
+                            $title = date('l, F d, Y');
136
+                        }
137 137
 
138
-						foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr) {
139
-							$node->removeAttribute($attr);
140
-						}
138
+                        foreach (['srcset', 'sizes', 'data-srcset', 'width'] as $attr) {
139
+                            $node->removeAttribute($attr);
140
+                        }
141 141
 
142
-						$tpl->setVariable('ARTICLE_ID', $article_link, true);
143
-						$tpl->setVariable('ARTICLE_LINK', $article_link, true);
144
-						$tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', mktime(11, 0, 0)), true);
145
-						$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($title), true);
146
-						$tpl->setVariable('ARTICLE_EXCERPT', '', true);
147
-						$tpl->setVariable('ARTICLE_CONTENT', $doc->saveHTML($node), true);
142
+                        $tpl->setVariable('ARTICLE_ID', $article_link, true);
143
+                        $tpl->setVariable('ARTICLE_LINK', $article_link, true);
144
+                        $tpl->setVariable('ARTICLE_UPDATED_ATOM', date('c', mktime(11, 0, 0)), true);
145
+                        $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($title), true);
146
+                        $tpl->setVariable('ARTICLE_EXCERPT', '', true);
147
+                        $tpl->setVariable('ARTICLE_CONTENT', $doc->saveHTML($node), true);
148 148
 
149
-						$tpl->setVariable('ARTICLE_AUTHOR', '', true);
150
-						$tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
151
-						$tpl->setVariable('ARTICLE_SOURCE_TITLE', $feed_title, true);
149
+                        $tpl->setVariable('ARTICLE_AUTHOR', '', true);
150
+                        $tpl->setVariable('ARTICLE_SOURCE_LINK', $site_url, true);
151
+                        $tpl->setVariable('ARTICLE_SOURCE_TITLE', $feed_title, true);
152 152
 
153
-						$tpl->addBlock('entry');
154
-					}
155
-				}
156
-			}
153
+                        $tpl->addBlock('entry');
154
+                    }
155
+                }
156
+            }
157 157
 
158
-			$tpl->addBlock('feed');
158
+            $tpl->addBlock('feed');
159 159
 
160
-			if ($tpl->generateOutputToString($tmp_data)) {
161
-							$feed_data = $tmp_data;
162
-			}
163
-		}
160
+            if ($tpl->generateOutputToString($tmp_data)) {
161
+                            $feed_data = $tmp_data;
162
+            }
163
+        }
164 164
 
165
-		return $feed_data;
166
-	}
165
+        return $feed_data;
166
+    }
167 167
 
168
-	public function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
169
-		if ($auth_login || $auth_pass) {
170
-					return $contents;
171
-		}
168
+    public function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) {
169
+        if ($auth_login || $auth_pass) {
170
+                    return $contents;
171
+        }
172 172
 
173
-		if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) {
174
-					return '<?xml version="1.0" encoding="utf-8"?>';
175
-		}
176
-		// Get is_html() to return false.
173
+        if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) {
174
+                    return '<?xml version="1.0" encoding="utf-8"?>';
175
+        }
176
+        // Get is_html() to return false.
177 177
 
178
-		return $contents;
179
-	}
178
+        return $contents;
179
+    }
180 180
 
181
-	public function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
182
-		if ($auth_login || $auth_pass) {
183
-					return $basic_info;
184
-		}
181
+    public function hook_feed_basic_info($basic_info, $fetch_url, $owner_uid, $feed, $auth_login, $auth_pass) {
182
+        if ($auth_login || $auth_pass) {
183
+                    return $basic_info;
184
+        }
185 185
 
186
-		if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches)) {
187
-					$basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
188
-		}
186
+        if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $fetch_url, $matches)) {
187
+                    $basic_info = array('title' => ucfirst($matches[1]), 'site_url' => $matches[0]);
188
+        }
189 189
 
190
-		return $basic_info;
191
-	}
190
+        return $basic_info;
191
+    }
192 192
 
193
-	public function api_version() {
194
-		return 2;
195
-	}
193
+    public function api_version() {
194
+        return 2;
195
+    }
196 196
 
197 197
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_whomp.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 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;
19
-			}
17
+            if (!$res && $fetch_last_error_content) {
18
+                            $res = $fetch_last_error_content;
19
+            }
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('//img[@id="cc-comic"]')->item(0);
23
+            if (@$doc->loadHTML($res)) {
24
+                $xpath = new DOMXPath($doc);
25
+                $basenode = $xpath->query('//img[@id="cc-comic"]')->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
-			return true;
33
-		}
32
+            return true;
33
+        }
34 34
 
35
-		return false;
36
-	}
35
+        return false;
36
+    }
37 37
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_pa.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,68 +1,68 @@
 block discarded – undo
1 1
 <?php
2 2
 class Af_Comics_Pa extends Af_ComicFilter {
3 3
 
4
-	public function supported() {
5
-		return array("Penny Arcade");
6
-	}
4
+    public function supported() {
5
+        return array("Penny Arcade");
6
+    }
7 7
 
8
-	public function process(&$article) {
9
-		if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "Comic:") !== false) {
8
+    public function process(&$article) {
9
+        if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "Comic:") !== false) {
10 10
 
11
-				$doc = new DOMDocument();
11
+                $doc = new DOMDocument();
12 12
 
13
-				if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
14
-					$xpath = new DOMXPath($doc);
15
-					$basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
13
+                if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
14
+                    $xpath = new DOMXPath($doc);
15
+                    $basenode = $xpath->query('(//div[@id="comicFrame"])')->item(0);
16 16
 
17
-					if ($basenode) {
18
-						$article["content"] = $doc->saveHTML($basenode);
19
-					}
20
-				}
17
+                    if ($basenode) {
18
+                        $article["content"] = $doc->saveHTML($basenode);
19
+                    }
20
+                }
21 21
 
22
-			return true;
23
-		}
22
+            return true;
23
+        }
24 24
 
25
-		if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "News Post:") !== false) {
26
-				$doc = new DOMDocument();
25
+        if (strpos($article["link"], "penny-arcade.com") !== false && strpos($article["title"], "News Post:") !== false) {
26
+                $doc = new DOMDocument();
27 27
 
28
-				if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
29
-					$xpath = new DOMXPath($doc);
30
-					$entries = $xpath->query('(//div[@class="post"])');
28
+                if ($doc->loadHTML(fetch_file_contents($article["link"]))) {
29
+                    $xpath = new DOMXPath($doc);
30
+                    $entries = $xpath->query('(//div[@class="post"])');
31 31
 
32
-					$basenode = false;
32
+                    $basenode = false;
33 33
 
34
-					foreach ($entries as $entry) {
35
-						$basenode = $entry;
36
-					}
34
+                    foreach ($entries as $entry) {
35
+                        $basenode = $entry;
36
+                    }
37 37
 
38
-					$meta = $xpath->query('(//div[@class="meta"])')->item(0);
39
-					if ($meta->parentNode) { $meta->parentNode->removeChild($meta); }
38
+                    $meta = $xpath->query('(//div[@class="meta"])')->item(0);
39
+                    if ($meta->parentNode) { $meta->parentNode->removeChild($meta); }
40 40
 
41
-					$header = $xpath->query('(//div[@class="postBody"]/h2)')->item(0);
42
-					if ($header->parentNode) { $header->parentNode->removeChild($header); }
41
+                    $header = $xpath->query('(//div[@class="postBody"]/h2)')->item(0);
42
+                    if ($header->parentNode) { $header->parentNode->removeChild($header); }
43 43
 
44
-					$header = $xpath->query('(//div[@class="postBody"]/div[@class="comicPost"])')->item(0);
45
-					if ($header->parentNode) { $header->parentNode->removeChild($header); }
44
+                    $header = $xpath->query('(//div[@class="postBody"]/div[@class="comicPost"])')->item(0);
45
+                    if ($header->parentNode) { $header->parentNode->removeChild($header); }
46 46
 
47
-					$avatar = $xpath->query('(//div[@class="avatar"]//img)')->item(0);
47
+                    $avatar = $xpath->query('(//div[@class="avatar"]//img)')->item(0);
48 48
 
49
-					if ($basenode) {
50
-											$basenode->insertBefore($avatar, $basenode->firstChild);
51
-					}
49
+                    if ($basenode) {
50
+                                            $basenode->insertBefore($avatar, $basenode->firstChild);
51
+                    }
52 52
 
53
-					$uninteresting = $xpath->query('(//div[@class="avatar"])');
54
-					foreach ($uninteresting as $i) {
55
-						$i->parentNode->removeChild($i);
56
-					}
53
+                    $uninteresting = $xpath->query('(//div[@class="avatar"])');
54
+                    foreach ($uninteresting as $i) {
55
+                        $i->parentNode->removeChild($i);
56
+                    }
57 57
 
58
-					if ($basenode) {
59
-						$article["content"] = $doc->saveHTML($basenode);
60
-					}
61
-				}
58
+                    if ($basenode) {
59
+                        $article["content"] = $doc->saveHTML($basenode);
60
+                    }
61
+                }
62 62
 
63
-			return true;
64
-		}
63
+            return true;
64
+        }
65 65
 
66
-		return false;
67
-	}
66
+        return false;
67
+    }
68 68
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_darklegacy.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,39 +1,39 @@
 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;
20
-				}
18
+                if (!$res && $fetch_last_error_content) {
19
+                                    $res = $fetch_last_error_content;
20
+                }
21 21
 
22
-				$doc = new DOMDocument();
22
+                $doc = new DOMDocument();
23 23
 
24
-				if (@$doc->loadHTML($res)) {
25
-					$xpath = new DOMXPath($doc);
26
-					$basenode = $xpath->query('//div[@class="comic"]')->item(0);
24
+                if (@$doc->loadHTML($res)) {
25
+                    $xpath = new DOMXPath($doc);
26
+                    $basenode = $xpath->query('//div[@class="comic"]')->item(0);
27 27
 
28
-					if ($basenode) {
28
+                    if ($basenode) {
29 29
 
30
-						$article["content"] = $doc->saveHTML($basenode);
31
-					}
32
-				}
30
+                        $article["content"] = $doc->saveHTML($basenode);
31
+                    }
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_cad.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,40 +1,40 @@
 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;
22
-				}
20
+                if (!$res && $fetch_last_error_content) {
21
+                                    $res = $fetch_last_error_content;
22
+                }
23 23
 
24
-				if (@$doc->loadHTML($res)) {
25
-					$xpath = new DOMXPath($doc);
26
-					$basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
24
+                if (@$doc->loadHTML($res)) {
25
+                    $xpath = new DOMXPath($doc);
26
+                    $basenode = $xpath->query('//div[@class="comicpage"]/a/img')->item(0);
27 27
 
28
-					if ($basenode) {
29
-						$article["content"] = $doc->saveHTML($basenode);
30
-					}
31
-				}
28
+                    if ($basenode) {
29
+                        $article["content"] = $doc->saveHTML($basenode);
30
+                    }
31
+                }
32 32
 
33
-			}
33
+            }
34 34
 
35
-			return true;
36
-		}
35
+            return true;
36
+        }
37 37
 
38
-		return false;
39
-	}
38
+        return false;
39
+    }
40 40
 }
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_dilbert.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -2,73 +2,73 @@
 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;
21
-				}
19
+                if (!$res && $fetch_last_error_content) {
20
+                                    $res = $fetch_last_error_content;
21
+                }
22 22
 
23
-				$doc = new DOMDocument();
23
+                $doc = new DOMDocument();
24 24
 
25
-				if (@$doc->loadHTML($res)) {
26
-					$xpath = new DOMXPath($doc);
25
+                if (@$doc->loadHTML($res)) {
26
+                    $xpath = new DOMXPath($doc);
27 27
 
28
-					// Get the image container
29
-					$basenode = $xpath->query('(//div[@class="img-comic-container"]/a[@class="img-comic-link"])')->item(0);
28
+                    // Get the image container
29
+                    $basenode = $xpath->query('(//div[@class="img-comic-container"]/a[@class="img-comic-link"])')->item(0);
30 30
 
31
-					// Get the comic title
32
-					$comic_title = $xpath->query('(//span[@class="comic-title-name"])')->item(0)->textContent;
31
+                    // Get the comic title
32
+                    $comic_title = $xpath->query('(//span[@class="comic-title-name"])')->item(0)->textContent;
33 33
 
34
-					// Get tags from the article
35
-					$matches = $xpath->query('(//p[contains(@class, "comic-tags")][1]//a)');
36
-					$tags = array();
34
+                    // Get tags from the article
35
+                    $matches = $xpath->query('(//p[contains(@class, "comic-tags")][1]//a)');
36
+                    $tags = array();
37 37
 
38
-					foreach ($matches as $tag) {
39
-						// Only strings starting with a number sign are considered tags
40
-						if (substr($tag->textContent, 0, 1) == '#') {
41
-							$tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8');
42
-						}
43
-					}
38
+                    foreach ($matches as $tag) {
39
+                        // Only strings starting with a number sign are considered tags
40
+                        if (substr($tag->textContent, 0, 1) == '#') {
41
+                            $tags[] = mb_strtolower(substr($tag->textContent, 1), 'utf-8');
42
+                        }
43
+                    }
44 44
 
45
-					// Get the current comics transcript and set it
46
-					// as the title so it will be visible on mousover
47
-					$transcript = $xpath->query('(//div[starts-with(@id, "js-toggle-transcript-")]//p)')->item(0);
48
-					if ($transcript) {
49
-						$basenode->setAttribute("title", $transcript->textContent);
50
-					}
45
+                    // Get the current comics transcript and set it
46
+                    // as the title so it will be visible on mousover
47
+                    $transcript = $xpath->query('(//div[starts-with(@id, "js-toggle-transcript-")]//p)')->item(0);
48
+                    if ($transcript) {
49
+                        $basenode->setAttribute("title", $transcript->textContent);
50
+                    }
51 51
 
52
-					if ($basenode) {
53
-						$article["content"] = $doc->saveHTML($basenode);
54
-					}
52
+                    if ($basenode) {
53
+                        $article["content"] = $doc->saveHTML($basenode);
54
+                    }
55 55
 
56
-					// Add comic title to article type if not empty (mostly Sunday strips)
57
-					if ($comic_title) {
58
-						$article["title"] = $article["title"]." - ".$comic_title;
59
-					}
56
+                    // Add comic title to article type if not empty (mostly Sunday strips)
57
+                    if ($comic_title) {
58
+                        $article["title"] = $article["title"]." - ".$comic_title;
59
+                    }
60 60
 
61
-					if (!empty($tags)) {
62
-						// Ignore existing tags and just replace them all
63
-						$article["tags"] = array_unique($tags);
64
-					}
61
+                    if (!empty($tags)) {
62
+                        // Ignore existing tags and just replace them all
63
+                        $article["tags"] = array_unique($tags);
64
+                    }
65 65
 
66
-				}
66
+                }
67 67
 
68
-			return true;
69
-		}
68
+            return true;
69
+        }
70 70
 
71
-		return false;
72
-	}
71
+        return false;
72
+    }
73 73
 }
74 74
 ?>
Please login to merge, or discard this patch.
plugins/af_comics/filters/af_comics_tfd.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@
 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) {
16
-			    return $article;
17
-			}
15
+            if (!$res) {
16
+                return $article;
17
+            }
18 18
 
19
-			$doc = new DOMDocument();
19
+            $doc = new DOMDocument();
20 20
 
21
-			if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
22
-				$xpath = new DOMXPath($doc);
23
-				$basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
21
+            if (@$doc->loadHTML(fetch_file_contents($article["link"]))) {
22
+                $xpath = new DOMXPath($doc);
23
+                $basenode = $xpath->query('//img[contains(@src, ".gif")]')->item(0);
24 24
 
25
-				if ($basenode) {
26
-					$article["content"] = $doc->saveHTML($basenode);
27
-					return true;
28
-				}
29
-			}
30
-		}
25
+                if ($basenode) {
26
+                    $article["content"] = $doc->saveHTML($basenode);
27
+                    return true;
28
+                }
29
+            }
30
+        }
31 31
 
32
-		return false;
33
-	}
32
+        return false;
33
+    }
34 34
 }
Please login to merge, or discard this patch.
plugins/auto_assign_labels/init.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,57 +1,57 @@
 block discarded – undo
1 1
 <?php
2 2
 class Auto_Assign_Labels extends Plugin {
3 3
 
4
-	/* @var PluginHost $host */
5
-	private $host;
4
+    /* @var PluginHost $host */
5
+    private $host;
6 6
 
7
-	public function about() {
8
-		return array(1.0,
9
-			"Assign labels automatically based on article title, content, and tags",
10
-			"fox");
11
-	}
7
+    public function about() {
8
+        return array(1.0,
9
+            "Assign labels automatically based on article title, content, and tags",
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_ARTICLE_FILTER, $this);
17
-	}
16
+        $host->add_hook($host::HOOK_ARTICLE_FILTER, $this);
17
+    }
18 18
 
19
-	public function get_all_labels_filter_format($owner_uid) {
20
-		$rv = array();
19
+    public function get_all_labels_filter_format($owner_uid) {
20
+        $rv = array();
21 21
 
22
-		$sth = $this->pdo->prepare("SELECT id, fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = ?");
23
-		$sth->execute([$owner_uid]);
22
+        $sth = $this->pdo->prepare("SELECT id, fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = ?");
23
+        $sth->execute([$owner_uid]);
24 24
 
25
-		while ($line = $sth->fetch()) {
26
-			array_push($rv, array(Labels::label_to_feed_id($line["id"]),
27
-				$line["caption"], $line["fg_color"], $line["bg_color"]));
28
-		}
25
+        while ($line = $sth->fetch()) {
26
+            array_push($rv, array(Labels::label_to_feed_id($line["id"]),
27
+                $line["caption"], $line["fg_color"], $line["bg_color"]));
28
+        }
29 29
 
30
-		return $rv;
31
-	}
30
+        return $rv;
31
+    }
32 32
 
33 33
 
34
-	public function hook_article_filter($article) {
34
+    public function hook_article_filter($article) {
35 35
 
36
-		$owner_uid = $article["owner_uid"];
37
-		$labels = $this->get_all_labels_filter_format($owner_uid);
38
-		$tags_str = join(",", $article["tags"]);
36
+        $owner_uid = $article["owner_uid"];
37
+        $labels = $this->get_all_labels_filter_format($owner_uid);
38
+        $tags_str = join(",", $article["tags"]);
39 39
 
40
-		foreach ($labels as $label) {
41
-			$caption = preg_quote($label[1], "/");
40
+        foreach ($labels as $label) {
41
+            $caption = preg_quote($label[1], "/");
42 42
 
43
-			if ($caption && preg_match("/\b$caption\b/i", "$tags_str ".strip_tags($article["content"])." ".$article["title"])) {
43
+            if ($caption && preg_match("/\b$caption\b/i", "$tags_str ".strip_tags($article["content"])." ".$article["title"])) {
44 44
 
45
-				if (!RSSUtils::labels_contains_caption($article["labels"], $caption)) {
46
-					array_push($article["labels"], $label);
47
-				}
48
-			}
49
-		}
45
+                if (!RSSUtils::labels_contains_caption($article["labels"], $caption)) {
46
+                    array_push($article["labels"], $label);
47
+                }
48
+            }
49
+        }
50 50
 
51
-		return $article;
52
-	}
51
+        return $article;
52
+    }
53 53
 
54
-	public function api_version() {
55
-		return 2;
56
-	}
54
+    public function api_version() {
55
+        return 2;
56
+    }
57 57
 }
Please login to merge, or discard this patch.