Esempio n. 1
0
 function GrabVideoData($listitem, $vsn, $videoid_optional = '')
 {
     $query_video_host = true;
     //Return Video Data Array separated with commma
     //extract title if it's needed for navigation (thumbnail) or for active video.
     $videoitem = array();
     $customtitle = '';
     $customdescription = '';
     $customimage = '';
     $startsecond = 0;
     $endsecond = 0;
     if (is_array($listitem)) {
         $theLink = trim($listitem[0]);
         if (isset($listitem[1])) {
             $customtitle = $listitem[1];
         }
         if (isset($listitem[2])) {
             $customdescription = $listitem[2];
         }
         if (isset($listitem[3])) {
             $customimage = $listitem[3];
         }
         if (isset($listitem[5])) {
             $startsecond = $listitem[5];
         }
         if (isset($listitem[6])) {
             $endsecond = $listitem[6];
         }
     } else {
         $theLink = $listitem;
     }
     if ($vsn == 'youtube' and !(strpos($theLink, '/embed/') === false)) {
         //Convert Embed links to Address bar version
         $theLink = str_replace('www.youtube.com/embed/', 'youtu.be/', $theLink);
         $theLink = str_replace('youtube.com/embed/', 'youtu.be/', $theLink);
     }
     //echo '$vsn2='.$vsn.'<br/>';
     switch ($vsn) {
         case 'break':
             require_once 'break.php';
             $HTML_SOURCE = '';
             $videoid = VideoSource_Break::extractBreakID($theLink, $HTML_SOURCE);
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Break::getVideoData($videoid, $customimage, $customtitle, $customdescription, $HTML_SOURCE);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'break', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'vimeo':
             require_once 'vimeo.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Vimeo::extractVimeoID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             //echo '$videoid111='.$videoid;
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Vimeo::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'vimeo', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'own3dtvlive':
             require_once 'own3dtvlive.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Own3DTvLive::extractOwn3DTvLiveID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Own3DTvLive::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'own3dtvlive', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'own3dtvvideo':
             require_once 'own3dtvvideo.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Own3DTvVideo::extractOwn3DTvVideoID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Own3DTvVideo::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'own3dtvvideo', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'youtube':
             require_once 'youtube.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Youtube::extractYouTubeID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     if (isset($this->theme_row->thumbnailstyle)) {
                         $theme_row_thumbnailstyle = $this->theme_row->thumbnailstyle;
                     } else {
                         $theme_row_thumbnailstyle = '';
                     }
                     $videoitem = VideoSource_Youtube::getVideoData($videoid, $customimage, $customtitle, $customdescription, $theme_row_thumbnailstyle);
                     $videoitem['link'] = $theLink;
                 } else {
                     if (strpos($customimage, '#') === false) {
                         $customimage_ = $customimage;
                     } else {
                         $customimage_ = '';
                     }
                     $videoitem = array('videosource' => 'youtube', 'videoid' => $videoid, 'imageurl' => $customimage_, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'google':
             require_once 'google.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Google::extractGoogleID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Google::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'google', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'yahoo':
             require_once 'yahoo.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Yahoo::extractYahooID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Yahoo::getVideoData($videoid, $customimage, $customtitle, $customdescription, $theLink);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'yahoo', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'collegehumor':
             require_once 'collegehumor.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_CollegeHumor::extractCollegeHumorID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_CollegeHumor::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'collegehumor', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'dailymotion':
             require_once 'dailymotion.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_DailyMotion::extractDailyMotionID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_DailyMotion::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'dailymotion', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'presentme':
             require_once 'presentme.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_PresentMe::extractPresentMeID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_PresentMe::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'presentme', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case 'ustream':
             require_once 'ustream.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_Ustream::extractUstreamID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_Ustream::getVideoData($videoid, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => 'ustream', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             break;
         case '.flv':
             require_once 'flv.php';
             if ($videoid_optional == '') {
                 $videoid = VideoSource_FLV::extractFLVID($theLink);
             } else {
                 $videoid = $videoid_optional;
             }
             if ($videoid != '') {
                 if ($query_video_host) {
                     $videoitem = VideoSource_FLV::getVideoData($videoid, $theLink, $customimage, $customtitle, $customdescription);
                     $videoitem['link'] = $theLink;
                 } else {
                     $videoitem = array('videosource' => '.flv', 'videoid' => $videoid, 'imageurl' => $customimage, 'title' => $customtitle, 'description' => $customdescription, 'link' => $theLink);
                 }
             }
             //print_r($videoitem);
             //die;
             break;
     }
     //switch($vsn)
     $videoitem['custom_title'] = $customtitle;
     $videoitem['custom_description'] = $customdescription;
     $videoitem['custom_imageurl'] = $customimage;
     $videoitem['startsecond'] = $startsecond;
     $videoitem['endsecond'] = $endsecond;
     return $videoitem;
 }