Ejemplo n.º 1
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     //get vimeo error
     if (strpos($this->xmlContent, 'not found.')) {
         $vimeoError = JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR');
         $this->setError($vimeoError);
         return false;
     }
     $parser = new SimpleXMLElement($this->xmlContent);
     //JFactory::getXMLParser('Simple');
     $videoElement = $parser->video;
     if (empty($videoElement)) {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR'));
         return false;
     }
     //get Video title
     $this->title = (string) $videoElement->title;
     //Get Video duration
     $this->duration = (int) $videoElement->duration;
     //Get Video thumbnail
     $this->thumbnail = (string) $videoElement->thumbnail_large;
     //Get Video description
     $this->description = (string) $videoElement->description;
     return true;
 }
Ejemplo n.º 2
0
 public function isValid()
 {
     // Connect and get the remote video
     if (!parent::isValid()) {
         return false;
     }
     return true;
 }
Ejemplo n.º 3
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     // If video is redirected
     $pattern = "'301 Moved Permanently's";
     if (preg_match_all($pattern, $this->xmlContent, $matches)) {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR'));
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     // Return Break error
     $pattern = "'<span id=\"sitemap404msg\">(.*?)<\\/span>'s";
     preg_match_all($pattern, $this->xmlContent, $matches);
     if (!empty($matches[1][0])) {
         $errormsg = 'COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR' . strip_tags($matches[1][0]);
         $this->setError(JText::_($errormsg));
         return false;
     }
     return true;
 }
Ejemplo n.º 5
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     // Connect and get the remote video
     if ($this->xmlContent == 'Invalid id') {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_INVALID_VIDEO_ID_ERROR'));
         return false;
     }
     if ($this->xmlContent == 'Video not found') {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_YOUTUBE_ERROR'));
         return false;
     }
     return true;
 }
Ejemplo n.º 6
0
 public function isValid()
 {
     // Connect and get the remote video
     if (!parent::isValid()) {
         return false;
     }
     if (class_exists('JFeedFactory')) {
         $feed = new JFeedFactory();
         $rssDoc = $feed->getFeed($this->getFeedUrl());
         $this->title = $rssDoc[0]->title;
         $this->data = $rssDoc[0]->content;
     } else {
         $rssDoc = JFactory::getFeedParser($this->getFeedUrl(), 0);
         foreach ($rssDoc->get_items() as $item) {
             $enclosures = $item->get_enclosures();
             $this->duration = $enclosures[0]->get_duration();
             $this->title = $item->get_title();
             $this->data = $item->get_description();
         }
     }
     return true;
 }
Ejemplo n.º 7
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadString($this->xmlContent);
     $videoElement = $parser->document;
     // Get Video Title
     $element = $videoElement->getElementByPath('videoset/video/title');
     $this->title = $element->data();
     // Get Video description
     $element = $videoElement->getElementByPath('videoset/video/description');
     $this->description = $element ? $element->data() : '';
     // Get Video duration
     if ($videoElement->getElementByPath('videoset/video/runtime') == true) {
         $element = $videoElement->getElementByPath('videoset/video/runtime');
         $this->duration = $element->data();
     }
     // Get Video thumbnail
     $element = $videoElement->getElementByPath('videoset/video/thumbnailurl');
     $this->thumbnail = $element->data();
     return true;
 }