public function testAmberExcluded_11622() { $this->assertFalse(AmberRobots::url_permitted(<<<EOD user-agent: Amber disallow: / EOD , "/Settings")); }
/** * Find out if the access to the given URL is permitted by the robots.txt * @param $url * @return bool */ public static function robots_allowed($url) { $p = parse_url($url); $p['path'] = "robots.txt"; $robots_url = $p['scheme'] . "://" . $p['host'] . (isset($p['port']) ? ":" . $p['port'] : '') . '/robots.txt'; $data = AmberNetworkUtils::open_url($robots_url, array(CURLOPT_FAILONERROR => FALSE)); if (isset($data['info']['http_code']) && $data['info']['http_code'] == 200) { $body = $data['body']; return !$body || AmberRobots::url_permitted($body, $url); } return true; }