- /**
- * Check entry url against an ignore list to replace with content url.
- *
- * XXX: move the ignore list in the database to let users handle it
- *
- * @param string $url url to test
- *
- * @return bool true if url matches ignore list otherwise false
- */
- private function ignoreUrl($url)
- {
- $ignored_hosts = ['feedproxy.google.com', 'feeds.reuters.com'];
- $ignored_patterns = ['https?://www\.lemonde\.fr/tiny.*'];
-
- $parsed_url = parse_url($url);
-
- $filtered = array_filter($ignored_hosts, function ($var) use ($parsed_url) {
- return $var === $parsed_url['host'];
- });
-
- if ([] !== $filtered) {
- return true;
- }
-
- $filtered = array_filter($ignored_patterns, function ($var) use ($url) {
- return preg_match("`$var`i", $url);
- });
-
- if ([] !== $filtered) {
- return true;
- }
-
- return false;
- }
-