d_robots_txt_parser.php (774B)
1 <?php 2 use d_robots_txt_parser\RobotsTxtParser; 3 use d_robots_txt_parser\RobotsTxtValidator; 4 5 class d_robots_txt_parser { 6 private $parser; 7 private $validator; 8 9 public function __construct($content, $encoding = 'UTF-8') { 10 $this->parser = new RobotsTxtParser($content, $encoding); 11 $this->validator = new RobotsTxtValidator($this->parser->getRules()); 12 } 13 14 public function getRules($userAgent = NULL) { 15 return $this->parser->getRules($userAgent); 16 } 17 18 public function getSitemaps() { 19 return $this->parser->getSitemaps(); 20 } 21 22 public function isUrlAllow($url, $userAgent = '*') { 23 return $this->validator->isUrlAllow($url, $userAgent); 24 } 25 26 public function isUrlDisallow($url, $userAgent = '*') { 27 return $this->validator->isUrlDisallow($url, $userAgent); 28 } 29 } 30 ?>