Beispiel #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;
 }
Beispiel #2
0
 public function isValid()
 {
     if (!parent::isValid()) {
         return false;
     }
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadString($this->xmlContent);
     $videoElement = $parser->document;
     if (empty($videoElement)) {
         $this->setError(JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR'));
         return false;
     }
     //get vimeo error
     $elementError = $videoElement->getElementByPath('error/message');
     if ($elementError) {
         $vimeoError = $elementError->data();
         $vimeoError = JText::_('COM_COMMUNITY_VIDEOS_FETCHING_VIDEO_ERROR') . ' ' . $vimeoError;
         $this->setError($vimeoError);
         return false;
     }
     //get Video Title
     $element = $videoElement->getElementByPath('video/caption');
     $this->title = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/duration');
     $this->duration = $element->data();
     //Get Video duration
     $element = $videoElement->getElementByPath('video/thumbnail');
     $this->thumbnail = $element->data();
     return true;
 }
Beispiel #3
0
 public function isValid()
 {
     // Connect and get the remote video
     if (!parent::isValid()) {
         return false;
     }
     return true;
 }
Beispiel #4
0
 public function isValid()
 {
     // Connect and get the remote video
     if (!parent::isValid()) {
         return false;
     }
     $pattern = '/property="video:duration"/';
     if (!preg_match($pattern, $this->xmlContent)) {
         return false;
     }
     return true;
 }
Beispiel #5
0
 public function isvalid()
 {
     //@since 4.0 we only support screen.yahoo, not movies.yahoo
     $pattern = "/(screen.yahoo)/";
     $match = preg_match($pattern, $this->url);
     if ($match) {
         parent::isValid();
         return true;
     }
     $this->setError(JText::_('COM_COMMUNITY_VIDEOS_PROVIDER_NOT_SUPPORTED_ERROR'));
     return false;
 }
Beispiel #6
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;
 }
Beispiel #7
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;
 }
Beispiel #8
0
 public function isValid()
 {
     //we remove the support to add
     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_PROVIDER_NOT_SUPPORTED_ERROR';
         $this->setError(JText::_($errormsg));
         return false;
     }
     return true;
 }
Beispiel #9
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;
 }
Beispiel #10
0
 public function isValid()
 {
     // Connect and get the remote video
     if (!parent::isValid()) {
         return false;
     }
     $options['rssUrl'] = $this->getFeedUrl();
     $rssDoc = JFactory::getXMLParser('RSS', $options);
     foreach ($rssDoc->get_items() as $item) {
         $enclosures = $item->get_enclosures();
         $this->duration = $enclosures[0]->get_duration();
         $this->title = $item->get_title();
         $this->description = $item->get_description();
     }
     return true;
 }
Beispiel #11
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;
 }