You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
561 B

  1. <?php
  2. namespace p3k\XRay\Formats;
  3. use DOMDocument, DOMXPath;
  4. interface iFormat {
  5. public static function matches_host($url);
  6. public static function matches($url);
  7. }
  8. abstract class Format implements iFormat {
  9. protected static function _unknown() {
  10. return [
  11. 'data' => [
  12. 'type' => 'unknown'
  13. ]
  14. ];
  15. }
  16. protected static function _loadHTML($html) {
  17. $doc = new DOMDocument();
  18. @$doc->loadHTML($html);
  19. if(!$doc) {
  20. return [null, null];
  21. }
  22. $xpath = new DOMXPath($doc);
  23. return [$doc, $xpath];
  24. }
  25. }