Absolutely Glamorous Custom Admin - Version 1.2

Version Description

  • All elements are grouped into small pages for better navigation.
  • Added color styles and improved user expirience.
  • Added settings page for fully control of main admin menu.
  • Added support for hidding items from admin menu.
  • Added support for changing items in admin menu.
  • Added support for adding new custom items in admin menu.
  • Added tooltips on option labels for better explanation of option.
  • Deprecated 'Hide Dashboard button from main menu' in 'Dashboard settings'. This option can be used now in 'Admin menu settings'.
  • Added settings for hidding/showing Dasboard widgets:"Recent Comments", "Incoming Links", "Plugins", "Quick Press", "Right Now", "Recent Drafts", primary widget area, secondary widget area.
  • Added option "(but show 'Log Out' button)" for displaying 'Log Out' button if admin top bar is completely removed.
  • Added option "Hide footer text".
  • Added support for hidding new Wordpress release notification.
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.2

Files changed (6) hide show
  1. images/btn_donate_LG.gif +0 -0
  2. plugin.php +569 -79
  3. readme.txt +34 -9
  4. screenshot-3.jpg +0 -0
  5. script/ag_script.js +281 -0
  6. style/ag_style.css +94 -0
images/btn_donate_LG.gif ADDED
Binary file
plugin.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  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.
6
  Author: Argonius
7
- Version: 1.0.1
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
@@ -31,12 +31,17 @@ class AGCA{
31
 
32
  public function __construct()
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
  // Add donate and support information
42
  function jk_filter_plugin_links($links, $file)
@@ -49,11 +54,18 @@ class AGCA{
49
  }
50
  return $links;
51
  }
 
 
 
 
 
 
52
 
53
  function reloadScript(){
54
  ?>
55
- <script type="text/javascript" src="<?php echo get_settings('home'); ?>/wp-includes/js/jquery/jquery.js"></script>
56
  <?php
 
57
  }
58
 
59
  function agca_register_settings() {
@@ -64,6 +76,7 @@ class AGCA{
64
  register_setting( 'agca-options-group', 'agca_options_menu' );
65
  register_setting( 'agca-options-group', 'agca_howdy' );
66
  register_setting( 'agca-options-group', 'agca_header' );
 
67
  register_setting( 'agca-options-group', 'agca_footer' );
68
  register_setting( 'agca-options-group', 'agca_privacy_options' );
69
  register_setting( 'agca-options-group', 'agca_header_logo' );
@@ -72,6 +85,7 @@ class AGCA{
72
  register_setting( 'agca-options-group', 'agca_update_bar' );
73
 
74
  register_setting( 'agca-options-group', 'agca_footer_left' );
 
75
  register_setting( 'agca-options-group', 'agca_footer_right' );
76
  register_setting( 'agca-options-group', 'agca_footer_right_hide' );
77
 
@@ -81,11 +95,27 @@ class AGCA{
81
  register_setting( 'agca-options-group', 'agca_login_photo_url' );
82
  register_setting( 'agca-options-group', 'agca_login_photo_href' );
83
 
84
- register_setting( 'agca-options-group', 'agca_menu_dashboard' );
85
  register_setting( 'agca-options-group', 'agca_dashboard_icon' );
86
  register_setting( 'agca-options-group', 'agca_dashboard_text' );
87
- register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
 
 
 
 
 
 
 
 
88
 
 
 
 
 
 
 
 
 
89
  }
90
 
91
  function agca_deactivate() {
@@ -96,6 +126,7 @@ class AGCA{
96
  delete_option( 'agca_options_menu' );
97
  delete_option( 'agca_howdy' );
98
  delete_option( 'agca_header' );
 
99
  delete_option( 'agca_footer' );
100
  delete_option( 'agca_privacy_options' );
101
  delete_option( 'agca_header_logo' );
@@ -104,6 +135,7 @@ class AGCA{
104
  delete_option( 'agca_update_bar' );
105
 
106
  delete_option( 'agca_footer_left' );
 
107
  delete_option( 'agca_footer_right' );
108
  delete_option( 'agca_footer_right_hide' );
109
 
@@ -111,33 +143,124 @@ class AGCA{
111
  delete_option( 'agca_login_banner_text' );
112
  delete_option( 'agca_login_photo_remove' );
113
  delete_option( 'agca_login_photo_url' );
114
- delete_option( 'agca_login_photo_href' );
115
-
116
 
117
- delete_option( 'agca_menu_dashboard' );
118
  delete_option( 'agca_dashboard_icon' );
119
  delete_option( 'agca_dashboard_text' );
120
- delete_option( 'agca_dashboard_text_paragraph' );
 
 
 
 
 
 
 
 
121
 
122
-
 
 
 
 
 
 
123
 
124
  }
125
  function agca_create_menu() {
126
  //create new top-level menu
127
  add_management_page( 'AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this,'agca_admin_page') );
128
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  function print_admin_css()
131
- {?>
 
 
 
 
 
132
  <script type="text/javascript">
133
  /* <![CDATA[ */
134
  jQuery(document).ready(function() {
 
135
 
136
  <?php if(get_option('agca_screen_options_menu')==true){ ?>
137
  jQuery("#screen-options-link-wrap").css("display","none");
138
  <?php } ?>
139
  <?php if(get_option('agca_help_menu')==true){ ?>
140
  jQuery("#contextual-help-link-wrap").css("display","none");
 
141
  <?php } ?>
142
  <?php if(get_option('agca_options_menu')==true){ ?>
143
  jQuery("#favorite-actions").css("display","none");
@@ -155,11 +278,25 @@ class AGCA{
155
  jQuery("#wphead #site-heading").after('<h1><?php echo get_option('agca_custom_site_heading'); ?></h1>');
156
  <?php } ?>
157
  <?php if(get_option('agca_update_bar')==true){ ?>
158
- jQuery(".update-nag").css("display","none");
159
  <?php } ?>
160
  <?php if(get_option('agca_header')==true){ ?>
161
  jQuery("#wphead").css("display","none");
162
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  <?php if(get_option('agca_footer')==true){ ?>
164
  jQuery("#footer").css("display","none");
165
  <?php } ?>
@@ -180,6 +317,9 @@ class AGCA{
180
  <?php if(get_option('agca_footer_left')!=""){ ?>
181
  jQuery("#footer-left").html('<?php echo get_option('agca_footer_left'); ?>');
182
  <?php } ?>
 
 
 
183
  <?php if(get_option('agca_footer_right')!=""){ ?>
184
  jQuery("#footer-upgrade").html('<?php echo get_option('agca_footer_right'); ?>');
185
  <?php } ?>
@@ -190,9 +330,10 @@ class AGCA{
190
  <?php if(get_option('agca_language_bar')==true){ ?>
191
  jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
192
  <?php } ?>
193
- <?php if(get_option('agca_menu_dashboard')==true){ ?>
 
194
  jQuery("#adminmenu #menu-dashboard").css("display","none");
195
- <?php } ?>
196
  <?php if(get_option('agca_dashboard_icon')==true){ ?>
197
  var className = jQuery("#icon-index").attr("class");
198
  if(className=='icon32'){
@@ -205,8 +346,168 @@ class AGCA{
205
  <?php if(get_option('agca_dashboard_text_paragraph')!=""){ ?>
206
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<br /><p style=\"text-indent:45px;\"><?php echo get_option('agca_dashboard_text_paragraph'); ?></p>');
207
  <?php } ?>
208
-
209
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
 
211
  });
212
  /* ]]> */
@@ -222,9 +523,10 @@ class AGCA{
222
  <?php
223
  }
224
 
225
- function print_login_head(){
226
 
227
  $this->reloadScript();
 
228
  ?>
229
  <script type="text/javascript">
230
  /* <![CDATA[ */
@@ -258,35 +560,48 @@ class AGCA{
258
  function agca_admin_page() {
259
  ?>
260
  <div class="wrap">
261
- <h1>AG Custom Admin Settings</h1>
262
- <br />
263
- <form method="post" action="options.php">
 
 
 
 
 
 
 
 
264
  <?php settings_fields( 'agca-options-group' ); ?>
265
- <table class="form-table" width="500px">
266
- <tr valign="center">
267
- <th scope="row" colspan="2">
268
- <h2>Admin Bar Options</h2>
269
- </th>
270
- </tr>
271
- <br />
272
- <tr valign="center">
273
  <td >
274
- <label for="agca_header"><p><strong>Hide admin bar completely</strong></p></label>
275
  </td>
276
  <td>
277
  <input type="checkbox" name="agca_header" value="true" <?php if (get_option('agca_header')==true) echo 'checked="checked" '; ?> />
278
  </td>
279
  </tr>
280
- <tr valign="center">
281
- <th >
282
- <br /><p class="underline_text">On left:</p>
283
- </th>
284
- <td>
 
 
 
 
 
 
285
  </td>
 
286
  </tr>
287
  <tr valign="center">
288
  <th >
289
- <label for="agca_privacy_options">Hide Privacy link <br /> <em>(link next to heading in admin bar)</em></label>
290
  </th>
291
  <td>
292
  <input type="checkbox" name="agca_privacy_options" value="true" <?php if (get_option('agca_privacy_options')==true) echo 'checked="checked" '; ?> />
@@ -294,7 +609,7 @@ class AGCA{
294
  </tr>
295
  <tr valign="center">
296
  <th >
297
- <label for="agca_header_logo">Hide WordPress logo in admin bar</label>
298
  </th>
299
  <td>
300
  <input type="checkbox" name="agca_header_logo" value="true" <?php if (get_option('agca_header_logo')==true) echo 'checked="checked" '; ?> />
@@ -302,7 +617,7 @@ class AGCA{
302
  </tr>
303
  <tr valign="center">
304
  <th scope="row">
305
- <label for="agca_custom_site_heading">Custom blog heading in admin bar</label>
306
  </th>
307
  <td>
308
  <textarea rows="5" name="agca_custom_site_heading" cols="40"><?php echo htmlspecialchars(get_option('agca_custom_site_heading')); ?></textarea><p><em><strong>Info: </strong>You can use HTML tags like 'h1' and/or 'a' tag</em></p>
@@ -310,7 +625,7 @@ class AGCA{
310
  </tr>
311
  <tr valign="center">
312
  <th scope="row">
313
- <label for="agca_update_bar">Hide WordPress update notification bar</label>
314
  </th>
315
  <td>
316
  <input type="checkbox" name="agca_update_bar" value="true" <?php if (get_option('agca_update_bar')==true) echo 'checked="checked" '; ?> />
@@ -318,16 +633,16 @@ class AGCA{
318
  </tr>
319
  <tr valign="center">
320
  <th scope="row">
321
- <label for="agca_site_heading">Hide default blog heading in admin bar</label>
322
  </th>
323
  <td>
324
  <input type="checkbox" name="agca_site_heading" value="true" <?php if (get_option('agca_site_heading')==true) echo 'checked="checked" '; ?> />
325
  </td>
326
  </tr>
327
  <tr valign="center">
328
- <th scope="row">
329
- <br /><p class="underline_text">On right:</p>
330
- </th>
331
  <td>
332
  </td>
333
  </tr>
@@ -363,37 +678,49 @@ class AGCA{
363
  </tr>
364
  <tr valign="center">
365
  <th scope="row">
366
- <label for="agca_logout">Change Log out text</label>
367
  </th>
368
  <td><input type="text" size="47" name="agca_logout" value="<?php echo get_option('agca_logout'); ?>" /></td>
369
  </tr>
370
  <tr valign="center">
371
  <th scope="row">
372
- <label for="agca_logout_only">Log out only</label>
373
  </th>
374
  <td>
375
  <input type="checkbox" name="agca_logout_only" value="true" <?php if (get_option('agca_logout_only')==true) echo 'checked="checked" '; ?> />
376
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  </tr>
378
-
379
- <tr valign="center">
380
- <th scope="row" colspan="2">
381
- <br /><br /><br /><h2>Admin Footer Options</h2>
382
- </th>
383
  <td>
384
  </td>
385
  </tr>
386
  <tr valign="center">
387
  <th scope="row">
388
- <label for="agca_footer"><p><strong>Hide footer completely</strong></p></label>
389
  </th>
390
- <td>
391
- <input type="checkbox" name="agca_footer" value="true" <?php if (get_option('agca_footer')==true) echo 'checked="checked" '; ?> />
392
  </td>
393
  </tr>
394
  <tr valign="center">
395
  <th scope="row">
396
- <label for="agca_footer_left">Change footer text</label>
397
  </th>
398
  <td>
399
  <textarea rows="5" name="agca_footer_left" cols="40"><?php echo htmlspecialchars(get_option('agca_footer_left')); ?></textarea>
@@ -401,78 +728,159 @@ class AGCA{
401
  </tr>
402
  <tr valign="center">
403
  <th scope="row">
404
- <label for="agca_footer_right_hide">Hide version text</label>
405
  </th>
406
  <td><input type="checkbox" name="agca_footer_right_hide" value="true" <?php if (get_option('agca_footer_right_hide')==true) echo 'checked="checked" '; ?> />
407
  </td>
408
  </tr>
409
  <tr valign="center">
410
  <th scope="row">
411
- <label for="agca_footer_right">Change version text</label>
412
  </th>
413
  <td>
414
  <textarea rows="5" name="agca_footer_right" cols="40"><?php echo htmlspecialchars(get_option('agca_footer_right')); ?></textarea>
415
  </td>
416
- </tr>
 
 
 
 
 
417
  <tr valign="center">
418
- <th scope="row" colspan="2">
419
- <br /><br /><br /><h2>Dashboard Page Options</h2>
420
- </th>
421
- <td>
422
  </td>
 
423
  </tr>
424
  <tr valign="center">
425
  <th scope="row">
426
- <label for="agca_dashboard_icon">Hide Dashboard heading icon</label>
427
  </th>
428
  <td>
429
  <input type="checkbox" name="agca_dashboard_icon" value="true" <?php if (get_option('agca_dashboard_icon')==true) echo 'checked="checked" '; ?> />
430
  </td>
431
  </tr>
 
432
  <tr valign="center">
433
  <th scope="row">
434
- <label for="agca_dashboard_text">Change Dashboard heading text</label>
435
  </th>
436
  <td><input type="text" size="47" name="agca_dashboard_text" value="<?php echo get_option('agca_dashboard_text'); ?>" /></td>
437
  </tr>
438
  <tr valign="center">
439
  <th scope="row">
440
- <label for="agca_dashboard_text_paragraph">Add custom Dashboard content<br> <em>(text or HTML content)</em></label>
441
  </th>
442
  <td>
443
  <textarea rows="5" name="agca_dashboard_text_paragraph" cols="40"><?php echo htmlspecialchars(get_option('agca_dashboard_text_paragraph')); ?></textarea>
444
  </td>
445
  </tr>
 
446
  <tr valign="center">
447
  <th scope="row">
448
  <label for="agca_menu_dashboard">Hide Dashboard button from main menu</label>
449
  </th>
450
  <td>
451
- <input type="checkbox" name="agca_menu_dashboard" value="true" <?php if (get_option('agca_menu_dashboard')==true) echo 'checked="checked" '; ?> />
452
  </td>
453
- </tr>
 
 
 
 
 
 
454
  <tr><td>
455
- <p><i><strong>Info:</strong> To remove Dashboard widgets go to Screen Options on Dashboard page.</i></p>
456
  </td>
457
  </tr>
458
- <tr valign="top">
459
- <th scope="row" colspan="2">
460
- <br /><br /><br /><h2>Login Page Options</h2>
461
  </th>
462
- <td>
 
 
 
 
 
 
 
 
 
463
  </td>
464
  </tr>
 
 
 
 
 
 
 
 
465
  <tr valign="center">
466
  <th scope="row">
467
- <label for="agca_login_banner"><strong>Hide Login top bar completely</strong></label>
 
 
 
 
 
 
 
 
468
  </th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  <td>
470
  <input type="checkbox" name="agca_login_banner" value="true" <?php if (get_option('agca_login_banner')==true) echo 'checked="checked" '; ?> />
471
  </td>
472
  </tr>
 
 
 
 
 
 
 
473
  <tr valign="center">
474
  <th scope="row">
475
- <label for="agca_login_banner_text">Change Login top bar text</label>
476
  </th>
477
  <td>
478
  <textarea 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>
@@ -480,7 +888,7 @@ class AGCA{
480
  </tr>
481
  <tr valign="center">
482
  <th scope="row">
483
- <label for="agca_login_photo_url">Change Login header image</label>
484
  </th>
485
  <td>
486
  <input type="text" size="47" name="agca_login_photo_url" value="<?php echo get_option('agca_login_photo_url'); ?>" />
@@ -489,7 +897,7 @@ class AGCA{
489
  </tr>
490
  <tr valign="center">
491
  <th scope="row">
492
- <label for="agca_login_photo_href">Change hyperlink on Login image</label>
493
  </th>
494
  <td>
495
  <input type="text" size="47" name="agca_login_photo_href" value="<?php echo get_option('agca_login_photo_href'); ?>" />
@@ -497,13 +905,95 @@ class AGCA{
497
  </tr>
498
  <tr valign="center">
499
  <th scope="row">
500
- <label for="agca_login_photo_remove">Hide Login header image</label>
501
  </th>
502
  <td>
503
  <input type="checkbox" name="agca_login_photo_remove" value="true" <?php if (get_option('agca_login_photo_remove')==true) echo 'checked="checked" '; ?> />
504
  </td>
505
  </tr>
506
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  <br /><br /><br />
508
  <p class="submit">
509
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
@@ -513,7 +1003,7 @@ class AGCA{
513
  </div>
514
  <p><i><strong>Info:</strong> You can use HTML tags in text areas, e.g. &lt;a href=&quot;http://www.mywebsite.com&quot;&gt;Visit Us&lt;/a&gt;</i></p>
515
  <br />
516
- <br /><br /><br /><br />
517
  <?php
518
  }
519
  }
2
  /*
3
  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.
6
  Author: Argonius
7
+ Version: 1.2
8
  Author URI: http://wordpress.argonius.com/ag-custom-admin
9
 
10
  Copyright 2011. Argonius (email : info@argonius.com)
31
 
32
  public function __construct()
33
  {
34
+
35
  add_filter('plugin_row_meta', array(&$this,'jk_filter_plugin_links'), 10, 2);
36
  add_action('admin_init', array(&$this,'agca_register_settings'));
37
  add_action('admin_head', array(&$this,'print_admin_css'));
38
  add_action('login_head', array(&$this,'print_login_head'));
39
+ add_action('admin_menu', array(&$this,'agca_create_menu'));
40
+ register_deactivation_hook(__FILE__, array(&$this,'agca_deactivate'));
41
+
42
+ /*Styles*/
43
+ // add_action('admin_menu', array(&$this,'agca_get_styles'));
44
+ // add_action('login_head', array(&$this,'agca_get_styles'));
45
  }
46
  // Add donate and support information
47
  function jk_filter_plugin_links($links, $file)
54
  }
55
  return $links;
56
  }
57
+ function agca_get_includes() {
58
+ ?>
59
+ <link rel="stylesheet" type="text/css" href="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>style/ag_style.css" />
60
+ <script type="text/javascript" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>script/ag_script.js"></script>
61
+ <?php
62
+ }
63
 
64
  function reloadScript(){
65
  ?>
66
+ <script type="text/javascript" src="<?php echo get_settings('home'); ?>/wp-includes/js/jquery/jquery.js"></script>
67
  <?php
68
+
69
  }
70
 
71
  function agca_register_settings() {
76
  register_setting( 'agca-options-group', 'agca_options_menu' );
77
  register_setting( 'agca-options-group', 'agca_howdy' );
78
  register_setting( 'agca-options-group', 'agca_header' );
79
+ register_setting( 'agca-options-group', 'agca_header_show_logout' );
80
  register_setting( 'agca-options-group', 'agca_footer' );
81
  register_setting( 'agca-options-group', 'agca_privacy_options' );
82
  register_setting( 'agca-options-group', 'agca_header_logo' );
85
  register_setting( 'agca-options-group', 'agca_update_bar' );
86
 
87
  register_setting( 'agca-options-group', 'agca_footer_left' );
88
+ register_setting( 'agca-options-group', 'agca_footer_left_hide' );
89
  register_setting( 'agca-options-group', 'agca_footer_right' );
90
  register_setting( 'agca-options-group', 'agca_footer_right_hide' );
91
 
95
  register_setting( 'agca-options-group', 'agca_login_photo_url' );
96
  register_setting( 'agca-options-group', 'agca_login_photo_href' );
97
 
98
+ //register_setting( 'agca-options-group', 'agca_menu_dashboard' ); DEPRECATED 1.2
99
  register_setting( 'agca-options-group', 'agca_dashboard_icon' );
100
  register_setting( 'agca-options-group', 'agca_dashboard_text' );
101
+ register_setting( 'agca-options-group', 'agca_dashboard_text_paragraph' );
102
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_rc' );
103
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_il' );
104
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_plugins' );
105
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_qp' );
106
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_rn' );
107
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_rd' );
108
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_primary' );
109
+ register_setting( 'agca-options-group', 'agca_dashboard_widget_secondary' );
110
 
111
+ /*Admin menu*/
112
+ register_setting( 'agca-options-group', 'agca_admin_menu_turnonoff' );
113
+ register_setting( 'agca-options-group', 'agca_admin_menu_agca_button_only' );
114
+ register_setting( 'agca-options-group', 'agca_admin_menu_separator_first' );
115
+ register_setting( 'agca-options-group', 'agca_admin_menu_separator_second' );
116
+ register_setting( 'agca-options-group', 'ag_edit_adminmenu_json' );
117
+ register_setting( 'agca-options-group', 'ag_add_adminmenu_json' );
118
+
119
  }
120
 
121
  function agca_deactivate() {
126
  delete_option( 'agca_options_menu' );
127
  delete_option( 'agca_howdy' );
128
  delete_option( 'agca_header' );
129
+ delete_option( 'agca_header_show_logout' );
130
  delete_option( 'agca_footer' );
131
  delete_option( 'agca_privacy_options' );
132
  delete_option( 'agca_header_logo' );
135
  delete_option( 'agca_update_bar' );
136
 
137
  delete_option( 'agca_footer_left' );
138
+ delete_option( 'agca_footer_left_hide' );
139
  delete_option( 'agca_footer_right' );
140
  delete_option( 'agca_footer_right_hide' );
141
 
143
  delete_option( 'agca_login_banner_text' );
144
  delete_option( 'agca_login_photo_remove' );
145
  delete_option( 'agca_login_photo_url' );
146
+ delete_option( 'agca_login_photo_href' );
 
147
 
148
+ //delete_option( 'agca_menu_dashboard' ); DEPRECATED 1.2
149
  delete_option( 'agca_dashboard_icon' );
150
  delete_option( 'agca_dashboard_text' );
151
+ delete_option( 'agca_dashboard_text_paragraph' );
152
+ delete_option( 'agca_dashboard_widget_rc' );
153
+ delete_option( 'agca_dashboard_widget_il' );
154
+ delete_option( 'agca_dashboard_widget_plugins' );
155
+ delete_option( 'agca_dashboard_widget_qp' );
156
+ delete_option( 'agca_dashboard_widget_rn' );
157
+ delete_option( 'agca_dashboard_widget_rd' );
158
+ delete_option( 'agca_dashboard_widget_primary' );
159
+ delete_option( 'agca_dashboard_widget_secondary' );
160
 
161
+ /*Admin menu*/
162
+ delete_option( 'agca_admin_menu_turnonoff' );
163
+ delete_option( 'agca_admin_menu_agca_button_only' );
164
+ delete_option( 'agca_admin_menu_separator_first' );
165
+ delete_option( 'agca_admin_menu_separator_second' );
166
+ delete_option( 'ag_edit_adminmenu_json' );
167
+ delete_option( 'ag_add_adminmenu_json' );
168
 
169
  }
170
  function agca_create_menu() {
171
  //create new top-level menu
172
  add_management_page( 'AG Custom Admin', 'AG Custom Admin', 'administrator', __FILE__, array(&$this,'agca_admin_page') );
173
  }
174
+
175
+ function agca_create_admin_button($name,$href) {
176
+ $class="";
177
+ if($name == 'AG Custom Admin'){
178
+ $class="agca_button_only";
179
+ }
180
+ $button ="";
181
+ $button .= '<li id="menu-'.$name.'" class="ag-custom-button menu-top menu-top-first '.$class.' menu-top-last">';
182
+ /*<div class="wp-menu-image">
183
+ <a href="edit-comments.php"><br></a>
184
+ </div>*/
185
+ $button .= '<div class="wp-menu-toggle" style="display: none;"><br></div>';
186
+ $button .= '<a tabindex="1" class="menu-top menu-top-last" href="'.$href.'">'.$name.'<a>';
187
+ $button .= '</li>';
188
+
189
+ return $button;
190
+ }
191
+ function agca_decode($code){
192
+ $code = str_replace("{","",$code);
193
+ $code = str_replace("}","",$code);
194
+ $elements = explode(", ",$code);
195
+
196
+ return $elements;
197
+ }
198
+
199
+ function jsonMenuArray($json,$type){
200
+ $arr = explode("|",$json);
201
+ $elements = "";
202
+ $array ="";
203
+ $first = true;
204
+ //print_r($json);
205
+ if($type == "buttons"){
206
+ $elements = json_decode($arr[0],true);
207
+ if($elements !=""){
208
+ foreach($elements as $k => $v){
209
+ $array.=$this->agca_create_admin_button($k,$v);
210
+ }
211
+ }
212
+ }else if($type == "buttonsJq"){
213
+ $elements = json_decode($arr[0],true);
214
+ if($elements !=""){
215
+ foreach($elements as $k => $v){
216
+ $array.='<tr><td colspan="2"><button title="'.$v.'" type="button">'.$k.'</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>';
217
+ }
218
+ }
219
+ }else{
220
+ //$elements = json_decode($arr[$type],true);
221
+ $elements = $this->agca_decode($arr[$type]);
222
+ if($elements !=""){
223
+ foreach($elements as $element){
224
+ if(!$first){
225
+ $array .=",";
226
+ }
227
+ $parts = explode(" : ",$element);
228
+ $array.="[".$parts[0].", ".$parts[1]."]";
229
+ $first=false;
230
+ }
231
+ }
232
+ }
233
+
234
+ return $array;
235
+ }
236
+
237
+
238
+
239
+ function remove_dashboard_widget($widget,$side)
240
+ {
241
+ //side can be 'normal' or 'side'
242
+ global $wp_meta_boxes;
243
+ remove_meta_box($widget, 'dashboard', $side);
244
+ }
245
 
246
  function print_admin_css()
247
+ {
248
+ $this->agca_get_includes();
249
+
250
+ get_currentuserinfo() ;
251
+ global $user_level;
252
+ ?>
253
  <script type="text/javascript">
254
  /* <![CDATA[ */
255
  jQuery(document).ready(function() {
256
+
257
 
258
  <?php if(get_option('agca_screen_options_menu')==true){ ?>
259
  jQuery("#screen-options-link-wrap").css("display","none");
260
  <?php } ?>
261
  <?php if(get_option('agca_help_menu')==true){ ?>
262
  jQuery("#contextual-help-link-wrap").css("display","none");
263
+ jQuery("#contextual-help-link").css("display","none");
264
  <?php } ?>
265
  <?php if(get_option('agca_options_menu')==true){ ?>
266
  jQuery("#favorite-actions").css("display","none");
278
  jQuery("#wphead #site-heading").after('<h1><?php echo get_option('agca_custom_site_heading'); ?></h1>');
279
  <?php } ?>
280
  <?php if(get_option('agca_update_bar')==true){ ?>
281
+ jQuery("#update-nag").css("display","none");
282
  <?php } ?>
283
  <?php if(get_option('agca_header')==true){ ?>
284
  jQuery("#wphead").css("display","none");
285
  <?php } ?>
286
+ <?php if((get_option('agca_header')==true)&&(get_option('agca_header_show_logout')==true)){ ?>
287
+ var clon ="";
288
+ jQuery("div#user_info a").each(function(){
289
+ if(jQuery(this).text() =="Log Out"){
290
+ clon = jQuery(this).clone();
291
+ }
292
+ });
293
+ if(clon !=""){
294
+ jQuery(clon).attr('style','float:right;padding:15px');
295
+ jQuery(clon).html('<?php echo ((get_option('agca_logout')=="")?"Log Out":get_option('agca_logout')); ?>');
296
+ }
297
+ jQuery("#wphead").after(clon);
298
+
299
+ <?php } ?>
300
  <?php if(get_option('agca_footer')==true){ ?>
301
  jQuery("#footer").css("display","none");
302
  <?php } ?>
317
  <?php if(get_option('agca_footer_left')!=""){ ?>
318
  jQuery("#footer-left").html('<?php echo get_option('agca_footer_left'); ?>');
319
  <?php } ?>
320
+ <?php if(get_option('agca_footer_left_hide')==true){ ?>
321
+ jQuery("#footer-left").css("display","none");
322
+ <?php } ?>
323
  <?php if(get_option('agca_footer_right')!=""){ ?>
324
  jQuery("#footer-upgrade").html('<?php echo get_option('agca_footer_right'); ?>');
325
  <?php } ?>
330
  <?php if(get_option('agca_language_bar')==true){ ?>
331
  jQuery("#user_info p").append('<?php include("language_bar/language_bar.php"); ?>');
332
  <?php } ?>
333
+ <?php //DEPRECATED 1.2
334
+ /*if(get_option('agca_menu_dashboard')==true){
335
  jQuery("#adminmenu #menu-dashboard").css("display","none");
336
+ } */?>
337
  <?php if(get_option('agca_dashboard_icon')==true){ ?>
338
  var className = jQuery("#icon-index").attr("class");
339
  if(className=='icon32'){
346
  <?php if(get_option('agca_dashboard_text_paragraph')!=""){ ?>
347
  jQuery("#wpbody-content #dashboard-widgets-wrap").before('<br /><p style=\"text-indent:45px;\"><?php echo get_option('agca_dashboard_text_paragraph'); ?></p>');
348
  <?php } ?>
349
+
350
+ <?php /*Remove Dashboard widgets*/ ?>
351
+ <?php
352
+
353
+
354
+ if(get_option('agca_dashboard_widget_rc')==true){
355
+ $this->remove_dashboard_widget('dashboard_recent_comments','normal');
356
+ }else{
357
+ ?>jQuery("#dashboard_recent_comments").css("display","block");<?php
358
+ }
359
+ if(get_option('agca_dashboard_widget_il')==true){
360
+ $this->remove_dashboard_widget('dashboard_incoming_links','normal');
361
+ }else{
362
+ ?>jQuery("#dashboard_incoming_links").css("display","block");<?php
363
+ }
364
+ if(get_option('agca_dashboard_widget_plugins')==true){
365
+ $this->remove_dashboard_widget('dashboard_plugins','normal');
366
+ }else{
367
+ ?>jQuery("#dashboard_plugins").css("display","block");<?php
368
+ }
369
+ if(get_option('agca_dashboard_widget_qp')==true){
370
+ $this->remove_dashboard_widget('dashboard_quick_press','side');
371
+ }else{
372
+ ?>jQuery("#dashboard_quick_press").css("display","block");<?php
373
+ }
374
+ if(get_option('agca_dashboard_widget_rn')==true){
375
+ $this->remove_dashboard_widget('dashboard_right_now','normal');
376
+ }else{
377
+ ?>jQuery("#dashboard_right_now").css("display","block");<?php
378
+ }
379
+ if(get_option('agca_dashboard_widget_rd')==true){
380
+ $this->remove_dashboard_widget('dashboard_recent_drafts','side');
381
+ }else{
382
+ ?>jQuery("#dashboard_recent_drafts").css("display","block");<?php
383
+ }
384
+ if(get_option('agca_dashboard_widget_primary')==true){
385
+ $this->remove_dashboard_widget('dashboard_primary','side');
386
+ }else{
387
+ ?>jQuery("#dashboard_primary").css("display","block");<?php
388
+ }
389
+ if(get_option('agca_dashboard_widget_secondary')==true){
390
+ $this->remove_dashboard_widget('dashboard_secondary','side');
391
+ }else{
392
+ ?>jQuery("#dashboard_secondary").css("display","block");<?php
393
+ }
394
+ ?>
395
+
396
+
397
+ <?php /*ADMIN MENU*/ ?>
398
+
399
+ //saved user menu configuration
400
+ <?php $checkboxes = $this->jsonMenuArray(get_option('ag_edit_adminmenu_json'),'0'); ?>
401
+ var checkboxes = <?php echo "[".$checkboxes."]"; ?>;
402
+
403
+ <?php $textboxes = $this->jsonMenuArray(get_option('ag_edit_adminmenu_json'),'1'); ?>
404
+ var textboxes = <?php echo "[".$textboxes."]"; ?>;
405
+
406
+ <?php $buttons = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttons'); ?>
407
+ var buttons = '<?php echo $buttons; ?>';
408
+
409
+ <?php $buttonsJq = $this->jsonMenuArray(get_option('ag_add_adminmenu_json'),'buttonsJq'); ?>
410
+ var buttonsJq = '<?php echo $buttonsJq; ?>';
411
+
412
+
413
+ createEditMenuPage(checkboxes,textboxes);
414
+
415
+ <?php if(get_option('agca_admin_menu_turnonoff') == 'on'){ ?>
416
+
417
+ <?php /*If Turned on*/ ?>
418
+
419
+ <?php /*Only admin see button*/
420
+ if ($user_level > 9){ ?>
421
+ jQuery('#adminmenu').append('<?php echo $this->agca_create_admin_button('AG Custom Admin','tools.php?page=ag-custom-admin/plugin.php'); ?>');
422
+ <?php } ?>
423
+
424
+ <?php if(get_option('agca_admin_menu_agca_button_only') == true){ ?>
425
+ jQuery('#adminmenu > li').each(function(){
426
+ if(!jQuery(this).hasClass('agca_button_only')){
427
+ jQuery(this).addClass('noclass');
428
+ }
429
+ });
430
+ <?php } ?>
431
+ <?php if(get_option('agca_admin_menu_separator_first')==true){ ?>
432
+ jQuery("li.wp-menu-separator").eq(0).css("display","none");
433
+ <?php } ?>
434
+ <?php if(get_option('agca_admin_menu_separator_second')==true){ ?>
435
+ jQuery("li.wp-menu-separator").eq(1).css("display","none");
436
+ <?php } ?>
437
+ <?php /*EDIT MENU ITEMS*/?>
438
+ <?php if(get_option('ag_edit_adminmenu_json')!=""){
439
+
440
+ ?>
441
+ var checkboxes_counter = 0;
442
+ var createAGCAbutton = false;
443
+ //console.log(checkboxes);
444
+ //console.log(textboxes);
445
+ <?php //loop through original menu and hide and change elements according to user setttngs ?>
446
+
447
+ var topmenuitem;
448
+ jQuery('ul#adminmenu > li').each(function(){
449
+
450
+ if(!jQuery(this).hasClass("wp-menu-separator") && !jQuery(this).hasClass("wp-menu-separator-last")){
451
+ //alert(checkboxes[checkboxes_counter]);
452
+
453
+ topmenuitem = jQuery(this).attr('id');
454
+ //console.log(jQuery(this));
455
+
456
+ var matchFound = false;
457
+ var subMenus = "";
458
+
459
+ for(i=0; i< checkboxes.length ; i++){
460
+
461
+ if(checkboxes[i][0].indexOf("<-TOP->") >=0){ //if it is top item
462
+ if(checkboxes[i][0].indexOf(topmenuitem) >0){//if found match in menu, with top item in array
463
+ matchFound = true;
464
+ //console.log(checkboxes[i][0]);
465
+ jQuery(this).find('a').eq(1).html(textboxes[i][1]);
466
+ if(checkboxes[i][1] == "true"){
467
+ jQuery(this).addClass('noclass');
468
+ }
469
+
470
+ i++;
471
+ var selector = '#' + topmenuitem + ' ul li';
472
+ //console.log(i+" "+checkboxes);
473
+ while((i<checkboxes.length) && (checkboxes[i][0].indexOf("<-TOP->") < 0)){
474
+ jQuery(selector).each(function(){ //loop through all submenus
475
+ if(checkboxes[i][0] == jQuery(this).text()){
476
+ if(checkboxes[i][1] == "true"){
477
+ jQuery(this).addClass('noclass');
478
+ }
479
+ jQuery(this).find('a').text(textboxes[i][1]);
480
+ }
481
+ });
482
+ i++;
483
+ }
484
+ };
485
+ }else{
486
+ //i++;
487
+ }
488
+ }
489
+ //console.log(subMenus);
490
+ //checkboxes_counter++;
491
+ }
492
+ });
493
+ <?php
494
+ } ?>
495
+
496
+
497
+ /*Add user buttons*/
498
+ jQuery('#adminmenu').append(buttons);
499
+
500
+
501
+ <?php /*END If Turned on*/ ?>
502
+ <?php } else{ ?>
503
+ jQuery("#adminmenu").removeClass("noclass");
504
+ <?php } ?>
505
+
506
+
507
+
508
+ /*Add user buttons*/
509
+ jQuery('#ag_add_adminmenu').append(buttonsJq);
510
+ reloadRemoveButtonEvents();
511
 
512
  });
513
  /* ]]> */
523
  <?php
524
  }
525
 
526
+ function print_login_head(){
527
 
528
  $this->reloadScript();
529
+ $this->agca_get_includes();
530
  ?>
531
  <script type="text/javascript">
532
  /* <![CDATA[ */
560
  function agca_admin_page() {
561
  ?>
562
  <div class="wrap">
563
+ <h1 style="color:green">AG Custom Admin Settings</h1>
564
+ <br />
565
+ <ul id="ag_main_menu">
566
+ <li class="selected" title="Options for Admin Bar">Admin Bar</li>
567
+ <li class="normal">Admin Footer</li>
568
+ <li class="normal">Dashboard Page</li>
569
+ <li class="normal">Login Page</li>
570
+ <li class="normal">Admin Menu</li>
571
+ <a id="agca_donate_button" style="margin-left:8px" title="Do You like this plugin? You can support its future development by providing small donation" href="http://wordpress.argonius.com/donate"><img alt="Donate" src="<?php echo trailingslashit(plugins_url(basename(dirname(__FILE__)))); ?>images/btn_donate_LG.gif" /></a>
572
+ </ul>
573
+ <form method="post" id="agca_form" action="options.php">
574
  <?php settings_fields( 'agca-options-group' ); ?>
575
+ <div id="section_admin_bar" class="ag_section">
576
+ <br />
577
+ <p style="font-style:italic"><strong>Info: </strong>Roll over option labels for more information about option.</p>
578
+ <br />
579
+ <table class="form-table" width="500px">
580
+ <tr valign="center" class="ag_table_major_options" >
 
 
581
  <td >
582
+ <label title="Hide admin bar with all elements in top of admin page" for="agca_header"><strong>Hide admin bar completely</strong></label>
583
  </td>
584
  <td>
585
  <input type="checkbox" name="agca_header" value="true" <?php if (get_option('agca_header')==true) echo 'checked="checked" '; ?> />
586
  </td>
587
  </tr>
588
+ <tr valign="center" class="ag_table_major_options" >
589
+ <td >
590
+ <label title='Check this if You want to show "Log Out" button in top right corner of admin page' for="agca_header_show_logout"><strong>(but show 'Log Out' button)</strong></label>
591
+ </td>
592
+ <td>
593
+ <input type="checkbox" name="agca_header_show_logout" value="true" <?php if ((get_option('agca_header')==true) && (get_option('agca_header_show_logout')==true)) echo 'checked="checked" '; ?> />
594
+ </td>
595
+ </tr>
596
+ <tr valign="center">
597
+ <td colspan="2">
598
+ <div class="ag_table_heading"><h3>Elements on Left</h3></div>
599
  </td>
600
+ <td></td>
601
  </tr>
602
  <tr valign="center">
603
  <th >
604
+ <label title="This is link next to heading in admin bar" for="agca_privacy_options">Hide Privacy link</label>
605
  </th>
606
  <td>
607
  <input type="checkbox" name="agca_privacy_options" value="true" <?php if (get_option('agca_privacy_options')==true) echo 'checked="checked" '; ?> />
609
  </tr>
610
  <tr valign="center">
611
  <th >
612
+ <label title="Small Wordpress logo in admin top bar" for="agca_header_logo">Hide WordPress logo</label>
613
  </th>
614
  <td>
615
  <input type="checkbox" name="agca_header_logo" value="true" <?php if (get_option('agca_header_logo')==true) echo 'checked="checked" '; ?> />
617
  </tr>
618
  <tr valign="center">
619
  <th scope="row">
620
+ <label title="Adds custom text in admin top bar. Default Wordpress heading stays intact." for="agca_custom_site_heading">Custom blog heading</label>
621
  </th>
622
  <td>
623
  <textarea rows="5" name="agca_custom_site_heading" cols="40"><?php echo htmlspecialchars(get_option('agca_custom_site_heading')); ?></textarea><p><em><strong>Info: </strong>You can use HTML tags like 'h1' and/or 'a' tag</em></p>
625
  </tr>
626
  <tr valign="center">
627
  <th scope="row">
628
+ <label title="Hides yellow bar with notifications of new Wordpress release" for="agca_update_bar">Hide WordPress update notification bar</label>
629
  </th>
630
  <td>
631
  <input type="checkbox" name="agca_update_bar" value="true" <?php if (get_option('agca_update_bar')==true) echo 'checked="checked" '; ?> />
633
  </tr>
634
  <tr valign="center">
635
  <th scope="row">
636
+ <label for="agca_site_heading">Hide default blog heading</label>
637
  </th>
638
  <td>
639
  <input type="checkbox" name="agca_site_heading" value="true" <?php if (get_option('agca_site_heading')==true) echo 'checked="checked" '; ?> />
640
  </td>
641
  </tr>
642
  <tr valign="center">
643
+ <td colspan="2">
644
+ <div class="ag_table_heading"><h3>Elements on Right</h3></div>
645
+ </td>
646
  <td>
647
  </td>
648
  </tr>
678
  </tr>
679
  <tr valign="center">
680
  <th scope="row">
681
+ <label title="Put 'Exit', for example" for="agca_logout">Change Log out text</label>
682
  </th>
683
  <td><input type="text" size="47" name="agca_logout" value="<?php echo get_option('agca_logout'); ?>" /></td>
684
  </tr>
685
  <tr valign="center">
686
  <th scope="row">
687
+ <label title="If selected, hides all elements in top right corner, except 'Log Out' button" for="agca_logout_only">Log out only</label>
688
  </th>
689
  <td>
690
  <input type="checkbox" name="agca_logout_only" value="true" <?php if (get_option('agca_logout_only')==true) echo 'checked="checked" '; ?> />
691
  </td>
692
+ </tr>
693
+ </table>
694
+ </div>
695
+
696
+ <div id="section_admin_footer" style="display:none" class="ag_section">
697
+ <br /><br />
698
+ <table class="form-table" width="500px">
699
+ <tr valign="center" class="ag_table_major_options">
700
+ <td>
701
+ <label title="Hides footer with all elements" for="agca_footer"><strong>Hide footer completely</strong></label>
702
+ </td>
703
+ <td>
704
+ <input type="checkbox" id="agca_footer" name="agca_footer" value="true" <?php if (get_option('agca_footer')==true) echo 'checked="checked" '; ?> />
705
+ </td>
706
  </tr>
707
+ <tr valign="center">
708
+ <td colspan="2">
709
+ <div class="ag_table_heading"><h3>Footer Options</h3></div>
710
+ </td>
 
711
  <td>
712
  </td>
713
  </tr>
714
  <tr valign="center">
715
  <th scope="row">
716
+ <label title="Hides default text in footer" for="agca_footer_left_hide">Hide footer text</label>
717
  </th>
718
+ <td><input type="checkbox" name="agca_footer_left_hide" value="true" <?php if (get_option('agca_footer_left_hide')==true) echo 'checked="checked" '; ?> />
 
719
  </td>
720
  </tr>
721
  <tr valign="center">
722
  <th scope="row">
723
+ <label title="Replaces text 'Thank you for creating with WordPress. | Documentation | Feedback' with custom text" for="agca_footer_left">Change footer text</label>
724
  </th>
725
  <td>
726
  <textarea rows="5" name="agca_footer_left" cols="40"><?php echo htmlspecialchars(get_option('agca_footer_left')); ?></textarea>
728
  </tr>
729
  <tr valign="center">
730
  <th scope="row">
731
+ <label title="Hides text 'Get Version ...' on right" for="agca_footer_right_hide">Hide version text</label>
732
  </th>
733
  <td><input type="checkbox" name="agca_footer_right_hide" value="true" <?php if (get_option('agca_footer_right_hide')==true) echo 'checked="checked" '; ?> />
734
  </td>
735
  </tr>
736
  <tr valign="center">
737
  <th scope="row">
738
+ <label title="Replaces text 'Get Version ...' with custom" for="agca_footer_right">Change version text</label>
739
  </th>
740
  <td>
741
  <textarea rows="5" name="agca_footer_right" cols="40"><?php echo htmlspecialchars(get_option('agca_footer_right')); ?></textarea>
742
  </td>
743
+ </tr>
744
+ </table>
745
+ </div>
746
+
747
+ <div id="section_dashboard_page" style="display:none" class="ag_section">
748
+ <table class="form-table" width="500px">
749
  <tr valign="center">
750
+ <td colspan="2">
751
+ <div class="ag_table_heading"><h3>Dashboard Page Options</h3></div>
 
 
752
  </td>
753
+ <td></td>
754
  </tr>
755
  <tr valign="center">
756
  <th scope="row">
757
+ <label title="This is small 'house' icon next to main heading ('Dashboard' text by default) on Dashboard page" for="agca_dashboard_icon">Hide Dashboard heading icon</label>
758
  </th>
759
  <td>
760
  <input type="checkbox" name="agca_dashboard_icon" value="true" <?php if (get_option('agca_dashboard_icon')==true) echo 'checked="checked" '; ?> />
761
  </td>
762
  </tr>
763
+
764
  <tr valign="center">
765
  <th scope="row">
766
+ <label title="Main heading ('Dashboard') on Dashboard page" for="agca_dashboard_text">Change Dashboard heading text</label>
767
  </th>
768
  <td><input type="text" size="47" name="agca_dashboard_text" value="<?php echo get_option('agca_dashboard_text'); ?>" /></td>
769
  </tr>
770
  <tr valign="center">
771
  <th scope="row">
772
+ <label title="Adds custom text (or HTML) between heading and widgets area on Dashboard page" for="agca_dashboard_text_paragraph">Add custom Dashboard content<br> <em>(text or HTML content)</em></label>
773
  </th>
774
  <td>
775
  <textarea rows="5" name="agca_dashboard_text_paragraph" cols="40"><?php echo htmlspecialchars(get_option('agca_dashboard_text_paragraph')); ?></textarea>
776
  </td>
777
  </tr>
778
+ <?php /* DEPRECATED 1.2
779
  <tr valign="center">
780
  <th scope="row">
781
  <label for="agca_menu_dashboard">Hide Dashboard button from main menu</label>
782
  </th>
783
  <td>
784
+ <input type="checkbox" name="agca_menu_dashboard" value="true" <php if (get_option('agca_menu_dashboard')==true) echo 'checked="checked" '; > />
785
  </td>
786
+ </tr> */ ?>
787
+ <tr valign="center">
788
+ <td colspan="2">
789
+ <div class="ag_table_heading"><h3>Dashboard widgets Options</h3></div>
790
+ </td>
791
+ <td></td>
792
+ </tr>
793
  <tr><td>
794
+ <p><i><strong>Info:</strong> These settings override settings in Screen options on Dashboard page.</i></p>
795
  </td>
796
  </tr>
797
+ <tr valign="center">
798
+ <th scope="row">
799
+ <label for="agca_dashboard_widget_rc">Hide "Recent Comments"</label>
800
  </th>
801
+ <td>
802
+ <input type="checkbox" name="agca_dashboard_widget_rc" value="true" <?php if (get_option('agca_dashboard_widget_rc')==true) echo 'checked="checked" '; ?> />
803
+ </td>
804
+ </tr>
805
+ <tr valign="center">
806
+ <th scope="row">
807
+ <label for="agca_dashboard_widget_il">Hide "Incoming Links"</label>
808
+ </th>
809
+ <td>
810
+ <input type="checkbox" name="agca_dashboard_widget_il" value="true" <?php if (get_option('agca_dashboard_widget_il')==true) echo 'checked="checked" '; ?> />
811
  </td>
812
  </tr>
813
+ <tr valign="center">
814
+ <th scope="row">
815
+ <label for="agca_dashboard_widget_plugins">Hide "Plugins"</label>
816
+ </th>
817
+ <td>
818
+ <input type="checkbox" name="agca_dashboard_widget_plugins" value="true" <?php if (get_option('agca_dashboard_widget_plugins')==true) echo 'checked="checked" '; ?> />
819
+ </td>
820
+ </tr>
821
  <tr valign="center">
822
  <th scope="row">
823
+ <label for="agca_dashboard_widget_qp">Hide "Quick Press"</label>
824
+ </th>
825
+ <td>
826
+ <input type="checkbox" name="agca_dashboard_widget_qp" value="true" <?php if (get_option('agca_dashboard_widget_qp')==true) echo 'checked="checked" '; ?> />
827
+ </td>
828
+ </tr>
829
+ <tr valign="center">
830
+ <th scope="row">
831
+ <label for="agca_dashboard_widget_rn">Hide "Right Now"</label>
832
  </th>
833
+ <td>
834
+ <input type="checkbox" name="agca_dashboard_widget_rn" value="true" <?php if (get_option('agca_dashboard_widget_rn')==true) echo 'checked="checked" '; ?> />
835
+ </td>
836
+ </tr>
837
+ <tr valign="center">
838
+ <th scope="row">
839
+ <label for="agca_dashboard_widget_rd">Hide "Recent Drafts"</label>
840
+ </th>
841
+ <td>
842
+ <input type="checkbox" name="agca_dashboard_widget_rd" value="true" <?php if (get_option('agca_dashboard_widget_rd')==true) echo 'checked="checked" '; ?> />
843
+ </td>
844
+ </tr>
845
+ <tr valign="center">
846
+ <th scope="row">
847
+ <label title="This is 'WordPress Development Blog' widget by default" for="agca_dashboard_widget_primary">Hide primary widget area</label>
848
+ </th>
849
+ <td>
850
+ <input type="checkbox" name="agca_dashboard_widget_primary" value="true" <?php if (get_option('agca_dashboard_widget_primary')==true) echo 'checked="checked" '; ?> />
851
+ </td>
852
+ </tr>
853
+ <tr valign="center">
854
+ <th scope="row">
855
+ <label title="This is 'Other WordPress News' widget by default" for="agca_dashboard_widget_secondary">Hide secondary widget area</label>
856
+ </th>
857
+ <td>
858
+ <input type="checkbox" name="agca_dashboard_widget_secondary" value="true" <?php if (get_option('agca_dashboard_widget_secondary')==true) echo 'checked="checked" '; ?> />
859
+ </td>
860
+ </tr>
861
+ </table>
862
+ </div>
863
+ <div id="section_login_page" style="display:none" class="ag_section">
864
+ <br /><br />
865
+ <table class="form-table" width="500px">
866
+ <tr valign="center" class="ag_table_major_options">
867
+ <td>
868
+ <label for="agca_login_banner"><strong>Hide Login top bar completely</strong></label>
869
+ </td>
870
  <td>
871
  <input type="checkbox" name="agca_login_banner" value="true" <?php if (get_option('agca_login_banner')==true) echo 'checked="checked" '; ?> />
872
  </td>
873
  </tr>
874
+ <tr valign="center">
875
+ <td colspan="2">
876
+ <div class="ag_table_heading"><h3>Login Page Options</h3></div>
877
+ </td>
878
+ <td>
879
+ </td>
880
+ </tr>
881
  <tr valign="center">
882
  <th scope="row">
883
+ <label title="Changes '<- Back to ...' text in top bar on Login page" for="agca_login_banner_text">Change Login top bar text</label>
884
  </th>
885
  <td>
886
  <textarea 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>
888
  </tr>
889
  <tr valign="center">
890
  <th scope="row">
891
+ <label title="If this field is not empty, image from provided url will be visible on Login page" for="agca_login_photo_url">Change Login header image</label>
892
  </th>
893
  <td>
894
  <input type="text" size="47" name="agca_login_photo_url" value="<?php echo get_option('agca_login_photo_url'); ?>" />
897
  </tr>
898
  <tr valign="center">
899
  <th scope="row">
900
+ <label title="Put here custom link to a web location, that will be triggered on image click" for="agca_login_photo_href">Change hyperlink on Login image</label>
901
  </th>
902
  <td>
903
  <input type="text" size="47" name="agca_login_photo_href" value="<?php echo get_option('agca_login_photo_href'); ?>" />
905
  </tr>
906
  <tr valign="center">
907
  <th scope="row">
908
+ <label title="Remove login image completely" for="agca_login_photo_remove">Hide Login header image</label>
909
  </th>
910
  <td>
911
  <input type="checkbox" name="agca_login_photo_remove" value="true" <?php if (get_option('agca_login_photo_remove')==true) echo 'checked="checked" '; ?> />
912
  </td>
913
  </tr>
914
+ </table>
915
+ </div>
916
+ <?php
917
+ /*ADMIN MENU*/
918
+ ?>
919
+ <div id="section_admin_menu" style="display:none" class="ag_section">
920
+ <br />
921
+ <p style="font-style:italic"><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 went wrong.</p>
922
+ <br />
923
+ <table class="form-table" width="500px">
924
+ <tr valign="center" class="ag_table_major_options">
925
+ <td><label for="agca_admin_menu_turnonoff"><strong>Turn on/off admin menu configuration</strong></label></td>
926
+ <td><strong><input type="radio" name="agca_admin_menu_turnonoff" value="on" <?php if(get_option('agca_admin_menu_turnonoff') == 'on') echo 'checked="checked" '; ?> /><span style="color:green">ON</span>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="agca_admin_menu_turnonoff" value="off" <?php if(get_option('agca_admin_menu_turnonoff') != 'on') echo 'checked="checked"'; ?> /><span style="color:red">OFF</span></strong></td>
927
+ </tr>
928
+ <tr valign="center" class="ag_table_major_options">
929
+ <td><label for="agca_admin_menu_agca_button_only"><strong>Hide admin menu completly (administrator can see 'AG custom admin' button)</strong></label></td>
930
+ <td><input type="checkbox" name="agca_admin_menu_agca_button_only" value="true" <?php if (get_option('agca_admin_menu_agca_button_only')==true) echo 'checked="checked" '; ?> /></td>
931
+ </tr>
932
+ <tr valign="center">
933
+ <td colspan="2">
934
+ <div class="ag_table_heading"><h3>Edit/Remove Menu Items</h3></div>
935
+ </td>
936
+ <td>
937
+ </td>
938
+ </tr>
939
+ <tr>
940
+ <td colspan="2">
941
+ Reset to default values
942
+ <button type="button" id="ag_edit_adminmenu_reset_button" name="ag_edit_adminmenu_reset_button">Reset Settings</button><br />
943
+ <p><em>(click on menu item to show/hide submenus)</em></p>
944
+ <table id="ag_edit_adminmenu">
945
+ <tr style="background-color:#999;">
946
+ <td width="300px"><div style="float:left;color:#fff;"><h3>Item</h3></div><div style="float:right;color:#fff;"><h3>Remove?</h3></div></td><td width="300px" style="color:#fff;" ><h3>Change Text</h3>
947
+ </td>
948
+ </tr>
949
+ </table>
950
+ <input type="hidden" size="47" id="ag_edit_adminmenu_json" name="ag_edit_adminmenu_json" value="<?php echo htmlspecialchars(get_option('ag_edit_adminmenu_json')); ?>" />
951
+ </td>
952
+ <td></td>
953
+ </tr>
954
+ <tr valign="center">
955
+ <th scope="row">
956
+ <label title="This is arrow like separator between Dashboard and Posts button (by default)" for="agca_admin_menu_separator_first">Remove first items separator</label>
957
+ </th>
958
+ <td>
959
+ <input type="checkbox" name="agca_admin_menu_separator_first" value="true" <?php if (get_option('agca_admin_menu_separator_first')==true) echo 'checked="checked" '; ?> />
960
+ </td>
961
+ </tr>
962
+ <tr valign="center">
963
+ <th scope="row">
964
+ <label title="This is arrow like separator between Comments and Appearance button (by default)" for="agca_admin_menu_separator_second">Remove second items separator</label>
965
+ </th>
966
+ <td>
967
+ <input type="checkbox" name="agca_admin_menu_separator_second" value="true" <?php if (get_option('agca_admin_menu_separator_second')==true) echo 'checked="checked" '; ?> />
968
+ </td>
969
+ </tr>
970
+ <tr valign="center">
971
+ <td colspan="2">
972
+ <div class="ag_table_heading"><h3>Add New Menu Items</h3></div>
973
+ </td>
974
+ <td>
975
+ </td>
976
+ </tr>
977
+ <tr>
978
+ <td colspan="2">
979
+
980
+ <table id="ag_add_adminmenu">
981
+ <tr>
982
+ <td colspan="2">
983
+ name:<input type="text" size="47" id="ag_add_adminmenu_name" name="ag_add_adminmenu_name" />
984
+ url:<input type="text" size="47" id="ag_add_adminmenu_url" name="ag_add_adminmenu_url" />
985
+ <button type="button" id="ag_add_adminmenu_button" name="ag_add_adminmenu_button">Add new item</button>
986
+ </td><td></td>
987
+ </tr>
988
+ </table>
989
+ <input type="hidden" size="47" id="ag_add_adminmenu_json" name="ag_add_adminmenu_json" value="<?php echo htmlspecialchars(get_option('ag_add_adminmenu_json')); ?>" />
990
+ </td>
991
+ <td>
992
+ </td>
993
+ </tr>
994
+ </table>
995
+ </div>
996
+
997
  <br /><br /><br />
998
  <p class="submit">
999
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
1003
  </div>
1004
  <p><i><strong>Info:</strong> You can use HTML tags in text areas, e.g. &lt;a href=&quot;http://www.mywebsite.com&quot;&gt;Visit Us&lt;/a&gt;</i></p>
1005
  <br />
1006
+ <br /><br /><br /><p id="agca_footer_support_info">Wordpress 'AG Custom Admin' plugin by Argonius. If You have any questions, ideas for future development or if You found a bug or having any issues regarding this plugin, please visit my <a href="http://wordpress.argonius.com/ag-custom-admin">SUPPORT</a> page. <br />You can also participate in development of this plugin if You <a href="http://wordpress.argonius.com/donate">BUY ME a DRINK</a> to refresh my energy for programming. Thanks!<br /><br />Have a nice blogging!</p><br />
1007
  <?php
1008
  }
1009
  }
readme.txt CHANGED
@@ -3,15 +3,15 @@ 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.1
7
- Stable tag: 1.0.1
8
 
9
- Hide or change items in admin panel.
10
 
11
  == Description ==
12
- With this plugin You can hide or change unwanted items from admin and login page.
13
- You can easily change header or footer text, remove unwanted options like Screen options, Help options
14
- or Favorites dropdown menu.
15
 
16
  Here is the list of options:
17
 
@@ -27,18 +27,18 @@ Here is the list of options:
27
  - Hide Favorite Actions
28
  - Change/remove Howdy text
29
  - Change Log out text
30
- - Log out link only
31
 
32
  Admin Footer Options
33
  - Hide footer completely
34
- - Change footer text
35
  - Change/remove footer version text
36
 
37
  Dasboard Page Options
38
  - Hide Dashboard heading icon
39
  - Change Dashboard heading text
40
  - Add custom Dashboard content
41
- - Hide Dashboard button from main menu
42
 
43
  Login Page Options
44
  - Hide Login top bar completely
@@ -46,6 +46,11 @@ Here is the list of options:
46
  - Change/remove Login header image
47
  - Change hyperlink on Login image
48
  - Hide Login header image
 
 
 
 
 
49
 
50
 
51
  For more information about the plugin please see: http://wordpress.argonius.com/ag-custom-admin
@@ -65,9 +70,24 @@ It is possible that WordPress usualy wraps that text with some HTML tags. In tha
65
 
66
  1. Text in header or footer could be customized.
67
  2. Login page top bar could be changer or removed. Custom login photo could be added.
 
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  = 1.0.1 =
72
  * Changed text in Settings page to be more clearer.
73
  * Updated list of options on plugin page
@@ -78,6 +98,11 @@ It is possible that WordPress usualy wraps that text with some HTML tags. In tha
78
 
79
  == Upgrade Notice ==
80
 
 
 
 
 
 
81
  = 1.0.1 =
82
  Better explainations in Settings page. No changes in functionality.
83
 
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
8
 
9
+ Hide or change items in admin panel. Customize buttons from admin menu.
10
 
11
  == Description ==
12
+ With this plugin You can hide or change unwanted items in admin and login pages.
13
+ For example, You can easily change header or footer text, remove unwanted options like Screen options, Help options or Favorites dropdown menu.
14
+ You can also completely change or hide buttons from admin menu, or add new customized butons.
15
 
16
  Here is the list of options:
17
 
27
  - Hide Favorite Actions
28
  - Change/remove Howdy text
29
  - Change Log out text
30
+ - Log out button only
31
 
32
  Admin Footer Options
33
  - Hide footer completely
34
+ - Change/remove footer text
35
  - Change/remove footer version text
36
 
37
  Dasboard Page Options
38
  - Hide Dashboard heading icon
39
  - Change Dashboard heading text
40
  - Add custom Dashboard content
41
+ - Hide dashboard widgets
42
 
43
  Login Page Options
44
  - Hide Login top bar completely
46
  - Change/remove Login header image
47
  - Change hyperlink on Login image
48
  - Hide Login header image
49
+
50
+ Admin Menu Options
51
+ - Rename menu and submenu items
52
+ - Remove menu and submenu items
53
+ - Add new buttons with custom links
54
 
55
 
56
  For more information about the plugin please see: http://wordpress.argonius.com/ag-custom-admin
70
 
71
  1. Text in header or footer could be customized.
72
  2. Login page top bar could be changer or removed. Custom login photo could be added.
73
+ 3. Admin menu is completely customizable. You can rename or remove items in menu and submenu, or add brand new buttons with custom links.
74
 
75
  == Changelog ==
76
 
77
+ = 1.2 =
78
+ * All elements are grouped into small pages for better navigation.
79
+ * Added color styles and improved user expirience.
80
+ * Added settings page for fully control of main admin menu.
81
+ * Added support for hidding items from admin menu.
82
+ * Added support for changing items in admin menu.
83
+ * Added support for adding new custom items in admin menu.
84
+ * Added tooltips on option labels for better explanation of option.
85
+ * Deprecated 'Hide Dashboard button from main menu' in 'Dashboard settings'. This option can be used now in 'Admin menu settings'.
86
+ * Added settings for hidding/showing Dasboard widgets:"Recent Comments", "Incoming Links", "Plugins", "Quick Press", "Right Now", "Recent Drafts", primary widget area, secondary widget area.
87
+ * Added option "(but show 'Log Out' button)" for displaying 'Log Out' button if admin top bar is completely removed.
88
+ * Added option "Hide footer text".
89
+ * Added support for hidding new Wordpress release notification.
90
+
91
  = 1.0.1 =
92
  * Changed text in Settings page to be more clearer.
93
  * Updated list of options on plugin page
98
 
99
  == Upgrade Notice ==
100
 
101
+ = 1.2 =
102
+ This is major milestone of this plugin. All elements are grouped and organized into small pages for better navigation.
103
+ Settings are styled in better way and some attractive interactions are added to make using of this plugin very easy.
104
+ Added settings for fully customization of admin menus.
105
+
106
  = 1.0.1 =
107
  Better explainations in Settings page. No changes in functionality.
108
 
screenshot-3.jpg ADDED
Binary file
script/ag_script.js ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var afterFormClickCreateJson = true;
2
+ var editingButtonNow = false;
3
+
4
+ function booleanToChecked(bool){
5
+ if(bool == 'true'){
6
+ return 'checked="checked"';
7
+ }
8
+ }
9
+
10
+ function hideShowSubmenus(index){
11
+
12
+ var finish = false;
13
+ jQuery('#ag_edit_adminmenu td').each(function(){
14
+ if(jQuery('#ag_edit_adminmenu td').index(jQuery(this)) >= index && (finish == false)){
15
+ if(jQuery(this).hasClass('ag_admin_menu_child')){
16
+ jQuery(this).parent().toggleClass('noclass');
17
+ }
18
+ if((jQuery('#ag_edit_adminmenu td').index(jQuery(this)) > index) && jQuery(this).hasClass('ag_admin_menu_parent')){
19
+ finish = true;
20
+ }
21
+ }
22
+ });
23
+ }
24
+
25
+ /*
26
+ Makes admin edit page pretty grouping items and submenus, and adding fancy interactions
27
+ */
28
+ function prettyEditMenuPage(){
29
+ jQuery('#ag_edit_adminmenu td').each(function(){
30
+ if(jQuery(this).hasClass('ag_admin_menu_child')){
31
+ jQuery(this).parent().addClass('noclass');
32
+ };
33
+ });
34
+ jQuery('#ag_edit_adminmenu td').each(function(){
35
+ if(jQuery(this).hasClass('ag_admin_menu_parent')){
36
+ jQuery(this).parent().css('background-color','#d8eAd8');
37
+ jQuery(this).bind('click',function(evt){
38
+ if(evt.target.className == 'ag_admin_menu_parent'){
39
+ hideShowSubmenus(jQuery('#ag_edit_adminmenu td').index(this));
40
+ }
41
+ });
42
+ };
43
+ });
44
+
45
+ };
46
+
47
+ function createEditMenuPage(checkboxes,textboxes){
48
+ /*Create menu page in AGCA settings*/
49
+
50
+ //console.log(textboxes);
51
+ var counter = 0;
52
+ var TBlength = textboxes.length;
53
+ if(textboxes==""){
54
+ TBlength = 9999999;
55
+ }
56
+
57
+ jQuery('ul#adminmenu li').each(function(){
58
+ if(!jQuery(this).hasClass("wp-menu-separator") && !jQuery(this).hasClass("wp-menu-separator-last") && !jQuery(this).hasClass("ag-custom-button") && (counter < TBlength )){
59
+ //if subelement
60
+ if(jQuery(this).parent().parent().hasClass('wp-submenu')){
61
+ subElement = jQuery(this).find('a').text();
62
+ //console.log(jQuery(this));
63
+ //console.log(subElement);
64
+ var isHidden = "";
65
+ var sub_item_text_value;
66
+ if(textboxes ==""){
67
+ sub_item_text_value = subElement;
68
+ }else{
69
+ sub_item_text_value = textboxes[counter][1];
70
+ isHidden = checkboxes[counter][1];
71
+ }
72
+ jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_child'><div style=\"float:left\">"+subElement+"</div><div style=\"float:right\"><input type=\"checkbox\" class=\""+subElement+"\" "+booleanToChecked(isHidden)+" name=\"ag_edit_adminmenu_item_sub_"+counter+"\" /></div></td><td class='ag_admin_menu_child2' ><input type=\"text\" class=\""+subElement+"\" size=\"47\" value=\""+sub_item_text_value+"\" name=\"ag_edit_adminmenu_item_sub_"+counter+"\" /></td></tr>");
73
+ }
74
+ //if top element
75
+ else{
76
+ var topElement = jQuery(this).children('a').clone().children().remove().end().text();
77
+ topElement = jQuery.trim(topElement);
78
+ var top_item_text_value;
79
+ var isHidden = "";
80
+ if(textboxes ==""){
81
+ top_item_text_value = topElement;
82
+ }else{
83
+ top_item_text_value = textboxes[counter][1];
84
+ isHidden = checkboxes[counter][1];
85
+ }
86
+ jQuery('#ag_edit_adminmenu').append("<tr><td class='ag_admin_menu_parent'><br />" + topElement +"<div style=\"float:right\"><input 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 type=\"text\" class=\""+jQuery(this).attr("id")+"\" size=\"47\" value=\""+top_item_text_value+"\" name=\"ag_edit_adminmenu_item_top_"+counter+"\" /></td></tr>");
87
+ }
88
+ counter++;
89
+ }
90
+ });
91
+
92
+ //console.log(checkboxes.replace('<-TOP->','')+"|"+textboxes.replace('<-TOP->',''));
93
+ prettyEditMenuPage();
94
+ }
95
+
96
+ function showHideSection(text) {
97
+ switch(text)
98
+ {
99
+ case 'Admin Bar': jQuery('#section_admin_bar').show();
100
+ break;
101
+ case 'Admin Footer': jQuery('#section_admin_footer').show();
102
+ break;
103
+ case 'Dashboard Page': jQuery('#section_dashboard_page').show();
104
+ break;
105
+ case 'Login Page': jQuery('#section_login_page').show();
106
+ break;
107
+ case 'Admin Menu': jQuery('#section_admin_menu').show();
108
+ break;
109
+ default: jQuery('#section_admin_bar').show();
110
+ }
111
+ }
112
+
113
+ function hideAllSections(){
114
+ jQuery('#ag_main_menu li').each(function(){
115
+ jQuery(this).attr("class","normal");
116
+ });
117
+ jQuery('.ag_section').each(function(){
118
+ jQuery(this).hide();
119
+ });
120
+ }
121
+
122
+ function reloadRemoveButtonEvents(){
123
+ jQuery('a.button_remove').click(function(){
124
+ jQuery(this).parent().parent().remove();
125
+ });
126
+ jQuery('a.button_edit').click(function(){
127
+ if(editingButtonNow == false){
128
+ var name = jQuery(this).parent().find('button').text();
129
+ var url = jQuery(this).parent().find('button').attr('title');
130
+ editingButtonNow = name;
131
+ jQuery(this).parent().append('<div id="temporary_button_edit">name:<input type="text" size="47" value="'+name+'" id="ag_add_adminmenu_name_edit" name="ag_add_adminmenu_name_edit" />url:<input type="text" size="47" value="'+url+'" id="ag_add_adminmenu_url_edit" name="ag_add_adminmenu_url_edit" /><button type="button" id="ag_add_adminmenu_button_edit" name="ag_add_adminmenu_button_edit">Save changes</button></div>');
132
+ reloadRemoveButtonEvents();
133
+ }
134
+ });/*Save editing changes*/
135
+ jQuery('#ag_add_adminmenu_button_edit').click(function(){
136
+ //alert(jQuery(this).parent().html());
137
+ var name = jQuery('#ag_add_adminmenu_name_edit').val();
138
+ var url = jQuery('#ag_add_adminmenu_url_edit').val();
139
+ jQuery('#temporary_button_edit').remove();
140
+
141
+ var element = 0;
142
+ jQuery('#ag_add_adminmenu :button').each(function(){
143
+ //dont use first button for adding new buttons
144
+ if(element > 0){
145
+ if(jQuery(this).html() == editingButtonNow){
146
+ jQuery(this).attr('title',url);
147
+ jQuery(this).html(name);
148
+ }
149
+ }
150
+ element++;
151
+ });
152
+ editingButtonNow = false;
153
+ });
154
+ };
155
+
156
+ jQuery(document).ready(function(){
157
+ /*Add click handler on main buttons*/
158
+ jQuery('#ag_main_menu li').bind('click',function(){
159
+ hideAllSections();
160
+
161
+ var text = jQuery(this).text();
162
+ jQuery(this).attr("class","selected");
163
+ showHideSection(text);
164
+ });
165
+
166
+ /*Admin Menu Reset all setings button*/
167
+ jQuery('#ag_edit_adminmenu_reset_button').click(function(){
168
+ afterFormClickCreateJson = false;
169
+ jQuery('#agca_form').submit();
170
+ });
171
+
172
+ /*Add new menu item button - creates new HTMl button elements*/
173
+ jQuery('#ag_add_adminmenu_button').click(function(){
174
+ var name = jQuery('#ag_add_adminmenu_name').val();
175
+ var url = jQuery('#ag_add_adminmenu_url').val();
176
+ 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>');
177
+ reloadRemoveButtonEvents();
178
+ });
179
+
180
+ /*Add tooltip box*/
181
+ jQuery("body").append("<div id='AGToolTipDiv'></div>");
182
+
183
+ /*ToolTip*/
184
+ jQuery("label[title],#agca_donate_button").each(function() {
185
+ jQuery(this).hover(function(e) {
186
+ jQuery(this).mousemove(function(e) {
187
+ var tipY = e.pageY + 16;
188
+ var tipX = e.pageX + 16;
189
+ jQuery("#AGToolTipDiv").css({'top': tipY, 'left': tipX});
190
+ });
191
+ jQuery("#AGToolTipDiv")
192
+ .html(jQuery(this).attr('title'))
193
+ .stop(true,true)
194
+ .fadeIn("fast");
195
+ jQuery(this).removeAttr('title');
196
+ }, function() {
197
+ jQuery("#AGToolTipDiv")
198
+ .stop(true,true)
199
+ .fadeOut("fast");
200
+ jQuery(this).attr('title', jQuery("#AGToolTipDiv").html());
201
+ });
202
+ });
203
+ });
204
+
205
+ /*CLICKING ON ITEMS HANDLING*/
206
+ jQuery(document).ready(function(){
207
+ jQuery('#agca_footer').change(function(){
208
+ });
209
+ });
210
+
211
+ /*Admin menu*/
212
+ jQuery(document).ready(function(){
213
+ jQuery('#adminmenu').css('display','block');
214
+ });
215
+
216
+ /*FORM SUBMITTED*/
217
+ jQuery(document).ready(function(){
218
+ jQuery('#agca_form').submit(function(){
219
+
220
+ /*Serialize checkboxes*/
221
+ var array = "{";
222
+ var firstElement = true;
223
+ var topMarker = "";
224
+ jQuery('#ag_edit_adminmenu :checkbox').each(function(){
225
+ if(firstElement != true){
226
+ array += ", ";
227
+ }
228
+ topMarker = "";
229
+ if(jQuery(this).parent().parent().hasClass('ag_admin_menu_parent')){
230
+ topMarker="<-TOP->";
231
+ }
232
+ array += "\"" + topMarker + jQuery(this).attr('class') + "\" : ";
233
+ array += "\"" + jQuery(this).attr('checked') + "\"";
234
+ firstElement = false;
235
+ });
236
+ array += "}|";
237
+
238
+ /*Serialize textboxes*/
239
+ array += "{";
240
+ firstElement = true;
241
+ jQuery('#ag_edit_adminmenu :text').each(function(){
242
+ if(firstElement != true){
243
+ array += ", ";
244
+ }
245
+ topMarker = "";
246
+ if(jQuery(this).parent().hasClass('ag_admin_menu_parent2')){
247
+ topMarker="<-TOP->";
248
+ }
249
+ array += "\"" + topMarker + jQuery(this).attr('class') + "\" : ";
250
+ array += "\"" + jQuery(this).val() + "\"";
251
+ firstElement = false;
252
+ });
253
+ array += "}";
254
+
255
+ if(afterFormClickCreateJson == true){
256
+ jQuery('#ag_edit_adminmenu_json').val(array);
257
+ }else{
258
+ jQuery('#ag_edit_adminmenu_json').val('');
259
+ }
260
+ //console.log(array);
261
+ //serialize buttons
262
+ array = "{";
263
+ var element = 0;
264
+ jQuery('#ag_add_adminmenu :button').each(function(){
265
+ //console.log(jQuery(this).html()+jQuery(this).attr('title'));
266
+ if(element > 0){
267
+ if(element > 1){
268
+ array += ", ";
269
+ }
270
+ array += "\"" + jQuery(this).html() + "\" : ";
271
+ array += "\"" + jQuery(this).attr('title') + "\"";
272
+ }
273
+ element++;
274
+ });
275
+ array += "}";
276
+ if(element == 1){array="";}
277
+ jQuery('#ag_add_adminmenu_json').val(array);
278
+
279
+ return true;
280
+ });
281
+ });
style/ag_style.css ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ag_main_menu {
2
+ display:block;
3
+ height:33px;
4
+ border-bottom:3px solid green;
5
+ }
6
+ #ag_main_menu li{
7
+ display:block;
8
+ background-color:#A9F5A9;
9
+ float:left;
10
+ color:#0B6138;
11
+ padding:15px;
12
+ padding-top:8px;
13
+ padding-bottom:8px;
14
+ font-weight:bold;
15
+ border-bottom:3px solid green;
16
+ }
17
+ #ag_main_menu li.selected{
18
+ border:3px solid green;
19
+ border-bottom:none ;
20
+ background-color:#F9F9F9;
21
+ cursor:default;
22
+ }
23
+ #ag_main_menu li.normal:hover{
24
+ background-color:#A9F500;
25
+ cursor:pointer;
26
+ }
27
+ .ag_table_heading{
28
+ background-color:#A9F5A9;
29
+ display:block;
30
+ height:20px;
31
+ padding:5px;
32
+ padding-top:0px;
33
+ padding-bottom:1px;
34
+ margin-top:50px;
35
+ border-bottom:1px solid green;
36
+ margin-left:-10px;
37
+ margin-right:-10px;
38
+ }
39
+ .ag_table_major_options{
40
+ background-color:#ddd;
41
+ width:500px;
42
+ }
43
+
44
+ .ag_table_major_options td{
45
+ padding:5px;
46
+ margin:0px;
47
+ }
48
+
49
+ div#AGToolTipDiv {
50
+ position: absolute;
51
+ top: 100px;
52
+ left: 200px;
53
+ height: 20px;
54
+ border: 1px solid #FFFF00;
55
+ background-color: #FFFFD4;
56
+ display: none;
57
+ padding: 3px;
58
+ padding-top: 7px;
59
+ padding-bottom: 5px;
60
+ }
61
+ td.ag_admin_menu_parent{
62
+ font-size:16px;
63
+ font-weight:bold;
64
+ }
65
+ td.ag_admin_menu_parent:hover{
66
+ background-color:#ddd;
67
+ }
68
+ #ag_edit_adminmenu tr{
69
+ margin:0;
70
+ padding:0;
71
+ background-color:#E8FAE8;
72
+ }
73
+ #ag_edit_adminmenu td.ag_admin_menu_child {
74
+ margin:0;
75
+ padding:30px;
76
+ padding-top:0;
77
+ padding-bottom:0;
78
+ }
79
+ #ag_edit_adminmenu th h2{
80
+ color:#fff;
81
+ }
82
+ #adminmenu{
83
+ display:none;
84
+ }
85
+ .noclass{
86
+ display:none;
87
+ }
88
+ #agca_footer_support_info{
89
+ font-size:12px;
90
+ font-weight:bold;
91
+ color:#555;
92
+ border:1px solid green;
93
+ padding:20px;
94
+ }