/**
 * Create the options page
 */
function wpvg_gallery_options_do_page()
{
    global $select_options, $radio_options, $message_log;
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>
<div class="wrap">
  <?php 
    if (isset($_GET['gallery_id']) and is_numeric($_GET['gallery_id'])) {
        ?>
  <?php 
        // Verify the Category is Exist
        $get_category_data = get_option('vcategory_id_' . $_GET['gallery_id']);
        if ($get_category_data !== FALSE) {
            // GET OPTION DATA
            $option_name = 'video_gallery_' . $_GET['gallery_id'];
            $gallery_option_data = get_option($option_name);
            $input_count = 0;
            $video_count = 0;
            if (!empty($gallery_option_data)) {
                foreach ($gallery_option_data as $position_video) {
                    // Count the Inputs
                    $input_count++;
                }
                if ($input_count >= 3) {
                    $input_decount = $input_count / 3;
                } else {
                    $input_decount = 0;
                }
            } else {
                $input_decount = 1;
            }
            ?>
 <script>
 // ADD IMAGE
	jQuery(document).ready(function($){
		var _custom_media = true,
			_orig_send_attachment = wp.media.editor.send.attachment;
	  
		$('#InputsWrapper .button').click(function(e) {
		  var send_attachment_bkp = wp.media.editor.send.attachment;
		  var button = $(this);
		  var id = button.attr('id').replace('_button', '');
		  _custom_media = true;
		  wp.media.editor.send.attachment = function(props, attachment){
			if ( _custom_media ) {
			  $("#"+id).val(attachment.url);
			} else {
			  return _orig_send_attachment.apply( this, [props, attachment] );
			};
		  }
	  
		  wp.media.editor.open(button);
		  return false;
		});
	  
		$('.add_media').on('click', function(){
		  _custom_media = false;
		});
	  });
			  
// VALIDATE FIELDS			
			jQuery(document).ready(function($){
			$( "#gallery-form" ).submit(function( event ) {
   				var empty = $('.setupload').parent().parent().find("input").filter(function() {
     			   return this.value === "";
			    });
			$('input[type="text"]').css({"border-color": "#DDDDDD", 
					             "border-width":"1px", 
					             "border-style":"solid"});

			    if(empty.length) {
        			//At least one input is empty
					alert("There were errors on the form, please make sure all fields are fill out correctly.");
					empty.focus();
					empty.css({"border-color": "#FF8888", 
					             "border-width":"1px", 
					             "border-style":"solid"});

					return false;
			    }
				//event.preventDefault();
			});			
			});

// ADD NEW SLIDE
			jQuery(document).ready(function($){
				
				var MaxInputs       = 1000; //maximum input boxes allowed
				var InputsWrapper   = $("#InputsWrapper #gallery-list"); //Input boxes wrapper ID
				var AddButton       = $("#AddMoreFileBox"); //Add button ID
				
				var x = <?php 
            echo $input_decount;
            ?>
; //initlal text box count
				var FieldCount=<?php 
            echo $input_decount;
            ?>
; //to keep track of text box added
	
				$(AddButton).click(function (e)  //on add input button click
				{
					
						if(x <= MaxInputs) //max input box allowed
						{
							FieldCount++; //text box added increment
							//add input box
							$(InputsWrapper).append('<div style="margin:20px 0;" class="setupload"><div class="setup-wrapper"><h3>Slide: </h3><div><p><label>Video Title<input id="video_title_'+ FieldCount +'" name="video_title_'+ FieldCount +'" class="sname" type="text" value="" /><small>This is used for display the video titles in the Video Gallery. <strong>Example: My First Video</strong></small></label></p><p><label>Video URL or Media<input id="video_url_'+ FieldCount +'" name="video_url_'+ FieldCount +'" type="text" value="" /><small>This is the URL of the video to play or Media. <strong>Example: http://vimeo.com/59362697 or http://instagr.am/p/IejkuUGxQn </strong></small></label></p><p><label>Thumbnail URL <input id="vthumbnail_url_'+ FieldCount +'" name="vthumbnail_url_'+ FieldCount +'" type="text" value="" /><small>This is used for display the Video Thumbnail. <strong>Example: http://www.yoursite.com/thumbnail.png </strong></small></label><input class="button" id="vthumbnail_url_'+ FieldCount +'_button" value="Add Image" /></p><a href="#" class="removeclass">REMOVE</a></div></div></div>');
							
							/*<div><input type="text" name="mytext[]" id="field_'+ FieldCount +'" value="Text '+ FieldCount +'"/></div> */
							x++; //text box increment
						}
				return false;
				});
				
				$("body").on("click",".removeclass", function(e){ //user click on remove text
						if( x > 1 ) {
								$(this).parent('div').parent('div').remove(); //remove text box
								x--; //decrement textbox
						}
				return false;
				}) 			
			});
			</script>
  
  <div id="leftsec-gallery">
  <div id="InputsWrapper">
  
  
  
  <div id="section-next">
  <div id="poststuff">
  <div class="postbox " id="videogallery-slider-topd">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span> <div class="dashicons dashicons-admin-users"></div> Top Donations</span></h3>
      <div class="inside">
      <p>Thanks for donate for WP Video Gallery</p>
        <div class="videogallery-field">
          <ul id="donations_list">
          <li>Fawad Khan <span class="country">Pakistan</span> <span class="ammount">$25</span></li>
          <li>ASTUS S.R.L <span class="country">Italy</span> <span class="ammount">$5</span></li>
          </ul>
        </div>
      </div>
    </div>
  <div class="postbox " id="videogallery-slider-support">
  <div title="Click to toggle" class="handlediv"><br>
  </div>
  <h3 class="hndle"><span><div class="dashicons dashicons-heart"></div> Support WP Video Gallery</span></h3>
  <div class="inside">
  <div id="credits">
    <p>Development: <a href="http://pluginsforwp.net/">Gulzar Ahmed</a><br>
		Additional UI: <a href="http://pluginsforwp.net/plugins/wp-video-gallery">WP Video Gallery</a></p>
  </div>
  <div id="contrib-note">
  <center>
  <p>If you find this plugin useful, or are using it commercially, please consider</p>
  <form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="hidden" name="hosted_button_id" value="XUNV7HH2STFQS" />
    <input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" value="1"/>
    <img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" />
  </form>
  <p>Donate <strong>$1</strong> or <strong>$5</strong> Thanks!</p>
  </center>
</div>
<div id="copyright">
  <p>&copy; 2011-<?php 
            echo date('Y');
            ?>
 Plugins for WP. Proud to be <a href="https://www.gnu.org/licenses/gpl-2.0.html">GPLv2 (or later) licensed</a>.</p>
  <p id="vpm-credit">Built by <a href="https://plus.google.com/106669313030431497344">Plugins For Wp</a></p>
</div>
</div>
</div>
    <div class="postbox " id="videogallery-slider-codes">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span>Get Slider Codes</span></h3>
      <div class="inside">
        <div class="videogallery-field">
          <label for="videogallery_get_shortcode">Your Shortcode: </label>
          <input type="text" value="[gallery_videos id=&quot;<?php 
            echo $_GET['gallery_id'];
            ?>
&quot;]"  class="widefat" id="videogallery_get_shortcode" readonly>
          <span class="note">Copy and paste this shortcode into your Post, Page or Custom Post editor.</span>
          <div class="clear"></div>
        </div>
        <div class="videogallery-field last">
          <label for="videogallery_get_code">Your PHP Code: </label>
          <input type="text" value="&lt;?php if( function_exists('wpvg_get_category_videos') ) wpvg_get_category_videos('<?php 
            echo $_GET['gallery_id'];
            ?>
'); ?&gt;" class="widefat" id="videogallery_get_code" readonly>
          <span class="note">Copy and paste this code when you need to display the slider in template files (header.php, front-page.php, etc.).</span>
          <div class="clear"></div>
        </div>
      </div>
    </div>
    <div class="postbox " id="videogallery-slider-extend">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Extend Power - WP Video Gallery</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Feedback - WP Video Gallery">Submit Your Feedback</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Customize Request - WP Video Gallery">Customize WP Video Gallery</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Report a Bug - WP Video Gallery">Report a Bug</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Hire Us - WP Video Gallery">Hire Us</a></p>            
          </div>
        </div>
      </div>
    <div class="postbox " id="videogallery-slider-news">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span>News from PluginsForWP.net</span></h3>
      <div class="inside">
        <div class="videogallery-field">
          <?php 
            wpvg_rss_news();
            ?>
        </div>
      </div>
    </div>
    <div class="postbox " id="videogallery-slider-codes">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span>Offers</span></h3>
      <div class="inside">
        <div class="videogallery-field">
          <iframe src="http://pluginsforwp.net/offers.html" width="260" height="250" frameborder="0" scrolling="no"></iframe>
        </div>
      </div>
    </div>
    <div class="postbox " id="videogallery-slider-codes">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span>Find us on Facebook</span></h3>
      <div class="inside">
        <div class="videogallery-field">
          <iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fiwebsolutions&amp;width=260&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=true&amp;appId=280237358777181" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:260px; height:258px;" allowTransparency="true"></iframe>
        </div>
      </div>
    </div>  
	</div>
	</div>
    <form id="gallery-form" method="post" action="">
    <div class="dashicons dashicons-images-alt2"></div><h2 class="g_headline">
    <input id="gallery_name" name="gallery_name" type="text" placeholder="Enter the Gallery Name" value="<?php 
            if ($category_title = get_option('vcategory_id_' . $_GET['gallery_id'])) {
                echo $category_title;
            }
            ?>
" />
    <a href="#" id="AddMoreFileBox" class="btn btn-info newstyle">Add New Slide</a></h2>
    <?php 
            if (!empty($message_log)) {
                ?>
  <div class="updated below-h2" id="message">
    <p><?php 
                echo $message_log;
                ?>
</p>
  </div>
  <?php 
            }
            ?>
  <p class="back-cat"><a href="?page=gallery_options">&#8592; Back to Video Categories</a></p>
  <div id="gallery-list">
<?php 
            if (!empty($gallery_option_data)) {
                foreach ($gallery_option_data as $position_video => $single_video) {
                    if ($video_count == 0) {
                        echo '<div style="margin:20px 0;" class="setupload"><div class="setup-wrapper"><h3>Slide:</h3><div>';
                    }
                    ?>
<p>
  <label>
    <?php 
                    if ($video_count == 0) {
                        echo "Video Title ";
                    } elseif ($video_count == 1) {
                        echo "Video URL or Media";
                    } elseif ($video_count == 2) {
                        echo 'Thumbnail URL';
                    }
                    ?>
    <input id="<?php 
                    echo $position_video;
                    ?>
" name="<?php 
                    echo $position_video;
                    ?>
" <?php 
                    if ($video_count == 0) {
                        echo 'class="sname"';
                    }
                    ?>
 type="text" value="<?php 
                    echo stripslashes($single_video);
                    ?>
" />
    <?php 
                    if ($video_count == 0) {
                        echo '<small>This is used for display the video titles in the Video Gallery. <strong>Example: My First Video</strong></small>';
                    } elseif ($video_count == 1) {
                        echo '<small>This is the URL of the video to play or Media. <strong>Example: http://vimeo.com/59362697 or http://instagr.am/p/IejkuUGxQn </strong><</small>';
                    } elseif ($video_count == 2) {
                        echo '<small>This is used for display the Video Thumbnail. <strong>Example: http://www.yoursite.com/thumbnail.png </strong></small>';
                    }
                    ?>
  </label>
  <?php 
                    // Video Count
                    $video_count++;
                    if ($video_count == 3) {
                        echo '<input class="button" id="' . $position_video . '_button" value="Add Image" />';
                    }
                    ?>
</p>
<?php 
                    if ($video_count == 3) {
                        $video_count = 0;
                        echo '<a href="#" class="removeclass">REMOVE</a></div></div></div>';
                    }
                }
            } else {
                ?>
<div style="margin:20px 0;" class="setupload">
  <div class="setup-wrapper">
    <h3>Slide:</h3><div>
    <p>
      <label>Video Title
        <input name="video_title_1" class="sname" type="text" value="" />
        <small>This is used for display the video titles in the Video Gallery. <strong>Example: My First Video</strong></small> </label>
    </p>
    <p>
      <label>Video URL or Media
        <input name="video_url_1" type="text" value="" />
        <small>This is the URL of the video to play or Media. <strong>Example: http://vimeo.com/59362697 or http://instagr.am/p/IejkuUGxQn</strong></small> </label>
    </p>
    <p>
      <label>Thumbnail URL
        <input id="vthumbnail_url_1"  name="vthumbnail_url_1" type="text" value="" />
        <small>This is used for display the Video Thumbnail. <strong>Example: http://www.yoursite.com/thumbnail.png </strong></small> </label>
      <input class="button" id="vthumbnail_url_1_button" value="Add Image" />
    </p>
  </div>
</div>
</div>
<?php 
            }
            ?>
</div>
<script>
// Get the Slide Name
$(".setupload").each(function(index, value) { 
		// Apply Values
		var slidename = $(this).find(".sname").val();
		$(this).find("h3").append( "<span>"+slidename+"</span>" );
});		
</script>
</div>
</div>
<div id="rightsec-gallery"> </div>
<?php 
            wp_nonce_field('wpvg_gallery_update', 'wpvg_gallery_nonce');
            ?>
<p class="submit">
  <input type="submit" class="button-primary submit_vgallery" value="<?php 
            _e('Save Gallery', 'vgallery');
            ?>
" />
</p>
</form>
<script>
            
			jQuery(document).ready(function($){
				
				var AddButton       = $("#AddMoreFileBox"); //Add button ID
				$(AddButton).click(function (e)  //on add input button click
				{
					var _custom_media = true,
					_orig_send_attachment = wp.media.editor.send.attachment;
			  
				$('#InputsWrapper .button').click(function(e) {
				  var send_attachment_bkp = wp.media.editor.send.attachment;
				  var button = $(this);
				  var id = button.attr('id').replace('_button', '');
				  _custom_media = true;
				  wp.media.editor.send.attachment = function(props, attachment){
					if ( _custom_media ) {
					  $("#"+id).val(attachment.url);
					} else {
					  return _orig_send_attachment.apply( this, [props, attachment] );
					};
				  }
			  
				  wp.media.editor.open(button);
				  return false;
				});
			  
				$('.add_media').on('click', function(){
				  _custom_media = false;
				});
					
				});
			});

            </script>
<?php 
        } else {
            echo "<p>The gallery does not Exist";
        }
    } else {
        ?>
<div class="dashicons dashicons-format-video"></div>
<h2>
  <?php 
        _e('Video Categories', 'vgallery');
        ?>
</h2>
<!-- pre<?php 
        print_r(get_option('video_category'));
        ?>
-->

<div id="left-section" class="category_set">
  <?php 
        if (!empty($message_log)) {
            ?>
  <div class="updated below-h2" id="message">
    <p><?php 
            echo $message_log;
            ?>
</p>
  </div>
  <?php 
        }
        ?>
  <div id="section-next" class="category_list">
    <div id="poststuff">
    <div class="postbox " id="videogallery-slider-topd">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span> <div class="dashicons dashicons-admin-users"></div> Top Donations</span></h3>
      <div class="inside">
      <p>Thanks for donate for WP Video Gallery</p>
        <div class="videogallery-field">
          <ul id="donations_list">
          <li>Fawad Khan <span class="country">Pakistan</span> <span class="ammount">$25</span></li>
          <li>ASTUS S.R.L <span class="country">Italy</span> <span class="ammount">$5</span></li>
          </ul>
        </div>
      </div>
    </div>
    <div class="postbox " id="videogallery-slider-support">
  <div title="Click to toggle" class="handlediv"><br>
  </div>
  <h3 class="hndle"><span><div class="dashicons dashicons-heart"></div> Support WP Video Gallery</span></h3>
  <div class="inside">
  <div id="credits">
    <p>Development: <a href="https://plus.google.com/106669313030431497344">Gulzar Ahmed</a><br>
		Additional UI: <a href="http://pluginsforwp.net/plugins/wp-video-gallery">WP Video Gallery</a></p>
  </div>
  <div id="contrib-note">
  <center>
  <p>If you find this plugin useful, or are using it commercially, please consider</p>
  <form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick" />
    <input type="hidden" name="hosted_button_id" value="XUNV7HH2STFQS" />
    <input type="image" value="1" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" />
    <img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" />
  </form>
  <p>Donate <strong>$1</strong> or <strong>$5</strong> Thanks!</p>
  </center>
</div>
<div id="copyright">
  <p>&copy; 2011-<?php 
        echo date('Y');
        ?>
 Plugins for WP. Proud to be <a href="https://www.gnu.org/licenses/gpl-2.0.html">GPLv2 (or later) licensed</a>.</p>
  <p id="vpm-credit">Built by <a href="http://pluginsforwp.net/">Plugins For Wp</a></p>
</div>
</div>
</div>
      <div class="postbox " id="videogallery-slider-codes">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Get All Categories Codes</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <label for="videogallery_get_shortcode">Your Shortcode: </label>
            <input type="text" value="[video_categories]"  class="widefat" id="videogallery_get_shortcode" readonly>
            <span class="note">Copy and paste this shortcode into your Post, Page or Custom Post editor.</span>
            <div class="clear"></div>
          </div>
          <div class="videogallery-field last">
            <label for="videogallery_get_code">Your PHP Code: </label>
            <input type="text" value="&lt;?php if( function_exists('wpvg_get_all_categories') ) wpvg_get_all_categories(); ?&gt;" class="widefat" id="videogallery_get_code" readonly>
            <span class="note">Copy and paste this code when you need to display the slider in template files (header.php, front-page.php, etc.).</span>
            <div class="clear"></div>
          </div>
        </div>
      </div>
      <div class="postbox " id="videogallery-slider-extend">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Extend Power - WP Video Gallery</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Feedback - WP Video Gallery">Submit Your Feedback</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Customize Request - WP Video Gallery">Customize WP Video Gallery</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Report a Bug - WP Video Gallery">Report a Bug</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Hire Us - WP Video Gallery">Hire Us</a></p>            
          </div>
        </div>
      </div>
      <div class="postbox " id="videogallery-slider-news">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>News from PluginsForWP.net</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <?php 
        wpvg_rss_news();
        ?>
          </div>
        </div>
      </div>
      <div class="postbox " id="videogallery-slider-codes">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Offers</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <iframe src="http://pluginsforwp.net/offers.html" width="260" height="250" frameborder="0" scrolling="no"></iframe>
          </div>
        </div>
      </div>
      <div class="postbox " id="videogallery-slider-codes">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Find us on Facebook</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fiwebsolutions&amp;width=260&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=true&amp;appId=280237358777181" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:260px; height:258px;" allowTransparency="true"></iframe>
          </div>
        </div>
      </div>
    </div>
  </div>
  <form method="post" name="add_category" action="admin.php?page=gallery_options">
    <?php 
        $counter_id = get_option('vcat_counter');
        ?>
    <div id="category_add">
      <div id="cat_add_wrapper">
        <h3>Add New Category</h3>
        <input name="vcategory_name" type="text" value="" />
        <input name="cat_id" type="hidden" value="<?php 
        echo $counter_id + 1;
        ?>
" />
        <input type="submit" class="button-primary addstyle" onClick="return wpvg_valid_category();" value="<?php 
        _e('Add Category', 'vgallery');
        ?>
" />
        <small>Enter the name of the Category</small> </div>
    </div>
    <div id="category-list">
      <div id="titles-cat"><span class="title_id"><strong>ID</strong></span><span class="slide_name"><strong>Title</strong></span><span class="slide_code"><strong>Shortcode</strong></span></div>
      <ul>
        <?php 
        $category_exist = NULL;
        $i = 1;
        while ($i <= $counter_id) {
            if (get_option('vcategory_id_' . $i) !== FALSE) {
                echo "<li><span class='title_id_list'>{$i}</span>\r\n\t\t\t\t\t<span class='title_list'><a href='?page=gallery_options&gallery_id=" . $i . "'>" . get_option('vcategory_id_' . $i) . " </span></a>\r\n\t\t\t\t\t<span class='action_edit'><a href='?page=gallery_options&gallery_id=" . $i . "'>Edit</a></span>\r\n\t\t\t\t\t<span class='action_delete'><a href='?page=gallery_options&cat_delete=" . $i . "'>Delete</a></span>\r\n\t\t\t\t\t<span class='short_code'>[gallery_videos id=&quot;" . $i . "&quot;]</span></li>";
                $category_exist = true;
            }
            $i++;
        }
        if ($category_exist == NULL) {
            echo "<p class='notexist'> Category does not Exist. Please Add New Category </p>";
        }
        ?>
      </ul>
      <div id="titles-cat"><span class="title_id"><strong>ID</strong></span><span class="slide-name"><strong>Title</strong></span></div>
    </div>
    <?php 
        wp_nonce_field('wpvg_gallery_update', 'wpvg_gallery_nonce');
        ?>
  </form>
</div>
<div id="right-section"> </div>
<script>
function wpvg_valid_category()
{
var x=document.forms["add_category"]["vcategory_name"].value;
if (x==null || x=="")
  {
  alert("Please enter the Category Name");
  return false;
  }
}
</script>
<?php 
    }
    ?>
</div>
<?php 
}
function wpvg_my_gallery_do_page()
{
    global $select_options, $radio_options, $pb_style;
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>

<div class="wrap wpvg_settings">
  <div id="leftsec-gallery">
    <div id="InputsWrapper">
      <div class="dashicons dashicons-admin-settings"></div>
      <?php 
    echo "<h2>" . __(' WP Video Gallery Settings', 'my_videogallery') . "</h2>";
    ?>
      <?php 
    if (false !== $_REQUEST['settings-updated']) {
        ?>
      <div class="updated fade">
        <p><strong>
          <?php 
        _e('Settings saved', 'my_videogallery');
        ?>
          </strong></p>
      </div>
      <?php 
    }
    ?>
      <div id="section-next">
        <div id="poststuff">
        <div class="postbox " id="videogallery-slider-topd">
      <div title="Click to toggle" class="handlediv"><br>
      </div>
      <h3 class="hndle"><span> <div class="dashicons dashicons-admin-users"></div> Top Donations</span></h3>
      <div class="inside">
      <p>Thanks for donate for WP Video Gallery</p>
        <div class="videogallery-field">
          <ul id="donations_list">
          <li>Fawad Khan <span class="country">Pakistan</span> <span class="ammount">$25</span></li>
          <li>ASTUS S.R.L <span class="country">Italy</span> <span class="ammount">$5</span></li>
          </ul>
        </div>
      </div>
    </div>
          <div class="postbox " id="videogallery-slider-support">
            <div title="Click to toggle" class="handlediv"><br>
            </div>
            <h3 class="hndle"><span>
              <div class="dashicons dashicons-heart"></div>
              Support WP Video Gallery</span></h3>
            <div class="inside">
              <div id="credits">
                <p>Development: <a href="https://plus.google.com/106669313030431497344">Gulzar Ahmed</a><br>
                  Additional UI: <a href="http://pluginsforwp.net/plugins/wp-video-gallery">WP Video Gallery</a></p>
              </div>
              <div id="contrib-note">
                <center>
                  <p>If you find this plugin useful, or are using it commercially, please consider</p>
                  <form style="text-align: center;" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                    <input type="hidden" name="cmd" value="_s-xclick" />
                    <input type="hidden" name="hosted_button_id" value="XUNV7HH2STFQS" />
                    <input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="PayPal - The safer, easier way to pay online!" />
                    <img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" />
                  </form>
                  <p>Donate <strong>$1</strong> or <strong>$5</strong> Thanks!</p>
                </center>
              </div>
              <div id="copyright">
                <p>&copy; 2011-<?php 
    echo date('Y');
    ?>
 Plugins for WP. Proud to be <a href="https://www.gnu.org/licenses/gpl-2.0.html">GPLv2 (or later) licensed</a>.</p>
                <p id="vpm-credit">Built by <a href="http://pluginsforwp.net/">Plugins For Wp</a></p>
              </div>
            </div>
          </div>
          <div class="postbox " id="videogallery-slider-extend">
        <div title="Click to toggle" class="handlediv"><br>
        </div>
        <h3 class="hndle"><span>Extend Power - WP Video Gallery</span></h3>
        <div class="inside">
          <div class="videogallery-field">
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Feedback - WP Video Gallery">Submit Your Feedback</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Customize Request - WP Video Gallery">Customize WP Video Gallery</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Report a Bug - WP Video Gallery">Report a Bug</a></p>
            <p><a href="mailto:webmaster.gulzarahmed@gmail.com?subject=Hire Us - WP Video Gallery">Hire Us</a></p>            
          </div>
        </div>
      </div>
          <div class="postbox " id="videogallery-slider-codes">
            <div title="Click to toggle" class="handlediv"><br>
            </div>
            <h3 class="hndle"><span>News from PluginsForWP.net</span></h3>
            <div class="inside">
              <div class="videogallery-field">
                <?php 
    wpvg_rss_news();
    ?>
              </div>
            </div>
          </div>
          <div class="postbox " id="videogallery-slider-codes">
            <div title="Click to toggle" class="handlediv"><br>
            </div>
            <h3 class="hndle"><span>Offers</span></h3>
            <div class="inside">
              <div class="videogallery-field">
                <iframe src="http://pluginsforwp.net/offers.html" width="260" height="250" frameborder="0" scrolling="no"></iframe>
              </div>
            </div>
          </div>
          <div class="postbox " id="videogallery-slider-codes">
            <div title="Click to toggle" class="handlediv"><br>
            </div>
            <h3 class="hndle"><span>Find us on Facebook</span></h3>
            <div class="inside">
              <div class="videogallery-field">
                <iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fiwebsolutions&amp;width=260&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=true&amp;appId=280237358777181" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:260px; height:258px;" allowTransparency="true"></iframe>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="setupload" style="margin:20px 0;">
        <form id="setting_page" method="post" action="options.php">
          <?php 
    settings_fields('my_gallery_options');
    ?>
          <?php 
    $options = get_option('my_gallery_video_options');
    ?>
          <h3 class="title-settings"><?php 
    echo __('Settings', 'my_videogallery');
    ?>
</h3>
          <table class="form-table">
            <tr valign="top">
              <th scope="row"><?php 
    _e('Touch (Mobile)', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[touch]" name="my_gallery_video_options[touch]" type="checkbox" value="1" <?php 
    checked('1', $options['touch']);
    ?>
 />
                <label class="description" for="my_gallery_video_options[touch]">
                  <?php 
    _e('Enable', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Social Share', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[sshare]" name="my_gallery_video_options[sshare]" type="checkbox" value="1" <?php 
    checked('1', $options['sshare']);
    ?>
 />
                <label class="description" for="my_gallery_video_options[sshare]">
                  <?php 
    _e('Enable', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Slide Width', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[slidewidth]" class="regular-text" type="text" name="my_gallery_video_options[slidewidth]" value="<?php 
    esc_attr_e($options['slidewidth']);
    ?>
" style="width:60px"/>
                <label class="description" for="my_gallery_video_options[slidewidth]">
                  <?php 
    _e('px', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Slide Margin', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[slidemargin]" class="regular-text" type="text" name="my_gallery_video_options[slidemargin]" value="<?php 
    esc_attr_e($options['slidemargin']);
    ?>
" style="width:60px"/>
                <label class="description" for="my_gallery_video_options[slidemargin]">
                  <?php 
    _e('px', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Move Slide', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[moveslide]" class="regular-text" type="number" name="my_gallery_video_options[moveslide]" value="<?php 
    esc_attr_e($options['moveslide']);
    ?>
" style="width:60px"/>
                <label class="description" for="my_gallery_video_options[moveslide]">
                  <?php 
    _e('Slide', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Min Slide', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[minslide]" class="regular-text" type="number" name="my_gallery_video_options[minslide]" value="<?php 
    esc_attr_e($options['minslide']);
    ?>
" style="width:60px"/>
                <label class="description" for="my_gallery_video_options[minslide]">
                  <?php 
    _e('Slide', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Max Slide', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[maxslide]" class="regular-text" type="number" name="my_gallery_video_options[maxslide]" value="<?php 
    esc_attr_e($options['maxslide']);
    ?>
" style="width:60px"/>
                <label class="description" for="my_gallery_video_options[maxslide]">
                  <?php 
    _e('Slide', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Responsive Slide', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[responsive]" name="my_gallery_video_options[responsive]" type="checkbox" value="1" <?php 
    checked('1', $options['responsive']);
    ?>
 />
                <label class="description" for="my_gallery_video_options[responsive]">
                  <?php 
    _e('Enable', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
              <th scope="row"><?php 
    _e('Play Button', 'my_videogallery');
    ?>
</th>
              <td><input id="my_gallery_video_options[playbutton]" name="my_gallery_video_options[playbutton]" type="checkbox" value="1" <?php 
    checked('1', $options['playbutton']);
    ?>
 />
                <label class="description" for="my_gallery_video_options[playbutton]">
                  <?php 
    _e('Enable', 'my_videogallery');
    ?>
                </label></td>
            </tr>
            <tr valign="top">
        <th scope="row"><?php 
    _e('Light Box Style', 'my_videogallery');
    ?>
</th>
        <td><select name="my_gallery_video_options[vgstyle]">
            <?php 
    $selected = $options['vgstyle'];
    $p = '';
    $r = '';
    foreach ($select_options as $option) {
        $label = $option['label'];
        if ($selected == $option['value']) {
            // Make default first in list
            $p = "\n\t<option style=\"padding-right: 10px;\" selected='selected' value='" . esc_attr($option['value']) . "'>{$label}</option>";
        } else {
            $r .= "\n\t<option style=\"padding-right: 10px;\" value='" . esc_attr($option['value']) . "'>{$label}</option>";
        }
    }
    echo $p . $r;
    ?>
          </select>
          <label class="description" for="my_gallery_video_options[vgstyle]">
            <?php 
    _e('Select', 'my_videogallery');
    ?>
          </label></td>
      </tr>
     		 <tr valign="top">
      <th scope="row"><?php 
    _e('Play Button Style', 'my_videogallery');
    ?>
</th>
        <td><select name="my_gallery_video_options[pbstyle]">

            <?php 
    $selected = $options['pbstyle'];
    $p = '';
    $r = '';
    foreach ($pb_style as $option) {
        $label = $option['label'];
        if ($selected == $option['value']) {
            // Make default first in list
            $p = "\n\t<option style=\"padding-right: 10px;\" selected='selected' value='" . esc_attr($option['value']) . "'>{$label}</option>";
        } else {
            $r .= "\n\t<option style=\"padding-right: 10px;\" value='" . esc_attr($option['value']) . "'>{$label}</option>";
        }
    }
    echo $p . $r;
    ?>

          </select>

          <label class="description" for="my_gallery_video_options[pbstyle]">

            <?php 
    _e('Select', 'my_videogallery');
    ?>

          </label></td>
       </table>
       </tr>
          </table>
          <p class="submit">
            <input type="submit" class="button-primary" value="<?php 
    _e('Save Settings', 'my_videogallery');
    ?>
" />
          </p>
        </form>
      </div>
      
    </div>
  </div>
</div>
<?php 
}