/** * Function to display * recent ,feature ,category, popular, * random, user and search pages * * @parem $type * @parem $arguments */ function video_more_pages($type, $arguments) { $TypeOFvideos = $CountOFVideos = $typename = $type_name = $morePage = $dataLimit = $div = $pagenum = ''; /** Check homeVideo function is exists */ if (!function_exists('homeVideo')) { if ($type == 'search' || $type == 'categories' || $type == '') { /** Get details for serach and videomore page */ $this->getSearchCategoryVideos($type); } else { /** Get details for other more pages */ $moreResult = $this->getTypeOfVideos($type, $arguments); } if (!empty($moreResult) && isset($moreResult)) { $TypeOFvideos = $moreResult[0]; $CountOFVideos = $moreResult[1]; $typename = $moreResult[2]; $type_name = $moreResult[3]; $morePage = $moreResult[4]; $dataLimit = $moreResult[5]; } if (isset($arguments['cols'])) { $colF = $arguments['cols']; } else { $colF = $this->_colF; } $div = '<div class="video_wrapper" id="' . $type_name . '_video"> <style type="text/css"> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important; } </style>'; /** Call function to display more video page title */ $div .= $this->morePageTitle($type_name, $typename); if (!empty($TypeOFvideos)) { $userId = get_current_user_id(); $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable); $pagenum = absint($this->_pagenum) ? absint($this->_pagenum) : 1; $videolist = 0; foreach ($TypeOFvideos as $video) { $vidF[$videolist] = $video->vid; $nameF[$videolist] = $video->name; $hitcount[$videolist] = $video->hitcount; $ratecount[$videolist] = $video->ratecount; $rate[$videolist] = $video->rate; $duration[$videolist] = $video->duration; $file_type = $video->file_type; $guid[$videolist] = get_video_permalink($video->slug); $imageFea[$videolist] = getImagesValue($video->image, $file_type, $video->amazon_buckets, ''); if (!empty($this->_playid)) { $fetched[$videolist] = $video->playlist_name; $fetched_pslug[$videolist] = $video->playlist_slugname; $playlist_id[$videolist] = absint($this->_playid); } else { $getPlaylist = $this->_wpdb->get_row('SELECT playlist_id FROM ' . $this->_wpdb->prefix . 'hdflvvideoshare_med2play WHERE media_id="' . intval($vidF[$videolist]) . '"'); if (isset($getPlaylist->playlist_id)) { $playlist_id[$videolist] = $getPlaylist->playlist_id; $fetPlay[$videolist] = playlistDetails($playlist_id[$videolist]); $fetched[$videolist] = $fetPlay[$videolist]->playlist_name; $fetched_pslug[$videolist] = $fetPlay[$videolist]->playlist_slugname; } } $videolist++; } $div .= '<div> <ul class="video-block-container">'; /** Display thumbnails starts */ for ($videolist = 0; $videolist < count($TypeOFvideos); $videolist++) { $videoId = $TypeOFvideos[$videolist]->vid; $playlistImg = APPTHA_VGALLERY_BASEURL . 'images/playlist.png'; if (in_array($videoId, $watchLaterVideoIds)) { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/accepted.png'; $watchLaterTitle = 'Added to Watch Later'; $clickEvent = ''; } else { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/watchlater2.png'; $watchLaterTitle = 'Add to Watch Later'; $clickEvent = 'onclick="watchLater(' . $videoId . ',this)"'; } if ($videolist % $colF == 0 && $videolist != 0) { $div .= '</ul><div class="clear"></div><ul class="video-block-container">'; } /** Display thumb and duration */ $div .= '<li class="video-block"> <div class="video-thumbimg"><a href="' . $guid[$videolist] . '" title="' . $nameF[$videolist] . '"><img src="' . $imageFea[$videolist] . '" alt="' . $nameF[$videolist] . '" class="imgHome" title="' . $nameF[$videolist] . '" /></a>'; if (!empty($duration[$videolist]) && $duration[$videolist] != '0:00') { $div .= '<span class="video_duration">' . $duration[$videolist] . '</span>'; } $div .= '<span class="watchlaterIcon" ' . $clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $watchLaterImg . '" title="' . $watchLaterTitle . '"></span> <span class="playlistIcon" data-vid = ' . $videoId . '><img class="playlistIconImg" style="width:24px !important;height:24px !important;" src="' . $playlistImg . '" title="Add to playlist"></span>'; /** Display duration ends and video title starts */ $div .= '</div> <div class="vid_info"><a href="' . $guid[$videolist] . '" title="' . $nameF[$videolist] . '" class="videoHname"><span>' . limitTitle($nameF[$videolist]) . '</span></a>'; /** Display playlist name starts here */ if (!empty($fetched[$videolist]) && $this->_settingsData->categorydisplay == 1) { $playlist_url = get_playlist_permalink($this->_mPageid, $playlist_id[$videolist], $fetched_pslug[$videolist]); $div .= '<a class="playlistName" href="' . $playlist_url . '"><span>' . $fetched[$videolist] . '</span></a>'; } /** Rating starts here */ if ($this->_settingsData->ratingscontrol == 1) { $div .= getRatingValue($rate[$videolist], $ratecount[$videolist], ''); } /** Views starts here */ if ($this->_settingsData->view_visible == 1) { $div .= displayViews($hitcount[$videolist]); } $div .= '</div></li>'; /** Foreah ends */ } $div .= '</ul> </div> <div class="clear"></div>'; } else { if ($type != 'search' && $type != 'categories' && $type != '') { if ($typename == 'Category') { /** Display no videos link for category page */ $div .= __('No', APPTHA_VGALLERY) . ' ' . __('Videos', APPTHA_VGALLERY) . ' ' . __('Under this Category', APPTHA_VGALLERY); } else { /** Display no videos link for other more pages */ $div .= __('No', APPTHA_VGALLERY) . ' ' . $typename . ' ' . __('Videos', APPTHA_VGALLERY); } } } $div .= '</div>'; /** Pagination starts * Call helper function to get pagination values for more pages */ if ($dataLimit != 0) { $div .= paginateLinks($CountOFVideos, $dataLimit, $pagenum, '', ''); } return $div; } }
/** * Function is used to display palyer and video information * * @param array $arguments * @return unknown number string */ function hdflv_sharerender($arguments = array()) { global $wpdb, $current_user; /** Variable initialization for ContusVideoDetailView */ $output = $videourl = $imgurl = $vid = $playlistid = $homeplayerData = $rate = $no_views = $windo = $post_date = ''; $video_playlist_id = $videoId = $hitcount = $show_posted_by = $show_added_on = $show_social_icon = $ratecount = $videodivId = 0; $fetched = array(); /** Get random number to attach */ $videodivId = rand(); /** Check admin logged in */ $isAdmin = absint(filter_input(INPUT_GET, 'admin')); /** Query to get settings data from db */ $configXML = getPluginSettings(); /** Generate flashvars detail * for player starts here */ $flashvars = $pluginflashvars = 'baserefW=' . home_url(); /** Get width from settings */ $width = $configXML->width; if (isset($arguments['width']) && !empty($arguments['width'])) { /** Get width from short code */ $width = $arguments['width']; } /** Get height from settings */ $height = $configXML->height; if (isset($arguments['height']) && !empty($arguments['height'])) { /** Get height from short code */ $height = $arguments['height']; } /** Get playor colors, posted by, social icon, rss icon * and related videos count from settings object */ $player_color = unserialize($configXML->player_colors); $show_posted_by = $player_color['show_posted_by']; $show_social_icon = $player_color['show_social_icon']; $show_rss_icon = $player_color['show_rss_icon']; $number_related_video = get_related_video_count(); /** If related video is not given in settings page, * then assign default value 100 */ if (empty($number_related_video)) { $number_related_video = 100; } /** Get show added on option from settings*/ if (isset($player_color['show_added_on'])) { $show_added_on = $player_color['show_added_on']; } /** Send report for video */ if (isset($arguments['id'])) { /** Get video id from short code */ $videodivId .= $arguments['id']; $vid = $arguments['id']; } if (!empty($vid)) { $wp_user = wp_get_current_user(); $wp_user_id = $wp_user->ID; /** Call function to get video details */ $homeplayerData = $this->short_video_detail($vid, $number_related_video); $fetched[] = $homeplayerData; } /** Store video details in variables */ if (!empty($homeplayerData)) { /** Get video detials from model */ $videoUrl = $homeplayerData->file; $videoId = $homeplayerData->vid; $video_title = $homeplayerData->name; $video_slug = $homeplayerData->slug; $video_file_type = $homeplayerData->file_type; $video_playlist_id = $homeplayerData->playlist_id; $description = $homeplayerData->description; $tag_name = $homeplayerData->tags_name; $hitcount = $homeplayerData->hitcount; $uploadedby = $homeplayerData->display_name; $uploadedby_id = $homeplayerData->ID; $ratecount = $homeplayerData->ratecount; $rate = $homeplayerData->rate; $post_date = $homeplayerData->post_date; $video_thumb = getImagesValue($homeplayerData->image, $video_file_type, $homeplayerData->amazon_buckets, ''); } /** Get playlist id from short code */ if (isset($arguments['playlistid'])) { /** Get video id */ $videodivId .= $arguments['playlistid']; /** Get playlist id */ $playlistid = $arguments['playlistid']; /** Set flash vars */ $flashvars .= '&mtype=playerModule'; } /** Check view is from admin */ if (!empty($isAdmin)) { $flashvars .= '&adminview=true'; } /** Generate flashvars detail for player starts here */ if (!empty($playlistid) && !empty($vid)) { $flashvars .= '&pid=' . $playlistid . '&vid=' . $vid; } elseif (!empty($playlistid)) { $flashvars .= '&pid=' . $playlistid . '&showPlaylist=true'; $playlist_videos = $this->_contOBJ->video_pid_detail($playlistid, 'detailpage', $number_related_video); /** Get video details based on the playlist id */ if (!empty($playlist_videos)) { $videoId = $playlist_videos[0]->vid; $video_playlist_id = $playlist_videos[0]->playlist_id; $hitcount = $playlist_videos[0]->hitcount; $uploadedby = $playlist_videos[0]->display_name; $uploadedby_id = $playlist_videos[0]->ID; $ratecount = $playlist_videos[0]->ratecount; $rate = $playlist_videos[0]->rate; $fetched[] = $playlist_videos[0]; } } else { if ($this->_post_type !== APPTHAVIDEOGALLERY && $this->_page_post_type !== APPTHAVIDEOGALLERY) { $flashvars .= '&vid=' . $vid . '&showPlaylist=false'; } else { $flashvars .= '&vid=' . $vid; } } /** Set flashvars based on the short code arguments */ if (isset($arguments['flashvars'])) { $flashvars .= '&' . $arguments['flashvars']; } if (!isset($arguments['playlistid']) && isset($arguments['id']) && $this->_post_type !== APPTHAVIDEOGALLERY && $this->_page_post_type !== APPTHAVIDEOGALLERY) { $flashvars .= '&playlist_autoplay=false&playlist_auto=false'; } /** Generate flashvars detail for player ends here */ $player_not_support = __('Player doesnot support this video.', APPTHA_VGALLERY); $htmlplayer_not_support = __('Html5 Not support This video Format.', APPTHA_VGALLERY); $output .= ' <script> var videoPage; videoPage = "' . $this->_mPageid . '"; </script>'; if (isset($arguments['title']) && $arguments['title'] == 'on') { $output .= '<h2 id="video_title' . $videodivId . '" class="videoplayer_title" ></h2>'; $pluginflashvars .= $flashvars .= '&videodata=current_video_' . $videodivId; } /** Player starts here */ $output .= '<div id="mediaspace' . $videodivId . '" class="videoplayer">'; $mobile = vgallery_detect_mobile(); /** Embed player code */ if (isset($fetched) && $fetched[0]->file_type == 5 && !empty($fetched[0]->embedcode)) { $playerembedcode = stripslashes($fetched[0]->embedcode); $playeriframewidth = str_replace('width=', 'width="' . $width . '"', $playerembedcode); if ($mobile) { $output .= $playerembedcode; } else { $output .= str_replace('height=', 'height="' . $height . '"', $playeriframewidth); watchedVideoHitCount($fetched[0]->vid, false); } } else { if ($mobile) { /** Check mobile device is detected */ /** Get video detail for HTML5 player * Load video details */ foreach ($fetched as $media) { $videourl = $media->file; $file_type = $media->file_type; $imgurl = getImagesValue($media->image, $file_type, $media->amazon_buckets, ''); } /** Check file type youtube, viddler,dailymotion */ if ($file_type == 3 || $file_type == 1) { if (strpos($videourl, 'youtube') > 0) { $videoid = getYoutubeVideoID($videourl); $output = '<div id="player"></div><script>var tag = document.createElement("script");tag.src = "https://www.youtube.com/iframe_api";var firstScriptTag = document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);var player;function onYouTubeIframeAPIReady() {player = new YT.Player("player", {width: "100%",videoId: "' . $videoid . '",playerVars: {"rel": 0,"showinfo":0,"modestbranding":0},events: {"onStateChange": onPlayerStateChange}});}var done = false;function onPlayerStateChange(event) {if (event.data == YT.PlayerState.PLAYING && !done) {currentVideoP(' . $videoId . ');done = true;}}</script>'; echo $output; /** Generate youtube embed code for html5 player */ } else { if (strpos($videourl, 'viddler') > 0) { /** For viddler videos in URL method */ $imgstr = explode('/', $videourl); $viddler_id = $imgstr[4]; $output = '<script type="text/javascript" src="//static.cdn-ec.viddler.com/js/arpeggio/v3/build/main-built.js"></script><div id="my-player"></div><script>var embed = new ViddlerEmbed({videoId: "' . $viddler_id . '",width: "100%",target: "#my-player"});var done = false;embed.manager.events.on("videoPlayer:play", function() {if (!done) {currentVideoP(' . $videoId . ');done = true;}});</script>'; } elseif (strpos($videourl, 'dailymotion') > 0) { /** For dailymotion videos in URL method */ $split_id = getDailymotionVideoID($videourl); $video = $videourl = $this->_protocolURL . 'www.dailymotion.com/embed/video/' . $split_id[0]; $output = '<script src="http://api.dmcdn.net/all.js"></script><div id="player"></div><script>var player = DM.player(document.getElementById("player"),{video: "' . $split_id[0] . '",width: "100%",params: {html: 0,wmode: "opaque"},events: {playing: function(){onPlayerStateChange();}}});var done = false;function onPlayerStateChange(){if (!done) {currentVideoP(' . $videoId . ');done = true;}}</script>'; echo $output; } else { $output .= '<video width="100%" height="' . $height . '" id="video" poster="' . $imgurl . '" src="' . $videourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>'; } } } else { /** For uploaded videos, get video URL */ $video_url = getVideosValue($videoFile, $file_type, $amazonBucket); /** Check for RTMP videos */ if ($file_type == 4) { $streamer = str_replace('rtmp://', 'http://', $media->streamer_path); $video_url = $streamer . '_definst_/mp4:' . $videourl . '/playlist.m3u8'; } /** Generate video code for html5 player */ $output .= '<video width="100%" height="' . $height . '" id="video" poster="' . $imgurl . '" src="' . $video_url . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>'; } } else { $output .= '<div id="flashplayer"><embed src="' . $this->_swfPath . '" flashvars="' . $flashvars . '" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" wmode="transparent"></div>'; /** Google adsense code Start */ if ($player_color['googleadsense_visible'] == 1 && !$mobile && ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY)) { if ($homeplayerData->google_adsense && $homeplayerData->google_adsense_value) { $output .= '<div>'; /** * Call function to dipaly google adsense on player */ $output .= $this->displayGoogleAdsense($width, $vid, $homeplayerData->vid); } } } } $output .= '</div>'; /** End Google adsense End. */ /** Get current user agent */ $useragent = $_SERVER['HTTP_USER_AGENT']; if (strpos($useragent, 'Windows Phone') > 0) { /** Check for windows phone */ $windo = 'Windows Phone'; } /** Check platform */ /** Call script to display error message within player */ $output .= '<script type="text/javascript"> function current_video_' . $videodivId . '( video_id,d_title ){ if( d_title == undefined ) { document.getElementById( "video_title' . $videodivId . '" ).innerHTML=""; } else { document.getElementById( "video_title' . $videodivId . '" ).innerHTML=""; document.getElementById( "video_title' . $videodivId . '" ).innerHTML=d_title; } } var txt = navigator.platform ; var windo = "' . $windo . '"; function failed( e ) { if( txt =="iPod"|| txt =="iPad" || txt == "iPhone" || windo=="Windows Phone" || txt == "Linux armv7l" || txt == "Linux armv6l" ) { alert( "' . $player_not_support . '" ); } } </script>'; /** Player ends here * Display description, views, tags, playlist names detail under player */ if (isset($arguments['views']) && $arguments['views'] == 'on') { $videogalleryviews = true; } else { if (($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) && $configXML->view_visible == 1) { $videogalleryviews = true; } else { $videogalleryviews = false; $no_views = 'noviews'; } } /** Call function to display view count, posted on details in video detail page */ $output .= $this->displayViewsPostedON($show_added_on, $videogalleryviews, $no_views, $post_date, $hitcount); /** Display user name under player */ $output .= '<div class="clearfix"></div>'; if ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) { $user_url = get_user_permalink($this->_mPageid, $uploadedby_id, $uploadedby); if ($show_posted_by) { $output .= '<div class="video-page-username"><strong>' . __('Posted by', APPTHA_VGALLERY) . ' : </strong><a href="' . $user_url . '">' . $uploadedby . '</a></div>'; } /** Display category name under player */ if ($configXML->categorydisplay == 1) { /** Category display function */ $output .= $this->displayCategory($vid); } } /** Rating starts here for video details page */ if ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) { /** Set ratings control if enabled for player */ if ($configXML->ratingscontrol == 1) { $ratingscontrol = true; } else { $ratingscontrol = false; } } else { if (isset($arguments['ratingscontrol']) && $arguments['ratingscontrol'] == 'on') { $ratingscontrol = true; } else { $ratingscontrol = false; } } /** Show ratings star avg */ if ($ratingscontrol) { $ratestar = getRatingValue($rate, $ratecount, 'calc'); /** Display ratings under player */ $output .= $this->displayRatings($ratestar, $ratecount, $videodivId, $vid, $videoId); } /** Rating ends here */ $output .= '</div>'; if ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) { /** Display tag info */ if (!empty($tag_name) && $configXML->tagdisplay == 1) { $output .= '<div class="video-page-tag"><strong>' . __('Tags', APPTHA_VGALLERY) . ' </strong>: ' . $tag_name . ' ' . '</div>'; } /** Check if video url is YouTube */ if (strpos($videoUrl, 'youtube') > 0) { $video_thumb = $this->_protocolURL . 'img.youtube.com/vi/' . getYoutubeVideoID($videoUrl) . '/hqdefault.jpg'; } /** Display description */ if (!empty($description)) { $removequotedescription = str_replace('"', '', $description); $videodescription = str_replace("'", '', $removequotedescription); } else { $videodescription = get_bloginfo('name'); } /** Check amazon s3 bucket is enabled */ if ($fetched[0]->amazon_buckets == 1) { $video_thumb = ''; } /** Load rss url link */ $rs_url = $this->_site_url . '/wp-admin/admin-ajax.php?action=rss&type=video&vid=' . $vid; $rss_image = getImagesDirURL() . '/rss_icon.png'; /** Show social icons below player */ if ($show_social_icon) { /** Function to display social icons * and rss icon */ $output .= $this->displaySocialIcons($configXML->keyApps, $videodescription, $video_thumb, $video_title); /** Show rss url link and image * Build rss icon div */ if ($show_rss_icon) { $output .= '<div class="floatleft rssfeed"> <a href="' . $rs_url . '"><img src="' . $rss_image . '"></a></div>'; } $output .= '</div>'; $output .= '<div class="clearfix">'; } $output .= '<div class="video-cat-thumb">'; /** Show rss icon enable / disable */ if ($show_rss_icon && !$show_social_icon) { $rs_url = $this->_site_url . '/wp-admin/admin-ajax.php?action=rss&type=video&vid=' . $vid; $rss_image = getImagesDirURL() . '/rss_icon.png'; $output .= '<div class="video-socialshare"><div class="floatleft rssfeed"> <a href="' . $rs_url . '"><img src="' . $rss_image . '"></a></div></div>'; } /** Show or hide embed /iframe/report video option code for video detail page.. */ if ($configXML->embed_visible == 1) { $output .= '<a href="javascript:void( 0 )" onclick="enableEmbed();" class="embed" id="allowEmbed"><span class="embed_text">' . __('Embed Code', APPTHA_VGALLERY) . '</span><span class="embed_arrow"></span></a>'; } if (isset($player_color['iframe_visible']) && $player_color['iframe_visible']) { $output .= '<a href="javascript::void(0);" onclick="view_iframe_code();" id="iframe_code" class="embed"><span class="embed_text">' . __('Iframe', APPTHA_VGALLERY) . '</span><span class="embed_arrow"></span></a>'; } if (isset($player_color['report_visible']) && $player_color['report_visible']) { $output .= '<a href="javascript:void(0)" onclick="reportVideo();" class="embed" id="allowReport"><span class="embed_text">' . __('Report Video', APPTHA_VGALLERY) . '</span><span class="embed_arrow"></span></a>'; } /** Condition for embed code */ if ($fetched[0]->file_type == 5 && !empty($fetched[0]->embedcode)) { $embed_code = stripslashes($fetched[0]->embedcode); } else { /** Display embed code */ $embed_code = '<embed src="' . $this->_swfPath . '" flashvars="' . $flashvars . '&shareIcon=false&email=false&showPlaylist=false&zoomIcon=false&copylink=' . get_permalink() . '&embedplayer=true" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" wmode="transparent">'; } /** Call fucntion to display report video option */ $output .= $this->displayReportVideo($embed_code, $video_slug, $current_user->user_email); /** Load embed code */ if ($fetched[0]->file_type == 5 && $fetched[0]->embedcode) { $iframe_code = stripslashes($fetched[0]->embedcode); } else { /** Load iframe code */ $iframe_code = '<iframe src="' . $this->_swfPath . '?' . $flashvars . '&shareIcon=false&email=false&showPlaylist=false&zoomIcon=false&copylink=' . get_permalink() . '&embedplayer=true" frameborder="0" width="' . $width . '" height="' . $height . '" ></iframe>'; } $output .= '<textarea row="7" col="60" id="iframe-content" name="iframe-content" style="display:none;" onclick="this.select();">' . $iframe_code . '</textarea><input type="hidden" value="" id="iframeflag" name="iframeflag" />'; /** Show /hide video description. */ if ($configXML->showTag) { $output .= '<div style="clear: both;"></div><div class="video-page-desc">' . apply_filters('the_content', $description) . '</div>'; } $output .= '</div></div>'; } $output .= '</div></div>'; /** Enable/disable Related videos slider */ $flag = 0; if ($vid && isset($arguments['playlistid']) && isset($arguments['relatedvideos']) && $arguments['relatedvideos'] == 'on') { $flag = 1; } if ($flag == 1 || ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) && $player_color['show_related_video'] == 1) { /** Call function to display related videos slider */ $output .= $this->relatedVideoSlider($vid, $video_playlist_id, $pluginflashvars, $width, $height, $videodivId); } /** To display video comments section */ return $output . $this->videoComments($configXML); }
/** * Function definition to add og detail for facebook */ function add_meta_details() { global $wpdb; $tags_name = ''; /** Get video id for meta details */ $videoID = pluginVideoID(); $output = '<script type="text/javascript">var baseurl = "' . site_url() . '";var adminurl = "' . admin_url() . '";</script>'; /** If video is not empty then get video details */ if (!empty($videoID)) { /** Get video details for given video id */ $video_count = videoDetails($videoID, ''); /** Check video details are exist */ if (!empty($video_count)) { /** Get video name */ $videoname = $video_count->name; if (isset($video_count->tags_name)) { /** Get tags name */ $tags_name = $video_count->tags_name; } /** Get swf file URL path */ $swfPath = APPTHA_VGALLERY_BASEURL . 'hdflvplayer' . DS . 'hdplayer.swf'; /** Get video page URL */ $videoPageURL = get_video_permalink($video_count->slug); /** Get thumb description for og:description */ $description = get_bloginfo('name'); if ($video_count->description) { $description = $video_count->description; } /** Get rating value for rich snippet */ $rateSnippet = getRatingValue($video_count->rate, $video_count->ratecount, 'calc'); /** Get thumb image for og:image */ $imageFea = getImagesValue($video_count->image, $video_count->file_type, $video_count->amazon_buckets, ''); /** Check video url is YouTube */ if (strpos($imageFea, 'youtube') > 0 || strpos($imageFea, 'ytimg') > 0) { /** Get YouTube video thumb image */ $imgstr = explode('/', $imageFea); $imageFea = 'http://img.youtube.com/vi/' . $imgstr[4] . '/hqdefault.jpg'; } /** Add meta details in the page for current video */ $output .= '<meta name="description" content="' . strip_tags($description) . '" /> <meta name="keyword" content="' . $tags_name . '" /> <link rel="image_src" href="' . $imageFea . '"/> <link rel="canonical" href="' . $videoPageURL . '"/> <meta property="og:image" content="' . $imageFea . '"/> <meta property="og:url" content="' . $videoPageURL . '"/> <meta property="og:title" content="' . $videoname . '"/> <meta property="og:description" content="' . strip_tags($description) . '"/> <meta name="viewport" content="width=device-width"> '; /** Check if SSL is enabled in site * If it is enbaled then add og:video, og:video:type, * og:video:secure_url in meta details to play video in facebook */ if (is_ssl() && $_SERVER['SERVER_PORT'] == 443) { $output .= '<meta property="og:video:type" content="application/x-shockwave-flash" /> <meta property="og:video" content="' . $swfPath . '?vid=' . $videoID . '&baserefW=' . APPTHA_VGALLERY_BASEURL . '&embedplayer=true" /> <meta property="og:video:secure_url" content="' . $swfPath . '?vid=' . $videoID . '&baserefW=' . APPTHA_VGALLERY_BASEURL . '&embedplayer=true" />'; } /** Set rich snippet details */ $output .= '<div id="video-container" class="" itemscope itemid="" itemtype="http://schema.org/VideoObject">'; $output .= '<link itemprop="url" href="' . $videoPageURL . '"/>'; $output .= '<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">'; $output .= '<meta itemprop="ratingValue" content="' . $rateSnippet . '"/> <meta itemprop="ratingCount" content="' . $video_count->ratecount . '"/></div> <div itemprop="video" itemscope itemtype="http://schema.org/VideoObject"> <meta itemprop="name" content="' . $videoname . '" /> <meta itemprop="thumbnail" content="' . $imageFea . '" /> <meta itemprop="description" content="' . strip_tags($description) . '" /> </div> <meta itemprop="image" content="' . $imageFea . '" /> <meta itemprop="thumbnailUrl" content="' . $imageFea . '" /> <meta itemprop="embedURL" content="' . $swfPath . '" /> </div>'; } } /** Display meta details */ echo $output; }
/** * Function to display recent ,feature ,category and popular video in home page after player * * @param unknown $type * @return Ambigous <$category_videos, string>|string */ function home_thumb($type) { global $playlistElement; /** Check homeVideo function is exists */ if (!function_exists('homeVideo')) { $TypeSet = $recent_video_order = $class = $divOutput = ''; $player_colors = $this->_player_colors; $recent_video_order = $player_colors['recentvideo_order']; /** Get popular, recent, featured video settings status and row, column values * Get home page category video settings status and row, column values * Call function to display home page category videos */ $where = ''; switch ($type) { case 'popular': $TypeSet = $this->_settingsData->popular; $rowF = $this->_settingsData->rowsPop; $colF = $this->_settingsData->colPop; $dataLimit = $rowF * $colF; $thumImageorder = 'w.hitcount DESC'; $typename = __('Popular', APPTHA_VGALLERY); $type_name = $morePage = 'popular'; break; case 'recent': $TypeSet = $this->_settingsData->recent; $rowF = $this->_settingsData->rowsRec; $colF = $this->_settingsData->colRec; $dataLimit = $rowF * $colF; $thumImageorder = 'w.vid DESC'; $typename = __('Recent', APPTHA_VGALLERY); $type_name = $morePage = 'recent'; break; case 'featured': $TypeSet = $this->_settingsData->feature; $rowF = $this->_settingsData->rowsFea; $colF = $this->_settingsData->colFea; $dataLimit = $rowF * $colF; $where = ' AND w.featured=1 '; $thumImageorder = getVideoOrder($recent_video_order); $typename = __('Featured', APPTHA_VGALLERY); $type_name = $morePage = 'featured'; break; case 'cat': if ($this->_settingsData->homecategory == 1) { $category_page = $this->_settingsData->category_page; $rowF = $this->_settingsData->rowCat; $colF = $this->_settingsData->colCat; $dataLimit = $rowF * $colF; $thumImageorder = getVideoOrder($recent_video_order); $typename = __('Video Categories', APPTHA_VGALLERY); } break; default: break; } if ($type == 'popular' || $type == 'recent' || $type == 'featured') { /** Get home page thumb data and get count of videos */ $TypeOFvideos = $this->home_thumbdata($thumImageorder, $where, $dataLimit); $CountOFVideos = $this->countof_home_thumbdata($thumImageorder, $where); } if ($type == 'cat') { /** Get home page category thumb data and get count of videos */ $TypeOFvideos = $this->home_categoriesthumbdata($this->_pagenum, $category_page); $CountOFVideos = getPlaylistCount(); /** Call function to display category videos in home page */ return $this->categorylist($CountOFVideos, $TypeOFvideos, $this->_pagenum, $dataLimit, $category_page, $thumImageorder); } if ($TypeSet) { /** Display thumbnail block strats */ $divOutput = '<div class="video_wrapper" id="' . $type_name . '_video">'; $divOutput .= '<style type="text/css" scoped> .video-block {margin-left:' . $this->_settingsData->gutterspace . 'px !important;float:left;} </style>'; if (!empty($TypeOFvideos)) { $userId = get_current_user_id(); $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable); /** Display videos title in home page */ $divOutput .= '<h2 class="video_header">' . $typename . ' ' . __('Videos', APPTHA_VGALLERY) . '</h2>'; $videolist = 0; foreach ($TypeOFvideos as $video) { /** Get video duration, image, filetype, slug, video id, * video name, view and rate count */ $videoId = $video->vid; $duration[$videolist] = $video->duration; $file_type = $video->file_type; $guid[$videolist] = get_video_permalink($video->slug); $imageFea[$videolist] = getImagesValue($video->image, $file_type, $video->amazon_buckets, ''); $nameF[$videolist] = $video->name; $ratecount[$videolist] = $video->ratecount; $rate[$videolist] = $video->rate; $hitcount[$videolist] = $video->hitcount; /** Get playlist id, name and slugname */ $playlist_id[$videolist] = $video->pid; $fetched[$videolist] = $video->playlist_name; $fetched_pslug[$videolist] = $video->playlist_slugname; $videolist++; } /** Code to display thumbs for popular / recent and featured videos */ $divOutput .= '<div class="video_thumb_content">'; $divOutput .= '<ul class="video-block-container">'; $playlistImg = APPTHA_VGALLERY_BASEURL . 'images/playlist.png'; $playlistCreateImg = APPTHA_VGALLERY_BASEURL . 'images/playlist_create.png'; $playlistSearchImg = APPTHA_VGALLERY_BASEURL . 'images/playlist_search.png'; /** Display video list container */ for ($videolist = 0; $videolist < count($TypeOFvideos); $videolist++) { $videoId = $TypeOFvideos[$videolist]->vid; if (in_array($videoId, $watchLaterVideoIds)) { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/accepted.png'; $watchLaterTitle = 'Added to Watch Later'; } else { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/watchlater2.png'; $watchLaterTitle = 'Add to Watch Later'; $clickEvent = 'onclick="watchLater(' . $videoId . ',this)"'; } $class = '<div class="clear"></div>'; if ($videolist % $colF == 0 && $videolist != 0) { $divOutput .= '</ul><div class="clear"></div><ul class="video-block-container">'; } $divOutput .= '<li class="video-block">'; /** Video thumb image display block starts */ $divOutput .= '<div class="video-thumbimg"><a href="' . $guid[$videolist] . '"><img src="' . $imageFea[$videolist] . '" alt="' . $nameF[$videolist] . '" class="imgHome" title="' . $nameF[$videolist] . '" /></a>'; if ($duration[$videolist]) { $divOutput .= '<span class="video_duration" >' . $duration[$videolist] . '</span>'; } $divOutput .= ' <span class="watchlaterIcon" ' . $clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $watchLaterImg . '" title="' . $watchLaterTitle . '"></span> <span class="playlistIcon" data-vid = ' . $videoId . '><img class="playlistIconImg" style="width:24px !important;height:24px !important;" src="' . $playlistImg . '" title="Add to playlist"></span>'; /** Display video details block starts */ $divOutput .= '</div><div class="vid_info"><a title="' . $nameF[$videolist] . '" href="' . $guid[$videolist] . '" class="videoHname"><span>' . limitTitle($nameF[$videolist]) . '</span></a>'; $divOutput .= ''; if ($fetched[$videolist] != '' && $this->_settingsData->categorydisplay == 1) { $playlist_url = get_playlist_permalink($this->_mPageid, $playlist_id[$videolist], $fetched_pslug[$videolist]); /** Display output videos */ $divOutput .= '<a class="playlistName" href="' . $playlist_url . '"><span>' . $fetched[$videolist] . '</span></a>'; } /** Display rating for video home page */ if ($this->_settingsData->ratingscontrol == 1) { $divOutput .= getRatingValue($rate[$videolist], $ratecount[$videolist], ''); } /** Display views for video home page */ if ($this->_settingsData->view_visible == 1) { $divOutput .= displayViews($hitcount[$videolist]); } /** Display video details block ends */ $divOutput .= '</div> </li>'; } $divOutput .= '</ul></div> <div class="clear"></div>'; /** Code to display more videos link for featured / popular/ recent videos */ if ($dataLimit < $CountOFVideos) { $more_videos_link = get_morepage_permalink($this->_mPageid, $morePage); /** Display more title for category */ $divOutput .= '<span class="more_title" ><a class="video-more" href="' . $more_videos_link . '">' . __('More Videos', APPTHA_VGALLERY) . ' »</a></span>'; $divOutput .= '<div class="clear"></div>'; } /** View more to the right */ if ($dataLimit == $CountOFVideos) { $divOutput .= '<div style="float:right"></div>'; } } else { $divOutput .= __('No', APPTHA_VGALLERY) . ' ' . $typename . ' ' . __('Videos', APPTHA_VGALLERY); } $divOutput .= '</div>'; } return $divOutput; } }
/** * Function to display popular / recent / featured / random widget videos * * @param unknown $title * @param unknown $type * @param unknown $videosData * @param unknown $show * @param unknown $pID * @param unknown $playlist_slugname * @return string */ function displayWidgetVideos($title, $type, $videosData, $show, $pID, $playlist_slugname, $watchLaterVideoIds) { global $wpdb; /** Get more page id , videos link for featured videos and plugin settings value */ $moreName = morePageID(); $more_videos_link = get_morepage_permalink($moreName, $type); $settings_result = getPluginSettings(); if ($type == 'watch history') { $postShortcodeContent = '[watch_history]'; } if ($type == 'watch later') { $postShortcodeContent = '[watch_later]'; } $watch_history_page = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_content=%s AND post_status=%s", "[watch_history]", "publish")); if (get_option('permalink_structure')) { $watchlink = get_site_url() . '/' . $watch_history_page[0]->post_name; } else { $watchlink = $watch_history_page[0]->guid; } $watch_later_page = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "posts WHERE post_content=%s AND post_status=%s", "[watch_later]", "publish")); if (get_option('permalink_structure')) { $watchLaterlink = get_site_url() . '/' . $watch_later_page[0]->post_name; } else { $watchLaterlink = $watch_later_page[0]->guid; } if ($type == 'watch history') { $more_videos_link = $watchlink; } if ($type == 'watch later') { $more_videos_link = $watchLaterlink; } /** Display widget tilte */ $div = '<div id="' . $type . '-videos" class="sidebar-wrap "> <h3 class="widget-title">'; /** Check type is realted */ if ($type == 'related') { /** Set title for widgets */ $link = $title; if (!empty($pID)) { /** Set link for related vidos title */ $link = '<a href=' . home_url() . '/?page_id=' . $moreName . '&playid=' . $pID . '>' . $title . '</a>'; } $div .= $link; } else { $div .= '<a href="' . $more_videos_link . '">' . $title . '</a>'; } $div .= ' </h3>'; /** Get count of videos */ $videosCount = getWidgetVideosCount($type, $pID); /** Display video thumbs */ $div .= '<ul class="ulwidget">'; /** Check videos are exist */ if (!empty($videosData)) { /** Looping widget video detials */ foreach ($videosData as $videodata) { $videoId = $videodata->vid; if (in_array($videoId, $watchLaterVideoIds)) { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/accepted.png'; $watchLaterTitle = 'Added to Watch Later'; $clickEvent = ''; } else { $watchLaterImg = APPTHA_VGALLERY_BASEURL . 'images/watchlater2.png'; $watchLaterTitle = 'Add to Watch Later'; $clickEvent = 'onclick="watchLater(' . $videoId . ',this)"'; } /** Get video file type */ $file_type = $videodata->file_type; /** Get video permalink */ $guid = get_video_permalink($videodata->slug); /** Get video name */ $name = limitTitle($videodata->name); /** Get thumb image url based on file type from helper */ $imageFea = $videodata->image; $imageFea = getImagesValue($videodata->image, $file_type, $videodata->amazon_buckets, ''); /** Output to screen */ $div .= '<li class="clearfix sideThumb">'; /** Display video thumb */ $div .= '<div class="imgBorder"> <a href="' . $guid . '" title="' . $videodata->name . '"> <img src="' . $imageFea . '" alt="' . $videodata->name . '" class="img" width="120" height="80" style="width: 120px; height: 80px;" /> </a>'; /** Display video duration */ if (!empty($videodata->duration) && $videodata->duration != 0.0) { $div .= '<span class="video_duration">' . $videodata->duration . '</span>'; } if ($type != 'watch history' && $type != 'watch later') { $div .= '<span class="watchlaterIcon" ' . $clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $watchLaterImg . '" title="' . $watchLaterTitle . '"></span>'; } $div .= '</div>'; /** Display video title */ $div .= '<div class="side_video_info"> <a title="' . $videodata->name . '" class="videoHname" href="' . $guid . '">' . $name . '</a> <div class="clear"></div>'; /** Check view is enabled in settings page */ if ($settings_result->view_visible == 1) { /** Display views count */ $div .= displayViews($videodata->hitcount); } /** Check rating is enabled in settings page */ if ($settings_result->ratingscontrol == 1) { /** Display ratingss count */ $div .= getRatingValue($videodata->rate, $videodata->ratecount, ''); } $div .= '<div class="clear"></div> <div class="clear"></div> </div></li>'; } } else { /** Display no videos link */ $div .= "<li>" . __('No', APPTHA_VGALLERY) . ' ' . ucfirst($type) . ' ' . __('Videos', APPTHA_VGALLERY) . "</li>"; } /** * Check number of videos to be shown count is less than or equal to total count */ $totalVideoCount = count($videosData); if ($show < $videosCount || $show == $videosCount) { /** If type is realted video, then display playlist URL as a link */ if ($type == 'related') { $playlist_url = get_playlist_permalink($moreName, $pID, $playlist_slugname); $div .= '<li><div class="right video-more"><a href="' . $playlist_url . '">'; } else { /** Else display more pages URL as a link */ $div .= '<li><div class="video-more"><a href="' . $more_videos_link . '">'; } $div .= __('More Videos', APPTHA_VGALLERY) . ' » </a> </div> <div class="clear"></div> </li>'; } else { $div .= '<li> <div align="right"></div> </li>'; } /** Return widget content */ return $div . '</ul></div>'; }
/** * Function to display search results * * @param unknown $video_search * @param unknown $CountOfSearchVideos * @param unknown $TypeOfSearchvideos * @param unknown $pagenum * @param unknown $dataLimit * @return string */ function searchlist($video_search, $CountOfSearchVideos, $TypeOfSearchvideos, $pagenum, $dataLimit) { $div = ''; $userId = get_current_user_id(); $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable); /** * Calculating page number * for search videos */ $pagenum = isset($pagenum) ? absint($pagenum) : 1; $div .= '<div class="video_wrapper" id="video_search_result"><h3 class="entry-title">' . __('Search Results', APPTHA_VGALLERY) . ' - ' . $video_search . '</h3>'; $div .= '<style> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important; } </style>'; /** Fetch videos based on search */ if (!empty($TypeOfSearchvideos)) { $inc = 0; $div .= '<ul class="video-block-container">'; foreach ($TypeOfSearchvideos as $playList) { $this->watchLaterHelper($playList, $watchLaterVideoIds); if ($inc % $this->_colF == 0 && $inc != 0) { /** Column count for search page */ $div .= '</ul><div class="clear"></div><ul class="video-block-container">'; } /** Display search videos * thumb and duration */ $div .= '<li class="video-block"><div class="video-thumbimg"><a href="' . $this->guid . '" title="' . $playList->name . '"><img src="' . $this->imageFea . '" alt="" class="imgHome" title="" /></a>'; if (!empty($this->duration) && $this->duration != '0:00') { $div .= '<span class="video_duration">' . $this->duration . '</span>'; } $div .= '<span class="watchlaterIcon" ' . $this->clickEvent . ' ><img class="watchlaterImg" style="width:24px !important;height:24px !important;" src="' . $this->watchLaterImg . '" title="' . $this->watchLaterTitle . '"></span> <span class="playlistIcon" data-vid = ' . $this->videoId . '><img class="playlistIconImg" style="width:24px !important;height:24px !important;" src="' . $this->playlistImg . '" title="Add to playlist"></span>'; /** Display video title, playlist name and link */ $div .= '</div><div class="vid_info"><a href="' . $this->guid . '" class="videoHname" title="' . $playList->name . '" >' . limitTitle($playList->name) . '</a>'; if (!empty($playList->playlist_name)) { $playlist_url = get_playlist_permalink($this->_mPageid, $playList->pid, $playList->playlist_slugname); $div .= '<a class="playlistName" href="' . $playlist_url . '">' . $playList->playlist_name . '</a>'; } /** Rating starts here * for search videos */ if ($this->_settingsData->ratingscontrol == 1) { $div .= getRatingValue($playList->rate, $playList->ratecount, ''); } if ($this->_settingsData->view_visible == 1) { /** Views starts here * for search videos */ $div .= displayViews($playList->hitcount); } $div .= '</div></li>'; $inc++; } $div .= '</ul>'; } else { /** If there is no video * for search result */ $div .= '<div>' . __('No Videos Found', APPTHA_VGALLERY) . '</div>'; } $div .= '</div> <div class="clear"></div>'; /** Pagination starts * Call helper function * to get pagination values */ if ($dataLimit != 0) { $div .= paginateLinks($CountOfSearchVideos, $dataLimit, $pagenum, '', ''); } echo $div; /** Search result function ends */ }