Absolutely Glamorous Custom Admin - Version 1.2.6.5

Version Description

  • using capabilities instead of user levels
  • define who is admin with choosing capability (Advanced tab)
  • added option to hide admin bar on front end only
  • added option to remove all AGCA customizations on front end
  • added option to remove register button on login page
  • added option to change hyperlink on register button on login page
  • added option to remove "Lost Password" link on login page
  • added support for collapse button on customized admin menu
  • option to show/hide collapse button on admin menu
  • added styles for collapsed menu
  • added WP filter to remove admin bar on front page
  • appling admin bar colors on front page
  • fixed blank space in admin panel when admin bar is removed
  • fixed some bugs in colorizer, better updating of input box colors, trigering colors on input box change, improved realtime color updating
  • adding jquery script on login page only if it is not already loaded
  • fixed background-size issue on login page image in chrome and some other browsers
  • updated important message on admin menu tab
Download this release

Release Info

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

Code changes from version 1.2.6.4 to 1.2.6.5

Files changed (4) hide show
  1. plugin.php +243 -55
  2. readme.txt +28 -2
  3. script/ag_script.js +35 -5
  4. script/agca_farbtastic.js +10 -2
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.6.4
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
@@ -32,6 +32,7 @@ class AGCA{
32
  private $colorizer="";
33
  private $active_plugin;
34
  private $agca_version;
 
35
  private $context = "";
36
  private $saveAfterImport = false;
37
  public function __construct()
@@ -39,10 +40,10 @@ class AGCA{
39
 
40
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
41
  add_action('admin_init', array(&$this,'agca_register_settings'));
42
- add_action('admin_head', array(&$this,'print_admin_css'));
43
- add_action('wp_head', array(&$this,'print_page'));
44
  add_action('login_head', array(&$this,'print_login_head'));
45
  add_action('admin_menu', array(&$this,'agca_create_menu'));
 
46
  register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
47
 
48
 
@@ -50,7 +51,7 @@ class AGCA{
50
  /*Initialize properties*/
51
  $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'),'colorizer');
52
  //fb($this->colorizer);
53
- $this->agca_version = "1.2.6.4";
54
  }
55
  // Add donate and support information
56
  function jk_filter_plugin_links($links, $file)
@@ -75,8 +76,7 @@ class AGCA{
75
  "ozh" => $ozh
76
  );
77
  }
78
- function agca_get_includes() {
79
- global $user_level;
80
  ?>
81
  <script type="text/javascript">
82
  <?php
@@ -88,7 +88,7 @@ class AGCA{
88
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
89
 
90
  <?php
91
- if(!((get_option('agca_role_allbutadmin')==true) and ($user_level > 9))){
92
  ?>
93
  <style type="text/css">
94
  <?php
@@ -109,8 +109,7 @@ class AGCA{
109
  function reloadScript(){
110
  ?>
111
  <script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
112
- <?php
113
-
114
  }
115
 
116
  function agca_register_settings() {
@@ -170,7 +169,14 @@ class AGCA{
170
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_user' );
171
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_media' );
172
  register_setting( 'agca-options-group', 'agca_admin_bar_update_notifications' );
173
- register_setting( 'agca-options-group', 'agca_remove_top_bar_dropdowns' );
 
 
 
 
 
 
 
174
 
175
 
176
  /*Admin menu*/
@@ -179,6 +185,7 @@ class AGCA{
179
  register_setting( 'agca-options-group', 'agca_admin_menu_separator_first' );
180
  register_setting( 'agca-options-group', 'agca_admin_menu_separator_second' );
181
  register_setting( 'agca-options-group', 'agca_admin_menu_icons' );
 
182
  register_setting( 'agca-options-group', 'agca_admin_menu_arrow' );
183
  register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round' );
184
  register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round_size' );
@@ -223,11 +230,16 @@ class AGCA{
223
 
224
  function agca_deactivate() {
225
 
226
- }
227
-
228
  function getOptions(){
229
  return Array(
230
  'agca_role_allbutadmin',
 
 
 
 
 
 
231
  'agca_screen_options_menu',
232
  'agca_help_menu',
233
  'agca_logout',
@@ -287,7 +299,8 @@ class AGCA{
287
  'agca_admin_menu_submenu_round',
288
  'agca_admin_menu_submenu_round_size',
289
  'agca_admin_menu_brand',
290
- 'agca_admin_menu_brand_link',
 
291
  'ag_edit_adminmenu_json',
292
  'ag_add_adminmenu_json',
293
  'ag_colorizer_json',
@@ -486,10 +499,10 @@ class AGCA{
486
 
487
  function print_page()
488
  {
489
- $this->context = "page";
490
- $wpversion = $this->get_wp_version();
491
- ?>
492
- <style type="text/css">
493
  #wpadminbar{
494
  display: none;
495
  }
@@ -499,7 +512,14 @@ class AGCA{
499
  window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
500
  </script>
501
 
502
- <?php } ?>
 
 
 
 
 
 
 
503
 
504
  <script type="text/javascript">
505
  var wpversion = "<?php echo $wpversion; ?>";
@@ -534,10 +554,30 @@ class AGCA{
534
  <script type="text/javascript">
535
  <?php echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';"; ?>
536
  </script>
537
- <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
538
-
539
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  <?php
 
541
 
542
  }
543
 
@@ -664,10 +704,12 @@ class AGCA{
664
  jQuery("#wp-admin-bar-site-name a:first").html('<?php echo get_option('agca_custom_site_heading'); ?>');
665
  }
666
  <?php } ?>
667
- <?php if(get_option('agca_header')==true){ ?>
 
668
  jQuery("#wpadminbar").css("display","none");
669
  jQuery("body.admin-bar").css("padding-top","0");
670
- jQuery("#wphead").css("display","none");
 
671
 
672
  <?php } ?>
673
  <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
@@ -761,19 +803,69 @@ class AGCA{
761
 
762
 
763
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
764
 
765
  function print_admin_css()
766
  {
767
  $this->agca_get_includes();
 
768
  $this->context = "admin";
769
- get_currentuserinfo() ;
770
- global $user_level;
771
- $wpversion = $this->get_wp_version();
772
-
773
  ?>
774
  <?php
775
  //in case that javaScript is disabled only admin can access admin menu
776
- if($user_level <= 9){
777
  ?>
778
  <style type="text/css">
779
  #adminmenu{display:none;}
@@ -839,9 +931,9 @@ try
839
  <?php } ?>
840
 
841
  <?php
842
- //if admin, and option to hide settings for admin is set
843
- //fb($user_level);
844
- if((get_option('agca_role_allbutadmin')==true) and ($user_level > 9)){
845
  ?>
846
  <?php } else{ ?>
847
  <?php if(get_option('agca_admin_menu_brand')!=""){ ?>
@@ -1020,7 +1112,7 @@ try
1020
  <?php /*If Turned on*/ ?>
1021
 
1022
  <?php /*Only admin see button*/
1023
- if ($user_level > 9){ ?>
1024
  jQuery('#adminmenu').append('<?php echo $this->agca_create_admin_button('AG Custom Admin','tools.php?page=ag-custom-admin/plugin.php'); ?>');
1025
  <?php } ?>
1026
 
@@ -1093,7 +1185,7 @@ try
1093
 
1094
 
1095
  /*Add user buttons*/
1096
- jQuery('#adminmenu').append(buttons);
1097
 
1098
 
1099
  <?php /*END If Turned on*/ ?>
@@ -1101,30 +1193,22 @@ try
1101
  jQuery("#adminmenu").removeClass("noclass");
1102
  <?php } ?>
1103
 
1104
- reloadRemoveButtonEvents();
 
 
 
 
 
 
1105
 
1106
 
1107
  <?php //COLORIZER ?>
1108
- <?php if(get_option('agca_colorizer_turnonoff') == 'on'){ ?>
1109
- <?php
1110
- foreach($this->colorizer as $k => $v){
1111
- if(($k !="") and ($v !="")){
1112
- ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
1113
- }
1114
- }
1115
- ?>
1116
- jQuery('.color_picker').each(function(){
1117
- updateColor(jQuery(this).attr('id'),jQuery(this).val())
1118
- });
1119
- jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
1120
- jQuery('#adminmenu li.wp-menu-open').css('border','none');
1121
- jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
1122
-
1123
- <?php } ?>
1124
  <?php //COLORIZER END ?>
1125
  <?php } //end of apply for any user except admin ?>
1126
  /*Add user buttons*/
1127
  jQuery('#ag_add_adminmenu').append(buttonsJq);
 
1128
 
1129
  }catch(err){
1130
  errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
@@ -1143,6 +1227,11 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1143
 
1144
  });
1145
 
 
 
 
 
 
1146
 
1147
 
1148
  /* ]]> */
@@ -1166,7 +1255,9 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1166
 
1167
  function print_login_head(){
1168
  $this->context = "login";
1169
- $this->reloadScript();
 
 
1170
  $this->agca_get_includes();
1171
  $wpversion = $this->get_wp_version();
1172
  ?>
@@ -1203,6 +1294,7 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1203
  var widthDiff = this.width - originalWidth;
1204
  jQuery("#login h1 a").height(this.height);
1205
  jQuery("#login h1 a").width(this.width);
 
1206
  jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+"px");
1207
  jQuery("#login h1 a").show();
1208
  });
@@ -1218,6 +1310,34 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1218
  <?php } ?>
1219
 
1220
  jQuery("#login h1 a").attr("title","");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1221
 
1222
 
1223
  <?php //COLORIZER ?>
@@ -1365,6 +1485,22 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1365
  </td>
1366
  </tr>
1367
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1368
  <tr valign="center">
1369
  <th >
1370
  <label title="Change default WordPress logo with custom image." for="agca_wp_logo_custom">Change admin bar logo</label>
@@ -1823,6 +1959,34 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1823
  <input class="validateNumber" limit="3" title="Size of rounded box curve" type="text" name="agca_login_round_box_size" type="text" size="3" value="<?php echo get_option('agca_login_round_box_size'); ?>" />&nbsp;(px)
1824
  </td>
1825
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1826
  </table>
1827
  </div>
1828
  <?php
@@ -1831,7 +1995,8 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1831
  <div id="section_admin_menu" style="display:none" class="ag_section">
1832
  <h2 class="section_title" tabindex="-1">Admin Menu Settings Page</h2>
1833
  <br />
1834
- <p style="font-style:italic" tabindex="0"><strong>Important: </strong>Please Turn off menu configuration before activating or disabling other plugins (or making any other changes to main menu). Use "Reset Settings" button to restore default values if anything goes wrong.</p>
 
1835
  <br />
1836
  <table class="form-table" width="500px">
1837
  <tr valign="center" class="ag_table_major_options">
@@ -1896,6 +2061,14 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
1896
  <input title="Removes small arrow that appears on button hover" type="checkbox" name="agca_admin_menu_arrow" value="true" <?php if (get_option('agca_admin_menu_arrow')==true) echo 'checked="checked" '; ?> />
1897
  </td>
1898
  </tr>
 
 
 
 
 
 
 
 
1899
  <tr valign="center">
1900
  <th scope="row">
1901
  <label title="Rounds submenu pop-up box" for="agca_admin_menu_submenu_round">Round submenu pop-up box</label><p><i>(Use it in combination with Colorizer)</i></p>
@@ -2149,11 +2322,26 @@ jQuery('#ag_add_adminmenu').append(buttonsJq);
2149
  </div>
2150
  <div id="section_advanced" style="display:none" class="ag_section">
2151
  <h2 class="section_title" tabindex="-1">Advanced</h2>
2152
- <br />
2153
- <p><i><strong>Info: </strong>These options will override existing customizations.</i></p>
2154
- <br />
2155
  <br /><br />
2156
  <table class="form-table" width="500px">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2157
  <tr valign="center">
2158
  <th scope="row">
2159
  <label title="Add custom CSS script to override existing styles" for="agca_script_css">Custom CSS Script</em></label>
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.6.5
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
32
  private $colorizer="";
33
  private $active_plugin;
34
  private $agca_version;
35
+ private $admin_capabilities;
36
  private $context = "";
37
  private $saveAfterImport = false;
38
  public function __construct()
40
 
41
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
42
  add_action('admin_init', array(&$this,'agca_register_settings'));
43
+ add_action('admin_head', array(&$this,'print_admin_css'));
 
44
  add_action('login_head', array(&$this,'print_login_head'));
45
  add_action('admin_menu', array(&$this,'agca_create_menu'));
46
+ add_action('wp_head', array(&$this,'print_page'));
47
  register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
48
 
49
 
51
  /*Initialize properties*/
52
  $this->colorizer = $this->jsonMenuArray(get_option('ag_colorizer_json'),'colorizer');
53
  //fb($this->colorizer);
54
+ $this->agca_version = "1.2.6.5";
55
  }
56
  // Add donate and support information
57
  function jk_filter_plugin_links($links, $file)
76
  "ozh" => $ozh
77
  );
78
  }
79
+ function agca_get_includes() {
 
80
  ?>
81
  <script type="text/javascript">
82
  <?php
88
  <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
89
 
90
  <?php
91
+ if(!((get_option('agca_role_allbutadmin')==true) and (current_user_can($this->admin_capability())))){
92
  ?>
93
  <style type="text/css">
94
  <?php
109
  function reloadScript(){
110
  ?>
111
  <script type="text/javascript" src="<?php echo get_bloginfo('wpurl'); ?>/wp-includes/js/jquery/jquery.js"></script>
112
+ <?php
 
113
  }
114
 
115
  function agca_register_settings() {
169
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_user' );
170
  register_setting( 'agca-options-group', 'agca_admin_bar_new_content_media' );
171
  register_setting( 'agca-options-group', 'agca_admin_bar_update_notifications' );
172
+ register_setting( 'agca-options-group', 'agca_remove_top_bar_dropdowns' );
173
+ register_setting( 'agca-options-group', 'agca_admin_bar_frontend' );
174
+ register_setting( 'agca-options-group', 'agca_admin_bar_frontend_hide' );
175
+ register_setting( 'agca-options-group', 'agca_login_register_remove' );
176
+ register_setting( 'agca-options-group', 'agca_login_register_href' );
177
+ register_setting( 'agca-options-group', 'agca_login_lostpassword_remove' );
178
+ register_setting( 'agca-options-group', 'agca_admin_capability' );
179
+
180
 
181
 
182
  /*Admin menu*/
185
  register_setting( 'agca-options-group', 'agca_admin_menu_separator_first' );
186
  register_setting( 'agca-options-group', 'agca_admin_menu_separator_second' );
187
  register_setting( 'agca-options-group', 'agca_admin_menu_icons' );
188
+ register_setting( 'agca-options-group', 'agca_admin_menu_collapse_button' );
189
  register_setting( 'agca-options-group', 'agca_admin_menu_arrow' );
190
  register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round' );
191
  register_setting( 'agca-options-group', 'agca_admin_menu_submenu_round_size' );
230
 
231
  function agca_deactivate() {
232
 
233
+ }
 
234
  function getOptions(){
235
  return Array(
236
  'agca_role_allbutadmin',
237
+ 'agca_admin_bar_frontend',
238
+ 'agca_admin_bar_frontend_hide',
239
+ 'agca_login_register_remove',
240
+ 'agca_login_register_href',
241
+ 'agca_login_lostpassword_remove',
242
+ 'agca_admin_capability',
243
  'agca_screen_options_menu',
244
  'agca_help_menu',
245
  'agca_logout',
299
  'agca_admin_menu_submenu_round',
300
  'agca_admin_menu_submenu_round_size',
301
  'agca_admin_menu_brand',
302
+ 'agca_admin_menu_brand_link',
303
+ 'agca_admin_menu_collapse_button',
304
  'ag_edit_adminmenu_json',
305
  'ag_add_adminmenu_json',
306
  'ag_colorizer_json',
499
 
500
  function print_page()
501
  {
502
+ if(get_option('agca_admin_bar_frontend_hide')==true){
503
+ add_filter( 'show_admin_bar', '__return_false' );
504
+ ?>
505
+ <style type="text/css">
506
  #wpadminbar{
507
  display: none;
508
  }
512
  window.setTimeout(function(){document.getElementsByTagName('html')[0].setAttribute('style',"margin-top:0px !important");},50);
513
  </script>
514
 
515
+ <?php }
516
+ }
517
+ if(get_option('agca_admin_bar_frontend')!=true){
518
+
519
+ $this->context = "page";
520
+ $wpversion = $this->get_wp_version();
521
+ ?>
522
+
523
 
524
  <script type="text/javascript">
525
  var wpversion = "<?php echo $wpversion; ?>";
554
  <script type="text/javascript">
555
  <?php echo "var agca_global_plugin_url = '".trailingslashit(plugins_url(basename(dirname(__FILE__))))."';"; ?>
556
  </script>
557
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js?ver=<?php echo $this->agca_version; ?>"></script>
558
+ <script type="text/javascript">
559
+ jQuery(document).ready(function(){
560
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on' && (get_option('agca_admin_bar_frontend_hide')!=true)){
561
+ foreach($this->colorizer as $k => $v){
562
+ if(($k !="") and ($v !="")){
563
+ if(
564
+ $k == "color_header" ||
565
+ $k == "color_font_header"
566
+ ){
567
+ ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
568
+ }
569
+
570
+ }
571
+ }
572
+ ?>
573
+
574
+ <?php
575
+ }
576
+ ?>
577
+ });
578
+ </script>
579
  <?php
580
+ }
581
 
582
  }
583
 
704
  jQuery("#wp-admin-bar-site-name a:first").html('<?php echo get_option('agca_custom_site_heading'); ?>');
705
  }
706
  <?php } ?>
707
+ <?php if(get_option('agca_header')==true && $this->context =='admin'){
708
+ ?>
709
  jQuery("#wpadminbar").css("display","none");
710
  jQuery("body.admin-bar").css("padding-top","0");
711
+ jQuery("#wphead").css("display","none");
712
+ jQuery('html.wp-toolbar').css("padding-top","0");
713
 
714
  <?php } ?>
715
  <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
803
 
804
 
805
  }
806
+
807
+ function updateAllColors(){
808
+
809
+ ?>
810
+ function updateAllColors(){
811
+ <?php
812
+ foreach($this->colorizer as $k => $v){
813
+ if(($k !="") and ($v !="")){
814
+ ?> updateTargetColor("<?php echo $k;?>","<?php echo $v;?>"); <?php
815
+ }
816
+ }
817
+ ?>
818
+ jQuery('.color_picker').each(function(){
819
+ updateColor(jQuery(this).attr('id'),jQuery(this).val())
820
+ });
821
+ jQuery('label,h1,h2,h3,h4,h5,h6,a,p,.form-table th,.form-wrap label').css('text-shadow','none');
822
+ jQuery('#adminmenu li.wp-menu-open').css('border','none');
823
+ jQuery('#adminmenu li.wp-menu-open .wp-submenu').css({'border':'none','margin':'0px','border-radius':'0px'});
824
+ }<?php
825
+
826
+ }
827
+ function admin_capabilities(){
828
+ global $wp_roles;
829
+ $capabs = $wp_roles->roles['administrator']['capabilities'];
830
+ $capabilitySelector = "";
831
+
832
+ $selectedValue = get_option('agca_admin_capability');
833
+ if($selectedValue == ""){
834
+ $selectedValue = "edit_dashboard";
835
+ }
836
+
837
+ foreach($capabs as $k=>$v){
838
+ $selected = "";
839
+ if($selectedValue == $k){
840
+ $selected = " selected=\"selected\" ";
841
+ }
842
+ $capabilitySelector .="<option val=\"$k\" $selected >".$k."</option>\n";
843
+ }
844
+
845
+ $this->admin_capabilities = "<select id=\"agca_admin_capability\" name=\"agca_admin_capability\" val=\"upload_files\">".$capabilitySelector."</select>";
846
+ }
847
+
848
+ function admin_capability(){
849
+ $selectedValue = get_option('agca_admin_capability');
850
+ if($selectedValue == ""){
851
+ $selectedValue = "edit_dashboard";
852
+ }
853
+ return $selectedValue;
854
+ }
855
 
856
  function print_admin_css()
857
  {
858
  $this->agca_get_includes();
859
+ $this->admin_capabilities();
860
  $this->context = "admin";
861
+ get_currentuserinfo() ;
862
+ $wpversion = $this->get_wp_version();
863
+
864
+
865
  ?>
866
  <?php
867
  //in case that javaScript is disabled only admin can access admin menu
868
+ if(!current_user_can($this->admin_capability())){
869
  ?>
870
  <style type="text/css">
871
  #adminmenu{display:none;}
931
  <?php } ?>
932
 
933
  <?php
934
+ //if admin, and option to hide settings for admin is set
935
+
936
+ if((get_option('agca_role_allbutadmin')==true) and current_user_can($this->admin_capability())){
937
  ?>
938
  <?php } else{ ?>
939
  <?php if(get_option('agca_admin_menu_brand')!=""){ ?>
1112
  <?php /*If Turned on*/ ?>
1113
 
1114
  <?php /*Only admin see button*/
1115
+ if (current_user_can($this->admin_capability())){ ?>
1116
  jQuery('#adminmenu').append('<?php echo $this->agca_create_admin_button('AG Custom Admin','tools.php?page=ag-custom-admin/plugin.php'); ?>');
1117
  <?php } ?>
1118
 
1185
 
1186
 
1187
  /*Add user buttons*/
1188
+ jQuery('#adminmenu').append(buttons);
1189
 
1190
 
1191
  <?php /*END If Turned on*/ ?>
1193
  jQuery("#adminmenu").removeClass("noclass");
1194
  <?php } ?>
1195
 
1196
+ reloadRemoveButtonEvents();
1197
+
1198
+ <?php if(get_option('agca_admin_menu_collapse_button') != true){ ?>
1199
+ //add collapse menu button
1200
+ jQuery('#adminmenu').append('<li class="hide-if-no-js" onclick="window.setTimeout(function(){updateAllColors();},10);" id="collapse-menu"><div id="collapse-button"><div></div></div><span>Collapse menu</span></li>');
1201
+ <?php } ?>
1202
+
1203
 
1204
 
1205
  <?php //COLORIZER ?>
1206
+ updateAllColors();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
  <?php //COLORIZER END ?>
1208
  <?php } //end of apply for any user except admin ?>
1209
  /*Add user buttons*/
1210
  jQuery('#ag_add_adminmenu').append(buttonsJq);
1211
+
1212
 
1213
  }catch(err){
1214
  errors = "AGCA - ADMIN ERROR: " + err.name + " / " + err.message;
1227
 
1228
  });
1229
 
1230
+ <?php if(get_option('agca_colorizer_turnonoff') == 'on'){
1231
+ $this->updateAllColors();
1232
+ }else{
1233
+ ?>function updateAllColors(){}; <?php
1234
+ } ?>
1235
 
1236
 
1237
  /* ]]> */
1255
 
1256
  function print_login_head(){
1257
  $this->context = "login";
1258
+ if( !wp_script_is('jquery')) {
1259
+ $this->reloadScript();
1260
+ }
1261
  $this->agca_get_includes();
1262
  $wpversion = $this->get_wp_version();
1263
  ?>
1294
  var widthDiff = this.width - originalWidth;
1295
  jQuery("#login h1 a").height(this.height);
1296
  jQuery("#login h1 a").width(this.width);
1297
+ jQuery("#login h1 a").css("background-size",this.width+"px "+this.height+"px");
1298
  jQuery("#login h1 a").css('margin-left',-(widthDiff/2)+"px");
1299
  jQuery("#login h1 a").show();
1300
  });
1310
  <?php } ?>
1311
 
1312
  jQuery("#login h1 a").attr("title","");
1313
+
1314
+ <?php if(get_option('agca_login_register_remove')==true){ ?>
1315
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1316
+ jQuery('p#nav a').each(function(){
1317
+ if(jQuery(this).attr('href').indexOf('register') != -1){
1318
+ jQuery(this).remove();
1319
+ }
1320
+ });
1321
+
1322
+ <?php } ?>
1323
+ <?php if(get_option('agca_login_register_href')!=""){ ?>
1324
+ jQuery('p#nav a').each(function(){
1325
+ if(jQuery(this).attr('href').indexOf('register') != -1){
1326
+ jQuery(this).attr('href','<?php echo get_option('agca_login_register_href'); ?>');
1327
+ }
1328
+ });
1329
+
1330
+ <?php } ?>
1331
+
1332
+ <?php if(get_option('agca_login_lostpassword_remove')==true){ ?>
1333
+ jQuery('p#nav').html(jQuery('p#nav').html().replace('|',''));
1334
+ jQuery('p#nav a').each(function(){
1335
+ if(jQuery(this).attr('href').indexOf('lostpassword') != -1){
1336
+ jQuery(this).remove();
1337
+ }
1338
+ });
1339
+
1340
+ <?php } ?>
1341
 
1342
 
1343
  <?php //COLORIZER ?>
1485
  </td>
1486
  </tr>
1487
  <?php } ?>
1488
+ <tr valign="center" >
1489
+ <td>
1490
+ <label tabindex="0" title="Removes admin bar customizations (AGCA scripts) on front end." for="agca_admin_bar_frontend">Remove admin bar customizations on site pages</label>
1491
+ </td>
1492
+ <td>
1493
+ <input id="agca_admin_bar_frontend" type="checkbox" title="Removes admin bar customizations (AGCA scripts) on front end." name="agca_admin_bar_frontend" value="true" <?php if (get_option('agca_admin_bar_frontend')==true) echo 'checked="checked" '; ?> />
1494
+ </td>
1495
+ </tr>
1496
+ <tr valign="center" >
1497
+ <td>
1498
+ <label tabindex="0" title="Removes admin bar on front end." for="agca_admin_bar_frontend_hide">Remove admin bar on site pages</label>
1499
+ </td>
1500
+ <td>
1501
+ <input id="agca_admin_bar_frontend_hide" type="checkbox" title="Removes admin bar on front end." name="agca_admin_bar_frontend_hide" value="true" <?php if (get_option('agca_admin_bar_frontend_hide')==true) echo 'checked="checked" '; ?> />
1502
+ </td>
1503
+ </tr>
1504
  <tr valign="center">
1505
  <th >
1506
  <label title="Change default WordPress logo with custom image." for="agca_wp_logo_custom">Change admin bar logo</label>
1959
  <input class="validateNumber" limit="3" title="Size of rounded box curve" type="text" name="agca_login_round_box_size" type="text" size="3" value="<?php echo get_option('agca_login_round_box_size'); ?>" />&nbsp;(px)
1960
  </td>
1961
  </tr>
1962
+ <tr valign="center">
1963
+ <th scope="row">
1964
+ <label title="Remove register link on login page" for="agca_login_register_remove">Remove register link</label>
1965
+ </th>
1966
+ <td>
1967
+ <input title="Remove register link on login page" type="checkbox" name="agca_login_register_remove" value="true" <?php if (get_option('agca_login_register_remove')==true) echo 'checked="checked" '; ?> />
1968
+ </td>
1969
+ </tr>
1970
+ <?php
1971
+ $agca_login_register_href_visibility = "style='display:none'";
1972
+ if (get_option('agca_login_register_remove')!='true') $agca_login_register_href_visibility = '';
1973
+ ?>
1974
+ <tr valign="center" id="agca_login_register_href_block" <?php echo $agca_login_register_href_visibility; ?> >
1975
+ <th scope="row">
1976
+ <label title="Change register link on login page to point to your custom registration page." for="agca_login_register_href">Change register hyperlink</label>
1977
+ </th>
1978
+ <td>
1979
+ <input title="Change register link on login page to point to your custom registration page." type="text" size="47" id="agca_login_register_href" name="agca_login_register_href" value="<?php echo get_option('agca_login_register_href'); ?>" /><input type="button" onClick="jQuery('#agca_login_register_href').val('');" value="Clear" />
1980
+ </td>
1981
+ </tr>
1982
+ <tr valign="center">
1983
+ <th scope="row">
1984
+ <label title="Removes lost password link on login page" for="agca_login_lostpassword_remove">Remove lost password link</label>
1985
+ </th>
1986
+ <td>
1987
+ <input title="Removes lost password link on login page" type="checkbox" name="agca_login_lostpassword_remove" value="true" <?php if (get_option('agca_login_lostpassword_remove')==true) echo 'checked="checked" '; ?> />
1988
+ </td>
1989
+ </tr>
1990
  </table>
1991
  </div>
1992
  <?php
1995
  <div id="section_admin_menu" style="display:none" class="ag_section">
1996
  <h2 class="section_title" tabindex="-1">Admin Menu Settings Page</h2>
1997
  <br />
1998
+ <p style="font-style:italic" tabindex="0"><strong>Important: </strong>Please Turn off menu configuration before activating or disabling other plugins (or making any other changes to main menu). Use <strong>Reset Settings</strong> button to restore default values if anything goes wrong.</p>
1999
+ <p style="font-style:italic" tabindex="0"><strong></strong>If you found that admin menu items are misaligned or not correct, press <strong>Reset Settings</strong> button. This happens if admin menu is changed by other plugins, or after activating / deactivating other plugings. Avoid such changes after you apply admin menu customizations.</p>
2000
  <br />
2001
  <table class="form-table" width="500px">
2002
  <tr valign="center" class="ag_table_major_options">
2061
  <input title="Removes small arrow that appears on button hover" type="checkbox" name="agca_admin_menu_arrow" value="true" <?php if (get_option('agca_admin_menu_arrow')==true) echo 'checked="checked" '; ?> />
2062
  </td>
2063
  </tr>
2064
+ <tr valign="center">
2065
+ <th scope="row">
2066
+ <label title="Removes collapse button at the end of admin menu" for="agca_admin_menu_collapse_button">Remove "Collapse menu" button</label>
2067
+ </th>
2068
+ <td>
2069
+ <input title="Removes collapse button at the end of admin menu" type="checkbox" name="agca_admin_menu_collapse_button" value="true" <?php if (get_option('agca_admin_menu_collapse_button')==true) echo 'checked="checked" '; ?> />
2070
+ </td>
2071
+ </tr>
2072
  <tr valign="center">
2073
  <th scope="row">
2074
  <label title="Rounds submenu pop-up box" for="agca_admin_menu_submenu_round">Round submenu pop-up box</label><p><i>(Use it in combination with Colorizer)</i></p>
2322
  </div>
2323
  <div id="section_advanced" style="display:none" class="ag_section">
2324
  <h2 class="section_title" tabindex="-1">Advanced</h2>
2325
+
 
 
2326
  <br /><br />
2327
  <table class="form-table" width="500px">
2328
+
2329
+ <tr valign="center">
2330
+ <th scope="row">
2331
+ <label title="Choose which capability will be used to distinct admin user from other users.</br>If customizations are not applied for admin users, this setting will be used to define admin users." for="agca_admin_capability">Distinguish admin from other users by capability:</label>
2332
+ </th>
2333
+ <td><?php echo $this->admin_capabilities; ?><i>(<strong>edit_dashboard</strong> is selected by default)</i>
2334
+ </td>
2335
+ <td>
2336
+ </td>
2337
+ </tr>
2338
+ <tr valign="center">
2339
+ <td colspan="2">
2340
+ <br />
2341
+ <p><i><strong>Info: </strong>These options will override existing customizations.</i></p>
2342
+ <br />
2343
+ </td><td></td>
2344
+ </tr>
2345
  <tr valign="center">
2346
  <th scope="row">
2347
  <label title="Add custom CSS script to override existing styles" for="agca_script_css">Custom CSS Script</em></label>
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.4
7
- Stable tag: 1.2.6.4
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
@@ -16,6 +16,7 @@ Here is the list of options:
16
 
17
  Admin Bar Options
18
  - Hide admin bar completely
 
19
  - Change admin bar logo and link
20
  - Hide admin bar WordPress logo
21
  - Add custom admin bar logo
@@ -50,6 +51,8 @@ Here is the list of options:
50
  - Change hyperlink on login image
51
  - Hide login image
52
  - Round corners on login boxes
 
 
53
 
54
  Admin Menu Options
55
  - Rename menu and submenu items
@@ -108,6 +111,25 @@ Try clearing browser's cache. If that does not work, go to browser's console and
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  = 1.2.6.4 =
112
  * Removing plugin options on plugin uninstall instead of on plugin deactivation
113
  * Refreshed some button styles
@@ -239,6 +261,10 @@ Try clearing browser's cache. If that does not work, go to browser's console and
239
 
240
  == Upgrade Notice ==
241
 
 
 
 
 
242
  = 1.2.6.4 =
243
  Bug fixes. Removing plugin's option on uninstall, not on deactivation.
244
 
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.4.2
7
+ Stable tag: 1.2.6.5
8
 
9
  Hide or change items in admin panel. Customize buttons from admin menu. Colorize admin and login page with custom colors.
10
 
16
 
17
  Admin Bar Options
18
  - Hide admin bar completely
19
+ - Hide admin bar on front end
20
  - Change admin bar logo and link
21
  - Hide admin bar WordPress logo
22
  - Add custom admin bar logo
51
  - Change hyperlink on login image
52
  - Hide login image
53
  - Round corners on login boxes
54
+ - Hide register and lost password links
55
+ - Change hyperlink on register button
56
 
57
  Admin Menu Options
58
  - Rename menu and submenu items
111
 
112
  == Changelog ==
113
 
114
+ = 1.2.6.5 =
115
+ * using capabilities instead of user levels
116
+ * define who is admin with choosing capability (Advanced tab)
117
+ * added option to hide admin bar on front end only
118
+ * added option to remove all AGCA customizations on front end
119
+ * added option to remove register button on login page
120
+ * added option to change hyperlink on register button on login page
121
+ * added option to remove "Lost Password" link on login page
122
+ * added support for collapse button on customized admin menu
123
+ * option to show/hide collapse button on admin menu
124
+ * added styles for collapsed menu
125
+ * added WP filter to remove admin bar on front page
126
+ * appling admin bar colors on front page
127
+ * fixed blank space in admin panel when admin bar is removed
128
+ * fixed some bugs in colorizer, better updating of input box colors, trigering colors on input box change, improved realtime color updating
129
+ * adding jquery script on login page only if it is not already loaded
130
+ * fixed background-size issue on login page image in chrome and some other browsers
131
+ * updated important message on admin menu tab
132
+
133
  = 1.2.6.4 =
134
  * Removing plugin options on plugin uninstall instead of on plugin deactivation
135
  * Refreshed some button styles
261
 
262
  == Upgrade Notice ==
263
 
264
+ = 1.2.6.5 =
265
+ New features and bug fixes. Improved colorizer, fixed admin bar issues, using capabilities to define admin users, added new options for login page, options to remove AGCA scripts on front-end. Using collapsed menus.
266
+
267
+
268
  = 1.2.6.4 =
269
  Bug fixes. Removing plugin's option on uninstall, not on deactivation.
270
 
script/ag_script.js CHANGED
@@ -435,6 +435,16 @@ jQuery(document).ready(function(){
435
  jQuery("#agca_admin_menu_submenu_round_block").hide("slideDown");
436
  }
437
  });
 
 
 
 
 
 
 
 
 
 
438
 
439
 
440
  });
@@ -584,24 +594,34 @@ function updateTargetColor(id, color){
584
  case 'color_admin_menu_top_button_background':
585
  jQuery('#adminmenu a.menu-top').css({
586
  'background':color
 
 
 
587
  });
588
  break;
589
  case 'color_admin_menu_top_button_current_background':
590
  jQuery('#adminmenu li.menu-top.wp-menu-open a.menu-top').css({
591
  'background':color
 
592
  });
593
  jQuery('#adminmenu li.menu-top.current a.menu-top').css({
594
  'background':color
 
 
 
595
  });
596
  break;
597
  case 'color_admin_menu_top_button_hover_background':
598
  if(color == "")break;
599
  var selector = '#adminmenu a.menu-top';
 
 
 
600
  var originalBackground = jQuery(selector).css('background-color');
601
 
602
  //if first is selected, use second
603
  if((jQuery(selector+":eq(0)").hasClass('current') || jQuery(selector+":eq(0)").hasClass('wp-has-current-submenu'))){
604
- originalBackground = jQuery('#adminmenu a.menu-top:eq(1)').css('background-color');
605
  }
606
  jQuery(selector).mouseover(function(){
607
  if(!(jQuery(this).hasClass('current') || jQuery(this).hasClass('wp-has-current-submenu'))){
@@ -612,7 +632,9 @@ function updateTargetColor(id, color){
612
  jQuery(this).css('background',originalBackground);
613
  }
614
  });
615
-
 
 
616
 
617
  break;
618
  case 'color_admin_menu_submenu_background':
@@ -634,10 +656,18 @@ function updateTargetColor(id, color){
634
  jQuery('#adminmenu .wp-submenu li a').css('color',color);
635
  break;
636
  case 'color_admin_menu_submenu_border_top':
637
- jQuery('#adminmenu > li > a').css('border-top-color',color);
 
 
 
 
638
  break;
639
  case 'color_admin_menu_submenu_border_bottom':
640
- jQuery('#adminmenu > li > a').css('border-bottom-color',color);
 
 
 
 
641
  break;
642
  case 'color_admin_menu_font':
643
  jQuery('#adminmenu, #adminmenu a, #adminmenu p').css({
@@ -692,7 +722,7 @@ function updateTargetColor(id, color){
692
  //jQuery(".widget, #widget-list .widget-top, .postbox, .menu-item-settings").css('background',color); remove if <3.2 work
693
  break;
694
  default:
695
- }
696
  }
697
  function updateColor(id,color){
698
  jQuery("#"+id).css({
435
  jQuery("#agca_admin_menu_submenu_round_block").hide("slideDown");
436
  }
437
  });
438
+
439
+ /*HIDE/SHOW size hyperllink on register link on login page*/
440
+ jQuery('input[name=agca_login_register_remove]').bind("click",function(){
441
+ var checked = jQuery(this).is(":checked");
442
+ if(!checked){
443
+ jQuery("#agca_login_register_href_block").show("slide");
444
+ }else{
445
+ jQuery("#agca_login_register_href_block").hide("slideDown");
446
+ }
447
+ });
448
 
449
 
450
  });
594
  case 'color_admin_menu_top_button_background':
595
  jQuery('#adminmenu a.menu-top').css({
596
  'background':color
597
+ });
598
+ jQuery('#adminmenu li.menu-top').css({
599
+ 'background':color
600
  });
601
  break;
602
  case 'color_admin_menu_top_button_current_background':
603
  jQuery('#adminmenu li.menu-top.wp-menu-open a.menu-top').css({
604
  'background':color
605
+
606
  });
607
  jQuery('#adminmenu li.menu-top.current a.menu-top').css({
608
  'background':color
609
+ });
610
+ jQuery('body.folded #adminmenu li.menu-top.wp-menu-open').css({
611
+ 'background':color
612
  });
613
  break;
614
  case 'color_admin_menu_top_button_hover_background':
615
  if(color == "")break;
616
  var selector = '#adminmenu a.menu-top';
617
+ if(jQuery('body').hasClass('folded')){
618
+ selector = '#adminmenu li.menu-top';
619
+ }
620
  var originalBackground = jQuery(selector).css('background-color');
621
 
622
  //if first is selected, use second
623
  if((jQuery(selector+":eq(0)").hasClass('current') || jQuery(selector+":eq(0)").hasClass('wp-has-current-submenu'))){
624
+ originalBackground = jQuery(selector+':eq(1)').css('background-color');
625
  }
626
  jQuery(selector).mouseover(function(){
627
  if(!(jQuery(this).hasClass('current') || jQuery(this).hasClass('wp-has-current-submenu'))){
632
  jQuery(this).css('background',originalBackground);
633
  }
634
  });
635
+
636
+ //for folded menu
637
+
638
 
639
  break;
640
  case 'color_admin_menu_submenu_background':
656
  jQuery('#adminmenu .wp-submenu li a').css('color',color);
657
  break;
658
  case 'color_admin_menu_submenu_border_top':
659
+ if(jQuery('body').hasClass('folded')){
660
+ jQuery('#adminmenu li.menu-top').css('border-top-color',color);
661
+ }else{
662
+ jQuery('#adminmenu > li > a').css('border-top-color',color);
663
+ }
664
  break;
665
  case 'color_admin_menu_submenu_border_bottom':
666
+ if(jQuery('body').hasClass('folded')){
667
+ jQuery('#adminmenu li.menu-top').css('border-bottom-color',color);
668
+ }else{
669
+ jQuery('#adminmenu > li > a').css('border-bottom-color',color);
670
+ }
671
  break;
672
  case 'color_admin_menu_font':
673
  jQuery('#adminmenu, #adminmenu a, #adminmenu p').css({
722
  //jQuery(".widget, #widget-list .widget-top, .postbox, .menu-item-settings").css('background',color); remove if <3.2 work
723
  break;
724
  default:
725
+ }
726
  }
727
  function updateColor(id,color){
728
  jQuery("#"+id).css({
script/agca_farbtastic.js CHANGED
@@ -35,12 +35,14 @@
35
  jQuery('#picker').css("left",e.pageX-100);
36
  jQuery('#picker').css("top",e.pageY-100);
37
  jQuery('#picker').show();
 
38
  });
39
  jQuery('.color_picker').click(function(){
40
- jQuery('#picker').farbtastic('#'+jQuery(this).attr('id'));
41
  });
42
  jQuery('.color_picker').bind('keydown',function(){
43
  updateColor(jQuery(this).attr('id'),jQuery(this).val())
 
44
  });
45
  jQuery('#picker').mouseleave(function(){
46
  jQuery(this).hide();
@@ -48,13 +50,19 @@
48
  jQuery('#picker').hide();
49
  jQuery('.pick_color_button_clear').click(function(){
50
  jQuery('#'+jQuery(this).attr('alt')).val("");
 
51
  });
52
  });
53
 
54
  jQuery(document).ready(function() {
55
  jQuery('#picker').farbtastic(function(color){
56
  if(document.activeElement.id !=""){
57
- updateColor(document.activeElement.id,color);
 
58
  }
59
  });
 
 
 
 
60
  });
35
  jQuery('#picker').css("left",e.pageX-100);
36
  jQuery('#picker').css("top",e.pageY-100);
37
  jQuery('#picker').show();
38
+
39
  });
40
  jQuery('.color_picker').click(function(){
41
+ jQuery('#picker').farbtastic('#'+jQuery(this).attr('id'));
42
  });
43
  jQuery('.color_picker').bind('keydown',function(){
44
  updateColor(jQuery(this).attr('id'),jQuery(this).val())
45
+ updateAllColors();
46
  });
47
  jQuery('#picker').mouseleave(function(){
48
  jQuery(this).hide();
50
  jQuery('#picker').hide();
51
  jQuery('.pick_color_button_clear').click(function(){
52
  jQuery('#'+jQuery(this).attr('alt')).val("");
53
+ jQuery('#'+jQuery(this).attr('alt')).attr("style","");
54
  });
55
  });
56
 
57
  jQuery(document).ready(function() {
58
  jQuery('#picker').farbtastic(function(color){
59
  if(document.activeElement.id !=""){
60
+ updateColor(document.activeElement.id,color);
61
+ updateAllColors();
62
  }
63
  });
64
+ jQuery(".color_picker").bind('keydown',function(){
65
+ updateColor(jQuery(this).attr('id'),jQuery(this).val());
66
+ updateAllColors();
67
+ });
68
  });