Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.74 KB | None | 0 0
  1. <?php
  2. /**
  3. * Video detail and short tags view file.
  4. *
  5. * @category Apptha
  6. * @package Contus video Gallery
  7. * @version 2.7
  8. * @author Apptha Team <developers@contus.in>
  9. * @copyright Copyright (C) 2014 Apptha. All rights reserved.
  10. * @license GNU General Public License http://www.gnu.org/copyleft/gpl.html
  11. */
  12. if (class_exists ( 'ContusVideoShortcodeView' ) != true) {
  13. class ContusVideoShortcodeView extends ContusVideoShortcodeController {
  14. public $_settingsData;
  15. public $_videosData;
  16. public $_swfPath;
  17. public $_singlevideoData;
  18. public $_videoDetail;
  19. public $_vId;
  20. public $_userEmail;
  21. public $_reportsend;
  22. public function __construct() {
  23. parent::__construct ();
  24.  
  25. $this->_vId = absint( filter_input ( INPUT_GET, 'vid' ));
  26. $this->_post_type = filter_input ( INPUT_GET, 'post_type' );
  27. $this->_page_post_type = $this->url_to_custompostid ( get_permalink () );
  28. $this->_showF = 5;
  29. $this->_contOBJ = new ContusVideoController ();
  30. $this->_mPageid = $this->more_pageid ();
  31. $dir = dirname ( plugin_basename ( __FILE__ ) );
  32. $dirExp = explode ( '/', $dir );
  33. $this->_plugin_name = $dirExp [0];
  34. $this->_site_url = get_site_url ();
  35. $this->_swfPath = APPTHA_VGALLERY_BASEURL . 'hdflvplayer' . DS . 'hdplayer.swf';
  36. $this->_imagePath = APPTHA_VGALLERY_BASEURL . 'images' . DS;
  37. $this->_userEmail = $this->get_current_user_email();
  38. $this->_reportsent = filter_input(INPUT_POST,'report_send');
  39. }
  40. public function url_to_custompostid($url) {
  41. global $wp_rewrite;
  42. $url = apply_filters ('url_to_postid', $url );
  43. if (preg_match ( '#[?&]( p|page_id|attachment_id )=( \d+ )#', $url, $values )) {
  44. $id = absint ( $values [2]);
  45. if ($id)
  46. return $id;
  47. }
  48.  
  49. $rewrite = $wp_rewrite->wp_rewrite_rules ();
  50.  
  51. if (empty ( $rewrite ))
  52. return 0;
  53. $url_split = explode ( '#', $url );
  54. $url = $url_split [0];
  55.  
  56. // Get rid of URL ?query=string
  57. $url_split = explode ( '?', $url );
  58. $url = $url_split [0];
  59.  
  60. // Add 'www.' if it is absent and should be there
  61. if (false !== strpos ( home_url (), '://www.' ) && false === strpos ( $url, '://www.' ))
  62. $url = str_replace ( '://', '://www.', $url );
  63.  
  64. // Strip 'www.' if it is present and shouldn't be
  65. if (false === strpos ( home_url (), '://www.' ))
  66. $url = str_replace ( '://www.', '://', $url );
  67.  
  68. // Strip 'index.php/' if we're not using path info permalinks
  69. if (! $wp_rewrite->using_index_permalinks ())
  70. $url = str_replace ( 'index.php/', '', $url );
  71.  
  72. if (false !== strpos ( $url, home_url () )) {
  73. // Chop off http://domain.com
  74. $url = str_replace ( home_url (), '', $url );
  75. } else {
  76. // Chop off /path/to/blog
  77. $home_path = parse_url ( home_url () );
  78. $home_path = isset ( $home_path ['path'] ) ? $home_path ['path'] : '';
  79. $url = str_replace ( $home_path, '', $url );
  80. }
  81.  
  82. // Trim leading and lagging slashes
  83. $url = trim ( $url, '/' );
  84.  
  85. $request = $url;
  86.  
  87. // Look for matches.
  88. $request_match = $request;
  89. foreach ( ( array ) $rewrite as $match => $query ) {
  90.  
  91. // If the requesting file is the anchor of the match, prepend it
  92. // to the path info.
  93. if (! empty ( $url ) && ($url != $request) && (strpos ( $match, $url ) === 0))
  94. $request_match = $url . '/' . $request;
  95.  
  96. if (preg_match ( "!^$match!", $request_match, $matches )) {
  97.  
  98. if ($wp_rewrite->use_verbose_page_rules && preg_match ( '/pagename=\$matches\[( [0-9]+ )\]/', $query, $varmatch )) {
  99. // this is a verbose page match, lets check to be sure about it
  100. if (get_page_by_path ( $matches [$varmatch [1]] ))
  101. continue;
  102. }
  103.  
  104. // Got a match.
  105. // Trim the query of everything up to the '?'.
  106. $query = preg_replace ( '!^.+\?!', '', $query );
  107.  
  108. // Substitute the substring matches into the query.
  109. $query = addslashes ( WP_MatchesMapRegex::apply ( $query, $matches ) );
  110.  
  111. // Filter out non-public query vars
  112. global $wp;
  113. global $wpdb;
  114. parse_str ( $query, $query_vars );
  115.  
  116. $query = array ();
  117. foreach ( ( array ) $query_vars as $key => $value ) {
  118.  
  119. if (in_array ( $key, $wp->public_query_vars )) {
  120. $query [$key] = $value;
  121. }
  122. }
  123. $post_type = '';
  124. // Do the query
  125. if (! empty ( $query ['videogallery'] ))
  126. $post_type = 'videogallery';
  127. return $post_type;
  128. }
  129. }
  130. return 0;
  131. }
  132.  
  133. /**
  134. * Display player details
  135. */
  136. function hdflv_sharerender($arguments = array()) {
  137. global $wpdb;
  138. $output = $videourl = $imgurl = $player_div = $vid = $playlistid = $homeplayerData = $reavideourl = $ratecount = $rate = $plugin_css = $no_views = '';
  139. $video_playlist_id = $videoId = $hitcount = $show_posted_by = $show_social_icon= $show_related_video = 0;
  140.  
  141. $videodivId = rand ();
  142. $image_path = str_replace ( 'plugins/' . $this->_plugin_name . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL );
  143. $_imagePath = APPTHA_VGALLERY_BASEURL . 'images' . DS;
  144. $configXML = $wpdb->get_row ( 'SELECT playlist,ratingscontrol,view_visible,tagdisplay,categorydisplay,embed_visible,keydisqusApps,comment_option,keyApps,configXML,width,height,showTag,player_colors FROM ' . $wpdb->prefix . 'hdflvvideoshare_settings' );
  145. $flashvars = $pluginflashvars = 'baserefW=' . get_option ( 'siteurl' ); // generate flashvars detail for player starts here
  146.  
  147. if (isset ( $arguments ['width'] )) {
  148. $width = $arguments ['width']; // get width from short code
  149. } else {
  150. $width = $configXML->width; // get width from settings
  151. }
  152. if (isset ( $arguments ['height'] )) {
  153. $height = $arguments ['height']; // get height from short code
  154. } else {
  155. $height = $configXML->height; // get height from settings
  156. }
  157. $showTags = $configXML->tagdisplay;
  158. $showRatting = $configXML->ratingscontrol;
  159. $player_color = unserialize($configXML->player_colors);
  160. $show_posted_by = $player_color['show_posted_by'];
  161. $show_social_icon = $player_color['show_social_icon'];
  162. $show_rss_icon = $player_color['show_rss_icon'];
  163. $number_related_video = $player_color['related_video_count'];
  164. if ( isset( $player_color['show_added_on'] ) ) { $show_added_on = $player_color['show_added_on']; } else { $show_added_on = '0'; }
  165. //Send report for video
  166. if (isset ( $arguments ['id'] )) {
  167. $videodivId .= $arguments ['id']; // get video id from short code
  168. $vid = $arguments ['id'];
  169. }
  170. if (! empty ( $vid )) {
  171. $homeplayerData = $this->video_detail( $vid ,$number_related_video );
  172. $fetched [] = $homeplayerData;
  173. }
  174. // store video details in variables
  175. if (! empty ( $homeplayerData )) {
  176. $videoUrl = $homeplayerData->file;
  177. $videoId = $homeplayerData->vid;
  178. $video_title = $homeplayerData->name;
  179. $video_file_type = $homeplayerData->file_type;
  180. $video_thumb = $homeplayerData->image;
  181. if ($video_file_type == 2 || $video_file_type == 5) {
  182. if(strpos($video_thumb,'/' )){
  183. $video_thumb = $homeplayerData->image;
  184. }else{
  185. $video_thumb = $image_path . $homeplayerData->image;
  186. }
  187. }
  188. $video_playlist_id = $homeplayerData->playlist_id;
  189. $description = $homeplayerData->description;
  190. $tag_name = $homeplayerData->tags_name;
  191. $hitcount = $homeplayerData->hitcount;
  192. $uploadedby = $homeplayerData->display_name;
  193. $uploadedby_id = $homeplayerData->ID;
  194. $ratecount = $homeplayerData->ratecount;
  195. $rate = $homeplayerData->rate;
  196. $post_date = $homeplayerData->post_date;
  197. }
  198. // get Playlist detail
  199. $playlistData = $this->playlist_detail ($vid );
  200. $incre = 0;
  201. $playlistname = $windo = $htmlvideo = '';
  202.  
  203. if (isset ( $arguments ['playlistid'] )) {
  204. $videodivId .= $arguments ['playlistid']; // get playlist id from short code
  205. $playlistid = $arguments ['playlistid'];
  206. $flashvars .= '&amp;mtype=playerModule';
  207. }
  208.  
  209. // generate flashvars detail for player starts here
  210. if (! empty ( $playlistid ) && ! empty ( $vid )) {
  211. $flashvars .= '&amp;pid=' . $playlistid;
  212. $flashvars .= '&amp;vid=' . $vid;
  213. } elseif (! empty ( $playlistid )) {
  214. $flashvars .= '&amp;pid=' . $playlistid . '&showPlaylist=true';
  215. $playlist_videos = $this->_contOBJ->video_pid_detail ( $playlistid, 'detailpage' , $number_related_video);
  216. if (! empty ( $playlist_videos )) {
  217. $videoId = $playlist_videos [0]->vid;
  218. $video_playlist_id = $playlist_videos [0]->playlist_id;
  219. $hitcount = $playlist_videos [0]->hitcount;
  220. $uploadedby = $playlist_videos [0]->display_name;
  221. $uploadedby_id = $playlist_videos [0]->ID;
  222. $ratecount = $playlist_videos [0]->ratecount;
  223. $rate = $playlist_videos [0]->rate;
  224. $fetched [] = $playlist_videos [0];
  225. }
  226. } else if ($this->_post_type !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
  227. $flashvars .= '&amp;vid=' . $vid . '&showPlaylist=false';
  228. } else {
  229. $flashvars .= '&amp;vid=' . $vid;
  230. }
  231. if (isset ( $arguments ['flashvars'] )) {
  232. $flashvars .= '&amp;' . $arguments ['flashvars'];
  233. }
  234. if (! isset ( $arguments ['playlistid'] ) && isset ( $arguments ['id'] ) && $this->_post_type !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
  235. $flashvars .= '&amp;playlist_autoplay=false&amp;playlist_auto=false';
  236. }
  237. // generate flashvars detail for player ends here
  238.  
  239. $player_not_support = __ ( 'Player doesnot support this video.', 'video_gallery' );
  240. $htmlplayer_not_support = __ ( 'Html5 Not support This video Format.', 'video_gallery' );
  241.  
  242. $output .= ' <script>
  243. var baseurl,folder,videoPage;
  244. baseurl = "' . $this->_site_url . '";
  245. folder = "' . $this->_plugin_name . '";
  246. videoPage = "' . $this->_mPageid . '";
  247. </script>';
  248. if (isset ( $arguments ['title'] ) && $arguments ['title'] == 'on') {
  249. $output .= '<h2 id="video_title' . $videodivId . '" class="videoplayer_title" ></h2>';
  250. $pluginflashvars .= $flashvars .= '&amp;videodata=current_video_' . $videodivId;
  251. }
  252. // Player starts here
  253. $output .= '<div id="mediaspace' . $videodivId . '" class="videoplayer">';
  254. $mobile = vgallery_detect_mobile ();
  255. // Embed player code
  256. if (! empty ( $fetched ) && $fetched [0]->file_type == 5 && ! empty ( $fetched [0]->embedcode )) {
  257. $playerembedcode = stripslashes ( $fetched [0]->embedcode );
  258. $playeriframewidth = str_replace ( 'width=', 'width="' . $width . '"', $playerembedcode );
  259. if ( $mobile == true ) {
  260. $output .= $playerembedcode;
  261. } else {
  262. $output .= str_replace ( 'height=', 'height="' . $height . '"', $playeriframewidth );
  263. }
  264. $output .= '<script> current_video( ' . $fetched [0]->vid . ',"' . $fetched [0]->name . '" ); </script>';
  265. } else if ($mobile === true) {
  266. $output .= '<script> current_video( ' . $fetched [0]->vid . ',"' . $fetched [0]->name . '" ); </script>';
  267. // Get video detail for HTML5 player
  268. foreach ( $fetched as $media ) { // Load video details
  269. $videourl = $media->file;
  270. $imgurl = $media->image;
  271. $file_type = $media->file_type;
  272. $video_amazon_buckets = $media->amazon_buckets;
  273. if ($imgurl == '') { // If there is no thumb image for video
  274. $imgurl = $_imagePath . 'nothumbimage.jpg';
  275. } else {
  276. if ($file_type == 2 || $file_type == 5) { // For uploaded image
  277.  
  278. if( $file_type == 2 && $video_amazon_buckets == 1 && strpos( $imgurl , '/' ) ){
  279. $imgurl = $imgurl;
  280. }else{
  281. $imgurl = $image_path . $imgurl;
  282. }
  283. }
  284. }
  285. }
  286. if ($file_type == 1) {
  287. // Check for youtube video
  288. if (preg_match ( '/www\.youtube\.com\/watch\?v=[^&]+/', $videourl, $vresult )) {
  289. $urlArray = explode ( '=', $vresult [0] );
  290. $video_id = trim ( $urlArray [1] );
  291. $videourl = 'http://www.youtube.com/embed/' . $video_id;
  292. // Generate youtube embed code for html5 player
  293. $output .= '<iframe type="text/html" width="'.$width.'" height="'.$height.'" src="' . $videourl . '" frameborder="0"></iframe>';
  294. } elseif (strpos ( $videourl, 'dailymotion' ) > 0 ) { // For dailymotion videos
  295. $split = explode ( "/", $videourl );
  296. $split_id = explode ( "_", $split [4] );
  297. $image_url = '';
  298. $video = $videourl = $previewurl = 'http://www.dailymotion.com/embed/video/' . $split_id [0];
  299.  
  300. $output .= '<iframe src="' . $video . '?allowed_in_playlists=0" width="'.$width.'" height="'.$height.'" class="iframe_frameborder" ></iframe>';
  301.  
  302. } else if (strpos ( $videourl, 'viddler' ) > 0) { // For viddler videos
  303. $imgstr = explode ( '/', $videourl );
  304. $viddler_id = $imgstr[4];
  305. $output .= '<iframe id="viddler-' . $viddler_id . '" width="'.$width.'" src="//www.viddler.com/embed/' . $viddler_id . '/?f=1&autoplay=0&player=full&secret=26392356&loop=false&nologo=false&hd=false" frameborder="0" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>';
  306. }
  307. } else if ($file_type == 3) {
  308. if(preg_match ( '/www\.youtube\.com\/watch\?v=[^&]+/', $videourl, $vresult ) ) {
  309. $urlArray = explode ( '=', $vresult [0] );
  310. $video_id = trim ( $urlArray [1] );
  311. $videourl = 'http://www.youtube.com/embed/' . $video_id;
  312. // Generate youtube embed code for html5 player
  313. $output .= '<iframe type="text/html" width="'.$width.'" height="'.$height.'" src="' . $videourl . '" frameborder="0"></iframe>';
  314. } else if ( strpos ( $videourl, 'viddler' ) > 0 ) {
  315. $imgstr = explode ( '/', $videourl );
  316. $viddler_id = $imgstr[4];
  317. $output .= '<iframe id="viddler-' . $viddler_id . '" width="'.$width.'" src="//www.viddler.com/embed/' . $viddler_id . '/?f=1&autoplay=0&player=full&secret=26392356&loop=false&nologo=false&hd=false" frameborder="0" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>';
  318. } elseif (strpos ( $videourl, 'dailymotion' ) > 0 ) { // For dailymotion videos
  319. $split = explode ( "/", $videourl );
  320. $split_id = explode ( "_", $split [4] );
  321. $image_url = '';
  322. $video = $videourl = $previewurl = 'http://www.dailymotion.com/embed/video/' . $split_id [0];
  323. $output .= '<iframe src="' . $video . '?allowed_in_playlists=0" width="'.$width.'" height="'.$height.'" class="iframe_frameborder" ></iframe>';
  324. } else {
  325. $output .= '<video widht="100%" id="video" poster="' . $imgurl . '" src="' . $videourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>';
  326. }
  327.  
  328. }else { // Check for upload, URL and RTMP videos
  329. if ($file_type == 2 || $file_type == 5) {
  330. if( $file_type == 2 && strpos( $videourl,'/') ){
  331. $videourl = $videourl;
  332. }else{
  333. $videourl = $image_path . $videourl;
  334. }
  335. } else if ($file_type == 4) { // For RTMP videos
  336. $streamer = str_replace ( 'rtmp://', 'http://', $media->streamer_path );
  337. $videourl = $streamer . '_definst_/mp4:' . $videourl . '/playlist.m3u8';
  338. }
  339. // Generate video code for html5 player
  340. $output .= '<video widht="100%" id="video" poster="' . $imgurl . '" src="' . $videourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>';
  341. }
  342. } else {
  343. $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>';
  344. // Google adsense code Start
  345.  
  346. if( ( $player_color['googleadsense_visible'] == 1) && ( !$mobile ) && ( $this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery' ) ) {
  347. if($homeplayerData->google_adsense && $homeplayerData->google_adsense_value) {
  348. $output .= '<div>';
  349.  
  350. if ($width > 468)
  351. {
  352. $adstyle = "margin-left: -234px;";
  353. }
  354. else
  355. {
  356. $margin_left = ($width - 100) / 2;
  357. $adwidth = ($width - 100);
  358. $adstyle = "width:" . $adwidth . "px;margin-left: -" . $margin_left . "px;";
  359. }
  360. $output .= '<div id="lightm" style="' . $adstyle . 'height:76px;position:absolute;display:none;background:none !important;background-position: initial initial !important;background-repeat: initial initial !important;bottom: 50px;left: 50%;">
  361. <span id="divimgm" ><img alt="close" id="closeimgm" src="' . APPTHA_VGALLERY_BASEURL . '/images/close.png" style="z-index: 10000000;width:48px;height:12px;cursor:pointer;top:-12px;" onclick="googleclose();" /> </span>
  362. <iframe height="60" width="' . ($width - 100) . '" scrolling="no" align="middle" id="IFrameName" src="" name="IFrameName" marginheight="0" marginwidth="0" class="iframe_frameborder" ></iframe>
  363. </div>
  364. </div>';
  365. $details = $this->get_video_google_adsense_details($vid);
  366. $details1 = unserialize($details->googleadsense_details);
  367.  
  368. if (isset($details1['adsense_option']) && $details1['adsense_option'] == 'always_show')
  369. {
  370. $closeadd = 0;
  371. }
  372. else {
  373. $closeadd = $details1['adsenseshow_time'];
  374. }
  375. if (isset($details1['adsense_reopen']) && $details1['adsense_reopen'] == '1')
  376. {
  377. $ropen = $details1['adsense_reopen_time'];
  378. }
  379. else {
  380. $ropen = 0;
  381. }
  382. $output .= '<script type="text/javascript">
  383. var pagepath = "' . get_site_url() . '/wp-admin/admin-ajax.php?action=googleadsense&vid=' . $homeplayerData->vid .'";
  384. var closeadd = ' . $closeadd * 1000 . ';
  385. var ropen = ' . $ropen * 1000 . ';
  386. </script>
  387. <script src="' . APPTHA_VGALLERY_BASEURL.'js/googlead.js" type="text/javascript"></script>';
  388. }
  389. }
  390. }
  391.  
  392. $output .= '</div>';
  393. // End Google adsense End.
  394. $useragent = $_SERVER ['HTTP_USER_AGENT'];
  395. if (strpos ( $useragent, 'Windows Phone' ) > 0) { // check for windows phone
  396. $windo = 'Windows Phone';
  397. }
  398.  
  399. // Check platform
  400. $output .= ' <script>
  401. function current_video_' . $videodivId . '( video_id,d_title ){
  402. if( d_title == undefined )
  403. {
  404. document.getElementById( "video_title' . $videodivId . '" ).innerHTML="";
  405. }
  406. else {
  407. document.getElementById( "video_title' . $videodivId . '" ).innerHTML="";
  408. document.getElementById( "video_title' . $videodivId . '" ).innerHTML=d_title;
  409. }
  410. }
  411. var txt = navigator.platform ;
  412. var windo = "' . $windo . '";
  413. function failed( e ) {
  414. if( txt =="iPod"|| txt =="iPad" || txt == "iPhone" || windo=="Windows Phone" || txt == "Linux armv7l" || txt == "Linux armv6l" )
  415. {
  416. alert( "' . $player_not_support . '" );
  417. }
  418. }
  419. </script>';
  420. // player ends here
  421. // Display description, views, tags, playlist names detail under player
  422. if ($this->_post_type !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
  423. $plugin_css = 'shortcode';
  424. }
  425. if (isset ( $arguments ['views'] ) && $arguments ['views'] == 'on') {
  426. $videogalleryviews = true;
  427. } else {
  428. if (($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') && $configXML->view_visible == 1) {
  429. $videogalleryviews = true;
  430. } else {
  431. $videogalleryviews = false;
  432. $no_views = 'noviews';
  433. }
  434. }
  435. $output .= '<div class="video-page-container ' . $plugin_css . '"><div class="vido_info_container"><div class="video-page-info ' . $no_views . '">';
  436. if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
  437. if ($show_added_on) {
  438. $output .= '<div class="video-page-date"><strong>' . __ ( 'Posted&nbsp;on', 'video_gallery' ) . '&nbsp;:&nbsp;</strong><span>' . date_i18n( get_option( 'date_format' ), strtotime( $post_date ) ). '</span></div>';
  439. }
  440. }
  441. if ($videogalleryviews == true) {
  442. $output .= '<div class="video-page-views"><strong>' . __ ( 'Views', 'video_gallery' ) . '&nbsp;:&nbsp;</strong><span>' . $hitcount . '</span></div>';
  443. }
  444. $output .= '<div class="clearfix"></div>';
  445. if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
  446. $user_url = get_user_permalink ( $this->_mPageid, $uploadedby_id, $uploadedby );
  447. if ($show_posted_by) {
  448. $output .= '<div class="video-page-username"><strong>' . __ ( 'Posted&nbsp;by', 'video_gallery' ) . '&nbsp;:&nbsp;</strong><a href="' . $user_url . '">' . $uploadedby . '</a></div>';
  449. }
  450. if ($configXML->categorydisplay == 1) {
  451. $output .= '<div class="video-page-category"><strong>' . __ ( 'Category', 'video_gallery' ) . '&nbsp;:&nbsp;</strong>';
  452. foreach ( $playlistData as $playlist ) {
  453. $playlist_url = get_playlist_permalink ( $this->_mPageid, $playlist->pid, $playlist->playlist_slugname );
  454. if ($incre > 0) {
  455. $playlistname .= ',&nbsp;' . '<a href="' . $playlist_url . '">' . str_replace ( ' ', '&nbsp;', $playlist->playlist_name ) . '</a>';
  456. } else {
  457. $playlistname .= '<a href="' . $playlist_url . '">' . str_replace ( ' ', '&nbsp;', $playlist->playlist_name ) . '</a>';
  458. }
  459. $incre ++;
  460. }
  461. $output .= $playlistname . '</div>';
  462. }
  463. }
  464. $output .= '<div class="clear"></div>';
  465. // Rating starts here
  466. if ($this->_post_type === 'videogallery' || ($this->_page_post_type === 'videogallery')) {
  467. if ($configXML->ratingscontrol == 1) {
  468. $ratingscontrol = true;
  469. } else {
  470. $ratingscontrol = false;
  471. }
  472. } else if (isset ( $arguments ['ratingscontrol'] ) && $arguments ['ratingscontrol'] == 'on') {
  473. $ratingscontrol = true;
  474. } else {
  475. $ratingscontrol = false;
  476. }
  477. if ($ratingscontrol == true) {
  478. if (isset ( $ratecount ) && $ratecount != 0) {
  479. $ratestar = round ( $rate / $ratecount );
  480. } else {
  481. $ratestar = 0;
  482. }
  483. $output .= '<div class="video-page-rating">
  484. <div class="centermargin floatleft" >
  485. <div class="rateimgleft" id="rateimg" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();" >
  486. <div id="a' . $videodivId . $vid . '" class="floatleft"></div>
  487. <ul class="ratethis " id="rate' . $videodivId . $vid . '" >
  488. <li class="one" >
  489. <a title="1 Star Rating" onclick="getrate' . $videodivId . $vid . '( 1 );" onmousemove="displayrating' . $videodivId . $vid . '( 1 );" onmouseout="resetvalue' . $videodivId . $vid . '();">1</a>
  490. </li>
  491. <li class="two" >
  492. <a title="2 Star Rating" onclick="getrate' . $videodivId . $vid . '( 2 );" onmousemove="displayrating' . $videodivId . $vid . '( 2 );" onmouseout="resetvalue' . $videodivId . $vid . '();">2</a>
  493. </li>
  494. <li class="three" >
  495. <a title="3 Star Rating" onclick="getrate' . $videodivId . $vid . '( 3 );" onmousemove="displayrating' . $videodivId . $vid . '( 3 );" onmouseout="resetvalue' . $videodivId . $vid . '();">3</a>
  496. </li>
  497. <li class="four" >
  498. <a title="4 Star Rating" onclick="getrate' . $videodivId . $vid . '( 4 );" onmousemove="displayrating' . $videodivId . $vid . '( 4 );" onmouseout="resetvalue' . $videodivId . $vid . '();" >4</a>
  499. </li>
  500. <li class="five" >
  501. <a title="5 Star Rating" onclick="getrate' . $videodivId . $vid . '( 5 );" onmousemove="displayrating' . $videodivId . $vid . '( 5 );" onmouseout="resetvalue' . $videodivId . $vid . '();" >5</a>
  502. </li>
  503. </ul>
  504. <input type="hidden" name="videoid" id="videoid' . $videodivId . $vid . '" value="' . $videoId . '" />
  505. <input type="hidden" value="" id="storeratemsg' . $videodivId . $vid . '" />
  506. </div>
  507. <div class="rateright-views floatleft" >
  508. <span class="clsrateviews" id="ratemsg' . $videodivId . $vid . '" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();"> </span>
  509. <span class="rightrateimg" id="ratemsg1' . $videodivId . $vid . '" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();"> </span>
  510. </div>
  511. </div>
  512. </div> ';
  513. $output .= '<div class="clear"></div>';
  514. $output .= '<script type="text/javascript">
  515. function ratecal' . $videodivId . $vid . '( rating,ratecount )
  516. {
  517. if( rating==1 )
  518. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis onepos";
  519. else if( rating==2 )
  520. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis twopos";
  521. else if( rating==3 )
  522. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis threepos";
  523. else if( rating==4 )
  524. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fourpos";
  525. else if( rating==5 )
  526. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fivepos";
  527. else
  528. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis nopos";
  529. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+ratecount;
  530. }
  531. ';
  532. if (isset ( $ratestar ) && isset ( $ratecount )) {
  533. if ($ratecount == '') {
  534. $ratecount = 0;
  535. }
  536. $output .= 'ratecal' . $videodivId . $vid . '( ' . $ratestar . ',' . $ratecount . ' ); ';
  537. }
  538. $output .= 'function createObject' . $videodivId . $vid . '() {
  539. var request_type;
  540. var browser = navigator.appName;
  541. if( browser == "Microsoft Internet Explorer" ){
  542. request_type = new ActiveXObject( "Microsoft.XMLHTTP" );
  543. } else {
  544. request_type = new XMLHttpRequest();
  545. }
  546. return request_type;
  547. }
  548. var http = createObject' . $videodivId . $vid . '();
  549. var nocache = 0;
  550. function getrate' . $videodivId . $vid . '( t ) {
  551. if( t==1 ) {
  552. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis onepos";
  553. document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis onepos";
  554. } else if( t==2 ) {
  555. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis twopos";
  556. document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis twopos";
  557. } else if( t==3 ) {
  558. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis threepos";
  559. document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis threepos";
  560. } else if( t==4 ) {
  561. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fourpos";
  562. document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis fourpos";
  563. } else if( t==5 ) {
  564. document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fivepos";
  565. document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis fivepos";
  566. }
  567. document.getElementById( "rate' . $videodivId . $vid . '" ).style.display="none";
  568. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Thanks for rating!";
  569. var vid = document.getElementById( "videoid' . $videodivId . $vid . '" ).value;
  570. nocache = Math.random();
  571. http.open( "get", baseurl+"/wp-admin/admin-ajax.php?action=ratecount&vid="+vid+"&rate="+t,true ); //Rating calling
  572. http.onreadystatechange = insertReply' . $videodivId . $vid . ';
  573. http.send( null );
  574. document.getElementById( "rate' . $videodivId . $vid . '" ).style.visibility="disable";
  575. }
  576. function insertReply' . $videodivId . $vid . '() {
  577. if( http.readyState == 4 ) {
  578. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+http.responseText;
  579. document.getElementById( "rate' . $videodivId . $vid . '" ).className="";
  580. document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value=http.responseText;
  581. }
  582. }
  583.  
  584. function resetvalue' . $videodivId . $vid . '() {
  585. document.getElementById( "ratemsg1' . $videodivId . $vid . '" ).style.display="none";
  586. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).style.display="block";
  587. if( document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value == "" ) {
  588. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;' . $ratecount . '";
  589. } else {
  590. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value;
  591. }
  592. }
  593. function displayrating' . $videodivId . $vid . '( t ) {
  594. if( t==1 ) {
  595. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Poor";
  596. } else if( t==2 ) {
  597. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Nothing&nbsp;Special";
  598. } else if( t==3 ) {
  599. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Worth&nbsp;Watching";
  600. } else if( t==4 ) {
  601. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Pretty&nbsp;Cool";
  602. } else if( t==5 ) {
  603. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Awesome";
  604. }
  605. document.getElementById( "ratemsg1' . $videodivId . $vid . '" ).style.display="none";
  606. document.getElementById( "ratemsg' . $videodivId . $vid . '" ).style.display="block";
  607. }
  608. </script>';
  609. }
  610. // Rating ends here
  611. $output .= '</div>';
  612. if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
  613. if (! empty ( $tag_name ) && $configXML->tagdisplay == 1) { // Tag display
  614. $output .= '<div class="video-page-tag"><strong>' . __ ( 'Tags', 'video_gallery' ) . ' </strong>: ' . $tag_name . ' ' . '</div>';
  615. }
  616. if (strpos ( $videoUrl, 'youtube' ) > 0) { // check video url is Youtube
  617. $imgstr = explode ( 'v=', $videoUrl );
  618. $imgval = explode ( '&', $imgstr [1] );
  619. $videoId1 = $imgval [0];
  620. $video_thumb = 'http://img.youtube.com/vi/' . $videoId1 . '/mqdefault.jpg';
  621. }
  622. $removequotedescription = str_replace ( '"', '', $description );
  623. $videodescription = str_replace ( "'", '', $removequotedescription );
  624.  
  625. $blog_title = get_bloginfo ( 'name' );
  626. $current_url = 'http://' . $_SERVER ['HTTP_HOST'] . $_SERVER ['REQUEST_URI'] . '?random=' . rand ( 0, 100 );
  627. if ($video_file_type == 5) {
  628. $sd = '';
  629. } else {
  630. $sd = '%5Bvideo%5D%5Bheight%5D=360&amp;p%5Bvideo%5D%5Bsrc%5D=' . urlencode ( $this->_swfPath ) . '%3Ffile%3D' . urlencode ( $videoUrl ) . '%26baserefW%3D' . urlencode ( APPTHA_VGALLERY_BASEURL ) . '%2F%26vid%3D' . $vid . '%26embedplayer%3Dtrue%26HD_default%3Dtrue%26share%3Dfalse%26skin_autohide%3Dtrue%26showPlaylist%3Dfalse&amp;p';
  631. }
  632. if ($show_social_icon) {
  633. $url_fb = "http://www.facebook.com/sharer/sharer.php?s=100&amp;p%5Btitle%5D=" . urlencode($video_title) . "&amp;p%5Bsummary%5D=" . urlencode($videodescription) . "&amp;p%5Bmedium%5D=103&amp;p%5Bvideo%5D%5Bwidth%5D=640&amp;p" . $sd . "%5Burl%5D=" . urlencode($current_url) . "&amp;p%5Bimages%5D%5B0%5D=" . urlencode($video_thumb);
  634. $rs_url = get_site_url () . '/wp-admin/admin-ajax.php?action=rss&type=video&vid='.$vid;
  635. $rss_image = plugins_url ( $this->_plugin_name.'/images/rss_icon.png' );
  636. $output .= '
  637. <!-- Facebook share Start -->
  638. <div class="video-socialshare">
  639. <div class="floatleft" style=" margin-right: 9px; "><a href="' . $url_fb . '" class="fbshare" id="fbshare" target="_blank" ></a></div>
  640. <!-- Facebook share End and Twitter like Start -->
  641. <div class="floatleft ttweet" ><a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="' . $current_url . '" data-via="' . $blog_title . '" data-text="' . $video_title . '">' . __ ( 'Tweet', 'video_gallery' ) . '</a><script>!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></div>
  642. <!-- Twitter like End and Google plus one Start -->
  643. <div class="floatleft gplusshare" ><script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script><div class="g-plusone" data-size="medium" data-count="false"></div></div>
  644. <!-- Google plus one End -->
  645. ';
  646. if( $show_rss_icon ){
  647. $output .='<div class="floatleft rssfeed">&nbsp;&nbsp;<a href="' . $rs_url . '"><img src="' . $rss_image . '"></a></div>';
  648. }
  649. $output .='</div>';
  650.  
  651. $output .= '<div class="clearfix">';
  652.  
  653. }
  654. $output .= '<div class="video-cat-thumb">';
  655. // show rss icon enable / disable
  656. if($show_rss_icon && !$show_social_icon ) {
  657. $rs_url = get_site_url () . '/wp-admin/admin-ajax.php?action=rss&type=video&vid='.$vid;
  658. $rss_image = plugins_url ( $this->_plugin_name.'/images/rss_icon.png' );
  659. $output .='<div class="video-socialshare"><div class="floatleft rssfeed">&nbsp;&nbsp;<a href="' . $rs_url . '"><img src="' . $rss_image . '"></a></div></div>';
  660. }
  661. // show or hide embed /iframe/report video option code for video detail page..
  662.  
  663. if( $configXML->embed_visible == 1){
  664. $output .= '<a href="javascript:void( 0 )" onclick="enableEmbed();" class="embed" id="allowEmbed"><span class="embed_text">' . __ ( 'Embed&nbsp;Code', 'video_gallery' ) . '</span><span class="embed_arrow"></span></a>';
  665. }
  666. if( isset($player_color['iframe_visible'] ) && ( $player_color['iframe_visible'] ) ){
  667. $output .= '<a href="javascript::void(0);" onclick="view_iframe_code();" id="iframe_code" class="embed"><span class="embed_text">'.__('Iframe' , 'video_gallery').'</span><span class="embed_arrow"></span></a>';
  668.  
  669. }
  670. if( isset( $player_color['report_visible'] ) && ( $player_color['report_visible'] ) ){
  671. $output .='<a href="javascript:void(0)" onclick="reportVideo();" class="embed" id="allowReport"><span class="embed_text">' . __ ( 'Report&nbsp;Video', 'video_gallery' ) . '</span><span class="embed_arrow"></span></a>';
  672. }
  673. if ($fetched [0]->file_type == 5 && ! empty ( $fetched [0]->embedcode )) {
  674. $embed_code = stripslashes ( $fetched [0]->embedcode );
  675. } else {
  676. $embed_code = '<embed src="' . $this->_swfPath . '" flashvars="' . $flashvars . '&amp;shareIcon=false&amp;email=false&amp;showPlaylist=false&amp;zoomIcon=false&amp;copylink=' . get_permalink () . '&amp;embedplayer=true" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" wmode="transparent">';
  677. }
  678. $output .='<textarea onclick="this.select()" id="embedcode" name="embedcode" style="display:none;" rows="7" >' . $embed_code . '</textarea>
  679. <input type="hidden" name="flagembed" id="flagembed" />';
  680. $admin_email = get_option('admin_email');
  681. $user_email = $this->_userEmail;
  682. $output .='<div id="report_video_response"></div><form name="reportform" id="reportform" style="display:none;" method="post" >';
  683. $output .='<div class="report-video-title">Report this video</div>';
  684. $output .='<img id="reportform_ajax_loader" src="'.APPTHA_VGALLERY_BASEURL.'/images/ajax-loader.gif" />';
  685. $output .='<input type="radio" name="reportvideotype" id="reportvideotype" value="Violent or repulsive content">Violent or repulsive content<label class="reportvideotype" title="Violent or grapical content or content posted to shock viewers"></label><br>';
  686. $output .='<input type="radio" name="reportvideotype" id="reportvideotype" value="Hateful or abusive content" >Hateful or abusive content<label class="reportvideotype" title="Content that promotes harted against protected groups, abuses vulnerable individuals , or enganges in cyberling"></label><br>';
  687. $output .='<input type="radio" name="reportvideotype" id="reportvideotype" value="Harmful dangerous acts" >Harmful dangerous acts<label class="reportvideotype" title="Content that includes acts that many results in physical harm"></label><br>';
  688. $output .='<input type="radio" name="reportvideotype" id="reportvideotype" value="Spam or misleading">Spam or misleading<label class="reportvideotype" title="Content that is massively posted or otherwise misleading in nature"></label><br>';
  689. $output .='<input type="radio" name="reportvideotype" class="reportvideotype" id="reportvideotype" value="Child abuse">Child abuse<label class="reportvideotype" title="Content that includes sexual,predatory or abusive communication towards minors"></label><br>';
  690. $output .='<input type="radio" name="reportvideotype" class="reportvideotype" id="reportvideotype" value="Sexual content">Sexual content<label class="reportvideotype" title="Includes graphic sexual activity, nutity and other sexual content"></label><br>';
  691. $output .='<input type="hidden" id="admin_email" value="'.$admin_email.'" name="admin_email" />';
  692. $output .='<input type="hidden" id="reporter_email" value="'.$user_email.'" name="reporter_email" />';
  693. $output .='<input type="hidden" id="video_title" value="'.$video_title.'" name="video_title" />';
  694. $output .='<input type="hidden" id="redirect_url" value="'.get_video_permalink( $this->_vId ).'" name="redirect_url" />';
  695. $output .='<input type="button" class="reportbutton" value="Send" onclick="return reportVideoSend();" name="reportsend" />';
  696. $output .='&nbsp;&nbsp;<input type="reset" onclick="return hideReportForm();" class="reportbutton" value="Cancel" id="ReportFormreset" name="reportclear" />';
  697. $output .='</form>';
  698. $output .='<input type="hidden" name="reportvideo" id="reportvideo" />';
  699. if( $fetched[0]->file_type == 5 && $fetched[0]->embedcode){
  700. $iframe_code = stripslashes($fetched[0]->embedcode);
  701. }else{
  702. $iframe_code = '<iframe src="'.$this->_swfPath.'?'. $flashvars . '&amp;shareIcon=false&amp;email=false&amp;showPlaylist=false&amp;zoomIcon=false&amp;copylink=' . get_permalink() . '&amp;embedplayer=true" frameborder="0" width="' . $width . '" height="' . $height . '" ></iframe>';
  703. }
  704. $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" />';
  705. // Show /hide video description.
  706. if ($configXML->showTag) {
  707. $output .= '<div style="clear: both;"></div><div class="video-page-desc">' . apply_filters('the_content', $description ) . '</div>';
  708. }
  709.  
  710. $output .= '</div>';
  711. }
  712. $output .= '</div></div>';
  713. // Enable/disable Related videos starts here
  714. if ( ( ( $this->_post_type === 'videogallery' && $configXML->playlist == 1|| $this->_page_post_type === 'videogallery' && $configXML->playlist == 1) ) || (((isset ( $arguments ['playlistid'] ) && isset ( $arguments ['id'] )) || $player_color['show_related_video']== 1|| (isset ( $arguments ['playlistid'] ))) && (isset ( $arguments ['relatedvideos'] ) && $arguments ['relatedvideos'] == 'on'))) {
  715. $Limit = $player_color['related_video_count'];
  716.  
  717. if(empty($Limit))
  718. {
  719. $Limit=100;
  720. }
  721.  
  722. $select = 'SELECT distinct( a.vid ),b.playlist_id,name,guid,description,file,hdfile,file_type,duration,embedcode,image,opimage,download,link,featured,hitcount,slug,
  723. a.post_date,postrollads,prerollads FROM ' . $wpdb->prefix . 'hdflvvideoshare a
  724. LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_med2play b ON a.vid=b.media_id
  725. LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist p ON p.pid=b.playlist_id
  726. LEFT JOIN ' . $wpdb->prefix . 'posts s ON s.ID=a.slug
  727. WHERE b.playlist_id=' . intval ( $video_playlist_id ) . ' AND a.publish=1 AND p.is_publish=1
  728. ORDER BY a.vid DESC LIMIT '.$Limit;
  729. $output .= '<div class="player_related_video"><h2 class="related-videos">' . __ ( 'Related Videos', 'video_gallery' ) . '</h2><div style="clear: both;"></div>';
  730. $related = $wpdb->get_results( $select );
  731. if (! empty ( $related ))
  732. $result = count($related);
  733. if($result < 4) {
  734. $output .='<style>.jcarousel-next , .jcarousel-prev {display:none!important;}</style>';
  735. }
  736. if ($result != '') {
  737. // Slide Display Here
  738. $output .= '<ul id="mycarousel" class="jcarousel-skin-tango">';
  739. $image_path = str_replace ( 'plugins/' . $this->_plugin_name . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL );
  740. foreach ($related as $relFet ) {
  741. $file_type = $relFet->file_type; // Video Type
  742. $imageFea = $relFet->image; // VIDEO IMAGE
  743. $reafile = $relFet->file; // VIDEO IMAGE
  744. $guid = get_video_permalink ( $relFet->slug ); // guid
  745.  
  746. if ($imageFea == '') { // If there is no thumb image for video
  747. $imageFea = $this->_imagePath . 'nothumbimage.jpg';
  748. } else {
  749. if ($file_type == 2 || $file_type == 5) { // For uploaded image
  750.  
  751. if ( $file_type == 2 && strpos( $imageFea , '/' ) ) {
  752. $imageFea = $imageFea;
  753. } else {
  754. $imageFea = $image_path . $imageFea;
  755. }
  756. } else if ( $file_type == 3 ) {
  757. $imageFea = $imageFea;
  758. }
  759. }
  760. // Embed player code
  761. if ($file_type == 5 && ! empty ( $relFet->embedcode )) {
  762. $relFetembedcode = stripslashes ( $relFet->embedcode );
  763. $relFetiframewidth = preg_replace ( array (
  764. '/width="\d+"/i'
  765. ), array (
  766. sprintf ( 'width="%d"', $width )
  767. ), $relFetembedcode );
  768. if ($mobile === true) {
  769. $player_values = htmlentities ( $relFetiframewidth );
  770. } else {
  771. $player_values = htmlentities ( preg_replace ( array (
  772. '/height="\d+"/i'
  773. ), array (
  774. sprintf ( 'height="%d"', $height )
  775. ), $relFetiframewidth ) );
  776. }
  777. } else {
  778. $mobile = vgallery_detect_mobile ();
  779. if ($mobile === true) {
  780. // Check for youtube video
  781. if (preg_match ( '/www\.youtube\.com\/watch\?v=[^&]+/', $reafile, $vresult )) {
  782. $urlArray = explode ( '=', $vresult [0] );
  783. $video_id = trim ( $urlArray [1] );
  784. $reavideourl = 'http://www.youtube.com/embed/' . $video_id;
  785. // Generate youtube embed code for html5 player
  786. $player_values = htmlentities ( '<iframe widht="100%" type="text/html" src="' . $reavideourl . '" frameborder="0"></iframe>' );
  787. } else if ($file_type != 5) { // Check for upload, URL and RTMP videos
  788. if ($file_type == 2) { // For uploaded image
  789. $reavideourl = $image_path . $reafile;
  790. } else if ($file_type == 4) { // For RTMP videos
  791. $streamer = str_replace ( 'rtmp://', 'http://', $media->streamer_path );
  792. $reavideourl = $streamer . '_definst_/mp4:' . $reafile . '/playlist.m3u8';
  793. }
  794. // Generate video code for html5 player
  795. $player_values = htmlentities ( '<video widht="100%" id="video" poster="' . $imageFea . '" src="' . $reavideourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>' );
  796. }
  797. } else {
  798. // Flash player code
  799. $player_values = htmlentities ( '<embed src="' . $this->_swfPath . '" flashvars="' . $pluginflashvars . '&amp;mtype=playerModule&amp;vid=' . $relFet->vid . '" width="' . $width . '" height="' . $height . '" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" wmode="transparent">' );
  800. }
  801. }
  802. if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
  803. $thumb_href = 'href="' . $guid . '"';
  804. } else {
  805. $player_div = 'mediaspace';
  806. $embedplayer = "videogallery_change_player( '$player_values',$videodivId,'$player_div',$file_type,$relFet->vid,'$relFet->name' )";
  807. $thumb_href = 'href="javascript:void( 0 );" onclick="' . $embedplayer . '"';
  808. }
  809. $output .= '<li><div class="imgSidethumb"><a title="'.$relFet->name.'" ' . $thumb_href . '><img src="' . $imageFea . '" alt="' . $relFet->name . '" class="related" /></a></div>';
  810. $output .= '<div class="vid_info"><span><a ' . $thumb_href . ' class="videoHname" title="'.$relFet->name.'">';
  811. if (strlen ( $relFet->name ) > 30) { // Displaying Video Title
  812. $videoname = substr ( $relFet->name, 0, 30 ) . '..';
  813. } else {
  814. $videoname = $relFet->name;
  815. }
  816. $output .= $videoname;
  817. $output .= '</a></span></div>';
  818. $output .= '</li>';
  819. }
  820.  
  821. $output .= '</ul>';
  822. }
  823. $output .= '</div>';
  824. }
  825. if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
  826. // Default Comments
  827. if ($configXML->comment_option == 0) {
  828. $output .= '<style type="text/css">#respond,#comments #respond,#comments.comments-area, #disqus_thread, .comments-link{ display: none!important; } </style>';
  829. }
  830. // Facebook Comments
  831. if ($configXML->comment_option == 2) {
  832. $output .= '<style type="text/css">#respond,#comments #respond,#comments.comments-area, #disqus_thread, .comments-link{ display: none!important; } </style>';
  833. $output .= '<div class="clear"></div>
  834. <h2 class="related-videos">' . __ ( 'Post Your Comments', 'video_gallery' ) . '</h2>
  835. <div id="fb-root"></div>
  836. <script>
  837. ( function( d, s, id ) {
  838. var js, fjs = d.getElementsByTagName( s )[0];
  839. if ( d.getElementById( id ) ) return;
  840. js = d.createElement( s ); js.id = id;
  841. js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=' . $configXML->keyApps . '";
  842. fjs.parentNode.insertBefore( js, fjs );
  843. }( document, "script", "facebook-jssdk" ) );
  844. </script>';
  845. $output .= '<div class="fb-comments" data-href="' . get_permalink () . '" data-num-posts="5"></div>';
  846. } // Disqus Comment
  847. else if ($configXML->comment_option == 3) {
  848. $output .= '<style type="text/css">#comments #respond,#comments.comments-area, .comments-link{ display: none!important; } </style>';
  849. $output .= '<div id="disqus_thread"></div>
  850. <script type="text/javascript">
  851. var disqus_shortname = "' . $configXML->keydisqusApps . '";
  852. ( function() {
  853. var dsq = document.createElement( "script" ); dsq.type = "text/javascript"; dsq.async = true;
  854. dsq.src = "http://"+ disqus_shortname + ".disqus.com/embed.js";
  855. ( document.getElementsByTagName( "head" )[0] || document.getElementsByTagName( "body" )[0] ).appendChild( dsq );
  856. } )();
  857. </script>
  858. <noscript>' . __ ( 'Please enable JavaScript to view the', 'video_gallery' ) . ' <a href="http://disqus.com/?ref_noscript">' . __ ( 'comments powered by Disqus.', 'video_gallery' ) . '</a></noscript>
  859. <a href="http://disqus.com" class="dsq-brlink">' . __ ( 'comments powered by', 'video_gallery' ) . ' <span class="logo-disqus">' . __ ( 'Disqus', 'video_gallery' ) . '</span></a>';
  860. }
  861. }
  862. return $output;
  863. }
  864. /**
  865. * function for get related video
  866. *
  867. * @global type $wpdb
  868. * @param type $videoID
  869. * @return type $related_video
  870. */
  871. public function get_related_videos($vid) {
  872. global $wpdb;
  873. $video_playlist_id = $wpdb->get_var ( "SELECT playlist_id FROM " . $wpdb->prefix . "hdflvvideoshare_med2play WHERE media_id='$vid'" );
  874. $Limit = $wpdb->get_var("SELECT related_video_count FROM " . $wpdb->prefix . "hdflvvideoshare_settings LIMIT 1");
  875. if( empty($Limit) ) {
  876. $Limit=100 ;
  877. }
  878. $sql = "SELECT distinct a.*,s.guid,b.playlist_id,p.playlist_name,p.playlist_slugname
  879. FROM " . $wpdb->prefix . "hdflvvideoshare a
  880. INNER JOIN " . $wpdb->prefix . "hdflvvideoshare_med2play b ON a.vid=b.media_id
  881. INNER JOIN " . $wpdb->prefix . "hdflvvideoshare_playlist p ON p.pid=b.playlist_id
  882. INNER JOIN " . $wpdb->prefix . "posts s ON s.ID=a.slug
  883. WHERE b.playlist_id=" . $video_playlist_id . " AND a.publish='1' AND p.is_publish='1' GROUP BY a.vid ORDER BY a.vid DESC LIMIT ".$Limit;
  884.  
  885. $related_videos = $wpdb->get_results ( $sql );
  886. return $related_videos;
  887. }
  888. } // class over
  889. } else {
  890. echo 'class contusVideo already exists';
  891. }
  892. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement