Beispiel #1
1
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription)
 {
     $theTitle = '';
     $Description = '';
     $theImage = '';
     //if($firstvideo=='')
     //$firstvideo=$videoid;
     $XML_SOURCE = '';
     if ($customimage != '') {
         $theImage = $customimage;
     } else {
         if (ini_get('allow_url_fopen')) {
             $XML_SOURCE = YouTubeGalleryMisc::getURLData('http://video.google.com/videofeed?docid=' . $videoid);
             $match = array();
             preg_match("/media:thumbnail url=\"([^\"]\\S*)\"/siU", $XML_SOURCE, $match);
             $theImage = $match[1];
         }
         //if(ini_get('allow_url_fopen'))
     }
     //if($customimage!='')
     $theTitle = 'Google Video';
     if ($customtitle != '') {
         $theTitle = $customtitle;
     }
     if ($customdescription != '') {
         $Description = $customdescription;
     }
     return array('videosource' => 'google', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description);
 }
Beispiel #2
0
 function __construct()
 {
     $DEVELOPER_KEY = YouTubeGalleryMisc::getSettingValue('youtube_public_api');
     $this->client = new Google_Client();
     $this->client->setDeveloperKey($DEVELOPER_KEY);
     $this->youtube = new Google_Service_YouTube($this->client);
 }
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$userid)
 {
     $optionalparameters_arr = explode(',', $optionalparameters);
     $videolist = array();
     $spq = implode('&', $optionalparameters_arr);
     $userid = VideoSource_YoutubeUserFavorites::extractYouTubeUserID($youtubeURL);
     if ($userid == '') {
         return $videolist;
     }
     //user id not found
     $url = 'http://gdata.youtube.com/feeds/api/users/' . $userid . '/favorites?v=2' . ($spq != '' ? '&' . $spq : '');
     //&max-results=10
     $xml = false;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     if (strpos($htmlcode, '<?xml version') === false) {
         if (strpos($htmlcode, 'Invalid id') === false) {
             return 'Cannot load data, Invalid id';
         }
         return 'Cannot load data, no connection';
     }
     $xml = simplexml_load_string($htmlcode);
     if ($xml) {
         foreach ($xml->entry as $entry) {
             $attr = $entry->link[0]->attributes();
             if (isset($entry->link[0]) && $attr['rel'] == 'alternate') {
                 $videolist[] = $attr['href'];
             } else {
                 $attr = $entry->link[1]->attributes();
                 $videolist[] = $attr['href'];
             }
         }
     }
     return $videolist;
 }
Beispiel #4
0
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription)
 {
     $theTitle = '';
     $Description = '';
     $theImage = '';
     $Url = 'https://api.present.me/v1/oEmbed?url=https://https://present.me/view/' . $videoid . '&amp;format=json';
     $HTML_SOURCE = YouTubeGalleryMisc::getURLData($Url);
     if ($HTML_SOURCE != '' and $HTML_SOURCE[0] == '{') {
         $streamData = json_decode($HTML_SOURCE);
         if ($customimage == '') {
             $theImage = $streamData->thumbnail_url;
         } else {
             $theImage = $customimage;
         }
         if ($customtitle == '') {
             $theTitle = $streamData->title;
         } else {
             $theTitle = $customtitle;
         }
         if ($customdescription == '') {
             $Description = '';
         } else {
             $Description = $customdescription;
         }
         $videodata = array('videosource' => 'presentme', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description, 'publisheddate' => '', 'duration' => 0, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => 0, 'statistics_viewCount' => 0, 'keywords' => '', 'channel_username' => $streamData->provider_name, 'channel_title' => $streamData->author_name);
         //print_r($videodata);
         //die;
         return $videodata;
     } else {
         return array('videosource' => 'collegehumor', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => '***Video not found***', 'description' => $Description);
     }
 }
Beispiel #5
0
function YouTubeGalleryBuildRoute(&$query)
{
    $segments = array();
    if (isset($query['view'])) {
        if (empty($query['Itemid'])) {
            $segments[] = $query['view'];
        }
        unset($query['view']);
    }
    if (isset($query['video'])) {
        $segments[] = $query['video'];
        unset($query['video']);
    } elseif (isset($query['videoid'])) {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
        $allowsef = YouTubeGalleryMisc::getSettingValue('allowsef');
        if ($allowsef == 1) {
            $videoid = $query['videoid'];
            $db = JFactory::getDBO();
            $db->setQuery('SELECT `alias` FROM `#__youtubegallery_videos` WHERE `videoid`="' . $videoid . '" LIMIT 1');
            if (!$db->query()) {
                die('yg router.php 1 err:' . $db->stderr());
            }
            $rows = $db->loadObjectList();
            if (count($rows) != 0) {
                $row = $rows[0];
                if ($row->alias != '') {
                    $segments[] = $row->alias;
                }
                unset($query['videoid']);
            }
        }
    }
    return $segments;
}
 public static function getVideoIDList($URL, $optionalparameters, &$playlistid, &$datalink)
 {
     //https://api.dailymotion.com/playlist/xy4h8/videos
     $videolist = array();
     $playlistid = VideoSource_DailymotionPlaylist::extractDailymotionPlayListID($URL);
     if ($playlistid == '') {
         return $videolist;
     }
     //playlist id not found
     $apiurl = 'https://api.dailymotion.com/playlist/' . $playlistid . '/videos';
     $datalink = $apiurl;
     $htmlcode = YouTubeGalleryMisc::getURLData($apiurl);
     if ($htmlcode == '') {
         return $videolist;
     }
     if (!isset($htmlcode) or $htmlcode == '' or $htmlcode[0] != '{') {
         return 'Cannot load data, no connection or access denied';
     }
     $streamData = json_decode($htmlcode);
     foreach ($streamData->list as $entry) {
         $videolist[] = 'http://www.dailymotion.com/playlist/' . $entry->id;
         //http://www.dailymotion.com/playlist/x1crql_BigCatRescue_funny-action-big-cats/1#video=x986zk
         //$media = $entry->children('http://search.yahoo.com/mrss/');
         //$link = $media->group->player->attributes();
         //if(isset($link))
         //{
         //	if(isset($link['url']))
         //	{
         ///		$videolist[] = $link['url'];
         //	}
         //}//if(isset($link)
     }
     //foreach ($xml->entry as $entry)
     return $videolist;
 }
Beispiel #7
0
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription)
 {
     $theTitle = '';
     $Description = '';
     $theImage = '';
     $videodata = array();
     if (phpversion() < 5) {
         return "Update to PHP 5+";
     }
     try {
         $url = 'http://api.own3d.tv/rest/video/list.xml?videoid=' . $videoid;
         $htmlcode = YouTubeGalleryMisc::getURLData($url);
         if (strpos($htmlcode, '<?xml version') === false) {
             $pair = array('Invalid id', 'Invalid id', '', '0', '0', '0', '0', '0', '0', '0', '');
             return $pair;
         }
         $doc = new DOMDocument();
         $doc->loadXML($htmlcode);
         $video_thumb_file_small = 'http://owned.vo.llnwd.net/v1/static/static/images/thumbnails/tn_' . $videoid . '__1.jpg';
         $videodata = array('videosource' => 'own3dtvvideo', 'videoid' => $videoid, 'imageurl' => $video_thumb_file_small, 'title' => $doc->getElementsByTagName("video_name")->item(0)->nodeValue, 'description' => $doc->getElementsByTagName("video_description")->item(0)->nodeValue, 'publisheddate' => "", 'duration' => $doc->getElementsByTagName("video_duration")->item(0)->nodeValue, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => 0, 'statistics_viewCount' => $doc->getElementsByTagName("video_views_total")->item(0)->nodeValue, 'keywords' => '');
         return $videodata;
     } catch (Exception $e) {
         return 'cannot get youtube video data';
     }
     return array('videosource' => 'own3dtvvideo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description);
 }
Beispiel #8
0
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription)
 {
     $theTitle = '';
     $Description = '';
     $theImage = '';
     $HTML_SOURCE = YouTubeGalleryMisc::getURLData('http://www.collegehumor.com/video/' . $videoid);
     $strPart = '<meta name="og:image" content="';
     $strPartLength = strlen($strPart);
     $p1 = strpos($HTML_SOURCE, $strPart);
     if ($p1 > 0) {
         $p2 = strpos($HTML_SOURCE, '"', $p1 + $strPartLength);
         $theImage = substr($HTML_SOURCE, $p1 + $strPartLength, $p2 - $p1 - $strPartLength);
         $theImage = str_replace('\\', '', $theImage);
     }
     if ($theImage == '') {
         return array('videosource' => 'collegehumor', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => '***Video not found***', 'description' => $Description);
     }
     if ($customimage != '') {
         $theImage = $customimage;
     }
     if ($customtitle == '') {
         if (ini_get('allow_url_fopen')) {
             $theTitle = 'CollegeHumor';
             $strPart = '<meta name="og:title" content="';
             $strPartLength = strlen($strPart);
             $p1 = strpos($HTML_SOURCE, $strPart);
             if ($p1 > 0) {
                 $p2 = strpos($HTML_SOURCE, '"', $p1 + $strPartLength);
                 $theTitle = substr($HTML_SOURCE, $p1 + $strPartLength, $p2 - $p1 - $strPartLength);
             }
         }
         //if(ini_get('allow_url_fopen'))
     } else {
         $theTitle = $customtitle;
     }
     if ($customdescription == '') {
         if (ini_get('allow_url_fopen')) {
             $Description = 'CollegeHumor';
             $strPart = '<meta name="description" content="';
             $strPartLength = strlen($strPart);
             $p1 = strpos($HTML_SOURCE, $strPart);
             if ($p1 > 0) {
                 $p2 = strpos($HTML_SOURCE, '"', $p1 + $strPartLength);
                 $Description = substr($HTML_SOURCE, $p1 + $strPartLength, $p2 - $p1 - $strPartLength);
             }
         }
         //if(ini_get('allow_url_fopen'))
     } else {
         $Description = $customdescription;
     }
     return array('videosource' => 'collegehumor', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description);
 }
Beispiel #9
0
 public static function extractBreakID($theLink, &$HTML_SOURCE)
 {
     if ($HTML_SOURCE == '') {
         $HTML_SOURCE = YouTubeGalleryMisc::getURLData($theLink);
     }
     $ActualLink = VideoSource_Break::getValueByAlmostTag($HTML_SOURCE, '<meta name="embed_video_url" content="');
     preg_match('/break.com\\/(\\d+)$/', $ActualLink, $matches);
     if (count($matches) != 0) {
         $video_id = $matches[1];
         return $video_id;
     }
     return '';
 }
 public static function extractYouTubePlayListID($youtubeURL)
 {
     $arr = YouTubeGalleryMisc::parse_query($youtubeURL);
     $p = $arr['list'];
     if (strlen($p) < 3) {
         return '';
     }
     if (substr($p, 0, 2) != 'PL') {
         return '';
     }
     //incorrect playlist ID
     return substr($p, 2);
     //return without leading "PL"
 }
Beispiel #11
0
 public static function getVideoIDList($vimeo_user_link, $optionalparameters, &$userid)
 {
     $videolist = array();
     $optionalparameters_arr = explode(',', $optionalparameters);
     $album_id = VideoSource_VimeoAlbum::extractVimeoAlbumID($vimeo_user_link);
     //-------------- prepare our Consumer Key and Secret
     require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
     $consumer_key = YouTubeGalleryMisc::getSettingValue('vimeo_api_client_id');
     $consumer_secret = YouTubeGalleryMisc::getSettingValue('vimeo_api_client_secret');
     if ($consumer_key == '' or $consumer_secret == '') {
         return $videolist;
     }
     //--------------
     require_once 'vimeo_api.php';
     if (!isset($_SESSION)) {
         session_start();
     }
     if (isset($_SESSION['oauth_access_token'])) {
         $s_oauth_access_token = $_SESSION['oauth_access_token'];
     } else {
         $s_oauth_access_token = '';
     }
     if (isset($_SESSION['oauth_access_token_secret'])) {
         $s_oauth_access_token_secret = $_SESSION['oauth_access_token_secret'];
     } else {
         $s_oauth_access_token_secret = '';
     }
     $vimeo = new phpVimeo($consumer_key, $consumer_secret, $s_oauth_access_token, $s_oauth_access_token_secret);
     //echo '$album_id='.$album_id.'<br/>';;
     $params = array();
     $params['album_id'] = $album_id;
     foreach ($optionalparameters_arr as $p) {
         $pair = explode('=', $p);
         if ($pair[0] == 'page') {
             $params['page'] = (int) $pair[1];
         }
         if ($pair[0] == 'per_page') {
             $params['per_page'] = (int) $pair[1];
         }
     }
     $videos = $vimeo->call('vimeo.albums.getVideos', $params);
     //print_r($videos);
     foreach ($videos->videos->video as $video) {
         $videolist[] = 'http://vimeo.com/' . $video->id;
     }
     //print_r($videolist);
     //die;
     return $videolist;
 }
Beispiel #12
0
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription, $theLink)
 {
     echo '<!-- ';
     $theTitle = '';
     $Description = '';
     $theImage = '';
     $XML_SOURCE = YouTubeGalleryMisc::getURLData('http://video.yahoo.com/services/oembed?url=' . $theLink);
     if ($customimage == '') {
         $p1 = strpos($XML_SOURCE, 'thumbUrl=');
         if ($p1 > 0) {
             $p2 = strpos($XML_SOURCE, '.jpg', $p1);
             $theImage = substr($XML_SOURCE, $p1 + 9, $p2 - $p1 - 9 + 4);
             $theImage = str_replace('\\', '', $theImage);
         }
     } else {
         $theImage = $customimage;
     }
     if ($customtitle == '') {
         if (ini_get('allow_url_fopen')) {
             $theTitle = 'Yahoo Video';
             $p1 = strpos($XML_SOURCE, '"title":"');
             if ($p1 > 0) {
                 $p2 = strpos($XML_SOURCE, '"', $p1 + 9);
                 $theTitle = substr($XML_SOURCE, $p1 + 9, $p2 - $p1 - 9);
             }
         }
         //if(ini_get('allow_url_fopen'))
     } else {
         $theTitle = $customtitle;
     }
     if ($customdescription == '') {
         if (ini_get('allow_url_fopen')) {
             $Description = 'Yahoo Video';
             $p1 = strpos($XML_SOURCE, '"description":"');
             if ($p1 > 0) {
                 $p2 = strpos($XML_SOURCE, '"', $p1 + 9);
                 $Description = substr($XML_SOURCE, $p1 + 9, $p2 - $p1 - 9);
             }
         }
         //if(ini_get('allow_url_fopen'))
     } else {
         $Description = $customdescription;
     }
     echo ' -->';
     return array('videosource' => 'yahoo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description);
 }
Beispiel #13
0
 public static function extractYouTubeSearchKeywords($youtubeURL)
 {
     //http://www.youtube.com/results?search_query=%22dogs+101%22&oq=%22dogs+101%22&gs_l=youtube.3..0l10.16119.16453.0.17975.2.2.0.0.0.0.330.649.3-2.2.0...0.0...1ac.1.GQ5tbo9Q0Cg
     $arr = YouTubeGalleryMisc::parse_query($youtubeURL);
     $p = urldecode($arr['search_query']);
     if (!isset($p) or $p == '') {
         return '';
     }
     //incorrect Link
     //echo $p;
     //die;
     $keywords = str_replace('"', '', $p);
     $keywords = str_replace('+', ' ', $keywords);
     $keywords = str_replace(' ', ',', $keywords);
     //$keywords=str_replace(',','%2C',$keywords);
     return $keywords;
 }
 public static function getVideoIDList($URL, $optionalparameters, &$playlistid)
 {
     //https://api.dailymotion.com/playlist/xy4h8/videos
     //$optionalparameters_arr=explode(',',$optionalparameters);
     //$videolist=array();
     //$spq=implode('&',$optionalparameters_arr);
     $videolist = array();
     $playlistid = VideoSource_DailymotionPlaylist::extractDailymotionPlayListID($URL);
     if ($playlistid == '') {
         return $videolist;
     }
     //playlist id not found
     //echo '$playlistid='.$playlistid.'<br/>';
     $apiurl = 'https://api.dailymotion.com/playlist/' . $playlistid . '/videos';
     //$apiurl = 'https://api.dailymotion.com/playlist/xy4h8/videos';
     //echo '$apiurl ='.$apiurl .'<br/>';
     //$xml=false;
     $htmlcode = YouTubeGalleryMisc::getURLData($apiurl);
     //echo '$htmlcode='.$htmlcode.'<br/>';
     //die;
     if (!isset($htmlcode) or $htmlcode == '' or $htmlcode[0] != '{') {
         //if(strpos($htmlcode,'Invalid id')===false)
         //	return 'Cannot load data, Invalid id';
         return 'Cannot load data, no connection or access denied';
     }
     $streamData = json_decode($htmlcode);
     //                print_r($streamData );
     foreach ($streamData->list as $entry) {
         //print_r($entry);
         $videolist[] = 'http://www.dailymotion.com/playlist/' . $entry->id;
         //http://www.dailymotion.com/playlist/x1crql_BigCatRescue_funny-action-big-cats/1#video=x986zk
         //$media = $entry->children('http://search.yahoo.com/mrss/');
         //$link = $media->group->player->attributes();
         //if(isset($link))
         //{
         //	if(isset($link['url']))
         //	{
         ///		$videolist[] = $link['url'];
         //	}
         //}//if(isset($link)
     }
     //foreach ($xml->entry as $entry)
     //print_r($videolist);
     //die;
     return $videolist;
 }
 public static function getUserInfo($youtubeURL, &$item)
 {
     $userid = VideoSource_YoutubeUserUploads::extractYouTubeUserID($youtubeURL);
     if ($userid == '') {
         return 'user id not found';
     }
     $url = 'http://gdata.youtube.com/feeds/api/users/' . $userid;
     $xml = false;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     if (strpos($htmlcode, '<?xml version') === false) {
         if (strpos($htmlcode, 'Invalid id') === false) {
             return 'Cannot load data, Invalid id';
         }
         return 'Cannot load data, no connection';
     }
     echo '$htmlcode=' . $htmlcode . '<br/>';
     //die;
     $doc = new DOMDocument();
     $doc->loadXML($htmlcode);
     $item['channel_username'] = $doc->getElementsByTagName("username")->item(0)->nodeValue;
     $item['channel_title'] = $doc->getElementsByTagName("title")->item(0)->nodeValue;
     $item['channel_description'] = $doc->getElementsByTagName("content")->item(0)->nodeValue;
     $item['channel_location'] = $doc->getElementsByTagName("location")->item(0)->nodeValue;
     $feedLink = $doc->getElementsByTagName("feedLink");
     if ($feedLink->length > 0) {
         foreach ($feedLink as $fe) {
             $rel = $fe->getAttribute("rel");
             if (!(strpos($rel, '#user.subscriptions') === false)) {
                 $item['channel_subscribed'] = $fe->getAttribute("countHint");
             }
             if (!(strpos($rel, '#user.contacts') === false)) {
                 $item['channel_commentcount'] = $fe->getAttribute("countHint");
             }
             if (!(strpos($rel, '#user.uploads') === false)) {
                 $item['channel_videocount'] = $fe->getAttribute("countHint");
             }
         }
     }
     $statistics = $doc->getElementsByTagName("statistics");
     $se = $statistics->item(0);
     $item['channel_subscribers'] = $se->getAttribute("subscriberCount");
     $item['channel_viewcount'] = $se->getAttribute("viewCount");
     $item['channel_totaluploadviews'] = $se->getAttribute("totalUploadViews");
     return '';
 }
Beispiel #16
0
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid)
 {
     $optionalparameters_arr = explode(',', $optionalparameters);
     $videolist = array();
     $spq = implode('&', $optionalparameters_arr);
     $videolist = array();
     $keywords = VideoSource_YoutubeSearch::extractYouTubeSearchKeywords($youtubeURL);
     //echo '$keywords='.$keywords.'<br/>';
     //die;
     if ($keywords == '') {
         return $videolist;
     }
     //WRONG LINK id not found
     $url = 'https://gdata.youtube.com/feeds/api/videos?q=' . urlencode($keywords) . '&v=2&' . $spq;
     $xml = false;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     //print_r($htmlcode);
     //die;
     if (strpos($htmlcode, '<?xml version') === false) {
         if (strpos($htmlcode, 'Invalid id') === false) {
             return 'Cannot load data, Invalid id';
         }
         return 'Cannot load data, no connection';
     }
     $xml = simplexml_load_string($htmlcode);
     //print_r($xml);
     //die;
     if ($xml) {
         foreach ($xml->entry as $entry) {
             $media = $entry->children('http://search.yahoo.com/mrss/');
             $link = $media->group->player->attributes();
             if (isset($link)) {
                 if (isset($link['url'])) {
                     $videolist[] = $link['url'];
                 }
             }
             //if(isset($link)
         }
         //foreach ($xml->entry as $entry)
     }
     //if($xml){
     //print_r($videolist);
     //die;
     return $videolist;
 }
 public static function getVideoData($videoid, $customimage, $customtitle, $customdescription)
 {
     $theTitle = '';
     $Description = '';
     $theImage = '';
     $videodata = array();
     if (phpversion() < 5) {
         return "Update to PHP 5+";
     }
     try {
         $url = 'http://api.own3d.tv/rest/live/list.json?liveid=' . $videoid;
         $htmlcode = YouTubeGalleryMisc::getURLData($url);
         if (strpos($htmlcode, '[{"') === false) {
             $pair = array('Invalid id', 'Invalid id', '', '0', '0', '0', '0', '0', '0', '0', '');
             return $pair;
         }
         $streamData = json_decode($htmlcode);
         $p = explode('/', $streamData[0]->thumbnail_small);
         if (count($p) < 5) {
             $video_thumb_file_small = '';
         } else {
             $video_thumb_file_small = 'http://owned.vo.llnwd.net/e2/live/' . $p[count($p) - 1];
         }
         $videodata = array('videosource' => 'own3dtvlive', 'videoid' => $videoid, 'imageurl' => $video_thumb_file_small, 'title' => $streamData[0]->live_name, 'description' => $streamData[0]->live_description, 'publisheddate' => $streamData[0]->live_since, 'duration' => 0, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => 0, 'statistics_viewCount' => $streamData[0]->live_viewers, 'keywords' => '');
         $url_live_status = 'http://api.own3d.tv/liveCheck.php?live_id=' . $videoid;
         $htmlcode = YouTubeGalleryMisc::getURLData($url_live_status);
         if (strpos($htmlcode, '<?xml version') === false) {
             $videodata['description'] .= 'Cannot get Live Status';
             return $videodata;
         }
         $doc = new DOMDocument();
         $doc->loadXML($htmlcode);
         $isLive = $doc->getElementsByTagName("isLive")->item(0)->nodeValue;
         $liveViewers = $doc->getElementsByTagName("liveViewers")->item(0)->nodeValue;
         $liveDuration = $doc->getElementsByTagName("liveDuration")->item(0)->nodeValue;
         $videodata['statistics_viewCount'] = $liveViewers;
         $videodata['duration'] = $liveDuration;
         return $videodata;
     } catch (Exception $e) {
         //$description='cannot get youtibe video data';
         return 'cannot get youtube video data';
     }
     return array('videosource' => 'own3dtvlive', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description);
 }
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$userid, &$datalink)
 {
     $videolist = array();
     $base_url = 'https://www.googleapis.com/youtube/v3';
     $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key');
     if ($api_key == '') {
         return $videolist;
     }
     $userid = VideoSource_YoutubeUserFavorites::extractYouTubeUserID($youtubeURL);
     if ($userid == '') {
         return $videolist;
     }
     //user id not found
     //------------- step 1 get user favorites plylist id
     $part = 'contentDetails';
     $url = $base_url . '/channels?forUsername='******'&key=' . $api_key . '&part=' . $part;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     //echo '$htmlcode='.$htmlcode.'</br>';
     if ($htmlcode == '') {
         return $videolist;
     }
     $j = json_decode($htmlcode);
     if (!$j) {
         return 'Connection Error';
     }
     $items = $j->items;
     $playlistid = '';
     if (isset($items[0]->contentDetails->relatedPlaylists->uploads)) {
         $playlistid = $items[0]->contentDetails->relatedPlaylists->favorites;
         if ($playlistid == '') {
             return $videolist;
         }
         //user not found or no files uploaded
     }
     //echo '$playlistid='.$playlistid.'</br>';
     // ----------------------- step 2 - get videos
     $videolist = VideoSource_YoutubePlaylist::getPlaylistVideos($playlistid, $datalink, $api_key, $optionalparameters);
     //print_r($videolist);
     //die;
     return $videolist;
 }
Beispiel #19
0
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid)
 {
     $optionalparameters_arr = explode(',', $optionalparameters);
     $videolist = array();
     $spq = implode('&', $optionalparameters_arr);
     $videolist = array();
     $playlistid = VideoSource_YoutubePlaylist::extractYouTubePlayListID($youtubeURL);
     if ($playlistid == '') {
         return $videolist;
     }
     //playlist id not found
     $url = 'http://gdata.youtube.com/feeds/api/playlists/' . $playlistid . ($spq != '' ? '?' . $spq : '');
     //&max-results=10;
     $xml = false;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     if (strpos($htmlcode, '<?xml version') === false) {
         if (strpos($htmlcode, 'Invalid id') === false) {
             return 'Cannot load data, Invalid id';
         }
         return 'Cannot load data, no connection';
     }
     $xml = simplexml_load_string($htmlcode);
     if ($xml) {
         foreach ($xml->entry as $entry) {
             $media = $entry->children('http://search.yahoo.com/mrss/');
             $link = $media->group->player->attributes();
             if (isset($link)) {
                 if (isset($link['url'])) {
                     $videolist[] = $link['url'];
                 }
             }
             //if(isset($link)
         }
         //foreach ($xml->entry as $entry)
     }
     //if($xml){
     return $videolist;
 }
    public static function ClassicNavTable($the_gallery_list, $width, $number_of_columns, &$videolist_row, &$theme_row, $AllowPagination, $videoid, $custom_itemid = 0)
    {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
        $misc = new YouTubeGalleryMisc();
        $misc->videolist_row = $videolist_row;
        $misc->theme_row = $theme_row;
        if ($theme_row->prepareheadtags > 0) {
            $curPageUrl = YoutubeGalleryLayoutRenderer::curPageURL();
            $document = JFactory::getDocument();
        }
        $catalogresult = '';
        $paginationcode = '';
        $w_str = 'width:' . $width . (strpos($width, '%') === false ? 'px' : '') . ';';
        $catalogresult .= '<table cellspacing="0" ' . ($theme_row->navbarstyle != '' ? 'style="' . $w_str . 'padding:0;border:none;' . $theme_row->navbarstyle . '" ' : 'style="' . $w_str . 'padding:0;border:none;margin:0 auto;"') . '>
		<tbody>';
        $column_width = floor(100 / $number_of_columns) . '%';
        $gallery_list = $the_gallery_list;
        $misc->RefreshVideoData($gallery_list);
        $tr = 0;
        $count = 0;
        foreach ($gallery_list as $listitem) {
            $bgcolor = $theme_row->bgcolor;
            /////////////////
            $aLinkURL = '';
            if ($theme_row->openinnewwindow == 4) {
                //$title=str_replace('"','ygdoublequote',$listitem['title']);
                //$description=str_replace('"','ygdoublequote',$listitem['description']);
                //$title=str_replace('\'','ygsinglequote',$title);
                //$description=str_replace('\'','ygsinglequote',$description);
                //$aLink='javascript:YoutubeGalleryHotVideoSwitch'.$videolist_row->id.'(\''.$listitem['videoid'].'\',\''.$listitem['videosource'].'\',\''.$title.'\',\''.$description.'\')';
                $aLink = 'javascript:YoutubeGalleryHotVideoSwitch' . $videolist_row->id . '(\'' . $listitem['videoid'] . '\',\'' . $listitem['videosource'] . '\',' . $listitem['id'] . ')';
            } else {
                $aLink = YoutubeGalleryLayoutRenderer::makeLink($listitem, $theme_row->rel, $aLinkURL, $videolist_row->id, $theme_row->id, $custom_itemid);
            }
            $isForShadowBox = false;
            if (isset($theme_row)) {
                if ($theme_row->rel != '') {
                    $isForShadowBox = true;
                }
            }
            if ($isForShadowBox and $theme_row->rel != '' and $theme_row->openinnewwindow != 4) {
                $aLink .= '&tmpl=component';
            }
            if ($theme_row->hrefaddon != '' and $theme_row->openinnewwindow != 4) {
                $hrefaddon = str_replace('?', '', $theme_row->hrefaddon);
                if ($hrefaddon[0] == '&') {
                    $hrefaddon = substr($hrefaddon, 1);
                }
                if (strpos($aLink, $hrefaddon) === false) {
                    if (strpos($aLink, '?') === false) {
                        $aLink .= '?';
                    } else {
                        $aLink .= '&';
                    }
                    $aLink .= $hrefaddon;
                }
            }
            if ($theme_row->openinnewwindow != 4) {
                if (strpos($aLink, '&amp;') === false) {
                    $aLink = str_replace('&', '&amp;', $aLink);
                }
                $aLink = $aLink . (($theme_row->openinnewwindow == 2 or $theme_row->openinnewwindow == 3) ? '#youtubegallery' : '');
            }
            //to apply shadowbox
            //do not route the link
            $aHrefLink = '<a href="' . $aLink . '"' . ($theme_row->rel != '' ? ' rel="' . $theme_row->rel . '"' : '') . (($theme_row->openinnewwindow == 1 or $theme_row->openinnewwindow == 3) ? ' target="_blank"' : '') . '>';
            $thumbnail_item = YoutubeGalleryLayoutRenderer::renderThumbnailForNavBar($aHrefLink, $aLink, $videolist_row, $theme_row, $listitem, $videoid);
            if ($thumbnail_item != '') {
                if ($tr == 0) {
                    $catalogresult .= '<tr style="border:none;" >';
                }
                $catalogresult .= '<td style="width:' . $column_width . ';vertical-align:top;text-align:center;border:none;' . ($bgcolor != '' ? ' background-color: #' . $bgcolor . ';' : '') . '">' . $thumbnail_item . '</td>';
                $tr++;
                if ($tr == $number_of_columns) {
                    $catalogresult .= '
							</tr>
						';
                    if ($count + 1 < count($gallery_list)) {
                        $catalogresult .= '
							<tr style="border:none;"><td colspan="' . $number_of_columns . '" style="border:none;" ><hr' . ($theme_row->linestyle != '' ? ' style="' . $theme_row->linestyle . '" ' : '') . ' /></td></tr>';
                    }
                    $tr = 0;
                }
                $count++;
            }
        }
        if ($tr > 0) {
            $catalogresult .= '<td style="border:none;" colspan="' . ($number_of_columns - $tr) . '">&nbsp;</td></tr>';
        }
        $catalogresult .= '</tbody>
	   
    </table>
	
	';
        return $catalogresult;
    }
Beispiel #21
0
 public static function renderUstreamPlayer($options, $width, $height, &$videolist_row, &$theme_row)
 {
     //http://www.dailymotion.com/doc/api/player.html
     $videoidkeyword = '****youtubegallery-video-id****';
     $playerid = 'youtubegalleryplayerid_' . $videolist_row->id;
     $settings = array();
     //$settings[]=array('autoplay',(int)$options['autoplay']);
     //$settings[]=array('related',$options['relatedvideos']);
     //$settings[]=array('controls',$options['controls']);
     //if($theme_row->logocover)
     //	$settings[]=array('logo','0');
     //else
     //	$settings[]=array('logo','1');
     if ($options['color1'] != '') {
         $settings[] = array('ub', $options['color1']);
         $settings[] = array('lc', $options['color1']);
     }
     if ($options['color2'] != '') {
         $settings[] = array('oc', $options['color2']);
         $settings[] = array('uc', $options['color2']);
     }
     $settings[] = array('info', $options['showinfo']);
     $settings[] = array('wmode', 'direct');
     YouTubeGalleryMisc::ApplyPlayerParameters($settings, $options['youtubeparams']);
     $settingline = YouTubeGalleryMisc::CreateParamLine($settings);
     $result = '';
     $result .= '<iframe ' . ' id="' . $playerid . '"';
     if (isset($options['title'])) {
         $result .= ' alt="' . $options['title'] . '"';
     }
     $result .= ' frameborder="0" width="' . $width . '" height="' . $height . '" src="http://www.ustream.tv/embed/recorded/' . $videoidkeyword . '?' . $settingline . '"' . ($theme_row->responsive == 1 ? ' onLoad="YoutubeGalleryAutoResizePlayer' . $videolist_row->id . '();"' : '') . ' scrolling="no" style="border: 0px none transparent;"></iframe>';
     return $result;
 }
 public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid, &$datalink)
 {
     $linkPair = explode(':', $youtubeURL);
     if (!isset($linkPair[1])) {
         return array();
     }
     $url = '';
     $playlistid = $linkPair[1];
     switch ($linkPair[1]) {
         case 'top_rated':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_rated';
             break;
         case 'top_favorites':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/top_favorites';
             break;
         case 'most_viewed':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed';
             break;
         case 'most_shared':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_shared';
             break;
         case 'most_popular':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_popular';
             break;
         case 'most_recent':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_recent';
             break;
         case 'most_discussed':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_discussed';
             break;
         case 'most_responded':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/most_responded';
             break;
         case 'recently_featured':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured';
             break;
         case 'on_the_web':
             $url = 'https://gdata.youtube.com/feeds/api/standardfeeds/on_the_web';
             break;
         default:
             return array();
             break;
     }
     $datalink = $url;
     $optionalparameters_arr = explode(',', $optionalparameters);
     $videolist = array();
     $spq = implode('&', $optionalparameters_arr);
     $spq = str_replace('max-results', 'maxResults', $spq);
     $url .= $spq != '' ? '?' . $spq : '';
     $xml = false;
     $htmlcode = YouTubeGalleryMisc::getURLData($url);
     if ($htmlcode == '') {
         return $videolist;
     }
     if (strpos($htmlcode, '<?xml version') === false) {
         if (strpos($htmlcode, 'Invalid id') === false) {
             return 'Cannot load data, Invalid id';
         }
         return 'Cannot load data, no connection';
     }
     $xml = simplexml_load_string($htmlcode);
     if ($xml) {
         foreach ($xml->entry as $entry) {
             /*
             if(isset($entry->link[0]))
             {
             	$link=$entry->link[0];
             	$attr = $link->attributes();
             	
             	$videolist[] = $attr['href'];
             }
             */
             //
             $media = $entry->children('http://search.yahoo.com/mrss/');
             $link = $media->group->player->attributes();
             if (isset($link['url'])) {
                 $videolist[] = $link['url'];
             }
             //
         }
     }
     return $videolist;
 }
Beispiel #23
0
 public static function renderDailyMotionPlayer($options, $width, $height, &$videolist_row, &$theme_row)
 {
     //http://www.dailymotion.com/doc/api/player.html
     $videoidkeyword = '****youtubegallery-video-id****';
     $title = '';
     if (isset($options['title'])) {
         $title = $options['title'];
     }
     $playerid = 'youtubegalleryplayerid_' . $videolist_row->id;
     $settings = array();
     $settings[] = array('autoplay', (int) $options['autoplay']);
     $settings[] = array('related', $options['relatedvideos']);
     $settings[] = array('controls', $options['controls']);
     if ($theme_row->logocover) {
         $settings[] = array('logo', '0');
     } else {
         $settings[] = array('logo', '1');
     }
     if ($options['color1'] != '') {
         $settings[] = array('foreground', $options['color1']);
     }
     if ($options['color2'] != '') {
         $settings[] = array('highlight', $options['color2']);
     }
     $settings[] = array('info', $options['showinfo']);
     YouTubeGalleryMisc::ApplyPlayerParameters($settings, $options['youtubeparams']);
     $settingline = YouTubeGalleryMisc::CreateParamLine($settings);
     $result = '';
     //echo '$videoidkeyword='.$videoidkeyword.'<br/>';
     $result .= '<iframe ' . ' id="' . $playerid . '"' . ' alt="' . $title . '"' . ' frameborder="0" width="' . $width . '" height="' . $height . '" src="http://www.dailymotion.com/embed/video/' . $videoidkeyword . '?' . $settingline . '"' . ($theme_row->responsive == 1 ? ' onLoad="YoutubeGalleryAutoResizePlayer' . $videolist_row->id . '();"' : '') . '></iframe>';
     return $result;
 }
Beispiel #24
0
echo YouTubeGalleryMisc::getSettingValue('vimeo_api_client_id');
?>
" />
				</p>
				
				<p>
				Client Secret (Also known as Consumer Secret or API Secret):<br/>
				<input name="vimeo_api_client_secret" style="width:400px;" value="<?php 
echo YouTubeGalleryMisc::getSettingValue('vimeo_api_client_secret');
?>
" />
				</p>
				
				<p>
				Youtube Public API:<br/>
				<input name="youtube_public_api" style="width:400px;" value="<?php 
echo YouTubeGalleryMisc::getSettingValue('youtube_public_api');
?>
" />
				</p>
				
				
                <input type="hidden" name="task" value="" />

				
                <?php 
echo JHtml::_('form.token');
?>

</form>
 public static function getPlaylistVideos($playlistid, &$datalink, $api_key, $optionalparameters)
 {
     $base_url = 'https://www.googleapis.com/youtube/v3';
     $videolist = array();
     if ($playlistid == '') {
         return $videolist;
     }
     //playlist id not found
     $part = 'id,snippet';
     $optionalparameters_arr = explode(',', $optionalparameters);
     $spq = implode('&', $optionalparameters_arr);
     $spq = str_replace('max-results', 'maxResults', $spq);
     //API 2 -> API 3 conversion
     $datalink = $base_url . '/playlistItems?part=' . $part . '&key=' . $api_key . '&playlistId=' . $playlistid . ($spq != '' ? '&' . $spq : '');
     $opt = "";
     $count = YouTubeGalleryMisc::getMaxResults($spq, $opt);
     if ($count < 1) {
         $maxResults = 1;
     } elseif ($count > 50) {
         $maxResults = 50;
     } else {
         $maxResults = $count;
     }
     $videos_found = 0;
     $nextPageToken = '';
     while ($videos_found < $count) {
         $newspq = str_replace($opt, 'maxResults=' . $maxResults, $spq);
         $url = $base_url . '/playlistItems?part=' . $part . '&key=' . $api_key . '&playlistId=' . $playlistid . ($newspq != '' ? '&' . $newspq : '');
         if ($nextPageToken != '') {
             $url .= '&pageToken=' . $nextPageToken;
         }
         $htmlcode = YouTubeGalleryMisc::getURLData($url);
         if ($htmlcode == '') {
             return $videolist;
         }
         $j = json_decode($htmlcode);
         if (!$j) {
             return 'Connection Error';
         }
         $nextPageToken = $j->nextPageToken;
         $pageinfo = $j->pageInfo;
         if ($pageinfo->totalResults < $count) {
             $count = $pageinfo->totalResults;
         }
         $items = $j->items;
         if (count($items) < $maxResults) {
             $maxResults = count($items);
         }
         foreach ($items as $item) {
             if ($item->kind == 'youtube#playlistItem') {
                 $s = $item->snippet->resourceId;
                 if ($s->kind == 'youtube#video') {
                     $videoId = $s->videoId;
                     $videolist[] = 'https://www.youtube.com/watch?v=' . $videoId;
                 }
             }
         }
         $videos_found += $maxResults;
         if ($count - $videos_found < 50) {
             $maxResults = $count - $videos_found;
         }
     }
     return $videolist;
 }
    public static function SocialButtons($link, $prefix, $params, $videolist_row_id, $videoid)
    {
        $pair = explode(',', $params);
        $w = 80;
        if (isset($pair[2])) {
            $w = (int) $pair[2];
        }
        switch ($pair[0]) {
            case 'facebook_comments':
                $head_result = '

<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=624599437567869";
  fjs.parentNode.insertBefore(js, fjs);
}(document, \'script\', \'facebook-jssdk\'));

document.write(\'<div id="fb-root"></div>\');
</script>
';
                $document = JFactory::getDocument();
                $document->addCustomTag($head_result);
                //ini_set('display_startup_errors',1);
                //ini_set('display_errors',1);
                //error_reporting(E_ALL|E_STRICT);
                //jimport( 'joomla.environment.response' );
                //prependBody("a");
                //jimport( 'joomla.environment.response' );
                //JFactory::getApplication()->getBody(true);
                //$app                = JFactory::getApplication();
                //$app->getBody();
                //$body = JResponse::getBody();
                //echo '*'.1.'*';
                //$app->appendBody('test***');
                $numposts = '3';
                if (isset($pair[1])) {
                    $numposts = (int) $pair[1];
                }
                $width = '';
                //style="width:auto !important;"';
                if (isset($pair[2])) {
                    $width = 'data-width="' . (int) $pair[2] . 'px"';
                }
                $colorscheme = 'light';
                if (isset($pair[3])) {
                    $colorscheme = $pair[3];
                }
                if ($link == '' or $link = 'window.location.href') {
                    $link = YouTubeGalleryMisc::full_url($_SERVER);
                }
                //$_SERVER['HTTP_REFERER'];
                $result = '<div class="fb-comments" data-href="' . $link . '" data-num-posts="' . $numposts . '" ' . $width . ' data-colorscheme="' . $colorscheme . '"></div>';
                return $result;
                break;
                //------------------------------------------------------------------------------------------------------------
            //------------------------------------------------------------------------------------------------------------
            case 'facebook_share':
                $bName = 'Share Link';
                if (isset($pair[1])) {
                    $bName = $pair[1];
                }
                $dName = $prefix . 'fbshare_' . $videolist_row_id . 'x' . $videoid;
                $tStyle = 'width:' . $w . 'px;height:20px;border: 1px #29447e solid;background-color:#5972a7;color:white;font-size:12px;font-weight:bold;text-align:center;position:relative;';
                $tStyle2 = 'border-top:#8a9cc2 1px solid;width:' . ($w - 2) . 'px;height:18px;padding:0px;font-decoration:none;';
                $result = '
	<div id="' . $dName . '"></div>
	<script>
		var theURL=escape(' . $link . ');
		
		var fbobj=document.getElementById("' . $dName . '");
		var sBody=\'<a href="https://www.facebook.com/sharer/sharer.php?u=\'+theURL+\'" target="_blank" style="color:white;"><div style="' . $tStyle . '"><div style="' . $tStyle2 . '">' . $bName . '</div>\';
		sBody+=\'<div style="position:absolute;bottom:0;left:0;margin-bottom:-2px;width:' . $w . 'px;height:1px;border-bottom:1px solid #e5e5e5;"></div>\';
		sBody+=\'</div></a>\';
	        fbobj.innerHTML = sBody;
	</script>
	';
                return $result;
                break;
                //------------------------------------------------------------------------------------------------------------
            //------------------------------------------------------------------------------------------------------------
            case 'facebook_like':
                $FBLanguage = '';
                if (isset($pair[1])) {
                    $FBLanguage = $pair[1];
                }
                $dName = $prefix . 'fblike_' . $videolist_row_id . 'x' . $videoid;
                $result = '
	<div id="' . $dName . '" style="width:' . $w . 'px;"></div>
	<script>
		var theURL=escape(' . $link . ');
		var fbobj=document.getElementById("' . $dName . '");
		var sBody=\'<iframe src="http://www.facebook.com/plugins/like.php?href=\';
		sBody+=theURL;
		sBody+=\'&layout=button_count&locale=' . $FBLanguage . '&show_faces=false&action=like&font=tahoma&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; height:20px" ></iframe>\';
	        fbobj.innerHTML = sBody;
	</script>
	';
                return $result;
                break;
                //------------------------------------------------------------------------------------------------------------
            //------------------------------------------------------------------------------------------------------------
            case 'twitter':
                $TwitterAccount = '';
                //"YoutubeGallery";
                if (isset($pair[1])) {
                    $TwitterAccount = $pair[1];
                } else {
                    return '<p style="color:white;background-color:red;">Set Twitter Account.<br/>Example: [social:twitter,JoomlaBoat]</p>';
                }
                $dName = $prefix . 'witter_' . $videolist_row_id . 'x' . $videoid;
                $result = '
	<div id="' . $dName . '" style="width:' . $w . 'px;"></div>
	<script>
		var theURL=escape(' . $link . ');
		var twobj=document.getElementById("' . $dName . '");
		var TwBody=\'<a href="https://twitter.com/share" class="twitter-share-button" data-url="\'+theURL+\'" data-via="' . $TwitterAccount . '" data-hashtags="\'+theURL+\'">Tweet</a>\';
		twobj.innerHTML = TwBody;
		!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
	</script>
	';
                return $result;
                break;
                //------------------------------------------------------------------------------------------------------------
                //case '':
                //break;
        }
    }
Beispiel #27
0
<?php

/**
 * YoutubeGallery Joomla! 3.0 Native Component
 * @version 4.3.6
 * @author Ivan Komlev< <*****@*****.**>
 * @link http://www.joomlaboat.com
 * @GNU General Public License
 **/
// No direct access
defined('_JEXEC') or die('Restricted access');
//$document = JFactory::getDocument();
//$document->addCustomTag('<script src="http://code.jquery.com/jquery-1.10.2.js"></script>');
require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
$client_id = YouTubeGalleryMisc::getSettingValue('soundcloud_api_client_id');
$getinfomethod = YouTubeGalleryMisc::getSettingValue('getinfomethod');
$document = JFactory::getDocument();
$document->addCustomTag('
<script>
				function YGGetSoundCloudClientID()
				{
								return "' . $client_id . '";
				}
				function YGGetInfoMethod()
				{
								return "' . $getinfomethod . '";
				}
</script>');
?>

Beispiel #28
0
    define('DS', DIRECTORY_SEPARATOR);
}
$videoid = JRequest::getVar('videoid');
if (isset($_POST['ygvdata'])) {
    $video_data = $_POST['ygvdata'];
    require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
    $video_data = str_replace('"', '\\"', $video_data);
    YouTubeGalleryMisc::setRawData($videoid, $video_data);
    $db = JFactory::getDBO();
    $query = 'SELECT * FROM `#__youtubegallery_videos` WHERE `videoid`="' . $videoid . '"';
    $db->setQuery($query);
    if (!$db->query()) {
        die($db->stderr());
    }
    $videos_rows = $db->loadAssocList();
    $misc = new YouTubeGalleryMisc();
    $getinfomethod = YouTubeGalleryMisc::getSettingValue('getinfomethod');
    $misc->RefreshVideoData($videos_rows, $getinfomethod, true);
    $query = 'SELECT * FROM `#__youtubegallery_videos` WHERE `videoid`="' . $videoid . '"';
    $db->setQuery($query);
    if (!$db->query()) {
        die($db->stderr());
    }
    $videos_rows = $db->loadAssocList();
    if (count($videos_rows) != 0) {
        $row = $videos_rows[0];
        echo '*title_start*=' . $row['title'] . '*title_end*';
        echo '*description_start*=' . $row['description'] . '*description_end*';
        echo '*lastupdate_start*=' . $row['lastupdate'] . '*lastupdate_end*';
    } else {
        echo '*status_start*=video not found*status_end*';
Beispiel #29
0
    function store()
    {
        $linksform_row = $this->getTable('videolists');
        // consume the post data with allow_html
        $data_ = JRequest::get('post', JREQUEST_ALLOWRAW);
        $data = $data_['jform'];
        $post = array();
        $listname = trim(preg_replace("/[^a-zA-Z0-9_]/", "", $data['listname']));
        $data['jform']['listname'] = $listname;
        if (!$linksform_row->bind($data)) {
            echo 'Cannot bind.';
            return false;
        }
        // Make sure the  record is valid
        if (!$linksform_row->check()) {
            echo 'Cannot check.';
            return false;
        }
        if ($linksform_row->id != 0) {
            require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php';
            $misc = new YouTubeGalleryMisc();
            $misc->videolist_row = $linksform_row;
            $misc->update_cache_table($linksform_row);
            $linksform_row->lastplaylistupdate = date('Y-m-d H:i:s');
        }
        // Store
        if (!$linksform_row->store()) {
            echo '<p>Cannot store.</p>
				<p>There is some fields missing.</p>
				';
            return false;
        }
        $this->id = $linksform_row->id;
        return true;
    }
 public static function renderPlayer($options, $width, $height, &$videolist_row, &$theme_row)
 {
     $videoidkeyword = '****youtubegallery-video-id****';
     $playerid = 'youtubegalleryplayerid_' . $videolist_row->id;
     $settings = array();
     //$settings[]=array('loop',(int)$options['repeat']);
     $settings[] = array('auto_play', (int) $options['autoplay'] ? 'true' : 'false');
     $settings[] = array('hide_related', (int) $options['relatedvideos'] ? 'false' : 'true');
     if ($options['showinfo'] == 0) {
         $settings[] = array('show_artwork', false);
         $settings[] = array('visual', false);
     } else {
         $settings[] = array('show_artwork', true);
         $settings[] = array('visual', true);
     }
     YouTubeGalleryMisc::ApplyPlayerParameters($settings, $options['youtubeparams']);
     $settingline = YouTubeGalleryMisc::CreateParamLine($settings);
     $result = '';
     $title = '';
     if (isset($options['title'])) {
         $title = $options['title'];
     }
     if (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") {
         $http = 'https://';
     } else {
         $http = 'http://';
     }
     $data = $http . 'w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/' . $videoidkeyword . '&amp;' . $settingline;
     //<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/22890406&amp;auto_play=false&amp;hide_related=false&amp;visual=true"></iframe>
     //<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/22890406&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_artwork=true"></iframe>
     $result .= '<iframe src="' . $data . '"' . ' id="' . $playerid . '"' . ' width="' . $width . '"' . ' height="' . $height . '"' . ' alt="' . $title . '"' . ' frameborder="' . ((int) $options['border'] == 1 ? 'yes' : 'no') . '"' . ($theme_row->responsive == 1 ? ' onLoad="YoutubeGalleryAutoResizePlayer' . $videolist_row->id . '();"' : '') . '>' . '</iframe>';
     return $result;
 }