コード例 #1
0
 /**
  *	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);
     });
 }
コード例 #2
0
ファイル: Crawler.php プロジェクト: muten84/luigibifulco.it
 /**
  *	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));
 }
コード例 #3
0
ファイル: OEmbed.php プロジェクト: muten84/luigibifulco.it
 /**
  *	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');
 }
コード例 #4
0
 /**
  *	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));
 }
コード例 #5
0
 /**
  *
  */
 public function testDocument()
 {
     $Factory = new Native();
     $Document = $Factory->document('html');
     $this->assertInstanceOf('Essence\\Dom\\Document', $Document);
 }