/** * Fucntion to display more videos page title * * @param unknown $type_name * @param unknown $typename * @return string */ function morePageTitle($type_name, $typename) { $div = ''; /** Check type name and get title for the more pages */ switch ($type_name) { case 'Category': /** Get playlsit name based on playl id */ $playlist_name = get_playlist_name(intval(absint($this->_playid))); /** Display playlist title in category page*/ $div .= '<h2 class="titleouter" >' . $playlist_name . ' </h2>'; break; case 'User': /** Get user name based on user id */ $user_name = get_user_name(intval($this->_userid)); /** Display user name in user videos page */ $div .= '<h2 >' . $user_name . ' </h2>'; break; case 'popular': case 'recent': case 'random': case 'featured': /** Get current more type and display as page title */ $div .= '<h2 >' . $typename . ' ' . __('Videos', APPTHA_VGALLERY) . ' </h2>'; break; default: break; } /** Return more page title */ return $div; }
/** * Content show in the video more page * @parem $type */ function video_more_pages($type) { if (function_exists('homeVideo') != true) { $type_name = ''; switch ($type) { case 'popular': $rowF = $this->_settingsData->rowMore; // row field of popular videos $colF = $this->_settingsData->colMore; // column field of popular videos $dataLimit = $rowF * $colF; $where = ''; $thumImageorder = 'w.hitcount DESC'; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_thumbdata($thumImageorder, $where, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videos('', '', $thumImageorder, $where); $typename = __('Popular', 'video_gallery'); $type_name = 'popular'; $morePage = '&more=pop'; break; case 'recent': $rowF = $this->_settingsData->rowMore; $where = ''; $colF = $this->_settingsData->colMore; $dataLimit = $rowF * $colF; $thumImageorder = 'w.vid DESC'; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_thumbdata($thumImageorder, $where, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videos('', '', $thumImageorder, $where); $typename = __('Recent', 'video_gallery'); $type_name = 'recent'; $morePage = '&more=rec'; break; case 'random': $rowF = $this->_settingsData->rowMore; $where = ''; $colF = $this->_settingsData->colMore; $dataLimit = $rowF * $colF; $thumImageorder = 'w.vid DESC'; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_thumbdata($thumImageorder, $where, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videos('', '', $thumImageorder, $where); $typename = __('Random', 'video_gallery'); $type_name = 'random'; $morePage = '&more=rand'; break; case 'featured': $thumImageorder = 'w.ordering ASC'; $where = 'AND w.featured=1'; $rowF = $this->_settingsData->rowMore; $colF = $this->_settingsData->colMore; $dataLimit = $rowF * $colF; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $player_color = unserialize($this->_settingsData->player_colors); $recent_video_order = $player_color['recentvideo_order']; if ($recent_video_order == 'id') { $thumImageorder = 'w.vid DESC'; } elseif ($recent_video_order == 'hitcount') { $thumImageorder = 'w.' . $recent_video_order . ' DESC'; } elseif ($recent_video_order == 'default') { $thumImageorder = 'w.ordering ASC'; } else { $thumImageorder = 'w.vid DESC'; } $TypeOFvideos = $this->home_thumbdata($thumImageorder, $where, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videos('', '', $thumImageorder, $where); $typename = __('Featured', 'video_gallery'); $type_name = 'featured'; $morePage = '&more=fea'; break; case 'cat': $thumImageorder = absint($this->_playid); $where = ''; $rowF = $this->_settingsData->rowCat; $colF = $this->_settingsData->colCat; $dataLimit = $rowF * $colF; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $player_color = unserialize($this->_settingsData->player_colors); $recent_video_order = $player_color['recentvideo_order']; if ($recent_video_order == 'id') { $default_order = 'w.vid DESC'; } elseif ($recent_video_order == 'hitcount') { $default_order = 'w.' . $recent_video_order . ' DESC'; } elseif ($recent_video_order == 'default') { $default_order = 'w.ordering ASC'; } else { $default_order = 'w.vid DESC'; } $TypeOFvideos = $this->home_catthumbdata($thumImageorder, $pagenum, $dataLimit, $default_order); $CountOFVideos = $this->countof_videos(absint($this->_playid), '', $thumImageorder, $where); $typename = __('Category', 'video_gallery'); $morePage = '&playid=' . $thumImageorder; break; case 'user': $thumImageorder = $this->_userid; $where = ''; $rowF = $this->_settingsData->rowCat; $colF = $this->_settingsData->colCat; $dataLimit = $rowF * $colF; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_userthumbdata($thumImageorder, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videos('', $this->_userid, $thumImageorder, $where); $typename = __('User', 'video_gallery'); $morePage = '&userid=' . $thumImageorder; break; case 'search': $video_search = str_replace('%20', ' ', $this->_video_search); if ($this->_video_search == __('Video Search ...', 'video_gallery')) { $video_search = ''; } $thumImageorder = $video_search; $rowF = $this->_settingsData->rowMore; $colF = $this->_settingsData->colMore; $dataLimit = $rowF * $colF; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_searchthumbdata($thumImageorder, $pagenum, $dataLimit); $CountOFVideos = $this->countof_videosearch($thumImageorder); return $this->searchlist($video_search, $CountOFVideos, $TypeOFvideos, $this->_pagenum, $dataLimit); break; case 'categories': default: $rowF = $this->_settingsData->rowCat; // category setting row value $colF = $this->_settingsData->colCat; // category setting column value $dataLimit = $rowF * $colF; $pagenum = $this->_pagenum; if (empty($pagenum)) { $pagenum = 1; } $TypeOFvideos = $this->home_categoriesthumbdata($pagenum, $dataLimit); $CountOFVideos = $this->countof_videocategories(); $typename = __('Video Categories', 'video_gallery'); return $this->categorylist($CountOFVideos, $TypeOFvideos, $this->_pagenum, $dataLimit); break; } $div = ''; $ratearray = array('nopos1', 'onepos1', 'twopos1', 'threepos1', 'fourpos1', 'fivepos1'); $pagenum = absint($this->_pagenum) ? absint($this->_pagenum) : 1; $div = '<div class="video_wrapper" id="' . $type_name . '_video">'; $div .= '<style type="text/css"> .video-block { margin-left:' . $this->_settingsData->gutterspace . 'px !important; } </style>'; if ($typename == 'Category') { $playlist_name = get_playlist_name(intval(absint($this->_playid))); $div .= '<h2 class="titleouter" >' . $playlist_name . ' </h2>'; } else { if ($typename == 'User') { $user_name = get_user_name(intval($this->_userid)); $div .= '<h2 >' . $user_name . ' </h2>'; } else { $div .= '<h2 >' . $typename . ' ' . __('Videos', 'video_gallery') . ' </h2>'; } } if (!empty($TypeOFvideos)) { $videolist = 0; $fetched[$videolist] = ''; $image_path = str_replace('plugins/' . $this->_folder . '/', 'uploads/videogallery/', APPTHA_VGALLERY_BASEURL); foreach ($TypeOFvideos as $video) { $duration[$videolist] = $video->duration; // VIDEO DURATION $imageFea[$videolist] = $video->image; // VIDEO IMAGE $file_type = $video->file_type; // Video Type $guid[$videolist] = get_video_permalink($video->slug); // guid if ($video->image == '') { // If there is no thumb image for video $imageFea[$videolist] = $this->_imagePath . 'nothumbimage.jpg'; } else { if ($file_type == 2 || $file_type == 5) { // For uploaded image if ($video->amazon_buckets == 1 && strpos($video->image, '/')) { $imageFea[$videolist] = $imageFea[$videolist]; } else { $imageFea[$videolist] = $image_path . $imageFea[$videolist]; } } else { if ($file_type == 3) { $imageFea[$videolist] = $imageFea[$videolist]; } } } $vidF[$videolist] = $video->vid; // VIDEO ID $nameF[$videolist] = $video->name; // VIDEI NAME $hitcount[$videolist] = $video->hitcount; // VIDEO HITCOUNT $ratecount[$videolist] = $video->ratecount; // VIDEO RATECOUNT $rate[$videolist] = $video->rate; // VIDEO RATE $des[$videolist] = substr($video->description, 0, 30) . '…'; // video description 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; // VIDEO CATEGORY ID $fetPlay[$videolist] = $this->_wpdb->get_row('SELECT playlist_name,playlist_slugname FROM ' . $this->_wpdb->prefix . 'hdflvvideoshare_playlist WHERE pid="' . intval($playlist_id[$videolist]) . '"'); $fetched[$videolist] = $fetPlay[$videolist]->playlist_name; // CATEOGORY NAME $fetched_pslug[$videolist] = $fetPlay[$videolist]->playlist_slugname; // CATEOGORY NAME } } $videolist++; } $div .= '<div>'; $div .= '<ul class="video-block-container">'; for ($videolist = 0; $videolist < count($TypeOFvideos); $videolist++) { if (strlen($nameF[$videolist]) > 30) { // Displaying Video Title $videoname = substr($nameF[$videolist], 0, 30) . '..'; } else { $videoname = $nameF[$videolist]; } if ($videolist % $colF == 0 && $videolist != 0) { // COLUMN COUNT $div .= '</ul><div class="clear"></div><ul class="video-block-container">'; } $div .= '<li class="video-block">'; $div .= '<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 ($duration[$videolist] != '0:00') { $div .= '<span class="video_duration">' . $duration[$videolist] . '</span>'; } $div .= '</div>'; $div .= '<div class="vid_info"><a href="' . $guid[$videolist] . '" title="' . $nameF[$videolist] . '" class="videoHname"><span>'; $div .= $videoname; $div .= '</span></a>'; 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) { if (isset($ratecount[$videolist]) && $ratecount[$videolist] != 0) { $ratestar = round($rate[$videolist] / $ratecount[$videolist]); } else { $ratestar = 0; } $div .= '<span class="ratethis1 ' . $ratearray[$ratestar] . '"></span>'; } // Rating ends and views starts here if ($this->_settingsData->view_visible == 1) { $div .= '<span class="video_views">'; if ($hitcount[$videolist] > 1) { $viewlang = $this->_viewslang; } else { $viewlang = $this->_viewlang; } $div .= $hitcount[$videolist] . ' ' . $viewlang; $div .= '</span>'; } $div .= '</div>'; $div .= '</li>'; // ELSE ENDS } // FOR EACH ENDS $div .= '</ul>'; $div .= '</div>'; $div .= '<div class="clear"></div>'; } else { if ($typename == 'Category') { $div .= __('No', 'video_gallery') . ' ' . __('Videos', 'video_gallery') . ' ' . __('Under this Category', 'video_gallery'); } else { $div .= __('No', 'video_gallery') . ' ' . $typename . ' ' . __('Videos', 'video_gallery'); } } $div .= '</div>'; // PAGINATION STARTS $total = $CountOFVideos; $num_of_pages = ceil($total / $dataLimit); $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('«', 'aag'), 'next_text' => __('»', 'aag'), 'total' => $num_of_pages, 'current' => $pagenum)); if ($page_links) { $div .= '<div class="tablenav"><div class="tablenav-pages" >' . $page_links . '</div></div>'; } // PAGINATION ENDS return $div; } }
/** * Function to display Playlist table * * @param unknown $mediaid */ function displayPlaylist($mediaid) { global $wpdb; $result = $hiddenarray = array(); /** Get playlist id, order for the given video id */ $checked_playlist = $wpdb->get_col('SELECT playlist_id, sorder FROM ' . $wpdb->prefix . 'hdflvvideoshare_playlist,' . $wpdb->prefix . 'hdflvvideoshare_med2play WHERE is_publish=1 AND ' . $wpdb->prefix . 'hdflvvideoshare_med2play.playlist_id = pid AND ' . $wpdb->prefix . 'hdflvvideoshare_med2play.media_id = "' . $mediaid . '"'); /** Check playlist count is 0 */ if (count($checked_playlist) == 0) { /** Set checked playlist array as 0 */ $checked_playlist[] = 0; } /** Fetch all published playlist id from database */ $playids = $this->getAllPlaylistID(); /** Check play id's are exist */ if (is_array($playids)) { /** Looping through playlist details */ foreach ($playids as $playid) { /** Get play id and assign */ $result[$playid]['playid'] = $playid; /** Check play id is exist in checked array */ $result[$playid]['checked'] = in_array($playid, $checked_playlist); /** Get playlist name and anssign */ $result[$playid]['name'] = get_playlist_name($playid); /** Get sorting order for playlist */ $result[$playid]['sorder'] = $this->get_sortorder($playid, $mediaid); } } /** Display ajax playlist creation section starts */ echo '<table>'; foreach ($result as $playlist) { $hiddenarray[] = $playlist['playid']; echo '<tr> <td style="font-size:11px"> <input value="' . $playlist['playid'] . '" type="checkbox" name="playlist[]" id="playlist-' . $playlist['playid'] . '"' . ($playlist['checked'] ? ' checked="checked"' : '') . '/> <label for="playlist-' . $playlist['playid'] . '" class="selectit">' . esc_html($playlist['name']) . '</label> </td ></tr>'; } echo '</table>'; /** Display ajax playlist creation section ends */ /** Set playlist id into hidden field */ $comma_separated = implode(',', $hiddenarray); echo '<input type=hidden name=hid value = "' . $comma_separated . '" >'; }