public function __construct($parent) { parent::__construct($parent); if (!isset(self::$cache)) { self::$cache = array(); } self::$path = "/tmp/wssub"; }
public function load($url, $cacheable = true) { if (!$url) { $this->log("load() no url", 'error'); return null; } if ($cacheable) { $cache = new wssubCache(null); if ($cache->add($url)) { $this->log("load() url added to cache: {$url}"); } if ($nurl = $cache->get_cache_url($url)) { $url = $nurl; } } $this->log("load() LOADING url: {$url}"); $doc = new DOMDocument(); $doc->validateOnParse = true; if (!@$doc->loadHTMLFile($url)) { $this->log("load() Cannot load file {$url}", 'error'); return null; } return $doc; }