Skip to content
Snippets Groups Projects
Commit 50d089ae authored by Andrew Dolgov's avatar Andrew Dolgov
Browse files

redditimgur: blacklist github because it usually resolves to a huge profile photo of someone

parent e48beee7
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ class Af_RedditImgur extends Plugin {
/* @var PluginHost $host */
private $host;
private $domain_blacklist = [ "github.com" ];
function about() {
return array(1.0,
......@@ -431,6 +432,9 @@ class Af_RedditImgur extends Plugin {
}
}
if ($content_link && $this->is_blacklisted($content_link->getAttribute("href")))
return $article;
$found = $this->inline_stuff($article, $doc, $xpath);
$node = $doc->getElementsByTagName('body')->item(0);
......@@ -567,4 +571,16 @@ class Af_RedditImgur extends Plugin {
return $article;
}
private function is_blacklisted($src) {
$src_domain = parse_url($src, PHP_URL_HOST);
foreach ($this->domain_blacklist as $domain) {
if (strstr($src_domain, $domain) !== false) {
return true;
}
}
return false;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment