示例#1
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 is used to display videos in widget
  *
  * @param unknown $args          
  * @param unknown $instance          
  */
 function widget($args, $instance)
 {
     /** Get featured widget title and set default number of videos to be shown as limit 3 */
     $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
     $videowidgettype = $instance['videowidgettype'];
     $show = 3;
     /** Get "number of featured videos to be shown" from admin */
     if ($instance['show'] && absint($instance['show'])) {
         $show = $instance['show'];
     }
     if ($instance['videowidgettype']) {
         $videowidgettype = $instance['videowidgettype'];
     }
     /** Before widget functions */
     echo $args['before_widget'];
     $userId = get_current_user_id();
     $watchLaterVideoIds = getWatchLaterVideoIds($userId, $this->watchDetailsTable);
     /** Get video order from settings data
      * Switch condition for each widget */
     switch ($videowidgettype) {
         /** Case featured video widget */
         case 'featured':
             $player_color = getPlayerColorArray();
             $recent_video_order = $player_color['recentvideo_order'];
             /** Get order to fetch featured videos */
             $thumImageorder = getVideoOrder($recent_video_order);
             $features = getWidgetVideos('feature', $thumImageorder, $show, '', '');
             /** Display featured videos */
             echo displayWidgetVideos($title, 'featured', $features, $show, '', '', $watchLaterVideoIds);
             echo $args['after_widget'];
             break;
             /** Case popular video widget */
         /** Case popular video widget */
         case 'popular':
             $thumImageorder = ' w.hitcount DESC ';
             /** Get popular videos from db */
             $populars = getWidgetVideos('popular', $thumImageorder, $show, '', '');
             /** Display popular videos */
             $output = displayWidgetVideos($title, 'popular', $populars, $show, '', '', $watchLaterVideoIds);
             /** echo popular widget closing tag */
             echo $output . $args['after_widget'];
             break;
             /** Case Watch History video widget */
         /** Case Watch History video widget */
         case 'watchhistory':
             /** Get watch history from db */
             $watchHistory = $this->getWatchHistoryVideos($show);
             /** Display watch history videos */
             $output = displayWidgetVideos($title, 'watch history', $watchHistory, $show, '', '', $watchLaterVideoIds);
             /** echo watch history widget closing tag */
             echo $output . $args['after_widget'];
             break;
             /** Case Watch Later video widget */
         /** Case Watch Later video widget */
         case 'watchlater':
             /** Get watch later from db */
             $watchLater = $this->getWatchLaterVideos($show);
             /** Display watch later videos */
             $output = displayWidgetVideos($title, 'watch later', $watchLater, $show, '', '', $watchLaterVideoIds);
             /** echo watch later widget closing tag */
             echo $output . $args['after_widget'];
             break;
             /** Case random video widget */
         /** Case random video widget */
         case 'random':
             $thumImageorder = ' RAND() ';
             $posts = getWidgetVideos('random', $thumImageorder, $show, '', '');
             /** Display random videos */
             $output = displayWidgetVideos($title, 'random', $posts, $show, '', '', $watchLaterVideoIds);
             /** echo random videos widget opening, closing tag */
             echo $output . $args['after_widget'];
             break;
             /** Case recent video widget */
         /** Case recent video widget */
         case 'recent':
             $thumImageorder = ' w.vid DESC ';
             $posts = getWidgetVideos('recent', $thumImageorder, $show, '', '');
             /** Display recent videos */
             echo displayWidgetVideos($title, 'recent', $posts, $show, '', '', $watchLaterVideoIds);
             echo $args['after_widget'];
             break;
             /** Case recent video widget */
         /** Case recent video widget */
         case 'related':
             /** Function call for related videos
              * Show and title params are send for helper */
             $this->related($show, $title);
             /** Related videos widget ends here */
             /** After widget functions */
             echo $args['after_widget'];
             break;
         default:
             break;
     }
 }
示例#3
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;
     }
 }
示例#4
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  */
 }