/** * Function to generate playlist of videos * @param $gallery_id - gallery id * @return embeded playlist * @author Praveen */ function CVG_render_playlist($gallery_id) { $options_player = get_option('cvg_player_settings'); if ($options_player['cvgplayer_autoplay'] == 1) { $autoplay = "true"; } else { $autoplay = "false"; } if ($options_player['cvgplayer_fullscreen'] == 1) { $full_screen = "true"; } else { $full_screen = "false"; } if ($options_player['cvgplayer_mute'] == 1) { $mute = "true"; } else { $mute = "false"; } $gallery_detail = videoDB::find_gallery($gallery_id); $gallery_name = $gallery_detail->name; $playlist_xml = site_url() . '/' . $gallery_detail->path . '/' . $gallery_name . '-playlist.xml'; $width = $options_player['cvgplayer_width']; if ($options_player['cvgplayer_controlbar'] == 'right' || $options_player['cvgplayer_controlbar'] == 'left') { $panel_width = $options_player['cvgplayer_width'] - $options_player['cvgplayer_width'] * (3 / 4); $panel_width = round($panel_width); } elseif ($options_player['cvgplayer_controlbar'] == 'top' || $options_player['cvgplayer_controlbar'] == 'bottom') { $panel_width = $options_player['cvgplayer_height'] - $options_player['cvgplayer_height'] * (3 / 4); $panel_width = round($panel_width); } ?> <script type='text/javascript' src='<?php echo $this->plugin_url; ?> cvg-player/swfobject.js'></script> <?php $gallery_display = '<div id="mediaplayer_gallery_' . $gallery_id . '"><object width="' . $options_player['cvgplayer_width'] . '" height="' . $options_player['cvgplayer_height'] . '" style="" id="playerID_Gallery' . $gallery_id . '" data="' . $this->plugin_url . 'cvg-player/player.swf" type="application/x-shockwave-flash">'; $gallery_display .= '<param value="' . $full_screen . '" name="allowfullscreen">'; $gallery_display .= '<param value="transparent" name="wmode">'; $gallery_display .= '<param value="always" name="allowscriptaccess">'; $gallery_display .= '<param value="playlistfile=' . $playlist_xml . '&playlist.position=' . $options_player['cvgplayer_playlist'] . '&playlist.size=' . $panel_width . '&height=' . $options_player['cvgplayer_height'] . '&width=' . $options_player['cvgplayer_width'] . '&autostart=' . $autoplay . '&controlbar=' . $options_player['cvgplayer_controlbar'] . '&backcolor=0x000000&frontcolor=0xCCCCCC&lightcolor=0x557722&skin=' . $this->video_player_url . 'skins/' . $options_player['cvgplayer_skin'] . '.swf' . '&volume=' . $options_player['cvgplayer_volume'] . '&mute=' . $mute . '&stretching=' . $options_player['cvgplayer_stretching'] . '" name="flashvars">'; $gallery_display .= '<embed width="' . $options_player['cvgplayer_width'] . '" height="' . $options_player['cvgplayer_height'] . '" flashvars="autostart=' . $autoplay . '&playlistfile=' . $playlist_xml . '&playlist.position=' . $options_player['cvgplayer_playlist'] . '&playlist.size=' . $panel_width . '&skin=' . $this->video_player_url . 'skins/' . $options_player['cvgplayer_skin'] . '.swf&volume=' . $options_player['cvgplayer_volume'] . '&mute=' . $mute . '&controlbar=' . $options_player['cvgplayer_controlbar'] . '&stretching=' . $options_player['cvgplayer_stretching'] . '" wmode="transparent" allowscriptaccess="always" allowfullscreen="' . $full_screen . '" quality="high" name="playerID_Gallery' . $gallery_id . '" id="playerID_Gallery' . $gallery_id . '" style="" src="' . $this->plugin_url . 'cvg-player/player.swf" type="application/x-shockwave-flash">'; $gallery_display .= '</object></div>'; echo $gallery_display; }
<?php } else { $options = get_option('cvg_settings'); $per_page = $options['max_vid_gallery']; $pagenum = isset($_GET['paged']) ? absint($_GET['paged']) : 0; if (empty($pagenum)) { $pagenum = 1; } /*Start and end page settings for pagination.*/ $start_page = ($pagenum - 1) * $per_page; $end_page = $start_page + $per_page; $total_num_pages = count(videoDB::get_gallery($gid)); $total_value = ceil($total_num_pages / $per_page); $defaults = array('base' => add_query_arg('paged', '%#%'), 'format' => '?paged=%#%', 'total' => $total_value, 'current' => $pagenum, 'show_all' => false, 'prev_next' => true, 'prev_text' => __('«'), 'next_text' => __('»'), 'end_size' => 1, 'mid_size' => 2, 'type' => 'plain', 'add_fragment' => ''); $page_links = paginate_links($defaults); $gallery = videoDB::find_gallery($gid); $title = __('Gallery: ' . $gallery->name); if (!$gallery) { CvgCore::show_video_error(__('Gallery not found.', 'nggallery')); } if ($gallery) { // look for pagination if (!isset($_GET['paged']) || $_GET['paged'] < 1) { $_GET['paged'] = 1; } $videolist = videoDB::get_gallery($gid, 'sortorder', 'asc', $per_page, $start_page); $act_author_user = get_userdata((int) $gallery->author); ?> <script type="text/javascript"> jQuery(document).ready(function(){
/** * Build a gallery output * * @param array $videolist * @param bool $galleryID - gallery ID * @param string $template (optional) name for a template file * @param int $videos (optional) number of videos per page * @return the content * @author Praveen Rajan */ function videoCreateGallery($videolist, $galleryID = false, $slide_show = false) { if (!is_array($videolist)) { $videolist = array($videolist); } $video_gallery = videoDB::find_gallery($galleryID); $video_gallery_name = $video_gallery->name; $index = 0; $out = ''; $options = get_option('cvg_settings'); if ($slide_show) { $out .= ' <div class="video-gallery-thumbnail-box slide"><ul class="slideContent" id="slide_' . $galleryID . '">'; } else { if (!empty($video_gallery->galdesc)) { if ($options['cvg_description'] == 1) { $out .= '<div class="clear"></div><div style="font-weight:bold;font-size:12px;">Description: ' . $video_gallery->galdesc . '</div>'; } } } foreach ($videolist as $video) { $video_filename = $video->rel_path . $video_gallery_name . '/' . $video->filename; $new_target_filename = $video->alttext . '.png'; $new_target_file = $video->rel_path . $video_gallery_name . '/thumbs/thumbs_' . $new_target_filename; $cool_video_gallery = new CoolVideoGallery(); if ($slide_show) { $out .= '<li class="slideImage">'; $out .= $cool_video_gallery->CVGVideo_Parse('[cvg-video videoId=' . $video->pid . ' /]'); $out .= '<span class="bottom">Click to Play</span></li>'; } else { $out .= '<div style="float:left;margin-right:10px;"><div class="video-gallery-thumbnail-box" style="padding:0px;" id="vide-file-' . $index . '">'; $out .= '<div class="video-gallery-thumbnail">'; $out .= $cool_video_gallery->CVGVideo_Parse('[cvg-video videoId=' . $video->pid . ' /]'); $out .= '</div></div><div class="clear"></div>'; if ($options['cvg_description'] == 1) { $out .= '<div style="text-align:center;">' . $video->description . '</div>'; } $out .= '</div>'; } $index++; } if ($slide_show) { $out .= '<div class="clear slideImage"></div></ul></div><div class="clear"></div>'; if ($options['cvg_description'] == 1) { $out .= '<div>Description: ' . $video_gallery->galdesc . '</div>'; } $out .= '<div class="clear" style="min-height:10px;"></div>'; } else { $out .= '<div class="clear"></div>'; } return $out; }
/** * Function to generate playlist of videos * @param $gallery_id - gallery id * @return embeded playlist * @author Praveen */ function CVG_render_playlist($gallery_id) { $options_player = get_option('cvg_player_settings'); if ($options_player['cvgplayer_autoplay'] == 1) { $autoplay = "true"; } else { $autoplay = "false"; } if ($options_player['cvgplayer_mute'] == 1) { $mute = "true"; } else { $mute = "false"; } if ($options_player['cvgplayer_share_option'] == 1) { $player_swf = "player-share.swf"; } else { $player_swf = "player.swf"; } $gallery_detail = videoDB::find_gallery($gallery_id); $gallery_name = $gallery_detail->name; $playlist_xml = site_url() . '/' . $gallery_detail->path . '/' . $gallery_name . '-playlist.xml'; $width = $options_player['cvgplayer_width']; if ($options_player['cvgplayer_playlist'] == 'right' || $options_player['cvgplayer_playlist'] == 'left') { $panel_width = $options_player['cvgplayer_playlist_width']; $full_player_width = $options_player['cvgplayer_width'] + $panel_width; $full_player_height = $options_player['cvgplayer_height']; } elseif ($options_player['cvgplayer_playlist'] == 'top' || $options_player['cvgplayer_playlist'] == 'bottom') { $panel_width = $options_player['cvgplayer_playlist_height']; $full_player_height = $options_player['cvgplayer_height'] + $panel_width; $full_player_width = $options_player['cvgplayer_width']; } $gallery_display = '<div id="mediaplayer_gallery_' . $gallery_id . '"></div>'; ?> <script type="text/javascript"> jQuery(document).ready(function(){ jwplayer("<?php echo 'mediaplayer_gallery_' . $gallery_id; ?> ").setup({ 'name' : "<?php echo 'playerID_Gallery' . $gallery_id; ?> ", 'flashplayer' : "<?php echo $this->plugin_url . "cvg-player/" . $player_swf; ?> ", 'id': "<?php echo 'playerID_Gallery' . $gallery_id; ?> ", 'playlistfile': "<?php echo $playlist_xml; ?> ", 'height' : "<?php echo $full_player_height; ?> ", 'width' : parseInt(<?php echo $full_player_width; ?> ), 'playlist.position' : "<?php echo $options_player['cvgplayer_playlist']; ?> ", 'playlist.size': parseInt(<?php echo $panel_width; ?> ), 'autostart' : "<?php echo $autoplay; ?> ", 'controlbar' : "<?php echo $options_player['cvgplayer_controlbar']; ?> ", 'volume' : "<?php echo $options_player['cvgplayer_volume']; ?> ", 'mute' : "<?php echo $mute; ?> ", 'stretching' : "<?php echo $options_player['cvgplayer_stretching']; ?> ", "skin" : "<?php echo $this->video_player_url . 'skins/' . $options_player['cvgplayer_skin'] . '-skin/' . $options_player['cvgplayer_skin'] . '.xml'; ?> " }); }); </script> <?php return $gallery_display; }
/** * Function to move video file and thumbnail from one gallery folder to another. * * @param $vid - Video ID * @param $gid - Gallery ID * @author Praveen Rajan */ function move_video($vid, $gid) { $details = videoDB::find_video($vid); $video_details = $details[0]; if ($video_details->video_type == 'upload') { $source_video_file = $this->winabspath . $video_details->path . '/' . $video_details->filename; $source_thumb_file = $this->winabspath . $video_details->path . '/thumbs/' . $video_details->thumb_filename; $gallery_details = videoDB::find_gallery($gid); $dest_video_file = $gallery_details->abspath . '/' . $video_details->filename; $dest_thumb_file = $gallery_details->abspath . '/thumbs/' . $video_details->thumb_filename; if (file_exists($source_video_file)) { if (copy($source_video_file, $dest_video_file)) { unlink($source_video_file); } } if (file_exists($source_thumb_file)) { if (copy($source_thumb_file, $dest_thumb_file)) { unlink($source_thumb_file); } } } else { return; } }