Esempio n. 1
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('') : $instance['title'], $instance, $this->id_base);
        if (!($number = (int) $instance['number'])) {
            $number = 5;
        } else {
            if ($number < 1) {
                $number = 1;
            }
        }
        $cvg_core = new CvgCore();
        $out = $cvg_core->videoShowGallery($instance['galleryid'], true, $number, "sidebar");
        if (!empty($out)) {
            echo $before_widget;
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
		<div class="cvg_slideshow widget">
			<?php 
            echo $out;
            ?>
		</div>
		<?php 
            echo $after_widget;
        }
    }
Esempio n. 2
0
 /**
  * Function to render gallery.
  * 
  * @param $matches - input arguments.
  * @return player code.
  * @author Praveen Rajan
  */
 function CVGVideo_Gallery($matches)
 {
     global $post, $wpdb;
     $output = '';
     $thumbexists = false;
     $setathumb = false;
     preg_match_all('/([\\.\\w]*)=(.*?) /i', $matches[1], $attributes);
     $arguments = array();
     $arguments = CoolVideoGallery::splitargs($matches[1]);
     $gallery_id = $arguments['galleryId'];
     if (isset($arguments['limit'])) {
         $limit = $arguments['limit'];
     } else {
         $limit = 0;
     }
     if (isset($arguments['mode'])) {
         $mode = $arguments['mode'];
         if ($mode == __('playlist')) {
             $this->CVG_render_playlist($gallery_id);
             return;
         }
         if ($mode == __('slideshow')) {
             $slide = true;
         } elseif ($mode == __('showcase')) {
             $slide = false;
         }
     } else {
         $slide = false;
     }
     $output = CvgCore::videoShowGallery($gallery_id, $slide, $limit);
     return $output;
 }
Esempio n. 3
0
<?php 
echo '<link rel="stylesheet" href="' . trailingslashit(WP_PLUGIN_URL . '/' . dirname(dirname(plugin_basename(__FILE__)))) . 'css/thickbox.css" type="text/css" />';
$title = __('Manage Video Gallery');
//Section to delete list of galleries
if (isset($_POST['TB_gallerylist']) && !empty($_POST['TB_gallerylist'])) {
    $gids = explode(',', $_POST['TB_gallerylist']);
    foreach ($gids as $gid) {
        CvgCore::delete_video_gallery($gid);
        videoDB::delete_gallery($gid);
    }
    _e('<div class="clear"><div class="wrap"><div id="message" class="updated fade below-h2"><p>Galleries deleted successfully.</p></div></div></div>');
}
//Section to delete a single gallery
if (isset($_POST['TB_gallerysingle']) && !empty($_POST['TB_gallerysingle'])) {
    $gid = $_POST['TB_gallerysingle'];
    CvgCore::delete_video_gallery($gid);
    videoDB::delete_gallery($gid);
    _e('<div class="clear"><div class="wrap"><div id="message" class="updated fade below-h2"><p>Gallery ' . $gid . ' deleted successfully.</p></div></div></div>');
}
//Build the pagination for more than 25 galleries
if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
    $_GET['paged'] = 1;
}
$options = get_option('cvg_settings');
$per_page = $options['max_cvg_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;
Esempio n. 4
0
		 	}else {
			 	jQuery('#uploadvideo_form').submit();
		 	}
		 });
	});
</script>
<div class="wrap">
	<div class="icon32" id="icon-video"><br></div>
	<h2><?php 
echo esc_html(__($title));
?>
</h2>
	<div class="clear"></div>

	<?php 
$tabs = CvgCore::tabs_order();
?>

	<!-- Section to display tabs -->
	<div id="slider" class="wrap">
        <ul id="tabs">
        	<?php 
foreach ($tabs as $tab_key => $tab_name) {
    echo "\n\t\t<li><a href='#{$tab_key}'>" . __($tab_name) . "</a></li>";
}
?>
		</ul>
        <?php 
foreach ($tabs as $tab_key => $tab_name) {
    echo "\n\t<div id='{$tab_key}'>\n";
    $function_name = 'tab_' . $tab_key;
Esempio n. 5
0
    $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' => __('&laquo;'), 'next_text' => __('&raquo;'), '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(){
					jQuery('#gallerydiv').addClass('closed');
					jQuery('#gallery_open').click(function(){
						if(jQuery('#gallerydiv').attr('class') == 'postbox closed') 
<style type="text/css">
#dashboard-widgets a {
	text-decoration:none;
}
</style>
<div class="wrap">
	<div class="icon32" id="icon-video"><br></div>
	<h2><?php 
echo esc_html($title);
?>
</h2>
	<?php 
if (isset($_POST['generatexml'])) {
    // wp_nonce_field('cvg_video_sitemap_nonce','cvg_video_sitemap_nonce_csrf');
    if (check_admin_referer('cvg_video_sitemap_nonce', 'cvg_video_sitemap_nonce_csrf')) {
        CvgCore::xml_sitemap();
    }
}
?>
	<div id="dashboard-widgets-wrap">
	<form method="post" action="<?php 
echo admin_url('admin.php?page=cvg-video-sitemap');
?>
">
		<div id="dashboard-widgets" class="metabox-holder">
			<div style="width: 100%;" class="postbox-container">
				<div class="meta-box-sortables ui-sortable" id="left-sortables"  style="min-height:0px;">
					
					<div class="postbox" id="server_settings" >	
						<div class="inside" style="margin:10px;">
							Generate your Google XML Video Sitemap here <i style="font-size:10px;"><b>(FFMPEG Library support required)</b></i>. 
Esempio n. 7
0
?>
</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'];
	
							</a>
						</div>
					</div>
					<div class="postbox" id="gallery_overview">	
						<div title="Click to toggle" class="handlediv"><br></div>
						<h3 id="hndle_overview" class="hndle"><span>Video Gallery Overview</span></h3>
						<div class="inside" style="margin:10px;">
							<?php 
CvgCore::gallery_overview();
?>
						</div>
					</div>	
					<div class="postbox" id="server_settings" >	
						<div title="Click to toggle" class="handlediv"><br></div>
						<h3 id="hndle_server" class="hndle"><span>Server Details</span></h3>
						<div class="inside" style="margin:10px;">
						  	<div class="dashboard-widget-content">
					      		<ul class="cvg_settings">
									<?php 
CvgCore::cvg_serverinfo();
?>
								</ul>
							</div>	
						</div>
					</div>
				</div>	
			</div>
		</div>
	</div>
</div>
<?php

/**
 * Section to uninstall plugin
 * @author Praveen Rajan
 */
if (preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) {
    die('You are not allowed to call this page directly.');
}
$title = __('CVG Uninstall');
CvgCore::upgrade_plugin();
if (isset($_POST['uninstallplugin'])) {
    // wp_nonce_field('cvg_plugin_uninstall_nonce','cvg_plugin_uninstall_nonce_csrf');
    if (check_admin_referer('cvg_plugin_uninstall_nonce', 'cvg_plugin_uninstall_nonce_csrf')) {
        CoolVideoGallery::cvg_uninstall();
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
        deactivate_plugins(dirname(dirname(__FILE__)) . '/cool-video-gallery.php');
        ?>
			<script type="text/javascript">
				location.href= "<?php 
        echo admin_url('plugins.php');
        ?>
";</script>
			<?php 
    }
}
?>
<style type="text/css">
	#dashboard-widgets a {
		text-decoration: none;
	}
Esempio n. 10
0
 /**
  * videoShowGallery() - return a gallery  
  * 
  * @param int $galleryID
  * @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 videoShowGallery($galleryID, $slide_show = false, $limit = 0)
 {
     $galleryID = (int) $galleryID;
     $limit_by = $limit > 0 ? $limit : 0;
     // get gallery values
     $videolist = videoDB::get_gallery($galleryID, 'sortorder', 'ASC', $limit_by);
     $outer = '';
     if (!$videolist) {
         return __('[Gallery not found]');
     }
     // get all picture with this galleryid
     if (is_array($videolist)) {
         $outer .= '<div class="video-gallery-thumbnail-box-outer" id="video-' . $galleryID . '">';
         $outer .= CvgCore::videoCreateGallery($videolist, $galleryID, $slide_show);
         $outer .= '</div>';
     }
     return $outer;
 }
Esempio n. 11
0
 /**
  * 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'));
     }
 }