Example #1
0
 function searchlist($video_search, $CountOFVideos, $TypeOFvideos, $pagenum, $dataLimit)
 {
     $div = '';
     $pagenum = isset($pagenum) ? absint($pagenum) : 1;
     // Calculating page number
     $start = ($pagenum - 1) * $dataLimit;
     // Video starting from
     $limit = $dataLimit;
     // Video Limit
     $ratearray = array('nopos1', 'onepos1', 'twopos1', 'threepos1', 'fourpos1', 'fivepos1');
     $div .= '<div class="video_wrapper" id="video_search_result"><h3 class="entry-title">' . __('Search Results', 'video_gallery') . ' - ' . $video_search . '</h3>';
     $div .= '<style> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important; } </style>';
     // Fetch videos for every category
     if (!empty($TypeOFvideos)) {
         $i = $inc = 0;
         $image_path = str_replace('plugins/' . $this->_folder . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL);
         $div .= '<ul class="video-block-container">';
         foreach ($TypeOFvideos as $playList) {
             $duration = $playList->duration;
             $imageFea = $playList->image;
             // VIDEO IMAGE
             $file_type = $playList->file_type;
             // Video Type
             $guid = get_video_permalink($playList->slug);
             // guid
             if ($imageFea == '') {
                 // If there is no thumb image for video
                 $imageFea = $this->_imagePath . 'nothumbimage.jpg';
             } else {
                 if ($file_type == 2 || $file_type == 5) {
                     if (strpos($imageFea, '/')) {
                         $imageFea = $imageFea;
                     } else {
                         $imageFea = $image_path . $imageFea;
                     }
                 } else {
                     if ($file_type == 3) {
                         $imageFea = $imageFea;
                     }
                 }
             }
             if (strlen($playList->name) > 30) {
                 $playListName = substr($playList->name, 0, 30) . '..';
             } else {
                 $playListName = $playList->name;
             }
             if ($inc % $this->_colF == 0 && $inc != 0) {
                 // COLUMN COUNT
                 $div .= '</ul><div class="clear"></div><ul class="video-block-container">';
             }
             $div .= '<li class="video-block"><div class="video-thumbimg"><a href="' . $guid . '" title="' . $playList->name . '"><img src="' . $imageFea . '" alt="" class="imgHome" title="" /></a>';
             if ($duration != '0:00') {
                 $div .= '<span class="video_duration">' . $duration . '</span>';
             }
             $div .= '</div><div class="vid_info"><a href="' . $guid . '" class="videoHname" title="' . $playList->name . '" >' . $playListName . '</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
             if ($this->_settingsData->ratingscontrol == 1) {
                 if (isset($playList->ratecount) && $playList->ratecount != 0) {
                     $ratestar = round($playList->rate / $playList->ratecount);
                 } else {
                     $ratestar = 0;
                 }
                 $div .= '<span class="ratethis1 ' . $ratearray[$ratestar] . '"></span>';
             }
             // Rating ends and views starts here
             if ($this->_settingsData->view_visible == 1) {
                 if ($playList->hitcount > 1) {
                     $viewlang = $this->_viewslang;
                 } else {
                     $viewlang = $this->_viewlang;
                 }
                 $div .= '<span class="video_views">' . $playList->hitcount . '&nbsp;' . $viewlang . '</span>';
             }
             $div .= '</div></li>';
             $inc++;
         }
         $div .= '</ul>';
     } else {
         // If there is no video for category
         $div .= '<div>' . __('No&nbsp;Videos&nbsp;Found', 'video_gallery') . '</div>';
     }
     $div .= '</div>';
     $div .= '<div class="clear"></div>';
     // PAGINATION STARTS
     $total = $CountOFVideos;
     $num_of_pages = ceil($total / $dataLimit);
     $video_search = str_replace(' ', '%20', $video_search);
     $arr_params = array('pagenum' => '%#%');
     $page_links = paginate_links(array('base' => add_query_arg($arr_params), 'format' => '', 'prev_text' => __('&laquo;', 'aag'), 'next_text' => __('&raquo;', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum));
     if ($page_links) {
         $div .= '<div class="contus_tablenav"><div class="contus_tablenav-pages" >' . $page_links . '</div></div>';
     }
     // PAGINATION ENDS
     return $div;
 }
Example #2
0
 /**
  * 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) . '&nbsp;' . __('Videos', APPTHA_VGALLERY) . '&nbsp;' . __('Under&nbsp;this&nbsp;Category', APPTHA_VGALLERY);
                 } else {
                     /** Display no videos link for other more pages */
                     $div .= __('No', APPTHA_VGALLERY) . '&nbsp;' . $typename . '&nbsp;' . __('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  for get the video from  category based.
         * @global type $wpdb
         * @param type $CountOFVideos
         * @param type $TypeOFvideos
         * @param type $pagenum
         * @param type $dataLimit
         * @param type $category_page
         * @return $category_videos
         */
        function categorylist($CountOFVideos, $TypeOFvideos, $pagenum, $dataLimit, $category_page)
        {
            global $wpdb;
            $div = '';
            $ratearray = array('nopos1', 'onepos1', 'twopos1', 'threepos1', 'fourpos1', 'fivepos1');
            $pagenum = isset($pagenum) ? absint($pagenum) : 1;
            //  Calculating page number
            $div .= '<style scoped> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important;float:left;} </style>';
            foreach ($TypeOFvideos as $catList) {
                $sql = 'SELECT s.guid,w.* FROM ' . $wpdb->prefix . 'hdflvvideoshare as w
					LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_med2play as m ON m.media_id = w.vid
					LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist as p on m.playlist_id = p.pid
					LEFT JOIN ' . $this->_wpdb->prefix . 'posts s ON s.ID=w.slug
					WHERE w.publish=1 and p.is_publish=1 and m.playlist_id=' . intval($catList->pid) . ' GROUP BY w.vid LIMIT ' . $dataLimit;
                $playLists = $wpdb->get_results($sql);
                $playlistCount = count($playLists);
                //Get count video assign this category.
                $category_video = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'hdflvvideoshare_med2play as m 
					LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist as p on m.playlist_id = p.pid WHERE m.playlist_id=' . intval($catList->pid) . ' AND p.is_publish=1');
                $video_count = count($category_video);
                // end of  get count
                $div .= '<div class="titleouter"> <h4 class="more_title">' . $catList->playlist_name . '</h4></div>';
                if (!empty($playlistCount)) {
                    $inc = 1;
                    $image_path = str_replace('plugins/' . $this->_plugin_name . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL);
                    $div .= '<ul class="video-block-container">';
                    foreach ($playLists as $playList) {
                        $duration = $playList->duration;
                        $imageFea = $playList->image;
                        //  VIDEO IMAGE
                        $file_type = $playList->file_type;
                        //  Video Type
                        $guid = get_video_permalink($playList->slug);
                        //  guid - url for video detail page
                        if ($imageFea == '') {
                            //  If there is no thumb image for video
                            $imageFea = $this->_imagePath . 'nothumbimage.jpg';
                        } else {
                            if ($file_type == 2 || $file_type == 5) {
                                if (strpos($imageFea, '/')) {
                                    $imageFea = $imageFea;
                                } else {
                                    $imageFea = $image_path . $imageFea;
                                }
                            } else {
                                if ($file_type == 3) {
                                    $imageFea = $imageFea;
                                }
                            }
                        }
                        if (strlen($playList->name) > 30) {
                            $playListName = substr($playList->name, 0, 30) . '..';
                        } else {
                            $playListName = $playList->name;
                        }
                        $div .= '<li class="video-block"><div class="video-thumbimg"><a href="' . $guid . '"><img src="' . $imageFea . '" alt="" class="imgHome" title=""></a>';
                        if ($duration != '0:00') {
                            $div .= '<span class="video_duration">' . $duration . '</span>';
                        }
                        $div .= '</div><div class="vid_info"><a href="' . $guid . '" title="' . $playList->name . '" class="videoHname"><span>' . $playListName . '</span></a>';
                        //Rating for  category video
                        if ($this->_settingsData->ratingscontrol == 1) {
                            if (isset($playList->ratecount) && $playList->ratecount != 0) {
                                $ratestar = round($playList->rate / $playList->ratecount);
                            } else {
                                $ratestar = 0;
                            }
                            $div .= '<span class="ratethis1 ' . $ratearray[$ratestar] . '"></span>';
                        }
                        // Show views count for video
                        if ($this->_settingsData->view_visible == 1) {
                            if ($playList->hitcount > 1) {
                                $viewlang = $this->_viewslang;
                            } else {
                                $viewlang = $this->_viewlang;
                            }
                            $div .= '<span class="video_views">' . $playList->hitcount . '&nbsp;' . $viewlang . '</span>';
                        }
                        $div .= '</div></li>';
                        if ($inc % $this->_colCat == 0 && $inc != 0) {
                            // COLUMN COUNT
                            $div .= '</ul><div class="clear"></div><ul class="video-block-container">';
                        }
                        $inc++;
                    }
                    $div .= '</ul>';
                    // Video category thumb based on gallery seeting number of rows,cols based
                    $colF = $this->_settingsData->colCat;
                    $rowF = $this->_settingsData->rowCat;
                    $CatLimit = $colF * $rowF;
                    if ($video_count > $CatLimit) {
                        $more_playlist_link = get_playlist_permalink($this->_mPageid, $catList->pid, $catList->playlist_slugname);
                        $div .= '<a class="video-more" href="' . $more_playlist_link . '">' . __('More&nbsp;Videos', 'video_gallery') . '</a>';
                    } else {
                        $div .= '<div align="clear"> </div>';
                    }
                } else {
                    //  If there is no video for category
                    $div .= '<div class="titleouter">' . __('No Videos for this Category', 'video_gallery') . '</div>';
                }
            }
            $div .= '<div class="clear"></div>';
            if ($category_page != 0) {
                // PAGINATION STARTS
                $total = $CountOFVideos;
                $num_of_pages = ceil($total / $category_page);
                $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'aag'), 'next_text' => __('&raquo;', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum));
                if ($page_links) {
                    $div .= '<div class="contus_tablenav"><div class="contus_tablenav-pages" >' . $page_links . '</div></div>';
                }
                // PAGINATION ENDS
            }
            return $div;
        }
    function widget($args, $instance)
    {
        ## and after_title are the array keys." - These are set up by the theme
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $show = 3;
        ## WIDGET CODE GOES HERE
        global $wpdb;
        ## These are our own options
        //Show no of  video  in  this  widgets
        if ($instance['show']) {
            if (absint($instance['show'])) {
                $show = $instance['show'];
            }
        }
        ?>
		<!-- Recent videos For Getting The Page Id More and Video-->
		<?php 
        $moreName = $wpdb->get_var('SELECT ID from ' . $wpdb->prefix . 'posts WHERE post_content LIKE "%[videomore]%" and post_status="publish" and post_type="page" limit 1');
        ## For video category
        $sql = 'SELECT * FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist WHERE is_publish=1 LIMIT ' . $show;
        $features = $wpdb->get_results($sql);
        $moreCategories = $wpdb->get_results('SELECT COUNT(*) AS contus FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist WHERE is_publish=1');
        $countCategories = $moreCategories[0]->contus;
        $div = '';
        $more_videos_link = get_morepage_permalink($moreName, 'categories');
        echo $before_widget;
        $div .= '<div id="videos-category"  class="widget widget_categories sidebar-wrap "> <h3 class="widget-title"><a href="' . $more_videos_link . '">' . $title . '</a></h3>';
        $div .= '<ul class="ulwidget clearfix">';
        ## were there any posts found?
        if (!empty($features)) {
            ## posts were found, loop through them
            foreach ($features as $feature) {
                $fetched = $feature->playlist_name;
                $playlist_slugname = $feature->playlist_slugname;
                $playlist_id = $feature->pid;
                $div .= '<li>';
                $playlist_url = get_playlist_permalink($moreName, $playlist_id, $playlist_slugname);
                $div .= '<a class="videoHname "  href="' . $playlist_url . '">' . $fetched . '</a>';
                $div .= '</li>';
            }
        } else {
            $div .= '<li>' . __('No Categories', 'video_gallery') . '</li>';
        }
        ## end list
        if ($show < $countCategories) {
            $div .= '<li><div class="right video-more"><a href="' . $more_videos_link . '">' . __('More Categories', 'video_gallery') . ' &#187;</a></div></li>';
        }
        $div .= '</ul></div>';
        echo balanceTags($div);
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        // and after_title are the array keys." - These are set up by the theme
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $show = 3;
        global $wpdb;
        // These are our own options
        if ($instance['show']) {
            if (absint($instance['show'])) {
                $show = $instance['show'];
            }
        }
        $site_url = get_site_url();
        $dir = dirname(plugin_basename(__FILE__));
        $dirExp = explode('/', $dir);
        $dirPage = $dirExp[0];
        $countF = $div = '';
        ?>
		<!-- For Getting The Page Id More and Video-->
		<?php 
        global $post;
        echo $before_widget;
        $videoID = $post->ID;
        if (isset($_GET['p'])) {
            $videoID = intval($_GET['p']);
        }
        $moreName = $wpdb->get_var('SELECT ID FROM ' . $wpdb->prefix . 'posts WHERE post_content LIKE "%[videomore]%" AND post_status="publish" AND post_type="page" LIMIT 1');
        if (!empty($videoID)) {
            $videoID = $wpdb->get_var('SELECT vid FROM ' . $wpdb->prefix . 'hdflvvideoshare WHERE slug=' . $videoID);
            if (!empty($videoID)) {
                $video_playlist_id = $wpdb->get_var('SELECT playlist_id FROM ' . $wpdb->prefix . 'hdflvvideoshare_med2play WHERE media_id=' . $videoID);
                $settings_result = $wpdb->get_row('SELECT ratingscontrol,view_visible FROM ' . $wpdb->prefix . 'hdflvvideoshare_settings WHERE settings_id=1');
                $site_url = get_site_url();
                $ratearray = array('nopos1', 'onepos1', 'twopos1', 'threepos1', 'fourpos1', 'fivepos1');
                $viewslang = __('Views', 'video_gallery');
                $viewlang = __('View', 'video_gallery');
                $show = $instance['show'];
                $sql = 'SELECT distinct a.*,s.guid,b.playlist_id,p.playlist_name,p.playlist_slugname
						FROM ' . $wpdb->prefix . 'hdflvvideoshare a
						LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_med2play b ON a.vid=b.media_id
						LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist p ON p.pid=b.playlist_id
						LEFT JOIN ' . $wpdb->prefix . 'posts s ON s.ID=a.slug
						WHERE b.playlist_id=' . $video_playlist_id . ' AND a.vid != ' . $videoID . ' and a.publish=1 AND p.is_publish=1 GROUP BY a.vid ORDER BY a.vid DESC LIMIT ' . $show;
                $relatedVideos = $wpdb->get_results($sql);
                if (!empty($relatedVideos)) {
                    $playlistID = $relatedVideos[0]->playlist_id;
                    $playlist_slugname = $relatedVideos[0]->playlist_slugname;
                    $moreF = $wpdb->get_results('SELECT COUNT(a.vid) as relatedcontus from ' . $wpdb->prefix . 'hdflvvideoshare a LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_med2play b ON a.vid=b.media_id WHERE b.playlist_id=' . $playlistID . ' ORDER BY a.vid DESC');
                    $countF = $moreF[0]->relatedcontus;
                }
            }
        }
        if (!empty($video_playlist_id)) {
            $link = '<a href=' . $site_url . '/?page_id=' . $moreName . '&amp;playid=' . $video_playlist_id . '>' . $title . '</a>';
        } else {
            $link = $title;
        }
        $div .= '<div id="related-videos"  class="sidebar-wrap "><h3 class="widget-title">' . $link . '</h3>';
        $div .= '<ul class="ulwidget">';
        if (!empty($videoID)) {
            // were there any posts found?
            if (!empty($relatedVideos)) {
                // posts were found, loop through them
                $image_path = str_replace('plugins/' . $dirPage . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL);
                $_imagePath = APPTHA_VGALLERY_BASEURL . 'images' . DS;
                foreach ($relatedVideos as $feature) {
                    $file_type = $feature->file_type;
                    // Video Type
                    $imageFea = $feature->image;
                    $guid = get_video_permalink($feature->slug);
                    //guid
                    if ($imageFea == '') {
                        //If there is no thumb image for video
                        $imageFea = $_imagePath . 'nothumbimage.jpg';
                    } else {
                        if ($file_type == 2 || $file_type == 5) {
                            //For uploaded image
                            if ($file_type == 2 && strpos($imageFea, '/')) {
                                $imageFea = $imageFea;
                            } else {
                                $imageFea = $image_path . $imageFea;
                            }
                        } else {
                            if ($file_type == 3) {
                                $imageFea = $imageFea;
                            }
                        }
                    }
                    $name = strlen($feature->name);
                    //output to screen
                    $div .= '<li class="clearfix sideThumb">';
                    $div .= '<div class="imgBorder"><a href="' . $guid . '" title="' . $feature->name . '" ><img src="' . $imageFea . '" alt="' . $feature->name . '"  class="img" style="width: 120px; height: 80px;" width="120" height="80"  /></a>';
                    if ($feature->duration != 0.0) {
                        $div .= '<span class="video_duration">' . $feature->duration . '</span>';
                    }
                    $div .= '</div>';
                    $div .= '<div class="side_video_info"><a class="videoHname" title="' . $feature->name . '" href="' . $guid . '">';
                    if ($name > 25) {
                        $div .= substr($feature->name, 0, 25) . '..';
                    } else {
                        $div .= $feature->name;
                    }
                    $div .= '</a><div class="clear"></div>';
                    if ($settings_result->view_visible == 1) {
                        if ($feature->hitcount > 1) {
                            $viewlanguage = $viewslang;
                        } else {
                            $viewlanguage = $viewlang;
                        }
                        $div .= '<span class="views">' . $feature->hitcount . ' ' . $viewlanguage;
                        $div .= '</span>';
                    }
                    // Rating starts here
                    if ($settings_result->ratingscontrol == 1) {
                        if (isset($feature->ratecount) && $feature->ratecount != 0) {
                            $ratestar = round($feature->rate / $feature->ratecount);
                        } else {
                            $ratestar = 0;
                        }
                        $div .= '<span class="ratethis1 ' . $ratearray[$ratestar] . '"></span>';
                    }
                    // Rating ends here
                    $div .= '</span>';
                    $div .= '<div class="clear"></div>';
                    $div .= '</div>';
                    $div .= '</li>';
                }
            } else {
                $div .= '<li>' . __('No Related videos', 'video_gallery') . '</li>';
            }
        } else {
            $div .= '<li>' . __('No Related videos', 'video_gallery') . '</li>';
        }
        if ($show < $countF || $show == $countF) {
            $playlist_url = get_playlist_permalink($moreName, $playlistID, $playlist_slugname);
            $div .= '<li><div class="right video-more"><a href="' . $playlist_url . '">' . __('More&nbsp;Videos', 'video_gallery') . '&nbsp;&#187;</a></div>';
            $div .= '<div class="clear"></div></li>';
        }
        $div .= '</ul></div><div class="clear"></div>';
        echo balanceTags($div);
        echo $after_widget;
    }
 /**
  * Fucntion to display category name
  *
  * @param unknown $vid
  * @return string
  */
 function displayCategory($vid)
 {
     $output = $playlistname = NULL;
     $incre = 0;
     /** Get Playlist detail */
     $playlistData = $this->playlist_detail($vid);
     /** Display playlist name under player */
     $output .= '<div class="video-page-category"><strong>' . __('Category', APPTHA_VGALLERY) . '&nbsp;:&nbsp;</strong>';
     foreach ($playlistData as $playlist) {
         /** Get playlist page URL */
         $playlist_url = get_playlist_permalink($this->_mPageid, $playlist->pid, $playlist->playlist_slugname);
         /** Check more than one playlist is exists */
         if ($incre > 0) {
             /** Display mulitple playlists */
             $playlistname .= ',&nbsp;' . '<a href="' . $playlist_url . '">' . str_replace(' ', '&nbsp;', $playlist->playlist_name) . '</a>';
         } else {
             /** Display single playlists */
             $playlistname .= '<a href="' . $playlist_url . '">' . str_replace(' ', '&nbsp;', $playlist->playlist_name) . '</a>';
         }
         $incre++;
     }
     /** Return playlist content to display */
     return $output . $playlistname . '</div>';
 }
Example #7
0
 /**
  * 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&nbsp;Videos', APPTHA_VGALLERY) . '&nbsp;&#187;</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;
     }
 }
Example #8
0
/**
 * 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 . '&amp;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&nbsp;Videos', APPTHA_VGALLERY) . '&nbsp;&#187; </a> </div> <div class="clear"></div> </li>';
    } else {
        $div .= '<li> <div align="right"></div> </li>';
    }
    /** Return widget content */
    return $div . '</ul></div>';
}
Example #9
0
 /**
  * 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&nbsp;Videos&nbsp;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  */
 }
 /**
  * Fucntion to display the catgoery list as a link
  * 
  * @param unknown $args
  * @param unknown $instance
  */
 function widget($args, $instanceCat)
 {
     /** Set default limit as 3 */
     $show = 3;
     /** Get catgoery widget title */
     $title = empty($instanceCat['title']) ? ' ' : apply_filters('widget_title', $instanceCat['title']);
     /** Catgoery Widget code starts here */
     global $wpdb;
     /** These are our own options
      * Get "number of playlist" from backend option */
     if ($instanceCat['show'] && absint($instanceCat['show'])) {
         $show = $instanceCat['show'];
     }
     /** Get playlist from db  */
     $features = getPlaylist(' playlist_order ASC ', $show);
     /** Count selected playlist */
     $countCategories = getPlaylistCount();
     /** Call function to get more page id  */
     $moreName = morePageID();
     /** Get more categories link from helper */
     $more_videos_link = get_morepage_permalink($moreName, 'categories');
     /** Before widget functions category */
     echo $args['before_widget'];
     /** Set category widget output */
     $div = '';
     $div .= '<div id="videos-category"  class="widget widget_categories sidebar-wrap "> <h3 class="widget-title"><a href="' . $more_videos_link . '">' . $title . '</a></h3>
                 <ul class="ulwidget clearfix">';
     /** Check if playlist is exist */
     if (!empty($features)) {
         /** If found, loop through them */
         foreach ($features as $feature) {
             /** Get playlist name */
             $fetched = $feature->playlist_name;
             /** Get playlist seo name */
             $playlist_slugname = $feature->playlist_slugname;
             /** Get playlist id */
             $playlist_id = $feature->pid;
             /** Get playlist page url */
             $playlist_url = get_playlist_permalink($moreName, $playlist_id, $playlist_slugname);
             /** Display playlist name */
             $div .= '<li>';
             $div .= '<a class="videoHname "  href="' . $playlist_url . '">' . $fetched . '</a>';
             $div .= '</li>';
         }
     } else {
         /** If no data, then display no categories message */
         $div .= '<li>' . __('No Categories', APPTHA_VGALLERY) . '</li>';
     }
     /** End category list */
     if ($show < $countCategories) {
         $div .= '<li><div class="right video-more"><a href="' . $more_videos_link . '">' . __('More Categories', APPTHA_VGALLERY) . ' &#187;</a></div></li>';
     }
     $div .= '</ul></div>';
     /** Display category widget */
     echo $div;
     /** Display widget closing tag */
     /** After widget functions category */
     echo $args['after_widget'];
 }
        /**
         *  Display player details
         */
        function hdflv_sharerender($arguments = array())
        {
            global $wpdb;
            $output = $videourl = $imgurl = $player_div = $vid = $playlistid = $homeplayerData = $reavideourl = $ratecount = $rate = $plugin_css = $no_views = '';
            $video_playlist_id = $videoId = $hitcount = $show_posted_by = $show_social_icon = $show_related_video = 0;
            $videodivId = rand();
            $image_path = str_replace('plugins/' . $this->_plugin_name . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL);
            $_imagePath = APPTHA_VGALLERY_BASEURL . 'images' . DS;
            $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');
            $flashvars = $pluginflashvars = 'baserefW=' . get_option('siteurl');
            // generate flashvars detail for player starts here
            if (isset($arguments['width'])) {
                $width = $arguments['width'];
                // get width from short code
            } else {
                $width = $configXML->width;
                // get width from settings
            }
            if (isset($arguments['height'])) {
                $height = $arguments['height'];
                // get height from short code
            } else {
                $height = $configXML->height;
                // get height from settings
            }
            $showTags = $configXML->tagdisplay;
            $showRatting = $configXML->ratingscontrol;
            $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 = $player_color['related_video_count'];
            if (isset($player_color['show_added_on'])) {
                $show_added_on = $player_color['show_added_on'];
            } else {
                $show_added_on = '0';
            }
            //Send report for  video
            if (isset($arguments['id'])) {
                $videodivId .= $arguments['id'];
                // get video id from short code
                $vid = $arguments['id'];
            }
            if (!empty($vid)) {
                $homeplayerData = $this->video_detail($vid, $number_related_video);
                $fetched[] = $homeplayerData;
            }
            // store video details in variables
            if (!empty($homeplayerData)) {
                $videoUrl = $homeplayerData->file;
                $videoId = $homeplayerData->vid;
                $video_title = $homeplayerData->name;
                $video_file_type = $homeplayerData->file_type;
                $video_thumb = $homeplayerData->image;
                if ($video_file_type == 2 || $video_file_type == 5) {
                    if (strpos($video_thumb, '/')) {
                        $video_thumb = $homeplayerData->image;
                    } else {
                        $video_thumb = $image_path . $homeplayerData->image;
                    }
                }
                $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;
            }
            // get Playlist detail
            $playlistData = $this->playlist_detail($vid);
            $incre = 0;
            $playlistname = $windo = $htmlvideo = '';
            if (isset($arguments['playlistid'])) {
                $videodivId .= $arguments['playlistid'];
                // get playlist id from short code
                $playlistid = $arguments['playlistid'];
                $flashvars .= '&amp;mtype=playerModule';
            }
            // generate flashvars detail for player starts here
            if (!empty($playlistid) && !empty($vid)) {
                $flashvars .= '&amp;pid=' . $playlistid;
                $flashvars .= '&amp;vid=' . $vid;
            } elseif (!empty($playlistid)) {
                $flashvars .= '&amp;pid=' . $playlistid . '&showPlaylist=true';
                $playlist_videos = $this->_contOBJ->video_pid_detail($playlistid, 'detailpage', $number_related_video);
                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 !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
                    $flashvars .= '&amp;vid=' . $vid . '&showPlaylist=false';
                } else {
                    $flashvars .= '&amp;vid=' . $vid;
                }
            }
            if (isset($arguments['flashvars'])) {
                $flashvars .= '&amp;' . $arguments['flashvars'];
            }
            if (!isset($arguments['playlistid']) && isset($arguments['id']) && $this->_post_type !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
                $flashvars .= '&amp;playlist_autoplay=false&amp;playlist_auto=false';
            }
            // generate flashvars detail for player ends here
            $player_not_support = __('Player doesnot support this video.', 'video_gallery');
            $htmlplayer_not_support = __('Html5 Not support This video Format.', 'video_gallery');
            $output .= ' <script>
						var baseurl,folder,videoPage;
						baseurl = "' . $this->_site_url . '";
						folder  = "' . $this->_plugin_name . '";
						videoPage = "' . $this->_mPageid . '"; 
						</script>';
            if (isset($arguments['title']) && $arguments['title'] == 'on') {
                $output .= '<h2 id="video_title' . $videodivId . '" class="videoplayer_title" ></h2>';
                $pluginflashvars .= $flashvars .= '&amp;videodata=current_video_' . $videodivId;
            }
            // Player starts here
            $output .= '<div id="mediaspace' . $videodivId . '" class="videoplayer">';
            $mobile = vgallery_detect_mobile();
            // Embed player code
            if (!empty($fetched) && $fetched[0]->file_type == 5 && !empty($fetched[0]->embedcode)) {
                $playerembedcode = stripslashes($fetched[0]->embedcode);
                $playeriframewidth = str_replace('width=', 'width="' . $width . '"', $playerembedcode);
                if ($mobile == true) {
                    $output .= $playerembedcode;
                } else {
                    $output .= str_replace('height=', 'height="' . $height . '"', $playeriframewidth);
                }
                $output .= '<script> current_video( ' . $fetched[0]->vid . ',"' . $fetched[0]->name . '" ); </script>';
            } else {
                if ($mobile === true) {
                    $output .= '<script> current_video( ' . $fetched[0]->vid . ',"' . $fetched[0]->name . '" ); </script>';
                    // Get video detail for HTML5 player
                    foreach ($fetched as $media) {
                        // Load video details
                        $videourl = $media->file;
                        $imgurl = $media->image;
                        $file_type = $media->file_type;
                        $video_amazon_buckets = $media->amazon_buckets;
                        if ($imgurl == '') {
                            // If there is no thumb image for video
                            $imgurl = $_imagePath . 'nothumbimage.jpg';
                        } else {
                            if ($file_type == 2 || $file_type == 5) {
                                // For uploaded image
                                if ($file_type == 2 && $video_amazon_buckets == 1 && strpos($imgurl, '/')) {
                                    $imgurl = $imgurl;
                                } else {
                                    $imgurl = $image_path . $imgurl;
                                }
                            }
                        }
                    }
                    if ($file_type == 1) {
                        // Check for youtube video
                        if (preg_match('/www\\.youtube\\.com\\/watch\\?v=[^&]+/', $videourl, $vresult)) {
                            $urlArray = explode('=', $vresult[0]);
                            $video_id = trim($urlArray[1]);
                            $videourl = 'http://www.youtube.com/embed/' . $video_id;
                            // Generate youtube embed code for html5 player
                            $output .= '<iframe  type="text/html" width="' . $width . '" height="' . $height . '" src="' . $videourl . '" frameborder="0"></iframe>';
                        } elseif (strpos($videourl, 'dailymotion') > 0) {
                            // For dailymotion videos
                            $split = explode("/", $videourl);
                            $split_id = explode("_", $split[4]);
                            $image_url = '';
                            $video = $videourl = $previewurl = 'http://www.dailymotion.com/embed/video/' . $split_id[0];
                            $output .= '<iframe src="' . $video . '?allowed_in_playlists=0" width="' . $width . '" height="' . $height . '"  class="iframe_frameborder" ></iframe>';
                        } else {
                            if (strpos($videourl, 'viddler') > 0) {
                                // For viddler videos
                                $imgstr = explode('/', $videourl);
                                $viddler_id = $imgstr[4];
                                $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>';
                            }
                        }
                    } else {
                        if ($file_type == 3) {
                            if (preg_match('/www\\.youtube\\.com\\/watch\\?v=[^&]+/', $videourl, $vresult)) {
                                $urlArray = explode('=', $vresult[0]);
                                $video_id = trim($urlArray[1]);
                                $videourl = 'http://www.youtube.com/embed/' . $video_id;
                                // Generate youtube embed code for html5 player
                                $output .= '<iframe  type="text/html" width="' . $width . '" height="' . $height . '" src="' . $videourl . '" frameborder="0"></iframe>';
                            } else {
                                if (strpos($videourl, 'viddler') > 0) {
                                    $imgstr = explode('/', $videourl);
                                    $viddler_id = $imgstr[4];
                                    $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>';
                                } elseif (strpos($videourl, 'dailymotion') > 0) {
                                    // For dailymotion videos
                                    $split = explode("/", $videourl);
                                    $split_id = explode("_", $split[4]);
                                    $image_url = '';
                                    $video = $videourl = $previewurl = 'http://www.dailymotion.com/embed/video/' . $split_id[0];
                                    $output .= '<iframe src="' . $video . '?allowed_in_playlists=0" width="' . $width . '" height="' . $height . '"  class="iframe_frameborder" ></iframe>';
                                } else {
                                    $output .= '<video widht="100%" id="video" poster="' . $imgurl . '"   src="' . $videourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>';
                                }
                            }
                        } else {
                            // Check for upload, URL and RTMP videos
                            if ($file_type == 2 || $file_type == 5) {
                                if ($file_type == 2 && strpos($videourl, '/')) {
                                    $videourl = $videourl;
                                } else {
                                    $videourl = $image_path . $videourl;
                                }
                            } else {
                                if ($file_type == 4) {
                                    // For RTMP videos
                                    $streamer = str_replace('rtmp://', 'http://', $media->streamer_path);
                                    $videourl = $streamer . '_definst_/mp4:' . $videourl . '/playlist.m3u8';
                                }
                            }
                            // Generate video code for html5 player
                            $output .= '<video widht="100%" id="video" poster="' . $imgurl . '"   src="' . $videourl . '" 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 === 'videogallery' || $this->_page_post_type === 'videogallery')) {
                        if ($homeplayerData->google_adsense && $homeplayerData->google_adsense_value) {
                            $output .= '<div>';
                            if ($width > 468) {
                                $adstyle = "margin-left: -234px;";
                            } else {
                                $margin_left = ($width - 100) / 2;
                                $adwidth = $width - 100;
                                $adstyle = "width:" . $adwidth . "px;margin-left: -" . $margin_left . "px;";
                            }
                            $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%;">
								 		<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>
								 				<iframe  height="60" width="' . ($width - 100) . '" scrolling="no" align="middle" id="IFrameName" src="" name="IFrameName" marginheight="0" marginwidth="0" class="iframe_frameborder" ></iframe>
								 						</div>
							</div>';
                            $details = $this->get_video_google_adsense_details($vid);
                            $details1 = unserialize($details->googleadsense_details);
                            if (isset($details1['adsense_option']) && $details1['adsense_option'] == 'always_show') {
                                $closeadd = 0;
                            } else {
                                $closeadd = $details1['adsenseshow_time'];
                            }
                            if (isset($details1['adsense_reopen']) && $details1['adsense_reopen'] == '1') {
                                $ropen = $details1['adsense_reopen_time'];
                            } else {
                                $ropen = 0;
                            }
                            $output .= '<script type="text/javascript">
								var pagepath  = "' . get_site_url() . '/wp-admin/admin-ajax.php?action=googleadsense&vid=' . $homeplayerData->vid . '";
							    var closeadd = ' . $closeadd * 1000 . ';
							    var ropen = ' . $ropen * 1000 . ';
							</script>
							<script src="' . APPTHA_VGALLERY_BASEURL . 'js/googlead.js" type="text/javascript"></script>';
                        }
                    }
                }
            }
            $output .= '</div>';
            // End Google adsense End.
            $useragent = $_SERVER['HTTP_USER_AGENT'];
            if (strpos($useragent, 'Windows Phone') > 0) {
                // check for windows phone
                $windo = 'Windows Phone';
            }
            // Check platform
            $output .= ' <script>
					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 ($this->_post_type !== 'videogallery' && $this->_page_post_type !== 'videogallery') {
                $plugin_css = 'shortcode';
            }
            if (isset($arguments['views']) && $arguments['views'] == 'on') {
                $videogalleryviews = true;
            } else {
                if (($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') && $configXML->view_visible == 1) {
                    $videogalleryviews = true;
                } else {
                    $videogalleryviews = false;
                    $no_views = 'noviews';
                }
            }
            $output .= '<div class="video-page-container ' . $plugin_css . '"><div class="vido_info_container"><div class="video-page-info ' . $no_views . '">';
            if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                if ($show_added_on) {
                    $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>';
                }
            }
            if ($videogalleryviews == true) {
                $output .= '<div class="video-page-views"><strong>' . __('Views', 'video_gallery') . '&nbsp;:&nbsp;</strong><span>' . $hitcount . '</span></div>';
            }
            $output .= '<div class="clearfix"></div>';
            if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                $user_url = get_user_permalink($this->_mPageid, $uploadedby_id, $uploadedby);
                if ($show_posted_by) {
                    $output .= '<div class="video-page-username"><strong>' . __('Posted&nbsp;by', 'video_gallery') . '&nbsp;:&nbsp;</strong><a href="' . $user_url . '">' . $uploadedby . '</a></div>';
                }
                if ($configXML->categorydisplay == 1) {
                    $output .= '<div class="video-page-category"><strong>' . __('Category', 'video_gallery') . '&nbsp;:&nbsp;</strong>';
                    foreach ($playlistData as $playlist) {
                        $playlist_url = get_playlist_permalink($this->_mPageid, $playlist->pid, $playlist->playlist_slugname);
                        if ($incre > 0) {
                            $playlistname .= ',&nbsp;' . '<a href="' . $playlist_url . '">' . str_replace(' ', '&nbsp;', $playlist->playlist_name) . '</a>';
                        } else {
                            $playlistname .= '<a href="' . $playlist_url . '">' . str_replace(' ', '&nbsp;', $playlist->playlist_name) . '</a>';
                        }
                        $incre++;
                    }
                    $output .= $playlistname . '</div>';
                }
            }
            $output .= '<div class="clear"></div>';
            // Rating starts here
            if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                if ($configXML->ratingscontrol == 1) {
                    $ratingscontrol = true;
                } else {
                    $ratingscontrol = false;
                }
            } else {
                if (isset($arguments['ratingscontrol']) && $arguments['ratingscontrol'] == 'on') {
                    $ratingscontrol = true;
                } else {
                    $ratingscontrol = false;
                }
            }
            if ($ratingscontrol == true) {
                if (isset($ratecount) && $ratecount != 0) {
                    $ratestar = round($rate / $ratecount);
                } else {
                    $ratestar = 0;
                }
                $output .= '<div class="video-page-rating">
							<div class="centermargin floatleft" >
							<div class="rateimgleft" id="rateimg" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();" >
							<div id="a' . $videodivId . $vid . '" class="floatleft"></div>
							<ul class="ratethis " id="rate' . $videodivId . $vid . '" >
							<li class="one" >
							<a title="1 Star Rating"  onclick="getrate' . $videodivId . $vid . '( 1 );"  onmousemove="displayrating' . $videodivId . $vid . '( 1 );" onmouseout="resetvalue' . $videodivId . $vid . '();">1</a>
							</li>
							<li class="two" >
							<a title="2 Star Rating"  onclick="getrate' . $videodivId . $vid . '( 2 );"  onmousemove="displayrating' . $videodivId . $vid . '( 2 );" onmouseout="resetvalue' . $videodivId . $vid . '();">2</a>
							</li>
							<li class="three" >
							<a title="3 Star Rating"  onclick="getrate' . $videodivId . $vid . '( 3 );"   onmousemove="displayrating' . $videodivId . $vid . '( 3 );" onmouseout="resetvalue' . $videodivId . $vid . '();">3</a>
							</li>
							<li class="four" >
							<a  title="4 Star Rating"  onclick="getrate' . $videodivId . $vid . '( 4 );"  onmousemove="displayrating' . $videodivId . $vid . '( 4 );" onmouseout="resetvalue' . $videodivId . $vid . '();"  >4</a>
							</li>
							<li class="five" >
							<a title="5 Star Rating"  onclick="getrate' . $videodivId . $vid . '( 5 );"  onmousemove="displayrating' . $videodivId . $vid . '( 5 );" onmouseout="resetvalue' . $videodivId . $vid . '();" >5</a>
							</li>
							</ul>
							<input type="hidden" name="videoid" id="videoid' . $videodivId . $vid . '" value="' . $videoId . '" />
							<input type="hidden" value="" id="storeratemsg' . $videodivId . $vid . '" />
							</div>
							<div class="rateright-views floatleft" >
							<span  class="clsrateviews"  id="ratemsg' . $videodivId . $vid . '" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();"> </span>
							<span  class="rightrateimg" id="ratemsg1' . $videodivId . $vid . '" onmouseover="displayrating' . $videodivId . $vid . '( 0 );" onmouseout="resetvalue' . $videodivId . $vid . '();">  </span>
							</div>
							</div>
							</div> ';
                $output .= '<div class="clear"></div>';
                $output .= '<script type="text/javascript">
							function ratecal' . $videodivId . $vid . '( rating,ratecount )
							{
							if( rating==1 )
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis onepos";
							else if( rating==2 )
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis twopos";
							else if( rating==3 )
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis threepos";
							else if( rating==4 )
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fourpos";
							else if( rating==5 )
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fivepos";
							else
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis nopos";
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+ratecount;
							} 
							';
                if (isset($ratestar) && isset($ratecount)) {
                    if ($ratecount == '') {
                        $ratecount = 0;
                    }
                    $output .= 'ratecal' . $videodivId . $vid . '( ' . $ratestar . ',' . $ratecount . ' ); ';
                }
                $output .= 'function createObject' . $videodivId . $vid . '() {
							var request_type;
							var browser = navigator.appName;
							if( browser == "Microsoft Internet Explorer" ){
							request_type = new ActiveXObject( "Microsoft.XMLHTTP" );
							} else {
							request_type = new XMLHttpRequest();
							}
							return request_type;
							}
							var http = createObject' . $videodivId . $vid . '();
							var nocache = 0;
							function getrate' . $videodivId . $vid . '( t ) {
							if( t==1 ) {
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis onepos";
							document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis onepos";
							} else if( t==2 ) {
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis twopos";
							document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis twopos";
							} else if( t==3 ) {
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis threepos";
							document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis threepos";
							} else if( t==4 ) {
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fourpos";
							document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis fourpos";
							} else if( t==5 ) {
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="ratethis fivepos";
							document.getElementById( "a' . $videodivId . $vid . '" ).className="ratethis fivepos";
							}
							document.getElementById( "rate' . $videodivId . $vid . '" ).style.display="none";
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Thanks for rating!";
							var vid     = document.getElementById( "videoid' . $videodivId . $vid . '" ).value;
							nocache     = Math.random();
							http.open( "get", baseurl+"/wp-admin/admin-ajax.php?action=ratecount&vid="+vid+"&rate="+t,true ); //Rating calling
							http.onreadystatechange = insertReply' . $videodivId . $vid . ';
							http.send( null );
							document.getElementById( "rate' . $videodivId . $vid . '" ).style.visibility="disable";
							}
							function insertReply' . $videodivId . $vid . '() {
							if( http.readyState == 4 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+http.responseText;
							document.getElementById( "rate' . $videodivId . $vid . '" ).className="";
							document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value=http.responseText;
							}
							}

							function resetvalue' . $videodivId . $vid . '() {
							document.getElementById( "ratemsg1' . $videodivId . $vid . '" ).style.display="none";
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).style.display="block";
							if( document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value == "" ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;' . $ratecount . '";
							} else {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Ratings&nbsp;:&nbsp;"+document.getElementById( "storeratemsg' . $videodivId . $vid . '" ).value;
							}
							}
							function displayrating' . $videodivId . $vid . '( t ) {
							if( t==1 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Poor";
							} else if( t==2 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Nothing&nbsp;Special";
							} else if( t==3 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Worth&nbsp;Watching";
							} else if( t==4 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Pretty&nbsp;Cool";
							} else if( t==5 ) {
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).innerHTML="Awesome";
							}
							document.getElementById( "ratemsg1' . $videodivId . $vid . '" ).style.display="none";
							document.getElementById( "ratemsg' . $videodivId . $vid . '" ).style.display="block";
							}
							</script>';
            }
            // Rating ends here
            $output .= '</div>';
            if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                if (!empty($tag_name) && $configXML->tagdisplay == 1) {
                    // Tag display
                    $output .= '<div class="video-page-tag"><strong>' . __('Tags', 'video_gallery') . '          </strong>: ' . $tag_name . ' ' . '</div>';
                }
                if (strpos($videoUrl, 'youtube') > 0) {
                    // check video url is Youtube
                    $imgstr = explode('v=', $videoUrl);
                    $imgval = explode('&', $imgstr[1]);
                    $videoId1 = $imgval[0];
                    $video_thumb = 'http://img.youtube.com/vi/' . $videoId1 . '/mqdefault.jpg';
                }
                $removequotedescription = str_replace('"', '', $description);
                $videodescription = str_replace("'", '', $removequotedescription);
                $blog_title = get_bloginfo('name');
                $current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '?random=' . rand(0, 100);
                if ($video_file_type == 5) {
                    $sd = '';
                } else {
                    $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';
                }
                if ($show_social_icon) {
                    $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);
                    $rs_url = get_site_url() . '/wp-admin/admin-ajax.php?action=rss&type=video&vid=' . $vid;
                    $rss_image = plugins_url($this->_plugin_name . '/images/rss_icon.png');
                    $output .= '
						<!-- Facebook share Start -->
						<div class="video-socialshare">
						<div class="floatleft" style=" margin-right: 9px; "><a href="' . $url_fb . '" class="fbshare" id="fbshare" target="_blank" ></a></div>
						<!-- Facebook share End and Twitter like Start -->
						<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>
						<!-- Twitter like End and Google plus one Start -->
						<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>
						<!-- Google plus one End -->
						';
                    if ($show_rss_icon) {
                        $output .= '<div class="floatleft rssfeed">&nbsp;&nbsp;<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 = get_site_url() . '/wp-admin/admin-ajax.php?action=rss&type=video&vid=' . $vid;
                    $rss_image = plugins_url($this->_plugin_name . '/images/rss_icon.png');
                    $output .= '<div class="video-socialshare"><div class="floatleft rssfeed">&nbsp;&nbsp;<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&nbsp;Code', 'video_gallery') . '</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', 'video_gallery') . '</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&nbsp;Video', 'video_gallery') . '</span><span class="embed_arrow"></span></a>';
                }
                if ($fetched[0]->file_type == 5 && !empty($fetched[0]->embedcode)) {
                    $embed_code = stripslashes($fetched[0]->embedcode);
                } else {
                    $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">';
                }
                $output .= '<textarea onclick="this.select()" id="embedcode" name="embedcode" style="display:none;" rows="7" >' . $embed_code . '</textarea>
								<input type="hidden" name="flagembed" id="flagembed" />';
                $admin_email = get_option('admin_email');
                $user_email = $this->_userEmail;
                $output .= '<div id="report_video_response"></div><form name="reportform" id="reportform" style="display:none;" method="post" >';
                $output .= '<div class="report-video-title">Report this video</div>';
                $output .= '<img id="reportform_ajax_loader"  src="' . APPTHA_VGALLERY_BASEURL . '/images/ajax-loader.gif" />';
                $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>';
                $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>';
                $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>';
                $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>';
                $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>';
                $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>';
                $output .= '<input type="hidden" id="admin_email" value="' . $admin_email . '" name="admin_email" />';
                $output .= '<input type="hidden" id="reporter_email" value="' . $user_email . '" name="reporter_email" />';
                $output .= '<input type="hidden" id="video_title" value="' . $video_title . '" name="video_title" />';
                $output .= '<input type="hidden" id="redirect_url" value="' . get_video_permalink($this->_vId) . '" name="redirect_url" />';
                $output .= '<input type="button" class="reportbutton" value="Send" onclick="return reportVideoSend();" name="reportsend" />';
                $output .= '&nbsp;&nbsp;<input type="reset" onclick="return hideReportForm();" class="reportbutton" value="Cancel" id="ReportFormreset"  name="reportclear" />';
                $output .= '</form>';
                $output .= '<input type="hidden" name="reportvideo" id="reportvideo" />';
                if ($fetched[0]->file_type == 5 && $fetched[0]->embedcode) {
                    $iframe_code = stripslashes($fetched[0]->embedcode);
                } else {
                    $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>';
                }
                $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>';
            }
            $output .= '</div></div>';
            // Enable/disable Related videos starts here
            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')) {
                $Limit = $player_color['related_video_count'];
                if (empty($Limit)) {
                    $Limit = 100;
                }
                $select = 'SELECT distinct( a.vid ),b.playlist_id,name,guid,description,file,hdfile,file_type,duration,embedcode,image,opimage,download,link,featured,hitcount,slug,
						a.post_date,postrollads,prerollads FROM ' . $wpdb->prefix . 'hdflvvideoshare a
						LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_med2play b ON a.vid=b.media_id
						LEFT JOIN ' . $wpdb->prefix . 'hdflvvideoshare_playlist p ON p.pid=b.playlist_id
						LEFT JOIN ' . $wpdb->prefix . 'posts s ON s.ID=a.slug
						WHERE b.playlist_id=' . intval($video_playlist_id) . ' AND a.publish=1 AND p.is_publish=1
						ORDER BY a.vid DESC LIMIT ' . $Limit;
                $output .= '<div class="player_related_video"><h2 class="related-videos">' . __('Related Videos', 'video_gallery') . '</h2><div style="clear: both;"></div>';
                $related = $wpdb->get_results($select);
                if (!empty($related)) {
                    $result = count($related);
                }
                if ($result < 4) {
                    $output .= '<style>.jcarousel-next , .jcarousel-prev {display:none!important;}</style>';
                }
                if ($result != '') {
                    // Slide Display Here
                    $output .= '<ul id="mycarousel" class="jcarousel-skin-tango">';
                    $image_path = str_replace('plugins/' . $this->_plugin_name . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL);
                    foreach ($related as $relFet) {
                        $file_type = $relFet->file_type;
                        // Video Type
                        $imageFea = $relFet->image;
                        // VIDEO IMAGE
                        $reafile = $relFet->file;
                        // VIDEO IMAGE
                        $guid = get_video_permalink($relFet->slug);
                        // guid
                        if ($imageFea == '') {
                            // If there is no thumb image for video
                            $imageFea = $this->_imagePath . 'nothumbimage.jpg';
                        } else {
                            if ($file_type == 2 || $file_type == 5) {
                                // For uploaded image
                                if ($file_type == 2 && strpos($imageFea, '/')) {
                                    $imageFea = $imageFea;
                                } else {
                                    $imageFea = $image_path . $imageFea;
                                }
                            } else {
                                if ($file_type == 3) {
                                    $imageFea = $imageFea;
                                }
                            }
                        }
                        // Embed player code
                        if ($file_type == 5 && !empty($relFet->embedcode)) {
                            $relFetembedcode = stripslashes($relFet->embedcode);
                            $relFetiframewidth = preg_replace(array('/width="\\d+"/i'), array(sprintf('width="%d"', $width)), $relFetembedcode);
                            if ($mobile === true) {
                                $player_values = htmlentities($relFetiframewidth);
                            } else {
                                $player_values = htmlentities(preg_replace(array('/height="\\d+"/i'), array(sprintf('height="%d"', $height)), $relFetiframewidth));
                            }
                        } else {
                            $mobile = vgallery_detect_mobile();
                            if ($mobile === true) {
                                // Check for youtube video
                                if (preg_match('/www\\.youtube\\.com\\/watch\\?v=[^&]+/', $reafile, $vresult)) {
                                    $urlArray = explode('=', $vresult[0]);
                                    $video_id = trim($urlArray[1]);
                                    $reavideourl = 'http://www.youtube.com/embed/' . $video_id;
                                    // Generate youtube embed code for html5 player
                                    $player_values = htmlentities('<iframe  widht="100%" type="text/html" src="' . $reavideourl . '" frameborder="0"></iframe>');
                                } else {
                                    if ($file_type != 5) {
                                        // Check for upload, URL and RTMP videos
                                        if ($file_type == 2) {
                                            // For uploaded image
                                            $reavideourl = $image_path . $reafile;
                                        } else {
                                            if ($file_type == 4) {
                                                // For RTMP videos
                                                $streamer = str_replace('rtmp://', 'http://', $media->streamer_path);
                                                $reavideourl = $streamer . '_definst_/mp4:' . $reafile . '/playlist.m3u8';
                                            }
                                        }
                                        // Generate video code for html5 player
                                        $player_values = htmlentities('<video widht="100%" id="video" poster="' . $imageFea . '"   src="' . $reavideourl . '" autobuffer controls onerror="failed( event )">' . $htmlplayer_not_support . '</video>');
                                    }
                                }
                            } else {
                                // Flash player code
                                $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">');
                            }
                        }
                        if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                            $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>';
                        $output .= '<div class="vid_info"><span><a ' . $thumb_href . ' class="videoHname" title="' . $relFet->name . '">';
                        if (strlen($relFet->name) > 30) {
                            // Displaying Video Title
                            $videoname = substr($relFet->name, 0, 30) . '..';
                        } else {
                            $videoname = $relFet->name;
                        }
                        $output .= $videoname;
                        $output .= '</a></span></div>';
                        $output .= '</li>';
                    }
                    $output .= '</ul>';
                }
                $output .= '</div>';
            }
            if ($this->_post_type === 'videogallery' || $this->_page_post_type === 'videogallery') {
                // Default Comments
                if ($configXML->comment_option == 0) {
                    $output .= '<style type="text/css">#respond,#comments #respond,#comments.comments-area, #disqus_thread, .comments-link{ display: none!important; } </style>';
                }
                // Facebook Comments
                if ($configXML->comment_option == 2) {
                    $output .= '<style type="text/css">#respond,#comments #respond,#comments.comments-area, #disqus_thread, .comments-link{ display: none!important; } </style>';
                    $output .= '<div class="clear"></div>
							<h2 class="related-videos">' . __('Post Your Comments', 'video_gallery') . '</h2>
							<div id="fb-root"></div>
							<script>
							( function( d, s, id ) {
							var js, fjs = d.getElementsByTagName( s )[0];
							if ( d.getElementById( id ) ) return;
							js = d.createElement( s ); js.id = id;
							js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=' . $configXML->keyApps . '";
							fjs.parentNode.insertBefore( js, fjs );
							}( document, "script", "facebook-jssdk" ) );
							</script>';
                    $output .= '<div class="fb-comments" data-href="' . get_permalink() . '" data-num-posts="5"></div>';
                } else {
                    if ($configXML->comment_option == 3) {
                        $output .= '<style type="text/css">#comments #respond,#comments.comments-area, .comments-link{ display: none!important; } </style>';
                        $output .= '<div id="disqus_thread"></div>
								<script type="text/javascript">
								var disqus_shortname = "' . $configXML->keydisqusApps . '";
								( function() {
								var dsq = document.createElement( "script" ); dsq.type = "text/javascript"; dsq.async = true;
								dsq.src = "http://"+ disqus_shortname + ".disqus.com/embed.js";
								( document.getElementsByTagName( "head" )[0] || document.getElementsByTagName( "body" )[0] ).appendChild( dsq );
								} )();
								</script>
								<noscript>' . __('Please enable JavaScript to view the', 'video_gallery') . ' <a href="http://disqus.com/?ref_noscript">' . __('comments powered by Disqus.', 'video_gallery') . '</a></noscript>
								<a href="http://disqus.com" class="dsq-brlink">' . __('comments powered by', 'video_gallery') . ' <span class="logo-disqus">' . __('Disqus', 'video_gallery') . '</span></a>';
                    }
                }
            }
            return $output;
        }