Absolutely Glamorous Custom Admin - Version 1.2.4

Version Description

  • Plugin is now fully compatible with WordPress version 3.2
  • Fixed update notification bar for lower WP versions
  • Login image can be now of any size.
  • Improved error management
  • Added options in 3.2 for changing background behind admin menu
  • Added option in 3.2 for removing "Your profile" from admin bar
  • Added invalid characters escaping when adding new custom buttons
  • Fixed few minor issues
Download this release

Release Info

Developer argonius
Plugin Icon 128x128 Absolutely Glamorous Custom Admin
Version 1.2.4
Comparing to
See all releases

Code changes from version 1.2.3 to 1.2.4

Files changed (3) hide show
  1. plugin.php +143 -40
  2. readme.txt +16 -3
  3. script/ag_script.js +82 -8
plugin.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: AG Custom Admin
4
  Plugin URI: http://wordpress.org/extend/plugins/ag-custom-admin
5
  Description: Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
6
  Author: Argonius
7
- Version: 1.2.3
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
@@ -28,14 +28,15 @@ $agca = new AGCA();
28
  class AGCA{
29
  private $colorizer="";
30
  public function __construct()
31
- {
 
32
 
33
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
34
  add_action('admin_init', array(&$this,'agca_register_settings'));
35
  add_action('admin_head', array(&$this,'print_admin_css'));
36
  add_action('login_head', array(&$this,'print_login_head'));
37
  add_action('admin_menu', array(&$this,'agca_create_menu'));
38
- register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
39
 
40
  /*Styles*/
41
  // add_action('admin_menu', array(&$this,'agca_get_styles'));
@@ -75,6 +76,7 @@ class AGCA{
75
  register_setting( 'agca-options-group', 'agca_screen_options_menu' );
76
  register_setting( 'agca-options-group', 'agca_help_menu' );
77
  register_setting( 'agca-options-group', 'agca_logout' );
 
78
  register_setting( 'agca-options-group', 'agca_logout_only' );
79
  register_setting( 'agca-options-group', 'agca_options_menu' );
80
  register_setting( 'agca-options-group', 'agca_howdy' );
@@ -130,6 +132,7 @@ class AGCA{
130
  delete_option( 'agca_screen_options_menu' );
131
  delete_option( 'agca_help_menu' );
132
  delete_option( 'agca_logout' );
 
133
  delete_option( 'agca_logout_only' );
134
  delete_option( 'agca_options_menu' );
135
  delete_option( 'agca_howdy' );
@@ -256,13 +259,21 @@ class AGCA{
256
  global $wp_meta_boxes;
257
  remove_meta_box($widget, 'dashboard', $side);
258
  }
 
 
 
 
 
 
 
259
 
260
  function print_admin_css()
261
  {
262
  $this->agca_get_includes();
263
 
264
  get_currentuserinfo() ;
265
- global $user_level;
 
266
 
267
  ?>
268
  <?php
@@ -277,8 +288,12 @@ class AGCA{
277
  ?>
278
  <script type="text/javascript">
279
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
 
 
280
  /* <![CDATA[ */
281
  jQuery(document).ready(function() {
 
 
282
  //get saved onfigurations
283
  <?php $checkboxes = $this->jsonMenuArray(get_option('ag_edit_adminmenu_json'),'0'); ?>
284
  var checkboxes = <?php echo "[".$checkboxes."]"; ?>;
@@ -292,7 +307,11 @@ jQuery(document).ready(function() {
292
  <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
293
  var buttonsJq = '<?php echo $buttonsJq; ?>';
294
 
295
- createEditMenuPage(checkboxes,textboxes);
 
 
 
 
296
 
297
  <?php
298
  //if admin, and option to hide settings for admin is set
@@ -341,6 +360,7 @@ jQuery(document).ready(function() {
341
  <?php } ?>
342
  <?php if(get_option('agca_update_bar')==true){ ?>
343
  jQuery("#update-nag").css("display","none");
 
344
  <?php } ?>
345
  <?php if(get_option('agca_header')==true){ ?>
346
  jQuery("#wphead").css("display","none");
@@ -362,19 +382,52 @@ jQuery(document).ready(function() {
362
  <?php if(get_option('agca_footer')==true){ ?>
363
  jQuery("#footer").css("display","none");
364
  <?php } ?>
365
- <?php if(get_option('agca_howdy')!=""){ ?>
366
- var howdyText = jQuery("#user_info").html();
367
- if(howdyText !=null){
368
- jQuery("#user_info").html("<p>"+"<?php echo get_option('agca_howdy'); ?>"+howdyText.substr(9));
369
- }
 
 
 
 
 
 
 
 
 
 
 
370
  <?php } ?>
371
- <?php if(get_option('agca_logout')!=""){ ?>
372
- jQuery("#user_info a:eq(1)").text("<?php echo get_option('agca_logout'); ?>");
 
 
 
 
 
 
373
  <?php } ?>
374
- <?php if(get_option('agca_logout_only')==true){ ?>
375
- var logoutText = jQuery("#user_info a:nth-child(2)").text();
376
- var logoutLink = jQuery("#user_info a:nth-child(2)").attr("href");
377
- jQuery("#user_info").html("<a href=\""+logoutLink+"\" title=\"Log Out\">"+logoutText+"</a>");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
378
  <?php } ?>
379
 
380
 
@@ -518,7 +571,7 @@ jQuery(document).ready(function() {
518
  matchFound = true;
519
  //console.log(checkboxes[i][0]);
520
  jQuery(this).find('a').eq(1).html(textboxes[i][1]);
521
- if(checkboxes[i][1] == "true"){
522
  jQuery(this).addClass('noclass');
523
  }
524
 
@@ -528,7 +581,7 @@ jQuery(document).ready(function() {
528
  while((i<checkboxes.length) && (checkboxes[i][0].indexOf("<-TOP->") < 0)){
529
  jQuery(selector).each(function(){ //loop through all submenus
530
  if(checkboxes[i][0] == jQuery(this).text()){
531
- if(checkboxes[i][1] == "true"){
532
  jQuery(this).addClass('noclass');
533
  }
534
  jQuery(this).find('a').text(textboxes[i][1]);
@@ -580,9 +633,12 @@ jQuery(document).ready(function() {
580
 
581
  <?php } ?>
582
  <?php //COLORIZER END ?>
583
- <?php } //end of apply for any user except admin ?>
 
 
 
584
  });
585
- /* ]]> */
586
  </script>
587
  <style type="text/css">
588
  .underline_text{
@@ -605,14 +661,16 @@ jQuery(document).ready(function() {
605
  function print_login_head(){
606
 
607
  $this->reloadScript();
608
- $this->agca_get_includes();
 
609
  ?>
610
 
611
  <script type="text/javascript">
612
  document.write('<style type="text/css">html{display:none;}</style>');
 
613
  /* <![CDATA[ */
614
- jQuery(document).ready(function() {
615
-
616
  <?php if(get_option('agca_login_banner')==true){ ?>
617
  jQuery("#backtoblog").css("display","none");
618
  <?php } ?>
@@ -621,7 +679,18 @@ jQuery(document).ready(function() {
621
  <?php } ?>
622
  <?php if(get_option('agca_login_photo_url')==true){ ?>
623
  var $url = "url(" + "<?php echo get_option('agca_login_photo_url'); ?>" + ")";
624
- jQuery("#login h1 a").css("background-image",$url);
 
 
 
 
 
 
 
 
 
 
 
625
  <?php } ?>
626
  <?php if(get_option('agca_login_photo_href')==true){ ?>
627
  var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
@@ -646,12 +715,14 @@ jQuery(document).ready(function() {
646
  }
647
  if($this->colorizer['color_header']!=""){
648
  ?>
649
- jQuery("#backtoblog").css("background","<?php echo $this->colorizer['color_header'];?>");
 
 
650
  <?php
651
  }
652
  if($this->colorizer['color_font_header']!=""){
653
- ?>
654
- jQuery("#backtoblog a,#backtoblog p").css("color","<?php echo $this->colorizer['color_font_header'];?>");
655
  <?php
656
  }
657
  } ?>
@@ -659,9 +730,13 @@ jQuery(document).ready(function() {
659
 
660
  <?php //unhide after everything is loaded ?>
661
  jQuery(document).ready(function() {
662
- jQuery('html').show();
 
663
  });
664
- <?php //unhide after everything is loaded ?>
 
 
 
665
  });
666
  /* ]]> */
667
  </script>
@@ -669,6 +744,8 @@ jQuery(document).ready(function() {
669
  }
670
 
671
  function agca_admin_page() {
 
 
672
  ?>
673
  <?php //includes ?>
674
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css" />
@@ -678,7 +755,7 @@ jQuery(document).ready(function() {
678
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js"></script>
679
  <?php //includes ?>
680
  <div class="wrap">
681
- <h1 style="color:green">AG Custom Admin Settings</h1>
682
  <div id="agca_news">&nbsp;</div><br />
683
  <form method="post" id="agca_form" action="options.php">
684
  <?php settings_fields( 'agca-options-group' ); ?>
@@ -822,7 +899,17 @@ jQuery(document).ready(function() {
822
  <label title="Put 'Exit', for example" for="agca_logout">Change Log out text</label>
823
  </th>
824
  <td><input title="Put 'Exit', for example" type="text" size="47" name="agca_logout" value="<?php echo get_option('agca_logout'); ?>" /></td>
 
 
 
 
 
 
 
 
 
825
  </tr>
 
826
  <tr valign="center">
827
  <th scope="row">
828
  <label title="If selected, hides all elements in top right corner, except Log Out button" for="agca_logout_only">Log out only</label>
@@ -1006,15 +1093,15 @@ jQuery(document).ready(function() {
1006
  <div id="section_login_page" style="display:none" class="ag_section">
1007
  <h2 class="section_title" tabindex="-1">Login Page Settings</h2>
1008
  <br /><br />
1009
- <table class="form-table" width="500px">
1010
  <tr valign="center" class="ag_table_major_options">
1011
- <td>
1012
- <label for="agca_login_banner"><strong>Hide Login top bar completely</strong></label>
1013
- </td>
1014
- <td>
1015
- <input type="checkbox" name="agca_login_banner" title="Hide Login top bar completely" value="true" <?php if (get_option('agca_login_banner')==true) echo 'checked="checked" '; ?> />
1016
- </td>
1017
- </tr>
1018
  <tr valign="center">
1019
  <td colspan="2">
1020
  <div class="ag_table_heading"><h3 tabindex="0">Login Page Options</h3></div>
@@ -1024,7 +1111,7 @@ jQuery(document).ready(function() {
1024
  </tr>
1025
  <tr valign="center">
1026
  <th scope="row">
1027
- <label title="Changes '<- Back to ...' text in top bar on Login page" for="agca_login_banner_text">Change Login top bar text</label>
1028
  </th>
1029
  <td>
1030
  <textarea title="Changes 'Back to ...' text in top bar on Login page" rows="5" name="agca_login_banner_text" cols="40"><?php echo htmlspecialchars(get_option('agca_login_banner_text')); ?></textarea>&nbsp;<p><i>You should surround it with anchor tag &lt;a&gt;&lt;/a&gt;.</i></p>
@@ -1036,7 +1123,7 @@ jQuery(document).ready(function() {
1036
  </th>
1037
  <td>
1038
  <input title="If this field is not empty, image from provided url will be visible on Login page" type="text" size="47" name="agca_login_photo_url" value="<?php echo get_option('agca_login_photo_url'); ?>" />
1039
- &nbsp;<p><i>Put here link of new login photo (e.g http://www.photo.com/myphoto.jpg). Original photo dimensions are: 310px x 70px</i>.</p>
1040
  </td>
1041
  </tr>
1042
  <tr valign="center">
@@ -1212,6 +1299,22 @@ jQuery(document).ready(function() {
1212
  <input type="button" alt="color_admin_menu_font" class="pick_color_button_clear" value="Clear" />
1213
  </td>
1214
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1215
  <!--<tr valign="center">
1216
  <th><label title="Change background submenu color on mouse over in admin menu" for="color_admin_menu_submenu_background_over">Submenu button background (Mouse over):</label></th>
1217
  <td><input type="text" id="color_admin_menu_submenu_background_over" name="color_admin_menu_submenu_background_over" class="color_picker" value="#123456" />
4
  Plugin URI: http://wordpress.org/extend/plugins/ag-custom-admin
5
  Description: Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
6
  Author: Argonius
7
+ Version: 1.2.4
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
28
  class AGCA{
29
  private $colorizer="";
30
  public function __construct()
31
+ {
32
+
33
 
34
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
35
  add_action('admin_init', array(&$this,'agca_register_settings'));
36
  add_action('admin_head', array(&$this,'print_admin_css'));
37
  add_action('login_head', array(&$this,'print_login_head'));
38
  add_action('admin_menu', array(&$this,'agca_create_menu'));
39
+ register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
40
 
41
  /*Styles*/
42
  // add_action('admin_menu', array(&$this,'agca_get_styles'));
76
  register_setting( 'agca-options-group', 'agca_screen_options_menu' );
77
  register_setting( 'agca-options-group', 'agca_help_menu' );
78
  register_setting( 'agca-options-group', 'agca_logout' );
79
+ register_setting( 'agca-options-group', 'agca_remove_your_profile' );
80
  register_setting( 'agca-options-group', 'agca_logout_only' );
81
  register_setting( 'agca-options-group', 'agca_options_menu' );
82
  register_setting( 'agca-options-group', 'agca_howdy' );
132
  delete_option( 'agca_screen_options_menu' );
133
  delete_option( 'agca_help_menu' );
134
  delete_option( 'agca_logout' );
135
+ delete_option( 'agca_remove_your_profile' );
136
  delete_option( 'agca_logout_only' );
137
  delete_option( 'agca_options_menu' );
138
  delete_option( 'agca_howdy' );
259
  global $wp_meta_boxes;
260
  remove_meta_box($widget, 'dashboard', $side);
261
  }
262
+
263
+ function get_wp_version(){
264
+ global $wp_version;
265
+ $array = explode('-', $wp_version);
266
+ $version = $array[0];
267
+ return $version;
268
+ }
269
 
270
  function print_admin_css()
271
  {
272
  $this->agca_get_includes();
273
 
274
  get_currentuserinfo() ;
275
+ global $user_level;
276
+ $wpversion = $this->get_wp_version();
277
 
278
  ?>
279
  <?php
288
  ?>
289
  <script type="text/javascript">
290
  document.write('<style type="text/css">html{visibility:hidden;}</style>');
291
+ var wpversion = "<?php echo $wpversion; ?>";
292
+
293
  /* <![CDATA[ */
294
  jQuery(document).ready(function() {
295
+ try
296
+ {
297
  //get saved onfigurations
298
  <?php $checkboxes = $this->jsonMenuArray(get_option('ag_edit_adminmenu_json'),'0'); ?>
299
  var checkboxes = <?php echo "[".$checkboxes."]"; ?>;
307
  <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
308
  var buttonsJq = '<?php echo $buttonsJq; ?>';
309
 
310
+ <?php if($wpversion >=3.2 ){ ?>
311
+ createEditMenuPageV32(checkboxes,textboxes);
312
+ <?php }else{ ?>
313
+ createEditMenuPage(checkboxes,textboxes);
314
+ <?php } ?>
315
 
316
  <?php
317
  //if admin, and option to hide settings for admin is set
360
  <?php } ?>
361
  <?php if(get_option('agca_update_bar')==true){ ?>
362
  jQuery("#update-nag").css("display","none");
363
+ jQuery(".update-nag").css("display","none");
364
  <?php } ?>
365
  <?php if(get_option('agca_header')==true){ ?>
366
  jQuery("#wphead").css("display","none");
382
  <?php if(get_option('agca_footer')==true){ ?>
383
  jQuery("#footer").css("display","none");
384
  <?php } ?>
385
+ <?php if(get_option('agca_howdy')!=""){ ?>
386
+ <?php //code for wp version >= 3.2 ?>
387
+ <?php if($wpversion >= 3.2 ){ ?>
388
+ var alltext="";
389
+ alltext="";
390
+ alltext = jQuery('#user_info div.hide-if-no-js').html();
391
+ alltext = alltext.replace('Howdy',"<?php echo get_option('agca_howdy'); ?>");
392
+ jQuery("#user_info div.hide-if-no-js").html(alltext);
393
+
394
+ <?php }else{ ?>
395
+ <?php //code for wp version < 3.2 ?>
396
+ var howdyText = jQuery("#user_info").html();
397
+ if(howdyText !=null){
398
+ jQuery("#user_info").html("<p>"+"<?php echo get_option('agca_howdy'); ?>"+howdyText.substr(9));
399
+ }
400
+ <?php } ?>
401
  <?php } ?>
402
+ <?php if(get_option('agca_logout')!=""){ ?>
403
+ <?php //code for wp version >= 3.2 ?>
404
+ <?php if($wpversion >= 3.2 ){ ?>
405
+ jQuery("#user_info #user_info_links a:eq(1)").text("<?php echo get_option('agca_logout'); ?>");
406
+ <?php }else{ ?>
407
+ <?php //code for wp version < 3.2 ?>
408
+ jQuery("#user_info a:eq(1)").text("<?php echo get_option('agca_logout'); ?>");
409
+ <?php } ?>
410
  <?php } ?>
411
+ <?php if(get_option('agca_remove_your_profile')==true){ ?>
412
+ <?php if($wpversion >= 3.2 ){ ?>
413
+ jQuery("#user_info #user_info_links li:eq(0)").remove();
414
+ <?php }?>
415
+ <?php } ?>
416
+ <?php if(get_option('agca_logout_only')==true){ ?>
417
+ <?php //code for wp version >= 3.2 ?>
418
+ <?php if($wpversion >= 3.2 ){ ?>
419
+ var logoutText = jQuery("#user_info a:nth-child(2)").text();
420
+ <?php if(get_option('agca_logout')!=""){ ?>
421
+ logoutText = "<?php echo get_option('agca_logout'); ?>";
422
+ <?php } ?>
423
+ var logoutLink = jQuery("#user_info a:nth-child(2)").attr("href");
424
+ jQuery("#user_info").html("<a href=\""+logoutLink+"\" title=\"Log Out\">"+logoutText+"</a>");
425
+ <?php }else{ ?>
426
+ <?php //code for wp version < 3.2 ?>
427
+ var logoutText = jQuery("#user_info a:nth-child(2)").text();
428
+ var logoutLink = jQuery("#user_info a:nth-child(2)").attr("href");
429
+ jQuery("#user_info").html("<a href=\""+logoutLink+"\" title=\"Log Out\">"+logoutText+"</a>");
430
+ <?php } ?>
431
  <?php } ?>
432
 
433
 
571
  matchFound = true;
572
  //console.log(checkboxes[i][0]);
573
  jQuery(this).find('a').eq(1).html(textboxes[i][1]);
574
+ if((checkboxes[i][1] == "true") || (checkboxes[i][1] == "checked")){
575
  jQuery(this).addClass('noclass');
576
  }
577
 
581
  while((i<checkboxes.length) && (checkboxes[i][0].indexOf("<-TOP->") < 0)){
582
  jQuery(selector).each(function(){ //loop through all submenus
583
  if(checkboxes[i][0] == jQuery(this).text()){
584
+ if((checkboxes[i][1] == "true") || (checkboxes[i][1] == "checked")){
585
  jQuery(this).addClass('noclass');
586
  }
587
  jQuery(this).find('a').text(textboxes[i][1]);
633
 
634
  <?php } ?>
635
  <?php //COLORIZER END ?>
636
+ <?php } //end of apply for any user except admin ?>
637
+ }catch(err){
638
+ alert("ADMIN ERROR: " + err);
639
+ }
640
  });
641
+ /* ]]> */
642
  </script>
643
  <style type="text/css">
644
  .underline_text{
661
  function print_login_head(){
662
 
663
  $this->reloadScript();
664
+ $this->agca_get_includes();
665
+ $wpversion = $this->get_wp_version();
666
  ?>
667
 
668
  <script type="text/javascript">
669
  document.write('<style type="text/css">html{display:none;}</style>');
670
+ var wpversion = "<?php echo $wpversion; ?>";
671
  /* <![CDATA[ */
672
+ jQuery(document).ready(function() {
673
+ try{
674
  <?php if(get_option('agca_login_banner')==true){ ?>
675
  jQuery("#backtoblog").css("display","none");
676
  <?php } ?>
679
  <?php } ?>
680
  <?php if(get_option('agca_login_photo_url')==true){ ?>
681
  var $url = "url(" + "<?php echo get_option('agca_login_photo_url'); ?>" + ")";
682
+ jQuery("#login h1 a").css("background-image",$url);
683
+ jQuery("#login h1 a").hide();
684
+ var image = new Image();
685
+ jQuery(image).attr('src',"<?php echo get_option('agca_login_photo_url'); ?>").load(function() {
686
+ var originalWidth = 326;
687
+ var widthDiff = this.width - originalWidth;
688
+ jQuery("#login h1 a").height(this.height);
689
+ jQuery("#login h1 a").width(this.width);
690
+ jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+"px");
691
+ jQuery("#login h1 a").show();
692
+
693
+ });
694
  <?php } ?>
695
  <?php if(get_option('agca_login_photo_href')==true){ ?>
696
  var $href = "<?php echo get_option('agca_login_photo_href'); ?>";
715
  }
716
  if($this->colorizer['color_header']!=""){
717
  ?>
718
+ <?php if($wpversion < 3.2){ ?>
719
+ jQuery("#backtoblog").css("background","<?php echo $this->colorizer['color_header'];?>");
720
+ <?php } ?>
721
  <?php
722
  }
723
  if($this->colorizer['color_font_header']!=""){
724
+ ?>
725
+ jQuery("#backtoblog a,#backtoblog p").css("color","<?php echo $this->colorizer['color_font_header'];?>");
726
  <?php
727
  }
728
  } ?>
730
 
731
  <?php //unhide after everything is loaded ?>
732
  jQuery(document).ready(function() {
733
+ jQuery('html').show();
734
+ jQuery('html').css("display","block");
735
  });
736
+ <?php //unhide after everything is loaded ?>
737
+ }catch(err){
738
+ alert("LOGIN ERROR: " + err);
739
+ }
740
  });
741
  /* ]]> */
742
  </script>
744
  }
745
 
746
  function agca_admin_page() {
747
+
748
+ $wpversion = $this->get_wp_version();
749
  ?>
750
  <?php //includes ?>
751
  <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/farbtastic.css" />
755
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/agca_farbtastic.js"></script>
756
  <?php //includes ?>
757
  <div class="wrap">
758
+ <h1 style="color:green">AG Custom Admin Settings <span style="font-size:15px;">(v1.2.4)</span></h1>
759
  <div id="agca_news">&nbsp;</div><br />
760
  <form method="post" id="agca_form" action="options.php">
761
  <?php settings_fields( 'agca-options-group' ); ?>
899
  <label title="Put 'Exit', for example" for="agca_logout">Change Log out text</label>
900
  </th>
901
  <td><input title="Put 'Exit', for example" type="text" size="47" name="agca_logout" value="<?php echo get_option('agca_logout'); ?>" /></td>
902
+ </tr>
903
+ <?php if($wpversion >= 3.2){ ?>
904
+ <tr valign="center">
905
+ <th scope="row">
906
+ <label for="agca_remove_your_profile">Remove "Your profile" option from dropdown menu</label>
907
+ </th>
908
+ <td>
909
+ <input type="checkbox" name="agca_remove_your_profile" value="true" <?php if (get_option('agca_remove_your_profile')==true) echo 'checked="checked" '; ?> />
910
+ </td>
911
  </tr>
912
+ <?php } ?>
913
  <tr valign="center">
914
  <th scope="row">
915
  <label title="If selected, hides all elements in top right corner, except Log Out button" for="agca_logout_only">Log out only</label>
1093
  <div id="section_login_page" style="display:none" class="ag_section">
1094
  <h2 class="section_title" tabindex="-1">Login Page Settings</h2>
1095
  <br /><br />
1096
+ <table class="form-table" width="500px">
1097
  <tr valign="center" class="ag_table_major_options">
1098
+ <td>
1099
+ <label for="agca_login_banner"><strong><?php if($wpversion < 3.2){ ?>Hide Login top bar completely<?php }else{ ?>Hide back to blog block completely<?php } ?></strong></label>
1100
+ </td>
1101
+ <td>
1102
+ <input type="checkbox" name="agca_login_banner" title="<?php if($wpversion < 3.2){ ?>Hide Login top bar completely<?php }else{ ?>Hide back to blog block completely<?php } ?>" value="true" <?php if (get_option('agca_login_banner')==true) echo 'checked="checked" '; ?> />
1103
+ </td>
1104
+ </tr>
1105
  <tr valign="center">
1106
  <td colspan="2">
1107
  <div class="ag_table_heading"><h3 tabindex="0">Login Page Options</h3></div>
1111
  </tr>
1112
  <tr valign="center">
1113
  <th scope="row">
1114
+ <label title="Changes '<- Back to ...' text in top bar on Login page" for="agca_login_banner_text"><?php if($wpversion < 3.2){ ?>Change Login top bar text<?php }else{ ?>Change back to blog text<?php } ?></label>
1115
  </th>
1116
  <td>
1117
  <textarea title="Changes 'Back to ...' text in top bar on Login page" rows="5" name="agca_login_banner_text" cols="40"><?php echo htmlspecialchars(get_option('agca_login_banner_text')); ?></textarea>&nbsp;<p><i>You should surround it with anchor tag &lt;a&gt;&lt;/a&gt;.</i></p>
1123
  </th>
1124
  <td>
1125
  <input title="If this field is not empty, image from provided url will be visible on Login page" type="text" size="47" name="agca_login_photo_url" value="<?php echo get_option('agca_login_photo_url'); ?>" />
1126
+ &nbsp;<p><i>Put here link of new login photo. Photo could be of any size and type</i>.</p>
1127
  </td>
1128
  </tr>
1129
  <tr valign="center">
1299
  <input type="button" alt="color_admin_menu_font" class="pick_color_button_clear" value="Clear" />
1300
  </td>
1301
  </tr>
1302
+ <?php if($wpversion >= 3.2) { ?>
1303
+ <tr valign="center">
1304
+ <th><label title="Change background color of element behind admin menu" for="color_admin_menu_behind_background">Wrapper background color:</label></th>
1305
+ <td><input type="text" id="color_admin_menu_behind_background" name="color_admin_menu_behind_background" class="color_picker" value="<?php echo htmlspecialchars($this->colorizer['color_admin_menu_behind_background']); ?>" />
1306
+ <input type="button" alt="color_admin_menu_behind_background" class="pick_color_button" value="Pick color" />
1307
+ <input type="button" alt="color_admin_menu_behind_background" class="pick_color_button_clear" value="Clear" />
1308
+ </td>
1309
+ </tr>
1310
+ <tr valign="center">
1311
+ <th><label title="Change border color of element behind admin menu" for="color_admin_menu_behind_border">Wrapper border color:</label></th>
1312
+ <td><input type="text" id="color_admin_menu_behind_border" name="color_admin_menu_behind_border" class="color_picker" value="<?php echo htmlspecialchars($this->colorizer['color_admin_menu_behind_border']); ?>" />
1313
+ <input type="button" alt="color_admin_menu_behind_border" class="pick_color_button" value="Pick color" />
1314
+ <input type="button" alt="color_admin_menu_behind_border" class="pick_color_button_clear" value="Clear" />
1315
+ </td>
1316
+ </tr>
1317
+ <?php } ?>
1318
  <!--<tr valign="center">
1319
  <th><label title="Change background submenu color on mouse over in admin menu" for="color_admin_menu_submenu_background_over">Submenu button background (Mouse over):</label></th>
1320
  <td><input type="text" id="color_admin_menu_submenu_background_over" name="color_admin_menu_submenu_background_over" class="color_picker" value="#123456" />
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: argonius
3
  Donate link: http://wordpress.argonius.com/donate
4
  Tags: admin, customize, hide, change admin
5
  Requires at least: 3.0
6
- Tested up to: 3.1.2
7
- Stable tag: 1.2.3
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
@@ -88,8 +88,18 @@ Please use 'Reset Settings' button on Admin Menu page to reset menu configuratio
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
 
 
 
 
91
  = 1.2.3 =
92
- * Added Colorizer options for changing widgets colours.
93
  * Added option for changing logo image in admin bar with custom image.
94
  * Fixed bug on add new post page: After clicking on buttons Add new image, Add new media pop-up window is blank.
95
  * Added info bar for displaying news and information about plugin.
@@ -131,6 +141,9 @@ Please use 'Reset Settings' button on Admin Menu page to reset menu configuratio
131
 
132
  == Upgrade Notice ==
133
 
 
 
 
134
  = 1.2.3 =
135
  Fixed 'White screen of death' bug, and few other improvements. Added colorizer options for widgets. Added support for changing admin bar logo with custom image.
136
 
3
  Donate link: http://wordpress.argonius.com/donate
4
  Tags: admin, customize, hide, change admin
5
  Requires at least: 3.0
6
+ Tested up to: 3.2
7
+ Stable tag: 1.2.4
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.2.4 =
92
+ * Plugin is now fully compatible with WordPress version 3.2
93
+ * Fixed update notification bar for lower WP versions
94
+ * Login image can be now of any size.
95
+ * Improved error management
96
+ * Added options in 3.2 for changing background behind admin menu
97
+ * Added option in 3.2 for removing "Your profile" from admin bar
98
+ * Added invalid characters escaping when adding new custom buttons
99
+ * Fixed few minor issues
100
+
101
  = 1.2.3 =
102
+ * Added Colorizer options for changing widgets colors.
103
  * Added option for changing logo image in admin bar with custom image.
104
  * Fixed bug on add new post page: After clicking on buttons Add new image, Add new media pop-up window is blank.
105
  * Added info bar for displaying news and information about plugin.
141
 
142
  == Upgrade Notice ==
143
 
144
+ = 1.2.4 =
145
+ This plugin version is ready for WordPress release 3.2, and fully compatible with it. Added few new options, and improved plugin stability.
146
+
147
  = 1.2.3 =
148
  Fixed 'White screen of death' bug, and few other improvements. Added colorizer options for widgets. Added support for changing admin bar logo with custom image.
149
 
script/ag_script.js CHANGED
@@ -4,6 +4,8 @@ var editingButtonNow = false;
4
  function booleanToChecked(bool){
5
  if(bool == 'true'){
6
  return 'checked="checked"';
 
 
7
  }
8
  }
9
 
@@ -92,7 +94,7 @@ function createEditMenuPage(checkboxes,textboxes){
92
  top_item_text_value = topElement;
93
  }else{
94
  top_item_text_value = textboxes[counter][1];
95
- isHidden = checkboxes[counter][1];
96
  }
97
  jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_parent'><br /><a tabindex=\"0\" href=\"javascript:void(0)\" >" + topElement +"</a><div style=\"float:right\"><input title=\"Remove "+topElement+" from menu\" class=\""+jQuery(this).attr("id")+"\" type=\"checkbox\" "+booleanToChecked(isHidden)+" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></div></td><td class='ag_admin_menu_parent2' ><input title=\"Rename "+topElement+" with this value\" type=\"text\" class=\""+jQuery(this).attr("id")+"\" size=\"47\" value=\""+top_item_text_value+"\" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></td></tr>");
98
  }
@@ -104,6 +106,58 @@ function createEditMenuPage(checkboxes,textboxes){
104
  prettyEditMenuPage();
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  function showHideSection(text) {
108
  switch(text)
109
  {
@@ -151,6 +205,8 @@ function reloadRemoveButtonEvents(){
151
  //alert(jQuery(this).parent().html());
152
  var name = jQuery('#ag_add_adminmenu_name_edit').val();
153
  var url = jQuery('#ag_add_adminmenu_url_edit').val();
 
 
154
  jQuery('#temporary_button_edit').remove();
155
 
156
  var element = 0;
@@ -186,7 +242,11 @@ jQuery(document).ready(function(){
186
  /*Add new menu item button - creates new HTMl button elements*/
187
  jQuery('#ag_add_adminmenu_button').click(function(){
188
  var name = jQuery('#ag_add_adminmenu_name').val();
189
- var url = jQuery('#ag_add_adminmenu_url').val();
 
 
 
 
190
  jQuery('#ag_add_adminmenu').append('<tr><td colspan="2"><button title="'+url+'" type="button">'+name+'</button>&nbsp;(<a style="cursor:pointer" class="button_edit">edit</a>)&nbsp;(<a style="cursor:pointer" class="button_remove">remove</a>)</td><td></td></tr>');
191
  reloadRemoveButtonEvents();
192
  });
@@ -245,7 +305,7 @@ jQuery(document).ready(function(){
245
  }
246
  topMarker = "";
247
  if(jQuery(this).parent().parent().hasClass('ag_admin_menu_parent')){
248
- topMarker="<-TOP->";
249
  }
250
  array += "\"" + topMarker + jQuery(this).attr('class') + "\" : ";
251
  array += "\"" + jQuery(this).attr('checked') + "\"";
@@ -317,15 +377,22 @@ jQuery(document).ready(function(){
317
  /*C O L O R I Z E R*/
318
  function updateTargetColor(id, color){
319
  switch(id)
320
- {
321
- case 'color_background':
322
- jQuery('html, .wp-dialog').css({'background-color':color});
323
  break;
324
  case 'color_footer':
325
  jQuery('#footer').css({'background':color});
 
 
 
326
  break;
327
- case 'color_header':
328
  jQuery('#wphead').css({'background':color});
 
 
 
 
329
  break;
330
  case 'color_admin_menu_top_button_background':
331
  jQuery('#adminmenu a.menu-top').css({'background':color});
@@ -338,6 +405,12 @@ function updateTargetColor(id, color){
338
  break;
339
  case 'color_admin_menu_font':
340
  jQuery('#adminmenu, #adminmenu a, #adminmenu p').css({'color':color});
 
 
 
 
 
 
341
  break;
342
  case 'color_admin_menu_submenu_background_over':
343
  //jQuery('#adminmenu .wp-submenu a:hover').css({'background':color});
@@ -355,7 +428,8 @@ function updateTargetColor(id, color){
355
  jQuery(".widget .widget-top, .postbox h3, .stuffbox h3").css({'background' : color, 'text-shadow' :'none'});
356
  break;
357
  case 'color_widget_background':
358
- jQuery(".widget, .postbox").css('background-color',color);
 
359
  break;
360
  default:
361
  }
4
  function booleanToChecked(bool){
5
  if(bool == 'true'){
6
  return 'checked="checked"';
7
+ }else if(bool == 'checked'){
8
+ return 'checked="checked"';
9
  }
10
  }
11
 
94
  top_item_text_value = topElement;
95
  }else{
96
  top_item_text_value = textboxes[counter][1];
97
+ isHidden = checkboxes[counter][1];
98
  }
99
  jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_parent'><br /><a tabindex=\"0\" href=\"javascript:void(0)\" >" + topElement +"</a><div style=\"float:right\"><input title=\"Remove "+topElement+" from menu\" class=\""+jQuery(this).attr("id")+"\" type=\"checkbox\" "+booleanToChecked(isHidden)+" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></div></td><td class='ag_admin_menu_parent2' ><input title=\"Rename "+topElement+" with this value\" type=\"text\" class=\""+jQuery(this).attr("id")+"\" size=\"47\" value=\""+top_item_text_value+"\" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></td></tr>");
100
  }
106
  prettyEditMenuPage();
107
  }
108
 
109
+ function createEditMenuPageV32(checkboxes,textboxes){
110
+ /*Create menu page in AGCA settings*/
111
+
112
+ var counter = 0;
113
+ var TBlength = textboxes.length;
114
+ if(textboxes==""){
115
+ TBlength = 9999999;
116
+ }
117
+
118
+ var topElement="";
119
+ jQuery('ul#adminmenu li').each(function(){
120
+ if(!jQuery(this).hasClass("wp-menu-separator") && !jQuery(this).hasClass("wp-menu-separator-last") && !jQuery(this).hasClass("ag-custom-button") && (jQuery(this).attr('id') !="collapse-menu") && (counter < TBlength )){
121
+
122
+ //if subelement
123
+ if(jQuery(this).parent().parent().parent().hasClass('wp-submenu')){
124
+ subElement = jQuery(this).find('a').text();
125
+ //console.log(jQuery(this));
126
+ //console.log(subElement);
127
+ var isHidden = "";
128
+ var sub_item_text_value;
129
+ if(textboxes ==""){
130
+ sub_item_text_value = subElement;
131
+ }else{
132
+ sub_item_text_value = textboxes[counter][1];
133
+ isHidden = checkboxes[counter][1];
134
+ }
135
+ jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_child'><div style=\"float:left\"><a tabindex=\"-1\" href=\"javascript:void(0)\" style=\"font-weight:bold;\"title=\""+topElement+" submenu: "+subElement+"\"><span style=\"font-weight:normal\">submenu: </span>"+subElement+"</a></div><div style=\"float:right\"><input type=\"checkbox\" title=\"Remove "+topElement+" submenu: "+subElement+" from menu\" class=\""+subElement+"\" "+booleanToChecked(isHidden)+" name=\"ag_edit_adminmenu_item_sub_"+counter+"\" /></div></td><td class='ag_admin_menu_child2' ><input type=\"text\" title=\"Rename submenu item "+subElement+" with this value\" class=\""+subElement+"\" size=\"47\" value=\""+sub_item_text_value+"\" name=\"ag_edit_adminmenu_item_sub_"+counter+"\" /></td></tr>");
136
+ }
137
+ //if top element
138
+ else{
139
+ topElement = jQuery(this).children('a').clone().children().remove().end().text();
140
+ topElement = jQuery.trim(topElement);
141
+ var top_item_text_value;
142
+ var isHidden = "";
143
+ if(textboxes ==""){
144
+ top_item_text_value = topElement;
145
+ }else{
146
+ top_item_text_value = textboxes[counter][1];
147
+ isHidden = checkboxes[counter][1];
148
+ }
149
+ jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_parent'><br /><a tabindex=\"0\" href=\"javascript:void(0)\" >" + topElement +"</a><div style=\"float:right\"><input title=\"Remove "+topElement+" from menu\" class=\""+jQuery(this).attr("id")+"\" type=\"checkbox\" "+booleanToChecked(isHidden)+" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></div></td><td class='ag_admin_menu_parent2' ><input title=\"Rename "+topElement+" with this value\" type=\"text\" class=\""+jQuery(this).attr("id")+"\" size=\"47\" value=\""+top_item_text_value+"\" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></td></tr>");
150
+ }
151
+ counter++;
152
+ }else if(jQuery(this).attr('id') =="collapse-menu"){
153
+ jQuery(this).remove();
154
+ }
155
+ });
156
+
157
+ //console.log(checkboxes.replace('<-TOP->','')+"|"+textboxes.replace('<-TOP->',''));
158
+ prettyEditMenuPage();
159
+ }
160
+
161
  function showHideSection(text) {
162
  switch(text)
163
  {
205
  //alert(jQuery(this).parent().html());
206
  var name = jQuery('#ag_add_adminmenu_name_edit').val();
207
  var url = jQuery('#ag_add_adminmenu_url_edit').val();
208
+ name = name.replace(/["']{1}/gi,"");
209
+ url = url.replace(/["']{1}/gi,"");
210
  jQuery('#temporary_button_edit').remove();
211
 
212
  var element = 0;
242
  /*Add new menu item button - creates new HTMl button elements*/
243
  jQuery('#ag_add_adminmenu_button').click(function(){
244
  var name = jQuery('#ag_add_adminmenu_name').val();
245
+ var url = jQuery('#ag_add_adminmenu_url').val();
246
+ name = name.replace(/["']{1}/gi,"");
247
+ url = url.replace(/["']{1}/gi,"");
248
+ jQuery('#ag_add_adminmenu_name').val("");
249
+ jQuery('#ag_add_adminmenu_url').val("");
250
  jQuery('#ag_add_adminmenu').append('<tr><td colspan="2"><button title="'+url+'" type="button">'+name+'</button>&nbsp;(<a style="cursor:pointer" class="button_edit">edit</a>)&nbsp;(<a style="cursor:pointer" class="button_remove">remove</a>)</td><td></td></tr>');
251
  reloadRemoveButtonEvents();
252
  });
305
  }
306
  topMarker = "";
307
  if(jQuery(this).parent().parent().hasClass('ag_admin_menu_parent')){
308
+ topMarker="<-TOP->";
309
  }
310
  array += "\"" + topMarker + jQuery(this).attr('class') + "\" : ";
311
  array += "\"" + jQuery(this).attr('checked') + "\"";
377
  /*C O L O R I Z E R*/
378
  function updateTargetColor(id, color){
379
  switch(id)
380
+ {
381
+ case 'color_background':
382
+ jQuery('html, .wp-dialog').css({'background-color':color});
383
  break;
384
  case 'color_footer':
385
  jQuery('#footer').css({'background':color});
386
+ if(wpversion >= 3.2){
387
+ jQuery('#footer').css({'margin':'0','margin-left':'146px','padding':'15px'});
388
+ }
389
  break;
390
+ case 'color_header':
391
  jQuery('#wphead').css({'background':color});
392
+ if(wpversion >= 3.2){
393
+ jQuery('#wphead').css({'margin':'0','margin-left':'-14px','padding-left':'15px'});
394
+ jQuery("#backtoblog").attr("style","");
395
+ }
396
  break;
397
  case 'color_admin_menu_top_button_background':
398
  jQuery('#adminmenu a.menu-top').css({'background':color});
405
  break;
406
  case 'color_admin_menu_font':
407
  jQuery('#adminmenu, #adminmenu a, #adminmenu p').css({'color':color});
408
+ break;
409
+ case 'color_admin_menu_behind_background':
410
+ jQuery('#adminmenuback, #adminmenuwrap').css({'background-color':color});
411
+ break;
412
+ case 'color_admin_menu_behind_border':
413
+ jQuery('#adminmenuback, #adminmenuwrap').css({'border-color':color});
414
  break;
415
  case 'color_admin_menu_submenu_background_over':
416
  //jQuery('#adminmenu .wp-submenu a:hover').css({'background':color});
428
  jQuery(".widget .widget-top, .postbox h3, .stuffbox h3").css({'background' : color, 'text-shadow' :'none'});
429
  break;
430
  case 'color_widget_background':
431
+ jQuery(".widget, .postbox").css('background',color);
432
+ //jQuery(".widget, #widget-list .widget-top, .postbox, .menu-item-settings").css('background',color); remove if <3.2 work
433
  break;
434
  default:
435
  }