/** * Extracts meta tags from the given HTML source. * * @param string $html HTML. * @return array Meta tags. */ protected function _extractMetas($html) { $Document = $this->_Dom->document($html); return $Document->tags('meta', function ($Tag) { return $Tag->matches('property', $this->_metaPattern); }); }
/** * Extracts embeddable URLs from an HTML source. * * @param string $html The HTML source to be extracted. * @param string $url URL of the HTML source. * @return array An array of extracted URLs. */ public function crawl($html, $url = '') { $Document = $this->_Dom->document($html); $urls = $this->_extractUrls($Document); if ($url) { $urls = $this->_completeUrls($urls, $url); } return $this->_filterUrls(array_unique($urls)); }
/** * Extracts an oEmbed configuration from the given page. * * @param string $html HTML page. * @return array Configuration. */ protected function _extractConfig($html) { $Document = $this->_Dom->document($html); $links = $Document->tags('link'); foreach ($links as $Link) { if ($format = $this->_extractFormat($Link)) { return new Config($Link->get('href'), $format); } } throw new Exception('Unable to extract any OEmbed endpoint'); }
/** * Extracts embeddable URLs from an HTML source. * * @param string $html The HTML source to be extracted. * @return array An array of extracted URLs. */ public function crawl($html) { $Document = $this->_Dom->document($html); $urls = $this->_extractUrls($Document); return $this->_filterUrls(array_unique($urls)); }
/** * */ public function testDocument() { $Factory = new Native(); $Document = $Factory->document('html'); $this->assertInstanceOf('Essence\\Dom\\Document', $Document); }