Adminimize - Version 1.11.4

Version Description

Download this release

Release Info

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

Code changes from version 1.11.3 to 1.11.4

adminimize.php CHANGED
@@ -7,7 +7,7 @@
7
  * Description: Visually compresses the administrative 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 all 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.
8
  * Author: Frank Bültge
9
  * Author URI: http://bueltge.de/
10
- * Version: 1.11.3
11
  * License: GPLv3+
12
  *
13
  * Php Version 5.6
@@ -15,7 +15,7 @@
15
  * @package WordPress
16
  * @author Frank Bültge <frank@bueltge.de>
17
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
18
- * @version 2017-11-16
19
  */
20
 
21
  /**
@@ -110,11 +110,11 @@ function _mw_adminimize_exclude_settings_page() {
110
 
111
  $screen = $page;
112
  if ( function_exists( 'get_current_screen' ) ) {
113
- $screen = get_current_screen();
114
  }
115
 
116
- if ( isset( $screen->id ) ) {
117
- $screen = $screen->id;
118
  }
119
 
120
  // Don't filter on settings page
@@ -378,12 +378,16 @@ function _mw_adminimize_admin_init() {
378
  $disabled_metaboxes_post_all
379
  )
380
  ) {
381
- add_filter(
382
- 'wp_default_editor',
383
- function() {
384
- return 'tinymce';
385
- }
386
- );
 
 
 
 
387
  }
388
 
389
  // Remove media buttons
@@ -424,7 +428,8 @@ function _mw_adminimize_admin_init() {
424
  }
425
 
426
  // Change menu via settings of Adminimize.
427
- add_action( 'custom_menu_order', '_mw_adminimize_set_menu_option', 99999 );
 
428
 
429
  // global_options
430
  add_action( 'admin_head', '_mw_adminimize_set_global_option', 1 );
@@ -434,7 +439,6 @@ if ( is_admin() ) {
434
  add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
435
  add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
436
  }
437
- add_action( 'init', '_mw_adminimize_set_logout_menu', 2 );
438
 
439
  register_activation_hook( __FILE__, '_mw_adminimize_install' );
440
  register_uninstall_hook( __FILE__, '_mw_adminimize_uninstall' );
@@ -620,21 +624,15 @@ function _mw_adminimize_set_menu_option() {
620
  _mw_adminimize_debug( $mw_adminimize_menu, 'Adminimize, Menu Slugs to hide after Filter.' );
621
  _mw_adminimize_debug( $mw_adminimize_menu, 'Adminimize, Sub-Menu Slugs to hide after Filter.' );
622
 
623
- /**
624
- * @ToDo Remove it after feedback from users.
625
- *
626
- // Fallback on users.php on all user roles smaller admin.
627
- if ( in_array( 'users.php', $mw_adminimize_menu, TRUE ) ) {
628
- $mw_adminimize_menu[] = 'profile.php';
629
- }
630
- */
631
  foreach ( $menu as $key => $item ) {
632
 
 
 
633
  // Menu
634
  if ( isset( $item[ 2 ] ) ) {
635
  $menu_slug = $item[ 2 ];
636
  // Check, if the Menu item in the current user role settings?
637
- if ( in_array( $menu_slug, $mw_adminimize_menu, TRUE )
638
  ) {
639
  remove_menu_page( $menu_slug );
640
  // Prevent access to the page with the slug, there was inactive.
@@ -1079,10 +1077,6 @@ require_once 'inc-setup/widget.php';
1079
  require_once 'inc-setup/footer.php';
1080
  require_once 'inc-setup/admin-footer.php';
1081
 
1082
- // global settings
1083
- // @TODO Testing, not ready for productive
1084
- //require_once( 'inc-options/settings_notice.php' );
1085
-
1086
  // remove admin bar
1087
  require_once 'inc-setup/remove-admin-bar.php';
1088
 
@@ -1116,8 +1110,7 @@ function _mw_adminimize_filter_plugin_meta( $links, $file ) {
1116
  array_unshift(
1117
  $links,
1118
  sprintf(
1119
- '<a href="options-general.php?page=%s">%s</a>',
1120
- FB_ADMINIMIZE_BASENAME,
1121
  esc_attr__( 'Settings' )
1122
  )
1123
  );
@@ -1168,31 +1161,6 @@ function _mw_adminimize_on_load_page() {
1168
  wp_enqueue_script( 'adminimize-settings-script' );
1169
  }
1170
 
1171
- /**
1172
- * Set theme for users
1173
- * Kill with version 1.7.18
1174
- * @ToDo Remove for the feature releases.
1175
- */
1176
- function _mw_adminimize_set_theme() {
1177
-
1178
- if ( ! current_user_can( 'edit_users' ) ) {
1179
- wp_die( esc_attr__( 'Cheatin&#8217; uh?' ) );
1180
- }
1181
-
1182
- $user_ids = (array) $_POST[ 'mw_adminimize_theme_items' ];
1183
- $admin_color = htmlspecialchars( stripslashes( $_POST[ '_mw_adminimize_set_theme' ] ) );
1184
-
1185
- if ( ! $user_ids ) {
1186
- return FALSE;
1187
- }
1188
-
1189
- foreach ( $user_ids as $user_id ) {
1190
- update_user_meta( $user_id, 'admin_color', $admin_color );
1191
- }
1192
-
1193
- return TRUE;
1194
- }
1195
-
1196
  /**
1197
  * Get setting value for each options key.
1198
  *
7
  * Description: Visually compresses the administrative 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 all 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.
8
  * Author: Frank Bültge
9
  * Author URI: http://bueltge.de/
10
+ * Version: 1.11.4
11
  * License: GPLv3+
12
  *
13
  * Php Version 5.6
15
  * @package WordPress
16
  * @author Frank Bültge <frank@bueltge.de>
17
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
18
+ * @version 2017-12-14
19
  */
20
 
21
  /**
110
 
111
  $screen = $page;
112
  if ( function_exists( 'get_current_screen' ) ) {
113
+ $screen_tmp = get_current_screen();
114
  }
115
 
116
+ if ( isset( $screen_tmp->id ) && null !== $screen_tmp->id ) {
117
+ $screen = $screen_tmp->id;
118
  }
119
 
120
  // Don't filter on settings page
378
  $disabled_metaboxes_post_all
379
  )
380
  ) {
381
+ add_filter( 'wp_default_editor', '_mw_admininimize_return_tinmyce' );
382
+ /**
383
+ * Return string tinymce.
384
+ * Necessary for php 5.2 usage :(; not possible to use an anonymous function.
385
+ *
386
+ * @return string
387
+ */
388
+ function _mw_admininimize_return_tinmyce() {
389
+ return 'tinymce';
390
+ }
391
  }
392
 
393
  // Remove media buttons
428
  }
429
 
430
  // Change menu via settings of Adminimize.
431
+ //add_filter( 'custom_menu_order', '__return_true' );
432
+ add_filter( 'admin_menu', '_mw_adminimize_set_menu_option', 99999 );
433
 
434
  // global_options
435
  add_action( 'admin_head', '_mw_adminimize_set_global_option', 1 );
439
  add_action( 'admin_menu', '_mw_adminimize_add_settings_page' );
440
  add_action( 'admin_menu', '_mw_adminimize_remove_dashboard' );
441
  }
 
442
 
443
  register_activation_hook( __FILE__, '_mw_adminimize_install' );
444
  register_uninstall_hook( __FILE__, '_mw_adminimize_uninstall' );
624
  _mw_adminimize_debug( $mw_adminimize_menu, 'Adminimize, Menu Slugs to hide after Filter.' );
625
  _mw_adminimize_debug( $mw_adminimize_menu, 'Adminimize, Sub-Menu Slugs to hide after Filter.' );
626
 
 
 
 
 
 
 
 
 
627
  foreach ( $menu as $key => $item ) {
628
 
629
+ _mw_adminimize_debug( $item, 'Adminimize, Each Menu Item Array to check for hiding.' );
630
+
631
  // Menu
632
  if ( isset( $item[ 2 ] ) ) {
633
  $menu_slug = $item[ 2 ];
634
  // Check, if the Menu item in the current user role settings?
635
+ if ( in_array( $menu_slug, $mw_adminimize_menu, false )
636
  ) {
637
  remove_menu_page( $menu_slug );
638
  // Prevent access to the page with the slug, there was inactive.
1077
  require_once 'inc-setup/footer.php';
1078
  require_once 'inc-setup/admin-footer.php';
1079
 
 
 
 
 
1080
  // remove admin bar
1081
  require_once 'inc-setup/remove-admin-bar.php';
1082
 
1110
  array_unshift(
1111
  $links,
1112
  sprintf(
1113
+ '<a href="options-general.php?page=adminimize-options">%s</a>',
 
1114
  esc_attr__( 'Settings' )
1115
  )
1116
  );
1161
  wp_enqueue_script( 'adminimize-settings-script' );
1162
  }
1163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1164
  /**
1165
  * Get setting value for each options key.
1166
  *
adminimize_page.php CHANGED
@@ -198,10 +198,6 @@ function _mw_adminimize_options() {
198
  <?php
199
  do_action( 'mw_adminimize_after_settings_form' );
200
 
201
- // Theme Options
202
- // @ToDo Remove for the feature releases.
203
- //require_once 'inc-options/theme_options.php';
204
-
205
  // Im/Export Options
206
  require_once 'inc-options/im_export_options.php';
207
 
198
  <?php
199
  do_action( 'mw_adminimize_after_settings_form' );
200
 
 
 
 
 
201
  // Im/Export Options
202
  require_once 'inc-options/im_export_options.php';
203
 
inc-options/menu_options.php CHANGED
@@ -107,32 +107,18 @@ if ( ! function_exists( 'add_action' ) ) {
107
 
108
  $i = 0;
109
  $x = 0;
110
-
111
- /**
112
- * @ToDo Remove it after feedback from users.
113
- *
114
- $users = array(
115
- 0 => 'Profile',
116
- 1 => 'edit_users',
117
- 2 => 'profile.php',
118
- 3 => '',
119
- 4 => 'menu-top',
120
- 5 => 'menu-users',
121
- 6 => 'div',
122
- );
123
- */
124
-
125
  foreach ( $wp_menu as $key => $item ) {
126
 
127
  $menu_slug = $item[ 2 ];
128
 
129
  // non checked items
 
130
  if ( $menu_slug === 'options-general.php' ) {
131
  $disabled_item_adm_hint = '<abbr title="' . esc_attr__(
132
- 'After activate the checkbox you will loose its easy access in the menu.', 'adminimize'
133
  ) . '" style="cursor:pointer;"> ! </acronym>';
134
  } else {
135
- $disabled_item_adm = '';
136
  $disabled_item_adm_hint = '';
137
  }
138
 
@@ -194,26 +180,6 @@ if ( ! function_exists( 'add_action' ) ) {
194
  }
195
  echo '</tr>';
196
 
197
- /**
198
- * @ToDo Remove it after feedback from users.
199
- *
200
- // Only for user smaller administrator, change user-Profile-File.
201
- if ( 'users.php' === $menu_slug ) {
202
- $x ++;
203
- echo '<tr>' . "\n";
204
- echo "\t" . '<th>' . esc_attr__( 'Profile' ) . ' <span>(profile.php)</span> </th>';
205
- foreach ( $user_roles as $role ) {
206
- echo "\t" . '<td class="num"><input disabled="disabled" id="check_menu'
207
- . $role . $x . '" class="menu_options_'
208
- . preg_replace( '/[^a-z0-9_-]+/', '', $role )
209
- . '" type="checkbox"' . $checked_user_role_[ $role ]
210
- . ' name="mw_adminimize_disabled_menu_' . $role
211
- . '_items[]" value="profile.php" /></td>' . "\n";
212
- }
213
- echo '</tr>';
214
- }
215
- */
216
-
217
  $x ++;
218
 
219
  if ( ! isset( $wp_submenu[ $menu_slug ] ) ) {
@@ -357,4 +323,4 @@ if ( ! function_exists( 'add_action' ) ) {
357
 
358
  </div>
359
  </div>
360
- </div>
107
 
108
  $i = 0;
109
  $x = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  foreach ( $wp_menu as $key => $item ) {
111
 
112
  $menu_slug = $item[ 2 ];
113
 
114
  // non checked items
115
+ $disabled_item_adm = '';
116
  if ( $menu_slug === 'options-general.php' ) {
117
  $disabled_item_adm_hint = '<abbr title="' . esc_attr__(
118
+ 'After activation of this checkbox you will loose the easy access to the settings area inside the menu.', 'adminimize'
119
  ) . '" style="cursor:pointer;"> ! </acronym>';
120
  } else {
121
+
122
  $disabled_item_adm_hint = '';
123
  }
124
 
180
  }
181
  echo '</tr>';
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  $x ++;
184
 
185
  if ( ! isset( $wp_submenu[ $menu_slug ] ) ) {
323
 
324
  </div>
325
  </div>
326
+ </div>
inc-options/minimenu.php CHANGED
@@ -118,13 +118,6 @@ if ( _mw_adminimize_is_active_on_multisite() ) {
118
  'WP Nav Menu', 'adminimize'
119
  ); ?></a></td>
120
  </tr>
121
- <!-- @ToDo Remove for the feature releases.
122
- <tr>
123
- <td class="row-title"><a href="#set_theme"><?php esc_attr_e(
124
- 'Set Theme', 'adminimize'
125
- ); ?></a></td>
126
- </tr>
127
- -->
128
  <tr>
129
  <td class="row-title"><a href="#import"><?php esc_attr_e(
130
  'Export/Import Options', 'adminimize'
118
  'WP Nav Menu', 'adminimize'
119
  ); ?></a></td>
120
  </tr>
 
 
 
 
 
 
 
121
  <tr>
122
  <td class="row-title"><a href="#import"><?php esc_attr_e(
123
  'Export/Import Options', 'adminimize'
inc-setup/export.php CHANGED
@@ -42,12 +42,16 @@ function _mw_adminimize_export_json() {
42
  }
43
 
44
  $settings = _mw_adminimize_get_option_value();
 
45
 
46
  ignore_user_abort( TRUE );
47
 
48
  nocache_headers();
 
49
  header( 'Content-Type: application/json; charset=utf-8' );
50
- header( 'Content-Disposition: attachment; filename=mw_adminimize-settings-export-' . date( 'm-d-Y' ) . '.json' );
 
 
51
  header( 'Expires: 0' );
52
 
53
  echo wp_json_encode( $settings );
42
  }
43
 
44
  $settings = _mw_adminimize_get_option_value();
45
+ $filepath = 'mw_adminimize-settings-export-' . date( 'm-d-Y' ) . '.json';
46
 
47
  ignore_user_abort( TRUE );
48
 
49
  nocache_headers();
50
+ header( 'Cache-Control: public' );
51
  header( 'Content-Type: application/json; charset=utf-8' );
52
+ header( 'Content-Transfer-Encoding: binary' );
53
+ header( 'Content-Disposition: attachment; filename=' . $filepath );
54
+ //header( 'Content-Length: ' . filesize( $filepath ) );
55
  header( 'Expires: 0' );
56
 
57
  echo wp_json_encode( $settings );
inc-setup/helping_hands.php CHANGED
@@ -81,6 +81,11 @@ function _mw_adminimize_current_user_has_role( $role ) {
81
  */
82
  function _mw_adminimize_debug( $data, $description = '' ) {
83
 
 
 
 
 
 
84
  if ( ! _mw_adminimize_get_option_value( 'mw_adminimize_debug' ) ) {
85
  return;
86
  }
81
  */
82
  function _mw_adminimize_debug( $data, $description = '' ) {
83
 
84
+ // Don't run on export data of Adminimize settings.
85
+ if ( isset( $_POST[ '_mw_adminimize_export' ] ) ) {
86
+ return;
87
+ }
88
+
89
  if ( ! _mw_adminimize_get_option_value( 'mw_adminimize_debug' ) ) {
90
  return;
91
  }
inc-setup/import.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package Adminimize
6
  * @subpackage import
7
  * @author Frank Bültge
8
- * @version 2017-04-13
9
  */
10
 
11
  if ( ! function_exists( 'add_action' ) ) {
@@ -45,15 +45,30 @@ function _mw_adminimize_import_json() {
45
  $tmp = explode( '/', $type );
46
  $extension = end( $tmp );
47
 
48
- if ( 'json' !== $extension ) {
 
 
 
 
 
 
 
 
 
49
  wp_die(
50
- esc_attr__( 'Please upload a valid .json file', 'adminimize' )
 
 
 
51
  );
52
  }
53
 
54
- if ( empty( $path ) ) {
55
  wp_die(
56
- esc_attr__( 'Please upload a file to import', 'adminimize' )
 
 
 
57
  );
58
  }
59
 
@@ -64,4 +79,5 @@ function _mw_adminimize_import_json() {
64
  unlink( $path );
65
 
66
  _mw_adminimize_update_option( $settings );
67
- }
 
5
  * @package Adminimize
6
  * @subpackage import
7
  * @author Frank Bültge
8
+ * @version 2017-11-29
9
  */
10
 
11
  if ( ! function_exists( 'add_action' ) ) {
45
  $tmp = explode( '/', $type );
46
  $extension = end( $tmp );
47
 
48
+ // Fallback, if we have no file information on server.
49
+ $extension_types = array( 'octet-stream' );
50
+ if ( in_array( $extension, $extension_types, false ) ) {
51
+ $finfo = new finfo(FILEINFO_MIME_TYPE);
52
+ $extension = $finfo->file( $_FILES[ 'import_file' ][ 'tmp_name' ] );
53
+ }
54
+
55
+ $extension_allow = array( 'json', 'text/plain', 'text/html' );
56
+ if ( false !== $extension && ! in_array( $extension, $extension_allow, false ) ) {
57
+ var_dump('test');var_dump($extension);
58
  wp_die(
59
+ sprintf(
60
+ esc_attr__( 'Please upload a valid .json file, Extension check. Your file have the extension %s.', 'adminimize' ),
61
+ '<code>' . $extension . '</code>'
62
+ )
63
  );
64
  }
65
 
66
+ if ( empty( $path ) || ! is_readable( $path ) ) {
67
  wp_die(
68
+ sprintf(
69
+ esc_attr__( 'It is not possible to find a file in %s', 'adminimize' ),
70
+ $path
71
+ )
72
  );
73
  }
74
 
79
  unlink( $path );
80
 
81
  _mw_adminimize_update_option( $settings );
82
+ wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/options-general.php?page=adminimize-options' );
83
+ }
inc-setup/remove-admin-bar.php CHANGED
@@ -108,6 +108,7 @@ function _mw_adminimize_add_user_logout( $wp_admin_bar ) {
108
  );
109
  }
110
 
 
111
  /**
112
  * Change logout, user info link in Admin bar.
113
  *
108
  );
109
  }
110
 
111
+ add_action( 'init', '_mw_adminimize_set_logout_menu', 2 );
112
  /**
113
  * Change logout, user info link in Admin bar.
114
  *
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/FrankBueltge
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: 4.0
6
  Tested up to: 4.9
7
- Stable tag: 1.11.3
8
 
9
  Adminimize that lets you hide 'unnecessary' items from the WordPress backend
10
 
@@ -40,6 +40,12 @@ Use the installer via back-end of your install or ...
40
  4. Administrator can go to `Settings` > `Adminimize` menu and configure the plugin (Menu, Sub-menu, Meta boxes, ...)
41
 
42
  == Changelog ==
 
 
 
 
 
 
43
  1.11.3 (2017-11-16)
44
  * Added custom dashbaord options to admin head to hide it via css.
45
  * Added support of multiple roles for dashboard options.
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: 4.0
6
  Tested up to: 4.9
7
+ Stable tag: 1.11.4
8
 
9
  Adminimize that lets you hide 'unnecessary' items from the WordPress backend
10
 
40
  4. Administrator can go to `Settings` > `Adminimize` menu and configure the plugin (Menu, Sub-menu, Meta boxes, ...)
41
 
42
  == Changelog ==
43
+ 1.11.4 (2017-12-14)
44
+ * Fixed hide of menu items, if you use custom menu, see [wiki page](https://github.com/bueltge/Adminimize/wiki/Custom-Menu-Order)
45
+ * Fixed Import/Export for different server environments.
46
+ * Remove languge file on github, we use always the translation community from wordpress.org
47
+ * Fixed check for settings page of Adminimize, so that we see all options, areas of the install.
48
+
49
  1.11.3 (2017-11-16)
50
  * Added custom dashbaord options to admin head to hide it via css.
51
  * Added support of multiple roles for dashboard options.