?> ]', denied:'File type not permitted.' }, accept : 'png,PNG', max: 1 }); }); </script> <?php //Section to update video gallery details if (isset($_POST['updatevideogallery'])) { if (videoDB::update_gallery()) { CvgCore::xml_playlist($_GET['gid']); CvgCore::show_video_message(__('Gallery details successfully updated.')); } } //Section to update video details. if (isset($_POST['updatevideos'])) { if (CvgCore::update_videos()) { CvgCore::xml_playlist($_GET['gid']); _e('<div class="clear"><div class="wrap"><div id="message" class="updated fade below-h2"><p>Details of Video(s) updated successfully.</p></div></div></div>'); } } //Section to delete video list. if (isset($_POST['TB_gallerylist']) && !empty($_POST['TB_gallerylist'])) { $pids = explode(',', $_POST['TB_gallerylist']); foreach ($pids as $pid) { CvgCore::delete_video_files($pid); videoDB::delete_video($pid);
?> </h2> <?php //Section to save gallery settings if (isset($_POST['update_Settings'])) { $options['max_cvg_gallery'] = $_POST['max_cvg_gallery']; $options['max_vid_gallery'] = $_POST['max_vid_gallery']; $options['cvg_preview_height'] = $_POST['cvg_preview_height']; $options['cvg_preview_width'] = $_POST['cvg_preview_width']; $options['cvg_preview_quality'] = $_POST['cvg_preview_quality']; $options['cvg_zc'] = $_POST['cvg_zc']; $options['cvg_slideshow'] = $_POST['cvg_slideshow']; $options['cvg_description'] = $_POST['cvg_description']; $options['cvg_ffmpegpath'] = $_POST['cvg_ffmpegpath']; update_option('cvg_settings', $options); CvgCore::show_video_message(__('Gallery settings successfully updated.')); } $options = get_option('cvg_settings'); ?> <form method="post" action="<?php echo admin_url('admin.php?page=cvg-gallery-settings'); ?> "> <div style="float:left;width:35%;"> <h4>Max no. of Galleries listed per page:</h4> </div> <div style="float:left;padding-top:6px;"> <textarea name="max_cvg_gallery" COLS=10 ROWS=1><?php echo $options['max_cvg_gallery'];
/** * Function to generate xml sitemap for videos * * @author Praveen Rajan */ function xml_sitemap() { global $wpdb; $results = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'cvg_videos ORDER BY galleryid', ARRAY_A); $xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">'; $xml .= '<!-- Generated by (http://wordpress.org/extend/plugins/cool-video-gallery/) -->' . "\n"; $xml .= '<url>'; $xml .= '<loc>' . site_url() . '</loc>'; foreach ($results as $result) { if ($result['meta_data'] != '') { $video_meta_data = unserialize($result['meta_data']); $seconds = date('s', strtotime($video_meta_data['videoDuration'])); $minutes = date('i', strtotime($video_meta_data['videoDuration'])); $hours = date('H', strtotime($video_meta_data['videoDuration'])); $total_seconds = round($hours * 60 * 60 + $minutes * 60 + $seconds); } else { $total_seconds = 100; } $gallery_details = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'cvg_gallery WHERE gid=' . $result['galleryid'], ARRAY_A); $video_url = site_url() . '/' . $gallery_details[0]['path'] . '/' . $result['filename']; $thumb_url = site_url() . '/' . $gallery_details[0]['path'] . '/thumbs/' . $result['thumb_filename']; $player_url = WP_PLUGIN_URL . '/cool-video-gallery/cvg-player/player.swf'; $xml .= '<video:video>'; $xml .= '<video:thumbnail_loc>' . $thumb_url . '</video:thumbnail_loc>'; $xml .= '<video:title>' . $result['alttext'] . '</video:title>'; $xml .= '<video:description>' . $result['description'] . '</video:description>'; $xml .= '<video:content_loc>' . $video_url . '</video:content_loc>'; $xml .= '<video:duration>' . $total_seconds . '</video:duration>'; $xml .= '</video:video> '; } $xml .= '</url>'; $xml .= '</urlset>'; $video_sitemap_url = ABSPATH . 'sitemap-video.xml'; if (CvgCore::createFile($video_sitemap_url)) { if (file_put_contents($video_sitemap_url, $xml)) { CvgCore::show_video_message('Google XML Video Sitemap successfully created at location <b>' . $video_sitemap_url . '</b>'); return true; } } }
}); </script> <?php if (isset($_POST['updateSortOrder'])) { global $wpdb; $sub_name_videos = 'cvg_videos'; $table_videos = $wpdb->prefix . $sub_name_videos; $sortArray = explode(',', $_POST['sortOrder']); if (is_array($sortArray)) { $sortindex = 1; foreach ($sortArray as $pid) { $wpdb->query("UPDATE {$table_videos} SET sortorder = '{$sortindex}' WHERE pid = {$pid}"); $sortindex++; } CvgCore::xml_playlist($_GET['gid']); CvgCore::show_video_message(__('Sort order updated successfully!')); } } $gid = $_GET['gid']; $orderBy = isset($_GET['order']) ? $_GET['order'] : 'sortorder'; //Section if no gallery is selected. if (!isset($gid)) { ?> <div class="wrap"> <div class="icon32" id="icon-video"><br></div> <h2>Sort Gallery Videos</h2> <div class="clear"></div> <div class="versions"> <p> Choose your gallery at <a class="button rbutton" href="<?php echo admin_url('admin.php?page=cvg-gallery-manage');
/** * Function to publish videos as post. * * @author Praveen Rajan */ function publish_video_post() { global $user_ID; if (isset($_POST['post_title']) && $_POST['post_title'] == "") { CvgCore::show_video_error(__('Please provide a title for Post')); return; } if ($_POST['width'] == "" || $_POST['height'] == "") { CvgCore::show_video_error(__('Width/Height not set properly.')); return; } $width = (int) $_POST['width']; $height = (int) $_POST['height']; $mode = ""; if (isset($_POST['showtypevideo']) && $_POST['showtypevideo'] == "embed") { $mode = "mode='playlist'"; } $post['post_type'] = 'post'; $post['post_content'] = "[cvg-video videoId='" . $_POST['videosingle_publish'] . "' width='{$width}' height='{$height}' {$mode}/]"; $post['post_author'] = $user_ID; $post['post_status'] = isset($_POST['publish']) ? 'publish' : 'draft'; $post['post_title'] = $_POST['post_title']; $post_id = wp_insert_post($post); if ($post_id != 0) { CvgCore::show_video_message(__('Published a new post')); } }