/** * Function to display related videos slider in video detail page * * @param unknown $vid * @param unknown $video_playlist_id * @param unknown $pluginflashvars * @param unknown $width * @param unknown $height * @return string */ public function relatedVideoSlider($vid, $video_playlist_id, $pluginflashvars, $width, $height, $videodivId) { global $wpdb; $reavideourl = $player_div = $result = $output = ''; $related1 = array(); /** Get related videos count */ $Limit = get_related_video_count(); /** Check related videos count. If it is empty then assign default value as 100 */ if (empty($Limit)) { /** set limit as 100 */ $Limit = 100; } /** Get video details for the current video id from helper */ $vidDetails = videoDetails($vid, 'related'); if (!empty($vidDetails)) { $related1 = array($vidDetails); /** Get related videos for the given video id */ $related = $this->relatedVideosDetails($related1[0]->vid, $video_playlist_id, $Limit); /** Merge the current video, related video details */ $related = array_merge($related1, $related); } if (!empty($related)) { $result = count($related); } if ($result < 4) { $output .= '<style>.jcarousel-next , .jcarousel-prev {display:none!important;}</style>'; } /** Display related videos in slider */ $output .= '<div class="player_related_video"><h2 class="related-videos">' . __('Related Videos', APPTHA_VGALLERY) . '</h2><div style="clear: both;"></div>'; if ($result != '') { /** Slide display starts here */ $output .= '<ul id="mycarousel" class="jcarousel-skin-tango">'; /** Check for mobile platform */ $mobile = vgallery_detect_mobile(); /** Looping related video details */ foreach ($related as $relFet) { $file_type = $relFet->file_type; /** Get featured images list */ $imageFea = getImagesValue($relFet->image, $file_type, $relFet->amazon_buckets, ''); $reafile = $relFet->file; $guid = get_video_permalink($relFet->slug); /** Embed player code in detail page * Get width and height for player */ if ($file_type == 5 && !empty($relFet->embedcode)) { /** Embed code for fearured * Width for related videos */ $relFetembedcode = stripslashes($relFet->embedcode); $relFetiframewidth = preg_replace(array('/width="\\d+"/i'), array(sprintf('width="%d"', $width)), $relFetembedcode); if ($mobile === true) { /** Embed code type for mobile view */ $player_values = htmlentities($relFetiframewidth); } else { $player_values = htmlentities(preg_replace(array('/height="\\d+"/i'), array(sprintf('height="%d"', $height)), $relFetiframewidth)); } } else { /** Code for mobile device */ if ($mobile) { /** Check for youtube video */ if (strpos($reafile, 'youtube') > 0) { $reavideourl = 'http://www.youtube.com/embed/' . getYoutubeVideoID($reafile); /** Generate youtube embed code for html5 player */ $player_values = htmlentities('<iframe width="100%" type="text/html" src="' . $reavideourl . '" frameborder="0"></iframe>'); } else { if ($file_type != 5) { /** Check for upload, URL and RTMP videos */ switch ($file_type) { case 2: $reavideourl = $this->_uploadPath . $reafile; break; case 4: $streamer = str_replace('rtmp://', 'http://', $media->streamer_path); $reavideourl = $streamer . '_definst_/mp4:' . $reafile . '/playlist.m3u8'; break; default: break; } /** Generate video code for html5 player */ $player_values = htmlentities('<video width="100%" id="video" poster="' . $imageFea . '" src="' . $reavideourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>'); } else { $player_values = ''; } } } else { /** Flash player code */ $player_values = htmlentities('<embed src="' . $this->_swfPath . '" flashvars="' . $pluginflashvars . '&mtype=playerModule&vid=' . $relFet->vid . '" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" wmode="transparent">'); } } /** Check the post type is videogallery page */ if ($this->_post_type === APPTHAVIDEOGALLERY || $this->_page_post_type === APPTHAVIDEOGALLERY) { $thumb_href = 'href="' . $guid . '"'; } else { $player_div = 'mediaspace'; $embedplayer = "videogallery_change_player( '{$player_values}',{$videodivId},'{$player_div}',{$file_type},{$relFet->vid},'{$relFet->name}' )"; $thumb_href = 'href="javascript:void( 0 );" onclick="' . $embedplayer . '"'; } $output .= '<li><div class="imgSidethumb"><a title="' . $relFet->name . '" ' . $thumb_href . '><img src="' . $imageFea . '" alt="' . $relFet->name . '" class="related" /></a></div>'; /** Display title under thumbnails */ $output .= '<div class="vid_info"><span><a ' . $thumb_href . ' class="videoHname" title="' . $relFet->name . '">' . limitTitle($relFet->name) . '</a></span></div>'; $output .= '</li>'; } $output .= '</ul>'; /** Slide display ends here and if ends */ } return $output . '</div>'; }
/** * 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; }