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 plgYoutubeGallery(&$text_original, $byId) { require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $text = plgContentYoutubeGallery::strip_html_tags_textarea($text_original); $options = array(); if ($byId) { $fList = plgContentYoutubeGallery::getListToReplace('youtubegalleryid', $options, $text); } else { $fList = plgContentYoutubeGallery::getListToReplace('youtubegallery', $options, $text); } if (count($fList) == 0) { return 0; } require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'render.php'; $errorreporting = (bool) YouTubeGalleryMisc::getSettingValue('errorreporting'); if ($errorreporting) { error_reporting(E_ALL); } else { error_reporting(0); } for ($i = 0; $i < count($fList); $i++) { $replaceWith = plgContentYoutubeGallery::getYoutubeGallery($options[$i], $i, $byId); $text_original = str_replace($fList[$i], $replaceWith, $text_original); } return count($fList); }
public static function getVideoData($videoid, $customimage, $customtitle, $customdescription, $thumbnailcssstyle, $getinfomethod) { //onBehalfOfContentOwner //blank array $blankArray = array('videosource' => 'youtube', 'videoid' => $videoid, 'imageurl' => '', 'title' => '', 'description' => '', 'publisheddate' => '', 'duration' => 0, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => 0, 'statistics_viewCount' => 0, 'keywords' => '', 'likes' => 0, 'dislikes' => '', 'commentcount' => '', 'channel_username' => '', 'channel_title' => '', 'channel_subscribers' => 0, 'channel_subscribed' => 0, 'channel_location' => '', 'channel_commentcount' => 0, 'channel_viewcount' => 0, 'channel_videocount' => 0, 'channel_description' => ''); $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key'); if ($api_key != '') { $answer = VideoSource_YouTube::getYouTubeVideoData_API_v3($videoid, $blankArray, $getinfomethod, $api_key); } else { $answer = VideoSource_YouTube::getYouTubeVideoData_API_v2($videoid, $blankArray, $getinfomethod); } if ($answer != '') { $blankArray['title'] = '***Video not found*** (' . YouTubeGalleryMisc::html2txt($answer) . ')'; $blankArray['description'] = YouTubeGalleryMisc::html2txt($answer); return $blankArray; } if ($customtitle != '') { $blankArray['title'] = $customtitle; } if ($customdescription != '') { $blankArray['description'] = $customdescription; } if ($customimage != '' and strpos($customimage, '#') === false) { $blankArray['imageurl'] = $customimage; } else { if ($blankArray['imageurl'] == '') { $blankArray['imageurl'] = VideoSource_YouTube::getYouTubeImageURL($videoid, $thumbnailcssstyle); } } return $blankArray; }
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($youtubeURL, $optionalparameters, &$playlistid, &$datalink) { $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key'); if ($api_key == '') { return array(); } $playlistid = VideoSource_YoutubePlaylist::extractYouTubePlayListID($youtubeURL); $videolist = VideoSource_YoutubePlaylist::getPlaylistVideos($playlistid, $datalink, $api_key, $optionalparameters); return $videolist; }
public static function getVideoData($videoid, $customimage, $customtitle, $customdescription) { //blank array $blankArray = array('videosource' => 'soundcloud', 'videoid' => $videoid, 'imageurl' => '', 'title' => '', 'description' => '', 'publisheddate' => '', 'duration' => 0, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => 0, 'statistics_viewCount' => 0, 'keywords' => '', 'likes' => 0, 'dislikes' => '', 'commentcount' => '', 'channel_username' => '', 'channel_title' => '', 'channel_subscribers' => 0, 'channel_subscribed' => 0, 'channel_location' => '', 'channel_commentcount' => 0, 'channel_viewcount' => 0, 'channel_videocount' => 0, 'channel_description' => ''); $theTitle = ''; $Description = ''; $theImage = ''; require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $client_id = YouTubeGalleryMisc::getSettingValue('soundcloud_api_client_id'); //$consumer_secret = YouTubeGalleryMisc::getSettingValue('soundcloud_api_client_secret'); $url = 'http://api.soundcloud.com/tracks/' . $videoid . '.json?client_id=' . $client_id; //echo '$url='.$url.'<br/>'; $HTML_SOURCE = YouTubeGalleryMisc::getURLData($url); if ($HTML_SOURCE == '') { $blankArray['title'] = '***Video not found***'; $blankArray['description'] = ''; return $blankArray; } //----------------------------------------------------------------------------------------------- $strPart = '{"kind":"track","id":'; $strPartLength = strlen($strPart); $test = substr($HTML_SOURCE, 0, $strPartLength); if ($test != $strPart) { $blankArray['title'] = '***Cannot Connect to SoundCloud Server***'; $blankArray['description'] = 'Check your API Client ID (go to Setting).'; return $blankArray; } $obj = json_decode($HTML_SOURCE); $blankArray['title'] = $obj->title; $blankArray['description'] = $obj->description; $blankArray['publisheddate'] = $obj->created_at; $blankArray['duration'] = floor($obj->duration / 1000); $blankArray['keywords'] = $obj->tag_list; $blankArray['statistics_viewCount'] = $obj->playback_count; $blankArray['statistics_favoriteCount'] = $obj->favoritings_count; $blankArray['commentcount'] = $obj->comment_count; $blankArray['imageurl'] = $obj->artwork_url; $u = $obj->user; $blankArray['channel_username'] = $u->username; $blankArray['channel_title'] = $u->username; if ($customtitle != '') { $blankArray['title'] = $customtitle; } if ($customdescription != '') { $blankArray['description'] = $customdescription; } if ($customimage != '' and strpos($customimage, '#') === false) { $blankArray['imageurl'] = $customimage; } return $blankArray; }
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; }
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; }
function RefreshPlayist($cids, $update_videolist = true) { $where = array(); foreach ($cids as $cid) { $where[] = 'id=' . $cid; } require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; // Create a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Select some fields $query->select('*'); // From the Youtube Gallery table $query->from('#__youtubegallery_videolists'); if (count($where) > 0) { $query->where(implode(' OR ', $where)); } $db->setQuery($query); if (!$db->query()) { die($db->stderr()); } $linksform_rows = $db->loadObjectList(); if (count($linksform_rows) < 1) { return false; } $misc = new YouTubeGalleryMisc(); $getinfomethod = YouTubeGalleryMisc::getSettingValue('getinfomethod'); foreach ($linksform_rows as $linksform_row) { $misc->videolist_row = $linksform_row; $misc->update_cache_table($linksform_row, $update_videolist); //false - refresh if (!$update_videolist) { $query = 'UPDATE #__youtubegallery_videolists SET `lastplaylistupdate`="' . date('Y-m-d H:i:s') . '" WHERE `id`=' . $linksform_row->id; $db->setQuery($query); if (!$db->query()) { die($db->stderr()); } if ($getinfomethod == 'js' or $getinfomethod == 'jsmanual') { $query = 'UPDATE #__youtubegallery_videos SET `lastupdate`="0000-00-00 00:00:00", `rawdata`="*youtubegallery_request*" WHERE `isvideo` AND `listid`=' . $linksform_row->id; } else { $query = 'UPDATE #__youtubegallery_videos SET `lastupdate`="0000-00-00 00:00:00", `rawdata`="" WHERE `isvideo` AND `listid`=' . $linksform_row->id; } $db->setQuery($query); if (!$db->query()) { die($db->stderr()); } } } return true; }
public static function getVideoIDList($youtubeURL, $optionalparameters, &$playlistid, &$datalink) { $optionalparameters_arr = explode(',', $optionalparameters); $videolist = array(); $base_url = 'https://www.googleapis.com/youtube/v3'; $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key'); if ($api_key == '') { return $videolist; } $spq = implode('&', $optionalparameters_arr); $keywords = VideoSource_YoutubeSearch::extractYouTubeSearchKeywords($youtubeURL); if ($keywords == '') { return $videolist; } //WRONG LINK id not found $part = 'id,snippet'; $spq = str_replace('max-results', 'maxResults', $spq); $datalink = $base_url . '/search?q=' . urlencode($keywords) . '&part=' . $part . '&key=' . $api_key . ($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 . '/search?q=' . urlencode($keywords) . '&part=' . $part . '&key=' . $api_key . ($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#searchResult') { $s = $item->id; 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 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; $getinfomethod = YouTubeGalleryMisc::getSettingValue('getinfomethod'); $misc->RefreshVideoData($gallery_list, $getinfomethod); $tr = 0; $count = 0; $bgcolor = $theme_row->bgcolor; $item_index = 1; foreach ($gallery_list as $listitem) { if (strpos($listitem['title'], '***Video not found***') === false) { if ($getinfomethod == 'js') { $thumbnail_item = 'updater'; 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++; } else { $aLinkURL = ''; if ($theme_row->openinnewwindow == 4 or $theme_row->openinnewwindow == 5) { //$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 and $theme_row->openinnewwindow != 5) { $aLink .= '&tmpl=component'; } if ($theme_row->hrefaddon != '' and $theme_row->openinnewwindow != 4 and $theme_row->openinnewwindow != 5) { $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 and $theme_row->openinnewwindow != 5) { if (strpos($aLink, '&') === false) { $aLink = str_replace('&', '&', $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, $item_index, $gallery_list); 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++; } } $item_index++; } } if ($tr > 0) { $catalogresult .= '<td style="border:none;" colspan="' . ($number_of_columns - $tr) . '"> </td></tr>'; } $catalogresult .= '</tbody> </table> '; return $catalogresult; }
<hr/> <p>When you finish you get Client ID and Secret information. Paste it into fields below:<br/></p> <p> Client ID (Also known as Consumer Key or API Key):<br/> <input name="vimeo_api_client_id" style="width:400px;" value="<?php 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> <input type="hidden" name="task" value="" /> <?php echo JHtml::_('form.token'); ?> </form>
/** * Get the message * @return actual youtube galley code */ public function getYoutubeGalleryCode() { require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $errorreporting = (bool) YouTubeGalleryMisc::getSettingValue('errorreporting'); if ($errorreporting) { error_reporting(E_ALL); } else { error_reporting(0); } jimport('joomla.version'); $version = new JVersion(); $JoomlaVersionRelease = $version->RELEASE; $result = ''; $app = JFactory::getApplication(); $params = $app->getParams(); if (!isset($this->youtubegallerycode)) { if (JRequest::getInt('listid')) { //Shadow Box $listid = (int) JRequest::getInt('listid'); //Get Theme $m_themeid = (int) JRequest::getInt('mobilethemeid'); if ($m_themeid != 0) { if (YouTubeGalleryMisc::check_user_agent('mobile')) { $themeid = $m_themeid; } else { $themeid = (int) JRequest::getInt('themeid'); } } else { $themeid = (int) JRequest::getInt('themeid'); } } else { $listid = (int) $params->get('listid'); //Get Theme $m_themeid = (int) $params->get('mobilethemeid'); if ($m_themeid != 0) { if (YouTubeGalleryMisc::check_user_agent('mobile')) { $themeid = $m_themeid; } else { $themeid = (int) $params->get('themeid'); } } else { $themeid = (int) $params->get('themeid'); } } if ($listid != 0 and $themeid != 0) { $videoid = JRequest::getCmd('videoid'); require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'render.php'; $misc = new YouTubeGalleryMisc(); if (!$misc->getVideoListTableRow($listid)) { return '<p>No video found</p>'; } if (!$misc->getThemeTableRow($themeid)) { return '<p>No video found</p>'; } $renderer = new YouTubeGalleryRenderer(); $total_number_of_rows = 0; $misc->update_playlist(); if ($misc->theme_row->playvideo == 1 and $videoid != '') { $misc->theme_row->autoplay = 1; } $videoid_new = $videoid; $videolist = $misc->getVideoList_FromCache_From_Table($videoid_new, $total_number_of_rows); if ($videoid == '') { if ($videoid_new != '') { JRequest::setVar('videoid', $videoid_new); } if ($misc->theme_row->playvideo == 1 and $videoid_new != '') { $videoid = $videoid_new; } } $gallerymodule = $renderer->render($videolist, $misc->videolist_row, $misc->theme_row, $total_number_of_rows, $videoid); $align = $params->get('align'); switch ($align) { case 'left': $this->youtubegallerycode = '<div style="float:left;">' . $gallerymodule . '</div>'; break; case 'center': if ((int) $misc->theme_row->width > 0) { $this->youtubegallerycode = '<div style="width:' . $misc->theme_row->width . 'px;margin: 0 auto;">' . $gallerymodule . '</div>'; } else { $this->youtubegallerycode = $gallerymodule; } break; case 'right': $this->youtubegallerycode = '<div style="float:right;">' . $gallerymodule . '</div>'; break; default: $this->youtubegallerycode = $gallerymodule; break; } } elseif ($listid == 0 and $themeid != 0) { $this->youtubegallerycode = '<p>Youtube Gallery: List not selected.</p>'; } elseif ($themeid == 0 and $listid != 0) { $this->youtubegallerycode = '<p>Youtube Gallery: Theme not selected.</p>'; } else { $this->youtubegallerycode = '<p>Youtube Gallery: List and Theme not selected.</p>'; } } if ($params->get('allowcontentplugins')) { $o = new stdClass(); $o->text = $this->youtubegallerycode; $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $r = $dispatcher->trigger('onContentPrepare', array('com_content.article', &$o, &$params_, 0)); $this->youtubegallerycode = $o->text; } $result .= $this->youtubegallerycode; return $result; }
public static function getURLData($url) { $getinfomethod = YouTubeGalleryMisc::getSettingValue('getinfomethod'); if ($getinfomethod == 'js' or $getinfomethod == 'jsmanual') { $db = JFactory::getDBO(); $query = 'SELECT `rawdata` FROM `#__youtubegallery_videos` WHERE INSTR(`datalink`,"' . $url . '") LIMIT 1'; $db->setQuery($query); if (!$db->query()) { die($db->stderr()); } $values = $db->loadAssocList(); if (count($values) == 1) { $v = $values[0]; $rd = $v['rawdata']; if ($rd != '' and $rd != '*youtubegallery_request*') { return $rd; } } return ''; } else { $htmlcode = ''; if (function_exists('curl_init')) { $ch = curl_init(); $timeout = 150; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $htmlcode = curl_exec($ch); curl_close($ch); } elseif (ini_get('allow_url_fopen') == true) { $htmlcode = file_get_contents($url); } else { echo '<p style="color:red;">Cannot load data, enable "allow_url_fopen" or install cURL<br/> <a href="http://joomlaboat.com/youtube-gallery/f-a-q/why-i-see-allow-url-fopen-message" target="_blank">Here</a> is what to do. </p> '; } return $htmlcode; } }
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 getVideoData($videoid, $customimage, $customtitle, $customdescription) { $theTitle = ''; $Description = ''; $theImage = ''; //-------------- 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 array('videosource' => 'vimeo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => 'Vimeo API Key not set. (YoutubeGallery/Settings)', 'description' => 'It\'s important to apply for your own API key.'); } //-------------- require_once 'vimeo_api.php'; if (!isset($_SESSION)) { session_start(); } if (isset($_SESSION['oauth_access_token'])) { $oauth_access_token = $_SESSION['oauth_access_token']; } else { $oauth_access_token = ''; } if (isset($_SESSION['oauth_access_token_secret'])) { $oauth_access_token_secret = $_SESSION['oauth_access_token_secret']; } else { $oauth_access_token_secret = ''; } $vimeo = new phpVimeo($consumer_key, $consumer_secret, $oauth_access_token, $oauth_access_token_secret); $params = array(); $params['video_id'] = $videoid; $video_info = $vimeo->call('videos.getInfo', $params); if (isset($video_info)) { if (!$video_info) { return array('videosource' => 'vimeo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => '***Video not found***', 'description' => 'Video not Found or Permission Denied.'); } if ($customimage != '') { $theImage = $customimage; } else { $theImage = $video_info->video[0]->thumbnails->thumbnail[1]->_content; } if ($customtitle == '') { $theTitle = $video_info->video[0]->title; } else { $theTitle = $customtitle; } if ($customdescription == '') { $Description = $video_info->video[0]->description; } else { $Description = $customdescription; } $keywords = array(); if (isset($video_info->video[0]->tags->tag)) { foreach ($video_info->video[0]->tags->tag as $tag) { $keywords[] = $tag->_content; } } return array('videosource' => 'vimeo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => $theTitle, 'description' => $Description, 'publisheddate' => $video_info->video[0]->upload_date, 'duration' => $video_info->video[0]->duration, 'rating_average' => 0, 'rating_max' => 0, 'rating_min' => 0, 'rating_numRaters' => 0, 'statistics_favoriteCount' => $video_info->video[0]->number_of_likes, 'statistics_viewCount' => $video_info->video[0]->number_of_plays, 'keywords' => implode(',', $keywords)); } else { return array('videosource' => 'vimeo', 'videoid' => $videoid, 'imageurl' => $theImage, 'title' => '***Video not found***', 'description' => $Description); } }
<?php /** * Youtube Gallery Joomla! Module * @version 4.3.6 * @author Ivan Komlev< <*****@*****.**> * @link http://www.joomlaboat.com * @GNU General Public License **/ defined('_JEXEC') or die('Restricted access'); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'render.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $errorreporting = (bool) YouTubeGalleryMisc::getSettingValue('errorreporting'); if ($errorreporting) { error_reporting(E_ALL); } else { error_reporting(0); } $listid = (int) $params->get('listid'); //Get Theme if (YouTubeGalleryMisc::check_user_agent('mobile')) { //Use Mobile Theme if set. $themeid = (int) $params->get('mobilethemeid'); if ($themeid == 0) { $themeid = (int) $params->get('themeid'); } } else { $themeid = (int) $params->get('themeid');
<?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>'); ?>
if (!ini_get('allow_url_fopen') or !ini_get('allow_url_include')) { echo '<div style="margin-bottom:10px;padding:3px;border: 1px solid red; "><p style="color:red;font-weight:bold;">PHP configuration: "allow_url_fopen" and "allow_url_include" should be "On" </p>'; echo ' <p>In order to let Youtube Gallery to request list of videos and/or information about videos from Youtube servers "allow_url_fopen" and "allow_url_include" should be enabled. <br/> To do this modify your main php.ini file or create a new file named "php.ini" with lines below:<br/><br/> <span style="color:green;">allow_url_fopen=on<br/> allow_url_include=on</span><br/> <br/> Upload it to your website root and administrator folders. Or contact your hosting provider to enable this functionality. <br/> <i>These settings maybe disabled for security reasons. If you are concern about it, enabled them temporary to get videos and disable again.</i> </p></div>'; } require_once JPATH_SITE . DS . 'components' . DS . 'com_youtubegallery' . DS . 'includes' . DS . 'misc.php'; $api_key = YouTubeGalleryMisc::getSettingValue('youtube_api_key'); if ($api_key == "") { echo '<div style="margin-bottom:10px;padding:3px;border: 1px solid red; "><p style="color:red;font-weight:bold;">Since April 2015 Youtube requires that you have you own API Key.</p>'; echo ' <p>Please click <a href="http://www.joomlaboat.com/youtube-gallery/f-a-q/why-i-see-allow-url-fopen-message?cbprofile=2" target="_blank">here</a> for step by step guide.</p> <p>When you get your own Youtube API Key add it to Youtube Gallery <a href="/administrator/index.php?option=com_youtubegallery&view=settings&layout=edit">Settings</a> page<br/> <i><span style="color:green;">Refresh video list and clear Joomla cache after that.</span></i> </p> </div>'; } if (!_is_curl_installed()) { echo '<div style="margin-bottom:10px;padding:3px;border: 1px solid red; "> <p style="font-weight:bold;">cURL is NOT <span style="color:red">installed</span> on this server.</p> </div>'; } if (!class_exists("DOMDocument")) {