Пример #1
0
 public function getEmbedUrl()
 {
     //return false;
     if ($videoId = $this->getVideoId()) {
         $oembed = new oembed();
         $oembed->setApi('http://www.wat.tv/interface/oembed/xml');
         $oembed->setFormat('xml');
         $oembed->setUrl($this->getUrl());
         if ($oembed->getType() == 'video') {
             //echo ' Type: video';
             if ($src = $oembed->getEmbedSrc()) {
                 //echo ' Src: '.$src;
                 return $src;
             }
         }
     }
     return false;
 }
 public function getEmbedUrl()
 {
     //return false;
     $domain = $this->getDomainName();
     $regexp = $this->_masks[$domain];
     $regexp = preg_quote($regexp, '#');
     $regexp = str_replace('\\*', '.*', $regexp);
     $regexp = str_replace('http\\://.*\\.', 'http\\://(.*\\.)?', $regexp);
     $regexp = '#' . $regexp . '#ims';
     //echo $regexp;
     if (preg_match($regexp, $this->getUrl())) {
         $oembed = new oembed();
         $oembed->setApi('http://oohembed.com/oohembed/');
         $oembed->setFormat('json');
         $oembed->setUrl($this->getUrl());
         if ($oembed->getType() == 'video') {
             //echo ' Type: video';
             if ($src = $oembed->getEmbedSrc()) {
                 //echo ' Src: '.$src;
                 return $src;
             }
         }
     }
     return false;
 }