Adminimize - Version 1.8.2

Version Description

(02/15/2013) = * Fix PHP Notice message for empty var, see support * Changes for load files and functions only, if it necessary * Fix, that the changes on Admin Bar work always in all admin pages

Download this release

Release Info

Developer Bueltge
Plugin Icon wp plugin Adminimize
Version 1.8.2
Comparing to
See all releases

Code changes from version 1.8.1 to 1.8.2

adminimize.php CHANGED
@@ -7,12 +7,12 @@
7
  /**
8
  * Plugin Name: Adminimize
9
  * Plugin URI: http://bueltge.de/wordpress-admin-theme-adminimize/674/
10
- * Text Domain: adminimize
11
  * Domain Path: /languages
12
  * Description: Visually compresses the administratrive meta-boxes so that more admin page content can be initially seen. The plugin that lets you hide 'unnecessary' items from the WordPress administration menu, for alle roles of your install. You can also hide post meta controls on the edit-area to simplify the interface. It is possible to simplify the admin in different for all roles.
13
  * Author: Frank Bültge
14
  * Author URI: http://bueltge.de/
15
- * Version: 1.8.1
16
  * License: GPLv3
17
  */
18
 
@@ -21,39 +21,29 @@
21
  * and i have written a plugin with many options on the basis
22
  * of differently user-right and a user-friendly range in admin-area.
23
  *
24
- * :( grmpf i have so much wishes and hints form users, do use the plugin and its not possible to development this on my free time)
 
25
  */
26
 
 
 
 
 
27
 
28
  global $wp_version;
29
- if ( ! function_exists( 'add_action' ) || version_compare( $wp_version, "2.5alpha", "<") ) {
30
- if ( function_exists( 'add_action' ) )
31
- $exit_msg = 'The plugin <em><a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/">Adminimize</a></em> requires WordPress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update WordPress</a> or delete the plugin.';
32
- else
33
- $exit_msg = '';
34
 
35
  header( 'Status: 403 Forbidden' );
36
  header( 'HTTP/1.1 403 Forbidden' );
37
  exit( $exit_msg );
38
  }
39
 
40
- if ( function_exists( 'add_action' ) ) {
41
-
42
- // Pre-2.6 compatibility
43
- if ( ! defined( 'WP_CONTENT_URL' ) )
44
- define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
45
- if ( ! defined( 'WP_CONTENT_DIR' ) )
46
- define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
47
- if ( ! defined( 'WP_PLUGIN_URL' ) )
48
- define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
49
- if ( ! defined( 'WP_PLUGIN_DIR' ) )
50
- define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
51
-
52
- // plugin definitions
53
- define( 'FB_ADMINIMIZE_BASENAME', plugin_basename( __FILE__ ) );
54
- define( 'FB_ADMINIMIZE_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
55
- define( 'FB_ADMINIMIZE_TEXTDOMAIN', _mw_adminimize_get_plugin_data( 'TextDomain' ) );
56
- }
57
 
58
  function _mw_adminimize_get_plugin_data( $value = 'Version' ) {
59
 
@@ -76,12 +66,6 @@ function _mw_adminimize_textdomain() {
76
  }
77
 
78
 
79
- function _mw_adminimize_register_styles() {
80
-
81
- wp_register_style( 'adminimize-style', plugins_url( 'css/style.css', __FILE__ ) );
82
- }
83
-
84
-
85
  function _mw_adminimize_recursive_in_array( $needle, $haystack ) {
86
 
87
  if ( '' != $haystack ) {
@@ -405,8 +389,6 @@ function _mw_adminimize_admin_init() {
405
  if ( _mw_adminimize_recursive_in_array( 'media_buttons', $disabled_metaboxes_page_all )
406
  || _mw_adminimize_recursive_in_array( 'media_buttons', $disabled_metaboxes_post_all ) )
407
  remove_action( 'media_buttons', 'media_buttons' );
408
-
409
- //add_filter( 'image_downsize', '_mw_adminimize_image_downsize', 1, 3);
410
  }
411
 
412
  $_mw_adminimize_control_flashloader = _mw_adminimize_get_option_value( '_mw_adminimize_control_flashloader' );
@@ -466,52 +448,23 @@ function _mw_adminimize_init() {
466
 
467
  // on admin init
468
  define( 'MW_ADMIN_FILE', plugin_basename( __FILE__ ) );
469
- add_action( 'admin_init', '_mw_adminimize_textdomain' );
470
- add_action( 'admin_init', '_mw_adminimize_register_styles', 1 );
471
- add_action( 'admin_init', '_mw_adminimize_admin_init', 2 );
 
 
 
 
 
 
 
472
  add_action( 'init', '_mw_adminimize_init', 2 );
473
- /* maybe later
474
- if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
475
- add_action( 'network_admin_menu', '_mw_adminimize_add_settings_page' );
476
- */
477
- add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
478
- add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
479
 
480
  register_activation_hook( __FILE__, '_mw_adminimize_install' );
481
  register_uninstall_hook( __FILE__, '_mw_adminimize_deinstall' );
482
  //register_deactivation_hook(__FILE__, '_mw_adminimize_deinstall' );
483
 
484
 
485
- /**
486
- * Uses WordPress filter for image_downsize, kill wp-image-dimension
487
- * code by Andrew Rickmann
488
- * http://www.wp-fun.co.uk/
489
- * @param $value, $id, $size
490
- */
491
- function _mw_adminimize_image_downsize( $value = FALSE, $id = 0, $size = 'medium' ) {
492
-
493
- if ( ! wp_attachment_is_image( $id ) )
494
- return FALSE;
495
-
496
- $img_url = wp_get_attachment_url( $id);
497
-
498
- // Mimic functionality in image_downsize function in wp-includes/media.php
499
- if ( $intermediate = image_get_intermediate_size( $id, $size ) ) {
500
- $img_url = str_replace( basename( $img_url ), $intermediate['file'], $img_url );
501
- } elseif ( $size == 'thumbnail' ) {
502
- // fall back to the old thumbnail
503
- if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize( $thumb_file ) ) {
504
- $img_url = str_replace( basename( $img_url ), basename( $thumb_file ), $img_url );
505
- }
506
- }
507
-
508
- if ( $img_url )
509
- return array( $img_url, 0, 0);
510
-
511
- return FALSE;
512
- }
513
-
514
-
515
  /**
516
  * list category-box in sidebar
517
  * @uses $post_ID
@@ -555,9 +508,10 @@ function _mw_adminimize_sidecat_list_category_box() {
555
 
556
 
557
  /**
558
- * remove the dashbord
559
- * @author of basic Austin Matzko
560
- * http://www.ilfilosofo.com/blog/2006/05/24/plugin-remove-the-wordpress-dashboard/
 
561
  */
562
  function _mw_adminimize_remove_dashboard() {
563
  global $menu, $submenu, $user_ID, $wp_version;
@@ -569,8 +523,8 @@ function _mw_adminimize_remove_dashboard() {
569
  $disabled_submenu_[$role] = _mw_adminimize_get_option_value( 'mw_adminimize_disabled_submenu_' . $role . '_items' );
570
  }
571
 
572
- $disabled_menu_all = array();
573
- $disabled_submenu_all = array();
574
 
575
  foreach ( $user_roles as $role ) {
576
  array_push( $disabled_menu_all, $disabled_menu_[$role] );
@@ -632,13 +586,14 @@ function _mw_adminimize_remove_dashboard() {
632
  unset( $menu[$page] );
633
  reset( $menu); $page = key( $menu);
634
 
635
- while ( !$the_user->has_cap( $menu[$page][1] ) && next( $menu) )
636
  $page = key( $menu);
637
 
638
  if ( preg_match( '#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI'] ) ) {
639
  wp_redirect( $_mw_adminimize_db_redirect );
640
  }
641
  }
 
642
  }
643
  }
644
 
@@ -1141,19 +1096,22 @@ function _mw_adminimize_small_user_info() {
1141
  */
1142
  // inc. settings page
1143
  require_once( 'adminimize_page.php' );
 
1144
  // dashbaord options
1145
  require_once( 'inc-setup/dashboard.php' );
1146
  // widget options
1147
  require_once( 'inc-setup/widget.php' );
1148
- // remove admin bar
1149
- require_once( 'inc-setup/remove-admin-bar.php' );
1150
  require_once( 'inc-setup/admin-footer.php' );
1151
  // globale settings
1152
  //require_once( 'inc-options/settings_notice.php' );
 
 
1153
  // admin bar helper, setup
 
1154
  require_once( 'inc-setup/admin-bar-items.php' );
1155
  // meta boxes helper, setup
1156
  //require_once( 'inc-setup/meta-boxes.php' );
 
1157
  /**
1158
  * @version WP 2.8
1159
  * Add action link(s) to plugins page
@@ -1200,13 +1158,15 @@ function _mw_adminimize_add_settings_page() {
1200
  __FILE__,
1201
  '_mw_adminimize_options'
1202
  );
1203
- add_filter( 'plugin_action_links', '_mw_adminimize_filter_plugin_meta', 10, 2 );
 
1204
  add_action( 'load-' . $pagehook, '_mw_adminimize_on_load_page' );
1205
  }
1206
 
1207
 
1208
  function _mw_adminimize_on_load_page() {
1209
 
 
1210
  wp_enqueue_style( 'adminimize-style' );
1211
  }
1212
 
@@ -1534,13 +1494,17 @@ function _mw_adminimize_update() {
1534
 
1535
  $adminimizeoptions['mw_adminimize_dashboard_widgets'] = _mw_adminimize_get_option_value('mw_adminimize_dashboard_widgets' );
1536
 
1537
- $adminimizeoptions['mw_adminimize_default_menu'] = $GLOBALS['menu'];
1538
- $adminimizeoptions['mw_adminimize_default_submenu'] = $GLOBALS['submenu'];
 
 
1539
 
 
 
1540
  // update
1541
  if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
1542
  update_site_option( 'mw_adminimize', $adminimizeoptions );
1543
- else
1544
  update_option( 'mw_adminimize', $adminimizeoptions );
1545
 
1546
  $myErrors = new _mw_adminimize_message_class();
@@ -1563,6 +1527,10 @@ function _mw_adminimize_deinstall() {
1563
  * Install options in database
1564
  */
1565
  function _mw_adminimize_install() {
 
 
 
 
1566
  global $menu, $submenu;
1567
 
1568
  $user_roles = _mw_adminimize_get_all_user_roles();
7
  /**
8
  * Plugin Name: Adminimize
9
  * Plugin URI: http://bueltge.de/wordpress-admin-theme-adminimize/674/
10
+ * Text Domain: adminimize
11
  * Domain Path: /languages
12
  * Description: Visually compresses the administratrive meta-boxes so that more admin page content can be initially seen. The plugin that lets you hide 'unnecessary' items from the WordPress administration menu, for alle roles of your install. You can also hide post meta controls on the edit-area to simplify the interface. It is possible to simplify the admin in different for all roles.
13
  * Author: Frank B&uuml;ltge
14
  * Author URI: http://bueltge.de/
15
+ * Version: 1.8.2
16
  * License: GPLv3
17
  */
18
 
21
  * and i have written a plugin with many options on the basis
22
  * of differently user-right and a user-friendly range in admin-area.
23
  *
24
+ * :( grmpf i have so much wishes and hints form users, do use the plugin and
25
+ * it is not possible to development this on my free time
26
  */
27
 
28
+ if ( ! function_exists( 'add_action' ) ) {
29
+ echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
30
+ exit;
31
+ }
32
 
33
  global $wp_version;
34
+ if ( version_compare( $wp_version, "2.5alpha", "<" ) ) {
35
+ $exit_msg = 'The plugin <em><a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/">Adminimize</a></em> requires WordPress 2.5 or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update WordPress</a> or delete the plugin.';
 
 
 
36
 
37
  header( 'Status: 403 Forbidden' );
38
  header( 'HTTP/1.1 403 Forbidden' );
39
  exit( $exit_msg );
40
  }
41
 
42
+ // plugin definitions
43
+ define( 'FB_ADMINIMIZE_BASENAME', plugin_basename( __FILE__ ) );
44
+ define( 'FB_ADMINIMIZE_BASEFOLDER', plugin_basename( dirname( __FILE__ ) ) );
45
+ define( 'FB_ADMINIMIZE_TEXTDOMAIN', _mw_adminimize_get_plugin_data( 'TextDomain' ) );
46
+
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  function _mw_adminimize_get_plugin_data( $value = 'Version' ) {
49
 
66
  }
67
 
68
 
 
 
 
 
 
 
69
  function _mw_adminimize_recursive_in_array( $needle, $haystack ) {
70
 
71
  if ( '' != $haystack ) {
389
  if ( _mw_adminimize_recursive_in_array( 'media_buttons', $disabled_metaboxes_page_all )
390
  || _mw_adminimize_recursive_in_array( 'media_buttons', $disabled_metaboxes_post_all ) )
391
  remove_action( 'media_buttons', 'media_buttons' );
 
 
392
  }
393
 
394
  $_mw_adminimize_control_flashloader = _mw_adminimize_get_option_value( '_mw_adminimize_control_flashloader' );
448
 
449
  // on admin init
450
  define( 'MW_ADMIN_FILE', plugin_basename( __FILE__ ) );
451
+ if ( is_admin() ) {
452
+ add_action( 'admin_init', '_mw_adminimize_textdomain' );
453
+ add_action( 'admin_init', '_mw_adminimize_admin_init', 2 );
454
+ /* maybe later
455
+ if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
456
+ add_action( 'network_admin_menu', '_mw_adminimize_add_settings_page' );
457
+ */
458
+ add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
459
+ add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
460
+ }
461
  add_action( 'init', '_mw_adminimize_init', 2 );
 
 
 
 
 
 
462
 
463
  register_activation_hook( __FILE__, '_mw_adminimize_install' );
464
  register_uninstall_hook( __FILE__, '_mw_adminimize_deinstall' );
465
  //register_deactivation_hook(__FILE__, '_mw_adminimize_deinstall' );
466
 
467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
468
  /**
469
  * list category-box in sidebar
470
  * @uses $post_ID
508
 
509
 
510
  /**
511
+ * Remove the dashboard
512
+ *
513
+ * @author Basic Austin Matzko
514
+ * @see http://www.ilfilosofo.com/blog/2006/05/24/plugin-remove-the-wordpress-dashboard/
515
  */
516
  function _mw_adminimize_remove_dashboard() {
517
  global $menu, $submenu, $user_ID, $wp_version;
523
  $disabled_submenu_[$role] = _mw_adminimize_get_option_value( 'mw_adminimize_disabled_submenu_' . $role . '_items' );
524
  }
525
 
526
+ $disabled_menu_all = array();
527
+ $disabled_submenu_all = array();
528
 
529
  foreach ( $user_roles as $role ) {
530
  array_push( $disabled_menu_all, $disabled_menu_[$role] );
586
  unset( $menu[$page] );
587
  reset( $menu); $page = key( $menu);
588
 
589
+ while ( ! $the_user->has_cap( $menu[$page][1] ) && next( $menu) )
590
  $page = key( $menu);
591
 
592
  if ( preg_match( '#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI'] ) ) {
593
  wp_redirect( $_mw_adminimize_db_redirect );
594
  }
595
  }
596
+
597
  }
598
  }
599
 
1096
  */
1097
  // inc. settings page
1098
  require_once( 'adminimize_page.php' );
1099
+ //require_once( 'inc-options/class-eximport.php' );
1100
  // dashbaord options
1101
  require_once( 'inc-setup/dashboard.php' );
1102
  // widget options
1103
  require_once( 'inc-setup/widget.php' );
 
 
1104
  require_once( 'inc-setup/admin-footer.php' );
1105
  // globale settings
1106
  //require_once( 'inc-options/settings_notice.php' );
1107
+ // remove admin bar
1108
+ require_once( 'inc-setup/remove-admin-bar.php' );
1109
  // admin bar helper, setup
1110
+ // work always in frontend
1111
  require_once( 'inc-setup/admin-bar-items.php' );
1112
  // meta boxes helper, setup
1113
  //require_once( 'inc-setup/meta-boxes.php' );
1114
+
1115
  /**
1116
  * @version WP 2.8
1117
  * Add action link(s) to plugins page
1158
  __FILE__,
1159
  '_mw_adminimize_options'
1160
  );
1161
+ if ( ! is_network_admin() )
1162
+ add_filter( 'plugin_action_links', '_mw_adminimize_filter_plugin_meta', 10, 2 );
1163
  add_action( 'load-' . $pagehook, '_mw_adminimize_on_load_page' );
1164
  }
1165
 
1166
 
1167
  function _mw_adminimize_on_load_page() {
1168
 
1169
+ wp_register_style( 'adminimize-style', plugins_url( 'css/style.css', __FILE__ ) );
1170
  wp_enqueue_style( 'adminimize-style' );
1171
  }
1172
 
1494
 
1495
  $adminimizeoptions['mw_adminimize_dashboard_widgets'] = _mw_adminimize_get_option_value('mw_adminimize_dashboard_widgets' );
1496
 
1497
+ if ( isset( $GLOBALS['menu'] ) )
1498
+ $adminimizeoptions['mw_adminimize_default_menu'] = $GLOBALS['menu'];
1499
+ if ( isset( $GLOBALS['submenu'] ) )
1500
+ $adminimizeoptions['mw_adminimize_default_submenu'] = $GLOBALS['submenu'];
1501
 
1502
+ //update_option( 'mw_adminimize1', $adminimizeoptions['mw_adminimize_disabled_admin_bar_administrator_items'] );
1503
+ //update_site_option( 'mw_adminimize1', $adminimizeoptions['mw_adminimize_disabled_admin_bar_administrator_items'] );
1504
  // update
1505
  if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
1506
  update_site_option( 'mw_adminimize', $adminimizeoptions );
1507
+ else
1508
  update_option( 'mw_adminimize', $adminimizeoptions );
1509
 
1510
  $myErrors = new _mw_adminimize_message_class();
1527
  * Install options in database
1528
  */
1529
  function _mw_adminimize_install() {
1530
+
1531
+ if ( ! is_admin() )
1532
+ return NULL;
1533
+
1534
  global $menu, $submenu;
1535
 
1536
  $user_roles = _mw_adminimize_get_all_user_roles();
adminimize_page.php CHANGED
@@ -21,9 +21,9 @@ function _mw_adminimize_options() {
21
  $_mw_adminimize_user_info = '';
22
 
23
  //get array with userroles
24
- $user_roles = _mw_adminimize_get_all_user_roles();
25
  $user_roles_names = _mw_adminimize_get_all_user_roles_names();
26
-
27
  // update options
28
  if ( ( isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_insert') && $_POST['_mw_adminimize_save'] ) {
29
 
@@ -112,6 +112,7 @@ function _mw_adminimize_options() {
112
  ?>
113
  <div class="wrap">
114
  <?php
 
115
  // Backend Options for all roles
116
  require_once( 'inc-options/minimenu.php' );
117
  ?>
@@ -151,10 +152,14 @@ function _mw_adminimize_options() {
151
 
152
  // WP Nav Menu Options
153
  require_once('inc-options/wp_nav_menu_options.php');
 
 
154
  ?>
155
  </form>
156
 
157
  <?php
 
 
158
  // Theme Options
159
  require_once('inc-options/theme_options.php');
160
 
@@ -181,4 +186,3 @@ function _mw_adminimize_options() {
181
  </div>
182
  <?php
183
  }
184
- ?>
21
  $_mw_adminimize_user_info = '';
22
 
23
  //get array with userroles
24
+ $user_roles = _mw_adminimize_get_all_user_roles();
25
  $user_roles_names = _mw_adminimize_get_all_user_roles_names();
26
+
27
  // update options
28
  if ( ( isset($_POST['_mw_adminimize_action']) && $_POST['_mw_adminimize_action'] == '_mw_adminimize_insert') && $_POST['_mw_adminimize_save'] ) {
29
 
112
  ?>
113
  <div class="wrap">
114
  <?php
115
+ do_action( 'mw_adminimize_before_settings_form' );
116
  // Backend Options for all roles
117
  require_once( 'inc-options/minimenu.php' );
118
  ?>
152
 
153
  // WP Nav Menu Options
154
  require_once('inc-options/wp_nav_menu_options.php');
155
+
156
+ do_action( 'mw_adminimize_settings_form' );
157
  ?>
158
  </form>
159
 
160
  <?php
161
+ do_action( 'mw_adminimize_after_settings_form' );
162
+
163
  // Theme Options
164
  require_once('inc-options/theme_options.php');
165
 
186
  </div>
187
  <?php
188
  }
 
inc-options/admin_bar.php CHANGED
@@ -44,7 +44,6 @@ if ( ! isset( $wp_admin_bar ) )
44
  // add items to array for select
45
  $admin_bar_items = _mw_adminimize_get_admin_bar_items();
46
  foreach ( $admin_bar_items as $key => $value ) {
47
- //var_dump($admin_bar_items);exit;
48
 
49
  $is_parent = ! empty( $value->parent );
50
  $has_link = ! empty( $node->href );
44
  // add items to array for select
45
  $admin_bar_items = _mw_adminimize_get_admin_bar_items();
46
  foreach ( $admin_bar_items as $key => $value ) {
 
47
 
48
  $is_parent = ! empty( $value->parent );
49
  $has_link = ! empty( $node->href );
inc-options/backend_options.php CHANGED
@@ -159,10 +159,10 @@ if ( ! function_exists( 'add_action' ) ) {
159
  <?php
160
  // when remove dashboard
161
  foreach ($user_roles as $role) {
162
- $disabled_menu_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_menu_'. $role .'_items');
163
  $disabled_submenu_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_submenu_'. $role .'_items');
164
  }
165
-
166
  $disabled_menu_all = array();
167
  foreach ($user_roles as $role) {
168
  array_push($disabled_menu_all, $disabled_menu_[$role]);
159
  <?php
160
  // when remove dashboard
161
  foreach ($user_roles as $role) {
162
+ $disabled_menu_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_menu_'. $role .'_items');
163
  $disabled_submenu_[$role] = _mw_adminimize_get_option_value('mw_adminimize_disabled_submenu_'. $role .'_items');
164
  }
165
+
166
  $disabled_menu_all = array();
167
  foreach ($user_roles as $role) {
168
  array_push($disabled_menu_all, $disabled_menu_[$role]);
inc-options/class-eximport.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Aminimize - Ex- Import Part
4
+ *
5
+ * @license GPLv3
6
+ * @subpackage Aminimize Settings
7
+ * @author Frank Bueltge <frank@bueltge.de>
8
+ */
9
+
10
+ if ( ! function_exists( 'add_filter' ) ) {
11
+ echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
12
+ exit;
13
+ }
14
+
15
+ if ( ! class_exists( 'Adminimize_Eximport' ) ) :
16
+
17
+ add_action( 'plugins_loaded', array( 'Adminimize_Eximport', 'get_object' ) );
18
+ class Adminimize_Eximport {
19
+
20
+ protected static $classobj = NULL;
21
+
22
+ // string for nonce fields
23
+ static public $nonce_string;
24
+
25
+ public function __construct() {
26
+
27
+ if ( ! is_admin() )
28
+ return NULL;
29
+
30
+ self::$nonce_string = '_mw_adminimize_nonce';
31
+
32
+ if ( isset( $_GET['_mw_adminimize_export'] ) && check_admin_referer( self::$nonce_string ) )
33
+ $this->get_export_file();
34
+
35
+ if ( isset( $_POST['_mw_adminimize_import'] ) && check_admin_referer( self::$nonce_string ) )
36
+ $this->import_file();
37
+
38
+ add_action( 'mw_adminimize_after_settings_form', array( $this, 'get_im_export_part' ) );
39
+ }
40
+
41
+ /**
42
+ * Handler for the action 'init'. Instantiates this class.
43
+ *
44
+ * @access public
45
+ * @since 02/15/2013
46
+ * @return $classobj
47
+ */
48
+ public static function get_object() {
49
+
50
+ if ( NULL === self::$classobj ) {
51
+ self::$classobj = new self;
52
+ }
53
+
54
+ return self::$classobj;
55
+ }
56
+
57
+ /**
58
+ * get markup for ex- and import on settings page
59
+ *
60
+ * @access public
61
+ * @since 2.0.0
62
+ * @uses wp_nonce_field
63
+ * @return string
64
+ */
65
+ public function get_im_export_part() {
66
+ ?>
67
+ <div class="postbox">
68
+ <h3><span><?php _e( 'Export', FB_ADMINIMIZE_TEXTDOMAIN ); ?></span></h3>
69
+ <div class="inside">
70
+ <p><?php _e( 'When you click the button below the plugin will create an XML file for you to save to your computer.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p>
71
+ <p><?php _e( 'This format, a custom XML, will contain your options from quicktags.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p>
72
+ <p><?php _e( 'Once you’ve saved the download file, you can use the Import function in another WordPress installation to import this site.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p>
73
+ <form method="get" action="">
74
+ <?php wp_nonce_field( self::$nonce_string ); ?>
75
+ <p class="submit">
76
+ <input type="submit" name="submit" value="<?php _e( 'Download Export File', FB_ADMINIMIZE_TEXTDOMAIN ); ?> &raquo;" />
77
+ <input type="hidden" name="addquicktag_download" value="true" />
78
+ </p>
79
+ </form>
80
+ </div>
81
+ </div>
82
+
83
+ <div class="postbox">
84
+ <h3><span><?php _e( 'Import', FB_ADMINIMIZE_TEXTDOMAIN ); ?></span></h3>
85
+ <div class="inside">
86
+ <p><?php _e( 'If you have quicktags from other installs, the plugin can import those into this site. To get started, choose a file to import.', FB_ADMINIMIZE_TEXTDOMAIN ); ?></p>
87
+ <form method="post" action="" enctype="multipart/form-data">
88
+ <?php wp_nonce_field( self::$nonce_string ); ?>
89
+ <p class="submit">
90
+ <input type="file" name="xml" />
91
+ <input type="submit" name="submit" value="<?php _e( 'Upload file and import', FB_ADMINIMIZE_TEXTDOMAIN ); ?> &raquo;" />
92
+ <input type="hidden" name="addquicktag_import" value="true" />
93
+ </p>
94
+ </form>
95
+ </div>
96
+ </div>
97
+ <?php
98
+ }
99
+
100
+ /*
101
+ * Build export file, xml
102
+ *
103
+ * @access public
104
+ * @since 2.0.0
105
+ * @uses is_plugin_active_for_network, get_site_option, get_option
106
+ * @return string $xml
107
+ */
108
+ public function get_export_file() {
109
+
110
+ if ( is_multisite() && is_plugin_active_for_network( parent :: get_plugin_string() ) )
111
+ $options = get_site_option( parent :: get_option_string() );
112
+ else
113
+ $options = get_option( parent :: get_option_string() );
114
+
115
+ if ( $options['buttons'] ) {
116
+
117
+ $xml = '<?xml version="1.0" encoding="UTF-8"?>';
118
+ $xml .= "\n" . '<buttons>' . "\n";
119
+
120
+ for ( $i = 0; $i < count( $options['buttons'] ); $i++ ) {
121
+ $xml .= "\t" . '<quicktag>' . "\n";
122
+ foreach( $options['buttons'][$i] as $name => $value ) {
123
+
124
+ $value = stripslashes( $value );
125
+
126
+ if ( empty( $value ) ) {
127
+ $xml .= "\t\t" . '<' . $name . '/>' . "\n";
128
+ } elseif ( preg_match( '/^[0-9]*$/', $value ) ) {
129
+ $xml .= "\t\t" . '<' . $name . '>' . $value . '</' . $name . '>' . "\n";
130
+ } else {
131
+ $xml .= "\t\t" . '<' . $name . '><![CDATA[' . $value . ']]></' . $name . '>' . "\n";
132
+ }
133
+ }
134
+ $xml .= "\t" . '</quicktag>' . "\n";
135
+ }
136
+ $xml .= '</buttons>';
137
+
138
+ } else {
139
+ $xml = 'We dont find settings in database';
140
+ }
141
+
142
+ $filename = urlencode( 'addquicktag.' . date('Y-m-d') . '.xml' );
143
+ $filesize = strlen( $xml );
144
+
145
+ $this -> export_xml( $filename, $filesize, $filetype = 'text/xml' );
146
+ echo $xml;
147
+ exit;
148
+ }
149
+
150
+ /**
151
+ * Create download file
152
+ *
153
+ * @access public
154
+ * @since 2.0.0
155
+ * @param string $filename
156
+ * @param string $filesize
157
+ * @param string $filetype
158
+ * @uses get_option
159
+ * @return void
160
+ */
161
+ public function export_xml( $filename, $filesize, $filetype ) {
162
+
163
+ header( 'Content-Description: File Transfer' );
164
+ header( 'Content-Disposition: attachment; filename=' . $filename );
165
+ header( 'Content-Length: ' . $filesize );
166
+ header( 'Content-type: ' . $filetype . '; charset=' . get_option('blog_charset'), TRUE );
167
+ flush();
168
+ }
169
+
170
+ /**
171
+ * Import XML and update settings
172
+ *
173
+ * @access public
174
+ * @since 2.0.0
175
+ * @param string $filename
176
+ * @uses current_user_can, wp_die, is_plugin_active_for_network, update_site_option, update_option
177
+ * @return void
178
+ */
179
+ public function import_file( $filename = FALSE ) {
180
+
181
+ if ( ! current_user_can( 'manage_options' ) )
182
+ wp_die( __('Options not update - you don&lsquo;t have the privilidges to do this!', FB_ADMINIMIZE_TEXTDOMAIN ) );
183
+
184
+ // use tmp file
185
+ if ( ! $filename )
186
+ $filename = $_FILES['xml']['tmp_name'];
187
+
188
+ $filename = preg_replace( "/\<\!\[CDATA\[(.*?)\]\]\>/ies", "'[CDATA]' . base64_encode('$1') . '[/CDATA]'", $filename );
189
+ $filename = utf8_encode( $filename );
190
+ $matches = simplexml_load_file( $filename );
191
+
192
+ // create array from xml
193
+ $button = array();
194
+ foreach ( $matches -> quicktag as $key ) {
195
+ foreach ($key as $value) {
196
+ $buttons[$value -> getName()] = $value;
197
+ }
198
+ $button[] = $buttons;
199
+ }
200
+ $options['buttons'] = $button;
201
+ // validate the values from xml
202
+ $options = parent :: validate_settings($options);
203
+
204
+ // update settings in database
205
+ if ( is_multisite() && is_plugin_active_for_network( parent :: get_plugin_string() ) )
206
+ update_site_option( parent :: get_option_string(), $options );
207
+ else
208
+ update_option( parent :: get_option_string(), $options );
209
+ }
210
+
211
+ } // end class
212
+
213
+ endif;
inc-setup/admin-bar-items.php CHANGED
@@ -20,18 +20,25 @@ add_action( 'wp_before_admin_bar_render', '_mw_adminimize_get_admin_bar_nodes' )
20
  function _mw_adminimize_get_admin_bar_nodes() {
21
 
22
  // Update only on Adminimize Settings page
23
- if ( isset( $GLOBALS['current_screen']->base ) &&
24
  'settings_page_adminimize/adminimize' !== $GLOBALS['current_screen']->base
25
  )
26
  return NULL;
27
 
 
 
 
28
  global $wp_admin_bar;
29
  // @see: http://codex.wordpress.org/Function_Reference/get_nodes
30
  $all_toolbar_nodes = $wp_admin_bar->get_nodes();
31
 
32
  if ( $all_toolbar_nodes ) {
33
  // get all options
34
- $adminimizeoptions = get_option( 'mw_adminimize' );
 
 
 
 
35
  // add admin bar array
36
  $adminimizeoptions['mw_adminimize_admin_bar_nodes'] = $all_toolbar_nodes;
37
 
@@ -55,7 +62,7 @@ function _mw_adminimize_get_admin_bar_items() {
55
  return $admin_bar_items;
56
  }
57
 
58
- add_action( 'admin_bar_menu', '_mw_adminimize_change_admin_bar', 999 );
59
  /**
60
  * Remove items in Admin Bar for current role of current active user
61
  * Exclude Super Admin, if active
@@ -66,16 +73,16 @@ add_action( 'admin_bar_menu', '_mw_adminimize_change_admin_bar', 999 );
66
  */
67
  function _mw_adminimize_change_admin_bar( $wp_admin_bar ) {
68
 
69
- // exclude super admin
70
- if ( _mw_adminimize_exclude_super_admin() )
71
- return NULL;
72
-
73
- // exclude Adminimize Settings page
74
  if ( isset( $GLOBALS['current_screen']->base ) &&
75
- 'settings_page_adminimize/adminimize' !== $GLOBALS['current_screen']->base
76
  )
77
  return NULL;
78
 
 
 
 
 
79
  $user_roles = _mw_adminimize_get_all_user_roles();
80
 
81
  foreach ( $user_roles as $role ) {
20
  function _mw_adminimize_get_admin_bar_nodes() {
21
 
22
  // Update only on Adminimize Settings page
23
+ if ( ! isset( $GLOBALS['current_screen']->base ) ||
24
  'settings_page_adminimize/adminimize' !== $GLOBALS['current_screen']->base
25
  )
26
  return NULL;
27
 
28
+ if ( ! is_admin() )
29
+ return NULL;
30
+
31
  global $wp_admin_bar;
32
  // @see: http://codex.wordpress.org/Function_Reference/get_nodes
33
  $all_toolbar_nodes = $wp_admin_bar->get_nodes();
34
 
35
  if ( $all_toolbar_nodes ) {
36
  // get all options
37
+ if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
38
+ $adminimizeoptions = get_site_option( 'mw_adminimize' );
39
+ else
40
+ $adminimizeoptions = get_option( 'mw_adminimize' );
41
+
42
  // add admin bar array
43
  $adminimizeoptions['mw_adminimize_admin_bar_nodes'] = $all_toolbar_nodes;
44
 
62
  return $admin_bar_items;
63
  }
64
 
65
+ add_action( 'admin_bar_menu', '_mw_adminimize_change_admin_bar', 99999 );
66
  /**
67
  * Remove items in Admin Bar for current role of current active user
68
  * Exclude Super Admin, if active
73
  */
74
  function _mw_adminimize_change_admin_bar( $wp_admin_bar ) {
75
 
76
+ // Don't filter on settings page
 
 
 
 
77
  if ( isset( $GLOBALS['current_screen']->base ) &&
78
+ 'settings_page_adminimize/adminimize' == $GLOBALS['current_screen']->base
79
  )
80
  return NULL;
81
 
82
+ // Exclude super admin
83
+ if ( _mw_adminimize_exclude_super_admin() )
84
+ return NULL;
85
+
86
  $user_roles = _mw_adminimize_get_all_user_roles();
87
 
88
  foreach ( $user_roles as $role ) {
inc-setup/admin-footer.php CHANGED
@@ -9,6 +9,9 @@ if ( ! function_exists( 'add_action' ) ) {
9
  exit;
10
  }
11
 
 
 
 
12
  // on init of WordPress
13
  add_action( 'admin_init', '_mw_adminimize_init_admin_footer' );
14
 
9
  exit;
10
  }
11
 
12
+ if ( ! is_admin() )
13
+ return NULL;
14
+
15
  // on init of WordPress
16
  add_action( 'admin_init', '_mw_adminimize_init_admin_footer' );
17
 
inc-setup/dashboard.php CHANGED
@@ -1,14 +1,17 @@
1
  <?php
2
  /**
3
- * @package Adminimize
4
- * @subpackage Dashboard Setup
5
- * @author Frank Bültge
6
  */
7
  if ( ! function_exists( 'add_action' ) ) {
8
  echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
9
  exit;
10
  }
11
 
 
 
 
12
  // retrun registered widgets; only on page index/dashboard :(
13
  add_action( 'wp_dashboard_setup', '_mw_adminimize_dashboard_setup', 99 );
14
 
@@ -24,6 +27,7 @@ function _mw_adminimize_dashboard_setup() {
24
  $adminimizeoptions['mw_adminimize_dashboard_widgets'] = $widgets;
25
 
26
  if ( current_user_can( 'manage_options' ) ) {
 
27
  if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
28
  update_site_option( 'mw_adminimize', $adminimizeoptions );
29
  else
@@ -49,6 +53,7 @@ function _mw_adminimize_dashboard_setup() {
49
 
50
  foreach ( $user_roles as $role ) {
51
  $user = wp_get_current_user();
 
52
  if ( is_array( $user->roles) && in_array( $role, $user->roles) ) {
53
  if ( current_user_can( $role ) && is_array( $disabled_dashboard_option_[$role] ) ) {
54
  foreach( $disabled_dashboard_option_[$role] as $widget ) {
@@ -66,6 +71,7 @@ function _mw_adminimize_get_dashboard_widgets () {
66
 
67
  $widgets = array();
68
  if ( isset($wp_meta_boxes['dashboard']) ) {
 
69
  foreach( $wp_meta_boxes['dashboard'] as $context => $data ) {
70
  foreach( $data as $priority => $data ) {
71
  foreach( $data as $widget => $data ) {
@@ -80,6 +86,8 @@ function _mw_adminimize_get_dashboard_widgets () {
80
  }
81
  }
82
  }
 
83
  }
 
84
  return $widgets;
85
  }
1
  <?php
2
  /**
3
+ * @package Adminimize
4
+ * @subpackage Dashboard Setup
5
+ * @author Frank Bültge
6
  */
7
  if ( ! function_exists( 'add_action' ) ) {
8
  echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
9
  exit;
10
  }
11
 
12
+ if ( ! is_admin() )
13
+ return NULL;
14
+
15
  // retrun registered widgets; only on page index/dashboard :(
16
  add_action( 'wp_dashboard_setup', '_mw_adminimize_dashboard_setup', 99 );
17
 
27
  $adminimizeoptions['mw_adminimize_dashboard_widgets'] = $widgets;
28
 
29
  if ( current_user_can( 'manage_options' ) ) {
30
+
31
  if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
32
  update_site_option( 'mw_adminimize', $adminimizeoptions );
33
  else
53
 
54
  foreach ( $user_roles as $role ) {
55
  $user = wp_get_current_user();
56
+
57
  if ( is_array( $user->roles) && in_array( $role, $user->roles) ) {
58
  if ( current_user_can( $role ) && is_array( $disabled_dashboard_option_[$role] ) ) {
59
  foreach( $disabled_dashboard_option_[$role] as $widget ) {
71
 
72
  $widgets = array();
73
  if ( isset($wp_meta_boxes['dashboard']) ) {
74
+
75
  foreach( $wp_meta_boxes['dashboard'] as $context => $data ) {
76
  foreach( $data as $priority => $data ) {
77
  foreach( $data as $widget => $data ) {
86
  }
87
  }
88
  }
89
+
90
  }
91
+
92
  return $widgets;
93
  }
inc-setup/meta-boxes.php CHANGED
@@ -9,6 +9,10 @@ if ( ! function_exists( 'add_action' ) ) {
9
  echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
10
  exit;
11
  }
 
 
 
 
12
  // The global var is only usable on edit Post Type page
13
  add_filter( 'do_meta_boxes', '_mw_adminimize_get_all_meta_boxes', 0, 3 );
14
  function _mw_adminimize_get_all_meta_boxes( $post_type, $priority, $post ) {
@@ -17,7 +21,11 @@ function _mw_adminimize_get_all_meta_boxes( $post_type, $priority, $post ) {
17
  if ( ! empty( $wp_meta_boxes[$post_type] ) ) {
18
 
19
  // get all options
20
- $adminimizeoptions = get_option( 'mw_adminimize' );
 
 
 
 
21
  // add admin bar array
22
  $adminimizeoptions['mw_adminimize_meta_boxes_' . $post_type ] = $wp_meta_boxes[$post_type];
23
 
9
  echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
10
  exit;
11
  }
12
+
13
+ if ( ! is_admin() )
14
+ return NULL;
15
+
16
  // The global var is only usable on edit Post Type page
17
  add_filter( 'do_meta_boxes', '_mw_adminimize_get_all_meta_boxes', 0, 3 );
18
  function _mw_adminimize_get_all_meta_boxes( $post_type, $priority, $post ) {
21
  if ( ! empty( $wp_meta_boxes[$post_type] ) ) {
22
 
23
  // get all options
24
+ if ( is_multisite() && is_plugin_active_for_network( MW_ADMIN_FILE ) )
25
+ $adminimizeoptions = get_site_option( 'mw_adminimize' );
26
+ else
27
+ $adminimizeoptions = get_option( 'mw_adminimize' );
28
+
29
  // add admin bar array
30
  $adminimizeoptions['mw_adminimize_meta_boxes_' . $post_type ] = $wp_meta_boxes[$post_type];
31
 
inc-setup/widget.php CHANGED
@@ -10,6 +10,9 @@ if ( ! function_exists( 'add_action' ) ) {
10
  exit;
11
  }
12
 
 
 
 
13
  function _mw_adminimize_get_all_widgets() {
14
  global $wp_widget_factory;
15
 
10
  exit;
11
  }
12
 
13
+ if ( ! is_admin() )
14
+ return NULL;
15
+
16
  function _mw_adminimize_get_all_widgets() {
17
  global $wp_widget_factory;
18
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: color, scheme, theme, admin, dashboard, color scheme, plugin, interface, ui, metabox, hide, editor, minimal, menu, customization, interface, administration, lite, light, usability, lightweight, layout, zen
5
  Requires at least: 2.5
6
  Tested up to: 3.6-alpha
7
- Stable tag: 1.8.1
8
 
9
  Adminimize is a WordPress plugin that lets you hide 'unnecessary' items from the WordPress backend and many many more ...
10
 
@@ -89,8 +89,10 @@ See on [the official website](http://bueltge.de/wordpress-admin-theme-adminimize
89
  1. Adminimize Theme how in WordPress 2.3
90
 
91
  == Changelog ==
92
- = 1.8.2 (01/11/2013) =
93
  * Fix PHP Notice message for empty var, see [support](http://wordpress.org/support/topic/undefined-index-current_screen)
 
 
94
 
95
  = 1.8.1 (01/10/2013) =
96
  * Fix PHP notice on message for network
@@ -98,8 +100,8 @@ See on [the official website](http://bueltge.de/wordpress-admin-theme-adminimize
98
  * Add Widget settings (Beta)
99
  * Fix for remove admin bar in backend
100
  * Remove Backend options, there not usable with WP 3.5 and earlier
101
- * Fix 'Category Height' in post to use also in newer versions of WP
102
- * Fix to hide foorer, but it is usable to add custom content
103
  * Fix Hints, Options for Multisite install
104
  * Add Admin Bar options (Beta)
105
 
4
  Tags: color, scheme, theme, admin, dashboard, color scheme, plugin, interface, ui, metabox, hide, editor, minimal, menu, customization, interface, administration, lite, light, usability, lightweight, layout, zen
5
  Requires at least: 2.5
6
  Tested up to: 3.6-alpha
7
+ Stable tag: 1.8.2
8
 
9
  Adminimize is a WordPress plugin that lets you hide 'unnecessary' items from the WordPress backend and many many more ...
10
 
89
  1. Adminimize Theme how in WordPress 2.3
90
 
91
  == Changelog ==
92
+ = 1.8.2 (02/15/2013) =
93
  * Fix PHP Notice message for empty var, see [support](http://wordpress.org/support/topic/undefined-index-current_screen)
94
+ * Changes for load files and functions only, if it necessary
95
+ * Fix, that the changes on Admin Bar work always in all admin pages
96
 
97
  = 1.8.1 (01/10/2013) =
98
  * Fix PHP notice on message for network
100
  * Add Widget settings (Beta)
101
  * Fix for remove admin bar in backend
102
  * Remove Backend options, there not usable with WP 3.5 and earlier
103
+ * Fix 'Category Height' on Meta Box on write post; See always all categories, without scolling inside Meta Box
104
+ * Fix to hide footer, but this is still usable by adding custom content
105
  * Fix Hints, Options for Multisite install
106
  * Add Admin Bar options (Beta)
107