diff --git a/metager/app/MetaGer.php b/metager/app/MetaGer.php index 56762787d0ac70f8866ce91c86a8a236ed7a1915..b178a5ff4bccefbd60ac6fa2d3a5a61b5442fc64 100644 --- a/metager/app/MetaGer.php +++ b/metager/app/MetaGer.php @@ -89,17 +89,23 @@ class MetaGer public function __construct($hash = "") { - # Timer starten + # start timer $this->starttime = microtime(true); - # Versuchen Blacklists einzulesen + # Read blocklists if (file_exists(config_path() . "/blacklistDomains.txt") && file_exists(config_path() . "/blacklistUrl.txt")) { $tmp = file_get_contents(config_path() . "/blacklistDomains.txt"); $this->domainsBlacklisted = explode("\n", $tmp); $tmp = file_get_contents(config_path() . "/blacklistUrl.txt"); - $this->urlsBlacklisted = explode("\n", $tmp); + $lines = explode("\n", $tmp); + $filtered_lines = array_filter($lines, function($line) { + return strpos(trim($line), '#') !== 0; + }); + # Re-index the array (array_filter preserves keys by default) + $filtered_lines = array_values($filtered_lines); + $this->urlsBlacklisted = $filtered_lines; } - # Versuchen Blacklists einzulesen + # Read blocklists if (file_exists(config_path() . "/adBlacklistDomains.txt")) { $tmp = file_get_contents(config_path() . "/adBlacklistDomains.txt"); $this->adDomainsBlacklisted = explode("\n", $tmp);