Adminimize - Version 1.10.2

Version Description

(2016-03-10) = * Add possibility for custom menu slugs, especially for Plugins, Themes, there add different slug for different roles. * Add the possibility to use the WP object cache for settings, if the webspace support this, like Memcached, APC. * More clarity for the "own options" label.

Download this release

Release Info

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

Code changes from version 1.10.1 to 1.10.2

CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  ## 1.10.1 (2016-02-29)
2
  * Fix the Removing of Admin Color Scheme Select on the profile page.
3
  * Back-end options are also excluded on the settings page.
1
+ ## 1.10.2 (2016-03-10)
2
+ * Add possibility for custom menu slugs, especially for Plugins, Themes, there add different slug for different roles.
3
+ * Add the possibility to use the WP object cache for settings, if the webspace support this, like Memcached, APC.
4
+ * More clarity for the "own options" label.
5
+
6
  ## 1.10.1 (2016-02-29)
7
  * Fix the Removing of Admin Color Scheme Select on the profile page.
8
  * Back-end options are also excluded on the settings page.
adminimize.php CHANGED
@@ -7,13 +7,13 @@
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.10.1
11
  * License: GPLv3+
12
  *
13
  * @package WordPress
14
  * @author Frank Bültge <frank@bueltge.de>
15
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16
- * @version 2016-02-29
17
  */
18
 
19
  /**
@@ -578,6 +578,9 @@ function _mw_adminimize_set_menu_option() {
578
  return;
579
  }
580
 
 
 
 
581
  $user_roles = _mw_adminimize_get_all_user_roles();
582
  $disabled_menu_ = array();
583
  $disabled_submenu_ = array();
@@ -618,6 +621,20 @@ function _mw_adminimize_set_menu_option() {
618
  $mw_adminimize_submenu = _mw_adminimize_get_duplicate( $mw_adminimize_submenu );
619
  }
620
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
  // Fallback on users.php on all user roles smaller admin.
622
  if ( in_array( 'users.php', $mw_adminimize_menu, FALSE ) ) {
623
  $mw_adminimize_menu[] = 'profile.php';
@@ -1181,11 +1198,19 @@ function _mw_adminimize_set_theme() {
1181
  */
1182
  function _mw_adminimize_get_option_value( $key = FALSE ) {
1183
 
1184
- // check for use on multisite
1185
- if ( _mw_adminimize_is_active_on_multisite() ) {
1186
- $adminimizeoptions = (array) get_site_option( 'mw_adminimize', array() );
1187
- } else {
1188
- $adminimizeoptions = (array) get_option( 'mw_adminimize', array() );
 
 
 
 
 
 
 
 
1189
  }
1190
 
1191
  if ( ! $key ) {
@@ -1199,11 +1224,13 @@ function _mw_adminimize_get_option_value( $key = FALSE ) {
1199
  * Update options.
1200
  *
1201
  * @param array $options
 
 
1202
  */
1203
  function _mw_adminimize_update_option( $options ) {
1204
 
1205
  if ( ! current_user_can( 'manage_options' ) ) {
1206
- return;
1207
  }
1208
 
1209
  if ( _mw_adminimize_is_active_on_multisite() ) {
@@ -1211,6 +1238,8 @@ function _mw_adminimize_update_option( $options ) {
1211
  } else {
1212
  update_option( 'mw_adminimize', $options );
1213
  }
 
 
1214
  }
1215
 
1216
  /**
@@ -1237,6 +1266,12 @@ function _mw_adminimize_update() {
1237
  }
1238
 
1239
  // Plugin Self Settings.
 
 
 
 
 
 
1240
  if ( isset( $_POST[ 'mw_adminimize_multiple_roles' ] ) ) {
1241
  $adminimizeoptions[ 'mw_adminimize_multiple_roles' ] = (int) $_POST[ 'mw_adminimize_multiple_roles' ];
1242
  } else {
@@ -1353,6 +1388,22 @@ function _mw_adminimize_update() {
1353
  $adminimizeoptions[ 'mw_adminimize_disabled_submenu_' . $role . '_items' ] = array();
1354
  }
1355
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1356
 
1357
  // global_options, metaboxes update
1358
  foreach ( $user_roles as $role ) {
@@ -1566,13 +1617,21 @@ function _mw_adminimize_update() {
1566
  }
1567
 
1568
  // update
1569
- _mw_adminimize_update_option( $adminimizeoptions );
1570
 
1571
  $myErrors = new _mw_adminimize_message_class();
1572
- $myErrors = '<div id="message" class="updated fade"><p>' . $myErrors->get_error(
 
1573
  '_mw_adminimize_update'
1574
- ) . '</p></div>';
1575
- echo $myErrors;
 
 
 
 
 
 
 
1576
  }
1577
 
1578
  /**
@@ -1580,6 +1639,7 @@ function _mw_adminimize_update() {
1580
  */
1581
  function _mw_adminimize_uninstall() {
1582
 
 
1583
  delete_site_option( 'mw_adminimize' );
1584
  delete_option( 'mw_adminimize' );
1585
  }
@@ -1622,6 +1682,7 @@ function _mw_adminimize_install() {
1622
  } else {
1623
  add_option( 'mw_adminimize', $adminimizeoptions );
1624
  }
 
1625
  }
1626
 
1627
  /**
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.10.2
11
  * License: GPLv3+
12
  *
13
  * @package WordPress
14
  * @author Frank Bültge <frank@bueltge.de>
15
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
16
+ * @version 2016-03-10
17
  */
18
 
19
  /**
578
  return;
579
  }
580
 
581
+ _mw_adminimize_debug( $menu, 'Adminimize, WordPress Menu:' );
582
+ _mw_adminimize_debug( $submenu, 'Adminimize, WordPress Sub-Menu:' );
583
+
584
  $user_roles = _mw_adminimize_get_all_user_roles();
585
  $disabled_menu_ = array();
586
  $disabled_submenu_ = array();
621
  $mw_adminimize_submenu = _mw_adminimize_get_duplicate( $mw_adminimize_submenu );
622
  }
623
 
624
+ /*
625
+ // Define custom slugs.
626
+ // Default menu slug as Administrator => Custom value
627
+ $custom_menu = array(
628
+ 'vc-general' => 'vc-welcome'
629
+ );
630
+ // Custom Fall Backs for stupid plugins.
631
+ foreach ( $custom_menu as $slug => $custom_slug ) {
632
+ if ( in_array( $slug, $mw_adminimize_menu, FALSE ) ) {
633
+ $mw_adminimize_menu[] = $custom_slug;
634
+ }
635
+ }
636
+ */
637
+
638
  // Fallback on users.php on all user roles smaller admin.
639
  if ( in_array( 'users.php', $mw_adminimize_menu, FALSE ) ) {
640
  $mw_adminimize_menu[] = 'profile.php';
1198
  */
1199
  function _mw_adminimize_get_option_value( $key = FALSE ) {
1200
 
1201
+ $adminimizeoptions = FALSE;
1202
+ if ( ! _mw_adminimize_exclude_settings_page() ) {
1203
+ $adminimizeoptions = wp_cache_get( 'mw_adminimize' );
1204
+ }
1205
+
1206
+ if ( FALSE === $adminimizeoptions ) {
1207
+ // check for use on multisite
1208
+ if ( _mw_adminimize_is_active_on_multisite() ) {
1209
+ $adminimizeoptions = (array) get_site_option( 'mw_adminimize', array() );
1210
+ } else {
1211
+ $adminimizeoptions = (array) get_option( 'mw_adminimize', array() );
1212
+ }
1213
+ wp_cache_set( 'mw_adminimize', $adminimizeoptions );
1214
  }
1215
 
1216
  if ( ! $key ) {
1224
  * Update options.
1225
  *
1226
  * @param array $options
1227
+ *
1228
+ * @return bool
1229
  */
1230
  function _mw_adminimize_update_option( $options ) {
1231
 
1232
  if ( ! current_user_can( 'manage_options' ) ) {
1233
+ return FALSE;
1234
  }
1235
 
1236
  if ( _mw_adminimize_is_active_on_multisite() ) {
1238
  } else {
1239
  update_option( 'mw_adminimize', $options );
1240
  }
1241
+
1242
+ return TRUE;
1243
  }
1244
 
1245
  /**
1266
  }
1267
 
1268
  // Plugin Self Settings.
1269
+ if ( isset( $_POST[ 'mw_adminimize_debug' ] ) ) {
1270
+ $adminimizeoptions[ 'mw_adminimize_debug' ] = (int) $_POST[ 'mw_adminimize_debug' ];
1271
+ } else {
1272
+ $adminimizeoptions[ 'mw_adminimize_debug' ] = 0;
1273
+ }
1274
+
1275
  if ( isset( $_POST[ 'mw_adminimize_multiple_roles' ] ) ) {
1276
  $adminimizeoptions[ 'mw_adminimize_multiple_roles' ] = (int) $_POST[ 'mw_adminimize_multiple_roles' ];
1277
  } else {
1388
  $adminimizeoptions[ 'mw_adminimize_disabled_submenu_' . $role . '_items' ] = array();
1389
  }
1390
  }
1391
+ // own menu slug
1392
+ if ( isset( $_POST[ '_mw_adminimize_own_menu_slug' ] ) ) {
1393
+ $adminimizeoptions[ '_mw_adminimize_own_menu_slug' ] = stripslashes(
1394
+ $_POST[ '_mw_adminimize_own_menu_slug' ]
1395
+ );
1396
+ } else {
1397
+ $adminimizeoptions[ '_mw_adminimize_own_menu_slug' ] = '';
1398
+ }
1399
+ // own custom menu slug
1400
+ if ( isset( $_POST[ '_mw_adminimize_own_menu_custom_slug' ] ) ) {
1401
+ $adminimizeoptions[ '_mw_adminimize_own_menu_custom_slug' ] = stripslashes(
1402
+ $_POST[ '_mw_adminimize_own_menu_custom_slug' ]
1403
+ );
1404
+ } else {
1405
+ $adminimizeoptions[ '_mw_adminimize_own_menu_custom_slug' ] = '';
1406
+ }
1407
 
1408
  // global_options, metaboxes update
1409
  foreach ( $user_roles as $role ) {
1617
  }
1618
 
1619
  // update
1620
+ $update_status = _mw_adminimize_update_option( $adminimizeoptions );
1621
 
1622
  $myErrors = new _mw_adminimize_message_class();
1623
+ if ( $update_status ) {
1624
+ $message = $myErrors->get_error(
1625
  '_mw_adminimize_update'
1626
+ );
1627
+ } else {
1628
+ $message = $myErrors->get_error(
1629
+ '_mw_adminimize_access_denied'
1630
+ );
1631
+ }
1632
+ echo '<div id="message" class="notice notice-success"><p>' . $message . '</p></div>';
1633
+
1634
+ return TRUE;
1635
  }
1636
 
1637
  /**
1639
  */
1640
  function _mw_adminimize_uninstall() {
1641
 
1642
+ wp_cache_delete( 'mw_adminimize' );
1643
  delete_site_option( 'mw_adminimize' );
1644
  delete_option( 'mw_adminimize' );
1645
  }
1682
  } else {
1683
  add_option( 'mw_adminimize', $adminimizeoptions );
1684
  }
1685
+ wp_cache_add( 'mw_adminimize', $adminimizeoptions );
1686
  }
1687
 
1688
  /**
adminimize_page.php CHANGED
@@ -35,7 +35,6 @@ function _mw_adminimize_options() {
35
  check_admin_referer( 'mw_adminimize_nonce' );
36
 
37
  _mw_adminimize_update();
38
-
39
  } else {
40
  $myErrors = new _mw_adminimize_message_class();
41
  $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error(
35
  check_admin_referer( 'mw_adminimize_nonce' );
36
 
37
  _mw_adminimize_update();
 
38
  } else {
39
  $myErrors = new _mw_adminimize_message_class();
40
  $myErrors = '<div id="message" class="error"><p>' . $myErrors->get_error(
inc-options/dashboard_options.php CHANGED
@@ -149,9 +149,9 @@ if ( ! function_exists( 'add_action' ) ) {
149
  <tr>
150
  <th><?php esc_attr_e( 'Your own options', 'adminimize' );
151
  echo '<br />';
152
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
153
  <th><?php echo '<br />';
154
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
155
  </tr>
156
  </thead>
157
 
149
  <tr>
150
  <th><?php esc_attr_e( 'Your own options', 'adminimize' );
151
  echo '<br />';
152
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
153
  <th><?php echo '<br />';
154
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
155
  </tr>
156
  </thead>
157
 
inc-options/global_options.php CHANGED
@@ -129,9 +129,9 @@ if ( ! function_exists( 'add_action' ) ) {
129
  <tr>
130
  <th><?php esc_attr_e( 'Your own options', 'adminimize' );
131
  echo '<br />';
132
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
133
  <th><?php echo '<br />';
134
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
135
  </tr>
136
  </thead>
137
 
129
  <tr>
130
  <th><?php esc_attr_e( 'Your own options', 'adminimize' );
131
  echo '<br />';
132
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
133
  <th><?php echo '<br />';
134
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
135
  </tr>
136
  </thead>
137
 
inc-options/links_options.php CHANGED
@@ -130,9 +130,9 @@ if ( ! function_exists( 'add_action' ) ) {
130
  <tr>
131
  <th><?php esc_attr_e( 'Your own Link options', 'adminimize' );
132
  echo '<br />';
133
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
134
  <th><?php echo '<br />';
135
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
136
  </tr>
137
  </thead>
138
 
130
  <tr>
131
  <th><?php esc_attr_e( 'Your own Link options', 'adminimize' );
132
  echo '<br />';
133
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
134
  <th><?php echo '<br />';
135
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
136
  </tr>
137
  </thead>
138
 
inc-options/menu_options.php CHANGED
@@ -45,10 +45,10 @@ if ( ! function_exists( 'add_action' ) ) {
45
  echo '<td class="num">';
46
  echo '<span class="form-invalid">';
47
  echo '<input id="select_all" class="menu_options_' . $role_slug
48
- . '" type="checkbox" name="" value="" />';
49
  echo '</span>';
50
  echo '<input id="select_all" class="submenu_options_' . $role_slug
51
- . '" type="checkbox" name="" value="" />';
52
  echo '</td>' . "\n";
53
  } ?>
54
  </tr>
@@ -74,6 +74,25 @@ if ( ! function_exists( 'add_action' ) ) {
74
  $wp_submenu = $submenu;
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  foreach ( $user_roles as $role ) {
78
  $disabled_metaboxes_post_[ $role ] = _mw_adminimize_get_option_value(
79
  'mw_adminimize_disabled_metaboxes_post_' . $role . '_items'
@@ -83,7 +102,7 @@ if ( ! function_exists( 'add_action' ) ) {
83
  );
84
  }
85
 
86
- // print menu, submenu
87
  if ( isset( $wp_menu ) && '' !== $wp_menu ) {
88
 
89
  $i = 0;
@@ -124,7 +143,7 @@ if ( ! function_exists( 'add_action' ) ) {
124
  // checkbox checked
125
  $checked_user_role_[ $role ] = '';
126
  if ( isset( $disabled_menu_[ $role ] )
127
- && in_array( $menu_slug, $disabled_menu_[ $role ], FALSE )
128
  ) {
129
  $checked_user_role_[ $role ] = ' checked="checked"';
130
  }
@@ -134,18 +153,21 @@ if ( ! function_exists( 'add_action' ) ) {
134
  $item[ 0 ] = '<b><i>' . esc_attr__( 'No Title!', 'adminimize' ) . '</i></b>';
135
  }
136
 
 
 
 
 
 
137
  echo '<tr class="form-invalid">' . "\n";
138
  echo "\t";
139
  echo '<td>';
140
- echo '<b>&bull; ' . $item[ 0 ] . '</b> <small>' . esc_attr__(
141
- 'Group', 'adminimize'
142
- ) . '</small>';
143
  echo '<span>('
144
- . preg_replace(
145
- '#[%2].*#',
146
- '...',
147
- htmlentities( $menu_slug )
148
- ) . ')</span>';
149
  echo '</td>';
150
 
151
  foreach ( $user_roles as $role ) {
@@ -160,11 +182,11 @@ if ( ! function_exists( 'add_action' ) ) {
160
  * Use $key instead of htmlentities( $item[ 2 ] ) in the input field below, attribute value
161
  */
162
  echo "\t" . '<td class="num">' . $disabled_item_adm_hint . '<input id="check_menu'
163
- . $role . $x . '" class="menu_options_'
164
- . preg_replace( '/[^a-z0-9]+/', '', $role ) . '" type="checkbox"'
165
- . $disabled_item_adm . $checked_user_role_[ $role ]
166
- . ' name="mw_adminimize_disabled_menu_' . $role . '_items[]" value="'
167
- . $menu_slug . '" />' . $disabled_item_adm_hint . '</td>' . "\n";
168
  }
169
  echo '</tr>';
170
 
@@ -175,11 +197,11 @@ if ( ! function_exists( 'add_action' ) ) {
175
  echo "\t" . '<th>' . esc_attr__( 'Profile' ) . ' <span>(profile.php)</span> </th>';
176
  foreach ( $user_roles as $role ) {
177
  echo "\t" . '<td class="num"><input disabled="disabled" id="check_menu'
178
- . $role . $x . '" class="menu_options_'
179
- . preg_replace( '/[^a-z0-9]+/', '', $role )
180
- . '" type="checkbox"' . $checked_user_role_[ $role ]
181
- . ' name="mw_adminimize_disabled_menu_' . $role
182
- . '_items[]" value="profile.php" /></td>' . "\n";
183
  }
184
  echo '</tr>';
185
  }
@@ -198,11 +220,11 @@ if ( ! function_exists( 'add_action' ) ) {
198
  if ( strtolower( $submenu_slug ) === 'adminimize/adminimize.php' ) {
199
  //$disabled_subitem_adm = ' disabled="disabled"';
200
  $disabled_subitem_adm_hint = '<abbr title="'
201
- . esc_attr__(
202
- 'After activate the check box it heavy attitudes will change.',
203
- 'adminimize'
204
- )
205
- . '" style="cursor:pointer;"> ! </acronym>';
206
  } else {
207
  $disabled_subitem_adm = '';
208
  $disabled_subitem_adm_hint = '';
@@ -213,22 +235,22 @@ if ( ! function_exists( 'add_action' ) ) {
213
  // checkbox checked
214
  $checked_user_role_[ $role ] = '';
215
  if ( isset( $disabled_submenu_[ $role ] )
216
- // @since 2015-11-11
217
- // Switch to custom key and url-slug of menu item.
218
- && _mw_adminimize_in_arrays(
219
- array( $menu_slug . '__' . $subkey, $submenu_slug ),
220
- $disabled_submenu_[ $role ]
221
- )
222
  ) {
223
  $checked_user_role_[ $role ] = ' checked="checked"';
224
  }
225
  }
226
- echo '<td> &mdash; ' . $subitem[ 0 ] . ' <span>(Slug: '
227
- . preg_replace(
228
- '#[%2].*#',
229
- '...',
230
- htmlentities( $submenu_slug )
231
- ) . ')[__' . $subkey . ']</span> </td>' . "\n";
232
 
233
  foreach ( $user_roles as $role ) {
234
  if ( $role !== 'administrator' ) { // only admin disable items
@@ -236,10 +258,10 @@ if ( ! function_exists( 'add_action' ) ) {
236
  $disabled_subitem_adm_hint = '';
237
  }
238
  echo '<td class="num">' . $disabled_subitem_adm_hint . '<input id="check_menu' . $role . $x
239
- . '" class="submenu_options_' . $role . '" type="checkbox"'
240
- . $disabled_subitem_adm . $checked_user_role_[ $role ]
241
- . ' name="mw_adminimize_disabled_submenu_' . $role . '_items[]" value="'
242
- . $menu_slug . '__' . $subkey . '" />' . $disabled_subitem_adm_hint . '</td>' . "\n";
243
  }
244
  echo '</tr>' . "\n";
245
  $x ++;
@@ -259,6 +281,61 @@ if ( ! function_exists( 'add_action' ) ) {
259
  </tbody>
260
  </table>
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  <p id="submitbutton">
263
  <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
264
  'Update Options', 'adminimize'
45
  echo '<td class="num">';
46
  echo '<span class="form-invalid">';
47
  echo '<input id="select_all" class="menu_options_' . $role_slug
48
+ . '" type="checkbox" name="" value="" />';
49
  echo '</span>';
50
  echo '<input id="select_all" class="submenu_options_' . $role_slug
51
+ . '" type="checkbox" name="" value="" />';
52
  echo '</td>' . "\n";
53
  } ?>
54
  </tr>
74
  $wp_submenu = $submenu;
75
  }
76
 
77
+ // Enhance Menu with custom slugs.
78
+ $own_menu_slug = _mw_adminimize_get_option_value(
79
+ '_mw_adminimize_own_menu_slug'
80
+ );
81
+ $own_menu_custom_slug = _mw_adminimize_get_option_value(
82
+ '_mw_adminimize_own_menu_custom_slug'
83
+ );
84
+ $own_menu_slug = preg_split( "/\r\n/", $own_menu_slug );
85
+ $own_menu_custom_slug = preg_split( "/\r\n/", $own_menu_custom_slug );
86
+ foreach ( (array) $own_menu_slug as $key => $slug ) {
87
+ $wp_menu[] = array(
88
+ 0 => trim( $slug ),
89
+ 1 => '',
90
+ 2 => $own_menu_custom_slug[ $key ],
91
+ 3 => '',
92
+ 4 => 'custom',
93
+ );
94
+ }
95
+
96
  foreach ( $user_roles as $role ) {
97
  $disabled_metaboxes_post_[ $role ] = _mw_adminimize_get_option_value(
98
  'mw_adminimize_disabled_metaboxes_post_' . $role . '_items'
102
  );
103
  }
104
 
105
+ // print menu, sub-menu
106
  if ( isset( $wp_menu ) && '' !== $wp_menu ) {
107
 
108
  $i = 0;
143
  // checkbox checked
144
  $checked_user_role_[ $role ] = '';
145
  if ( isset( $disabled_menu_[ $role ] )
146
+ && in_array( $menu_slug, $disabled_menu_[ $role ], FALSE )
147
  ) {
148
  $checked_user_role_[ $role ] = ' checked="checked"';
149
  }
153
  $item[ 0 ] = '<b><i>' . esc_attr__( 'No Title!', 'adminimize' ) . '</i></b>';
154
  }
155
 
156
+ $typ = esc_attr__( 'Group', 'adminimize' );
157
+ if ( 'custom' === $item[ 4 ] ) {
158
+ $typ = esc_attr__( 'Custom', 'adminimize' );
159
+ }
160
+
161
  echo '<tr class="form-invalid">' . "\n";
162
  echo "\t";
163
  echo '<td>';
164
+ echo '<b>&bull; ' . strip_tags( $item[ 0 ] ) . '</b> <small>' . $typ . '</small>';
 
 
165
  echo '<span>('
166
+ . preg_replace(
167
+ '#[%2].*#',
168
+ '...',
169
+ htmlentities( $menu_slug )
170
+ ) . ')</span>';
171
  echo '</td>';
172
 
173
  foreach ( $user_roles as $role ) {
182
  * Use $key instead of htmlentities( $item[ 2 ] ) in the input field below, attribute value
183
  */
184
  echo "\t" . '<td class="num">' . $disabled_item_adm_hint . '<input id="check_menu'
185
+ . $role . $x . '" class="menu_options_'
186
+ . preg_replace( '/[^a-z0-9]+/', '', $role ) . '" type="checkbox"'
187
+ . $disabled_item_adm . $checked_user_role_[ $role ]
188
+ . ' name="mw_adminimize_disabled_menu_' . $role . '_items[]" value="'
189
+ . $menu_slug . '" />' . $disabled_item_adm_hint . '</td>' . "\n";
190
  }
191
  echo '</tr>';
192
 
197
  echo "\t" . '<th>' . esc_attr__( 'Profile' ) . ' <span>(profile.php)</span> </th>';
198
  foreach ( $user_roles as $role ) {
199
  echo "\t" . '<td class="num"><input disabled="disabled" id="check_menu'
200
+ . $role . $x . '" class="menu_options_'
201
+ . preg_replace( '/[^a-z0-9]+/', '', $role )
202
+ . '" type="checkbox"' . $checked_user_role_[ $role ]
203
+ . ' name="mw_adminimize_disabled_menu_' . $role
204
+ . '_items[]" value="profile.php" /></td>' . "\n";
205
  }
206
  echo '</tr>';
207
  }
220
  if ( strtolower( $submenu_slug ) === 'adminimize/adminimize.php' ) {
221
  //$disabled_subitem_adm = ' disabled="disabled"';
222
  $disabled_subitem_adm_hint = '<abbr title="'
223
+ . esc_attr__(
224
+ 'After activate the check box it heavy attitudes will change.',
225
+ 'adminimize'
226
+ )
227
+ . '" style="cursor:pointer;"> ! </acronym>';
228
  } else {
229
  $disabled_subitem_adm = '';
230
  $disabled_subitem_adm_hint = '';
235
  // checkbox checked
236
  $checked_user_role_[ $role ] = '';
237
  if ( isset( $disabled_submenu_[ $role ] )
238
+ // @since 2015-11-11
239
+ // Switch to custom key and url-slug of menu item.
240
+ && _mw_adminimize_in_arrays(
241
+ array( $menu_slug . '__' . $subkey, $submenu_slug ),
242
+ $disabled_submenu_[ $role ]
243
+ )
244
  ) {
245
  $checked_user_role_[ $role ] = ' checked="checked"';
246
  }
247
  }
248
+ echo '<td> &mdash; ' . strip_tags( $subitem[ 0 ] ) . ' <span>(Slug: '
249
+ . preg_replace(
250
+ '#[%2].*#',
251
+ '...',
252
+ htmlentities( $submenu_slug )
253
+ ) . ')[__' . $subkey . ']</span> </td>' . "\n";
254
 
255
  foreach ( $user_roles as $role ) {
256
  if ( $role !== 'administrator' ) { // only admin disable items
258
  $disabled_subitem_adm_hint = '';
259
  }
260
  echo '<td class="num">' . $disabled_subitem_adm_hint . '<input id="check_menu' . $role . $x
261
+ . '" class="submenu_options_' . $role . '" type="checkbox"'
262
+ . $disabled_subitem_adm . $checked_user_role_[ $role ]
263
+ . ' name="mw_adminimize_disabled_submenu_' . $role . '_items[]" value="'
264
+ . $menu_slug . '__' . $subkey . '" />' . $disabled_subitem_adm_hint . '</td>' . "\n";
265
  }
266
  echo '</tr>' . "\n";
267
  $x ++;
281
  </tbody>
282
  </table>
283
 
284
+ <?php
285
+ //Your own dashboard options.
286
+ ?>
287
+ <br style="margin-top: 10px;" />
288
+ <table summary="config_edit_post" class="widefat">
289
+ <thead>
290
+ <tr>
291
+ <th><?php esc_attr_e( 'Your own options', 'adminimize' );
292
+ echo '<br />';
293
+ esc_attr_e( 'Slug', 'adminimize' ); ?></th>
294
+ <th><?php echo '<br />';
295
+ esc_attr_e( 'Custom Slug', 'adminimize' ); ?></th>
296
+ </tr>
297
+ </thead>
298
+
299
+ <tbody>
300
+ <tr valign="top">
301
+ <td colspan="2"><?php esc_attr_e(
302
+ 'It is possible to add your own slugs for menu items.',
303
+ 'adminimize'
304
+ ); ?></td>
305
+ </tr>
306
+ <tr valign="top">
307
+ <td>
308
+ <textarea name="_mw_adminimize_own_menu_slug" cols="60" rows="3"
309
+ id="_mw_adminimize_own_menu_slug" style="width: 95%;"><?php
310
+ echo _mw_adminimize_get_option_value(
311
+ '_mw_adminimize_own_menu_slug'
312
+ ); ?></textarea>
313
+ <br />
314
+ <label for="_mw_adminimize_own_menu_slug">
315
+ <?php esc_attr_e(
316
+ 'String of the custom slug, matched to the the default menu slug, there you see aboive in the list.',
317
+ 'adminimize'
318
+ ); ?>
319
+ </label>
320
+ </td>
321
+ <td>
322
+ <textarea class="code" name="_mw_adminimize_own_menu_custom_slug" cols="60" rows="3"
323
+ id="_mw_adminimize_own_menu_custom_slug" style="width: 95%;"><?php
324
+ echo _mw_adminimize_get_option_value(
325
+ '_mw_adminimize_own_menu_custom_slug'
326
+ ); ?></textarea>
327
+ <br />
328
+ <label for="_mw_adminimize_own_menu_custom_slug">
329
+ <?php esc_attr_e(
330
+ 'String of the custom slug.',
331
+ 'adminimize'
332
+ ); ?>
333
+ </label>
334
+ </td>
335
+ </tr>
336
+ </tbody>
337
+ </table>
338
+
339
  <p id="submitbutton">
340
  <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
341
  'Update Options', 'adminimize'
inc-options/self_settings.php CHANGED
@@ -17,6 +17,19 @@ if ( ! function_exists( 'add_action' ) ) {
17
  <div class="inside">
18
 
19
  <table class="form-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  <tr>
21
  <td class="row-title"><label for="mw_adminimize_multiple_roles">
22
  <?php esc_attr_e( 'Support Multiple Roles', 'adminimize' ); ?>
17
  <div class="inside">
18
 
19
  <table class="form-table">
20
+ <tr>
21
+ <td class="row-title"><label for="mw_adminimize_debug">
22
+ <?php esc_attr_e( 'Active Debug Helper', 'adminimize' ); ?>
23
+ </label>
24
+ </td>
25
+ <td>
26
+ <input type="checkbox" value="1" id="mw_adminimize_debug"
27
+ name="mw_adminimize_debug" <?php checked(
28
+ _mw_adminimize_get_option_value( 'mw_adminimize_debug' ),
29
+ 1, TRUE ); ?>>
30
+ <?php esc_attr_e( 'After activation is it possible to see several information inside the console of the browser for the current active user.', 'adminimize' ); ?>
31
+ </td>
32
+ </tr>
33
  <tr>
34
  <td class="row-title"><label for="mw_adminimize_multiple_roles">
35
  <?php esc_attr_e( 'Support Multiple Roles', 'adminimize' ); ?>
inc-options/widget_options.php CHANGED
@@ -142,9 +142,9 @@ if ( ! function_exists( 'add_action' ) ) {
142
  <tr>
143
  <th><?php esc_attr_e( 'Your own Widget options', 'adminimize' );
144
  echo '<br />';
145
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
146
  <th><?php echo '<br />';
147
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
148
  </tr>
149
  </thead>
150
 
142
  <tr>
143
  <th><?php esc_attr_e( 'Your own Widget options', 'adminimize' );
144
  echo '<br />';
145
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
146
  <th><?php echo '<br />';
147
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
148
  </tr>
149
  </thead>
150
 
inc-options/wp_nav_menu_options.php CHANGED
@@ -157,9 +157,9 @@ if ( ! function_exists( 'add_action' ) ) {
157
  <tr>
158
  <th><?php esc_attr_e( 'Your own Nav Menu options', 'adminimize' );
159
  echo '<br />';
160
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
161
  <th><?php echo '<br />';
162
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
163
  </tr>
164
  </thead>
165
 
157
  <tr>
158
  <th><?php esc_attr_e( 'Your own Nav Menu options', 'adminimize' );
159
  echo '<br />';
160
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
161
  <th><?php echo '<br />';
162
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
163
  </tr>
164
  </thead>
165
 
inc-options/write_cp_options.php CHANGED
@@ -247,13 +247,14 @@ foreach ( get_post_types( $args ) as $post_type ) {
247
  <tr>
248
  <th>
249
  <?php echo sprintf(
250
- esc_attr__( 'Your own %s options', 'adminimize' ), $post_type_object->label
 
251
  );
252
  echo '<br />';
253
- esc_attr_e( 'ID or class', 'adminimize' ); ?>
254
  </th>
255
  <th><?php echo '<br />';
256
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
257
  </tr>
258
  </thead>
259
 
247
  <tr>
248
  <th>
249
  <?php echo sprintf(
250
+ esc_attr__( 'Your own %s options', 'adminimize' ),
251
+ $post_type_object->label
252
  );
253
  echo '<br />';
254
+ esc_attr_e( 'Option name', 'adminimize' ); ?>
255
  </th>
256
  <th><?php echo '<br />';
257
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
258
  </tr>
259
  </thead>
260
 
inc-options/write_page_options.php CHANGED
@@ -224,11 +224,11 @@ if ( ! function_exists( 'add_action' ) ) {
224
  <table summary="config_own_page" class="widefat">
225
  <thead>
226
  <tr>
227
- <th><?php esc_attr_e( 'Your own page options', 'adminimize' );
228
  echo '<br />';
229
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
230
  <th><?php echo '<br />';
231
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
232
  </tr>
233
  </thead>
234
 
224
  <table summary="config_own_page" class="widefat">
225
  <thead>
226
  <tr>
227
+ <th><?php esc_attr_e( 'Your own options', 'adminimize' );
228
  echo '<br />';
229
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
230
  <th><?php echo '<br />';
231
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
232
  </tr>
233
  </thead>
234
 
inc-options/write_post_options.php CHANGED
@@ -226,11 +226,11 @@ if ( ! function_exists( 'add_action' ) ) {
226
  <table summary="config_own_post" class="widefat">
227
  <thead>
228
  <tr>
229
- <th><?php esc_attr_e( 'Your own post options', 'adminimize' );
230
  echo '<br />';
231
- esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
232
  <th><?php echo '<br />';
233
- esc_attr_e( 'Option', 'adminimize' ); ?></th>
234
  </tr>
235
  </thead>
236
 
226
  <table summary="config_own_post" class="widefat">
227
  <thead>
228
  <tr>
229
+ <th><?php esc_attr_e( 'Your own options', 'adminimize' );
230
  echo '<br />';
231
+ esc_attr_e( 'Option name', 'adminimize' ); ?></th>
232
  <th><?php echo '<br />';
233
+ esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
234
  </tr>
235
  </thead>
236
 
inc-setup/helping_hands.php CHANGED
@@ -12,8 +12,8 @@ if ( ! function_exists( 'add_action' ) ) {
12
  /**
13
  * Recursive search in array.
14
  *
15
- * @param $needle
16
- * @param $haystack
17
  *
18
  * @return bool
19
  */
@@ -43,8 +43,8 @@ function _mw_adminimize_recursive_in_array( $needle, $haystack ) {
43
  /**
44
  * Check if array contains all array values from another array.
45
  *
46
- * @param $array1
47
- * @param $array2
48
  *
49
  * @return bool
50
  */
@@ -74,12 +74,12 @@ function _mw_adminimize_current_user_has_role( $role ) {
74
  * Simple helper to debug to the console of the browser.
75
  * Set WP_DEBUG_DISPLAY in your wp-config.php to true for view debug messages inside the console.
76
  *
77
- * @param string $description
78
  * @param string | array | object
 
79
  */
80
- function _mw_adminimize_debug( $description = '' , $data ) {
81
 
82
- if ( ! defined( 'WP_DEBUG_DISPLAY' ) || ( defined( 'WP_DEBUG_DISPLAY' ) && ! WP_DEBUG_DISPLAY ) ) {
83
  return;
84
  }
85
 
12
  /**
13
  * Recursive search in array.
14
  *
15
+ * @param string $needle
16
+ * @param array $haystack
17
  *
18
  * @return bool
19
  */
43
  /**
44
  * Check if array contains all array values from another array.
45
  *
46
+ * @param array $array1
47
+ * @param array $array2
48
  *
49
  * @return bool
50
  */
74
  * Simple helper to debug to the console of the browser.
75
  * Set WP_DEBUG_DISPLAY in your wp-config.php to true for view debug messages inside the console.
76
  *
 
77
  * @param string | array | object
78
+ * @param string $description
79
  */
80
+ function _mw_adminimize_debug( $data, $description = '' ) {
81
 
82
+ if ( ! _mw_adminimize_get_option_value( 'mw_adminimize_debug' ) ) {
83
  return;
84
  }
85
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Bueltge
3
  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.5-beta1
7
- Stable tag: 1.10.1
8
 
9
  Adminimize that lets you hide 'unnecessary' items from the WordPress backend
10
 
@@ -41,6 +41,11 @@ Use the installer via back-end of your install or ...
41
  1. Settings area in WP 4.5-alpha
42
 
43
  == Changelog ==
 
 
 
 
 
44
  = 1.10.1 (2016-02-29) =
45
  * Fix the Removing of Admin Color Scheme Select on the profile page.
46
  * Back-end options are also excluded on the settings page.
3
  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.5-beta3
7
+ Stable tag: 1.10.2
8
 
9
  Adminimize that lets you hide 'unnecessary' items from the WordPress backend
10
 
41
  1. Settings area in WP 4.5-alpha
42
 
43
  == Changelog ==
44
+ = 1.10.2 (2016-03-10) =
45
+ * Add possibility for custom menu slugs, especially for Plugins, Themes, there add different slug for different roles.
46
+ * Add the possibility to use the WP object cache for settings, if the webspace support this, like Memcached, APC.
47
+ * More clarity for the "own options" label.
48
+
49
  = 1.10.1 (2016-02-29) =
50
  * Fix the Removing of Admin Color Scheme Select on the profile page.
51
  * Back-end options are also excluded on the settings page.