Admin Menu Editor - Version 1.9.6

Version Description

  • Added an option to disable WPML support.
  • Fixed a minor WP 5.5 compatibility issue where some of the boxes shown on the menu settings page were displayed incorrectly.
  • Fixed a bug where hidden plugins were still visible under "Dashboard -> Updates" and were included in the number of updates shown in the admin menu, Toolbar and other places.
  • Fixed a conflict with WP Job Manager where activating Admin Menu Editor made the hidden "Dashboard -> Setup" menu visible.
  • Fixed a browser warning about cookies using "SameSite: None".
  • Fixed a conflict with plugins that use a different, incompatible version of the jquery-cookie library. For example: Participants Database Field Group Tabs.
  • Tested with WP 5.5-RC1 and 5.6-alpha.
Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Admin Menu Editor
Version 1.9.6
Comparing to
See all releases

Code changes from version 1.9.5 to 1.9.6

css/menu-editor.css CHANGED
@@ -1022,6 +1022,15 @@ a#ws-ame-delete-color-preset:hover {
1022
 
1023
  .ws_dialog_subpanel {
1024
  margin-bottom: 1em; }
 
 
 
 
 
 
 
 
 
1025
 
1026
  #ws_menu_access_editor .ws_column_access,
1027
  #ws_menu_access_editor .ws_ext_action_check_column {
@@ -1388,7 +1397,11 @@ a#ws-ame-delete-color-preset:hover {
1388
  margin-left: 0.5em; }
1389
 
1390
  .ws_ame_doc_box .hndle, .ws_ame_custom_postbox .hndle {
1391
- cursor: default !important; }
 
 
 
 
1392
  .ws_ame_doc_box .inside, .ws_ame_custom_postbox .inside {
1393
  margin-bottom: 0; }
1394
  .ws_ame_doc_box ul, .ws_ame_custom_postbox ul {
@@ -1500,6 +1513,17 @@ a#ws-ame-delete-color-preset:hover {
1500
  bottom: 40px;
1501
  z-index: 100; }
1502
 
 
 
 
 
 
 
 
 
 
 
 
1503
  .test-wrap {
1504
  background-color: #444444;
1505
  padding: 30px; }
1022
 
1023
  .ws_dialog_subpanel {
1024
  margin-bottom: 1em; }
1025
+ .ws_dialog_subpanel fieldset p {
1026
+ margin-top: 0;
1027
+ margin-bottom: 4px; }
1028
+
1029
+ .ws-ame-dialog-subheading {
1030
+ display: block;
1031
+ font-weight: 600;
1032
+ font-size: 1em;
1033
+ margin: 0 0 0.2em 0; }
1034
 
1035
  #ws_menu_access_editor .ws_column_access,
1036
  #ws_menu_access_editor .ws_ext_action_check_column {
1397
  margin-left: 0.5em; }
1398
 
1399
  .ws_ame_doc_box .hndle, .ws_ame_custom_postbox .hndle {
1400
+ cursor: default !important;
1401
+ border-bottom: 1px solid #ccd0d4; }
1402
+ .ws_ame_doc_box .handlediv, .ws_ame_custom_postbox .handlediv {
1403
+ display: block;
1404
+ float: right; }
1405
  .ws_ame_doc_box .inside, .ws_ame_custom_postbox .inside {
1406
  margin-bottom: 0; }
1407
  .ws_ame_doc_box ul, .ws_ame_custom_postbox ul {
1513
  bottom: 40px;
1514
  z-index: 100; }
1515
 
1516
+ .ws-ame-icon-radio-button-group > label {
1517
+ display: inline-block;
1518
+ padding: 8px;
1519
+ border: 1px solid #ccd0d4;
1520
+ border-radius: 2px;
1521
+ margin-right: 0.5em; }
1522
+
1523
+ span.description {
1524
+ color: #666;
1525
+ font-style: italic; }
1526
+
1527
  .test-wrap {
1528
  background-color: #444444;
1529
  padding: 30px; }
css/menu-editor.scss CHANGED
@@ -1387,6 +1387,18 @@ $accessLevelRightMargin: 5px;
1387
 
1388
  .ws_dialog_subpanel {
1389
  margin-bottom: 1em;
 
 
 
 
 
 
 
 
 
 
 
 
1390
  }
1391
 
1392
  #ws_menu_access_editor .ws_column_access,
@@ -1958,6 +1970,12 @@ $userSelectionPanelPadding: 10px;
1958
  .ws_ame_doc_box, .ws_ame_custom_postbox {
1959
  .hndle {
1960
  cursor: default !important;
 
 
 
 
 
 
1961
  }
1962
 
1963
  .inside {
@@ -2125,6 +2143,20 @@ $userSelectionPanelPadding: 10px;
2125
  z-index: 100;
2126
  }
2127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2128
 
2129
  .test-wrap {
2130
  background-color: #444444;
1387
 
1388
  .ws_dialog_subpanel {
1389
  margin-bottom: 1em;
1390
+
1391
+ fieldset p {
1392
+ margin-top: 0;
1393
+ margin-bottom: 4px;
1394
+ }
1395
+ }
1396
+
1397
+ .ws-ame-dialog-subheading {
1398
+ display: block;
1399
+ font-weight: 600;
1400
+ font-size: 1em;
1401
+ margin: 0 0 0.2em 0;
1402
  }
1403
 
1404
  #ws_menu_access_editor .ws_column_access,
1970
  .ws_ame_doc_box, .ws_ame_custom_postbox {
1971
  .hndle {
1972
  cursor: default !important;
1973
+ border-bottom: 1px solid $amePostboxBorderColor;
1974
+ }
1975
+
1976
+ .handlediv {
1977
+ display: block;
1978
+ float: right;
1979
  }
1980
 
1981
  .inside {
2143
  z-index: 100;
2144
  }
2145
 
2146
+ .ws-ame-icon-radio-button-group > label {
2147
+ display: inline-block;
2148
+ padding: 8px;
2149
+ border: 1px solid #ccd0d4;
2150
+ border-radius: 2px;
2151
+
2152
+ margin-right: 0.5em;
2153
+ }
2154
+
2155
+ span.description {
2156
+ color: #666;
2157
+ //Before WP 5.5 description text was displayed in italics. We'll preserve that style for now.
2158
+ font-style: italic;
2159
+ }
2160
 
2161
  .test-wrap {
2162
  background-color: #444444;
includes/menu-editor-core.php CHANGED
@@ -178,6 +178,10 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
178
  //but adds decompression overhead to very admin page.
179
  'compress_custom_menu' => false,
180
 
 
 
 
 
181
  //Which modules are active or inactive. Format: ['module-id' => true/false].
182
  'is_active_module' => array(
183
  'highlight-new-menus' => false,
@@ -289,6 +293,8 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
289
  'options-general.php?page=mace-general-settings' => true,
290
  //"What's Your Reaction"
291
  'options-general.php?page=wyr-fakes-settings' => true,
 
 
292
  );
293
 
294
  //AJAXify screen options
@@ -871,7 +877,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
871
  //jQuery Form plugin. This is a more recent version than the one included with WP.
872
  wp_register_auto_versioned_script('ame-jquery-form', plugins_url('js/jquery.form.js', $this->plugin_file), array('jquery'));
873
  //jQuery cookie plugin
874
- wp_register_auto_versioned_script('jquery-cookie', plugins_url('js/jquery.biscuit.js', $this->plugin_file), array('jquery'));
875
  }
876
 
877
  /**
@@ -997,7 +1003,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
997
  $editor_dependencies = array(
998
  'jquery', 'jquery-ui-sortable', 'jquery-ui-dialog', 'jquery-ui-tabs',
999
  'ame-jquery-form', 'jquery-ui-droppable', 'jquery-qtip',
1000
- 'jquery-sort', 'jquery-json', 'jquery-cookie',
1001
  'wp-color-picker', 'ame-lodash', 'ame-access-editor', 'ame-actor-manager',
1002
  'ame-actor-selector',
1003
  );
@@ -1263,7 +1269,6 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
1263
  *
1264
  * @param array|null $custom_menu
1265
  * @param string|null $config_id Supported values: 'network-admin', 'global' or 'site'
1266
- * @throws InvalidMenuException
1267
  */
1268
  function set_custom_menu($custom_menu, $config_id = null) {
1269
  if ( $config_id === null ) {
@@ -1273,7 +1278,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
1273
  $custom_menu = apply_filters('ame_pre_set_custom_menu', $custom_menu);
1274
 
1275
  $previous_custom_menu = $this->load_custom_menu($config_id);
1276
- $this->update_wpml_strings($previous_custom_menu, $custom_menu);
 
 
1277
 
1278
  if ( !empty($custom_menu) ) {
1279
  $custom_menu['prebuilt_virtual_caps'] = $this->build_virtual_capability_list($custom_menu);
@@ -1312,7 +1319,6 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
1312
  *
1313
  * @param null $config_id
1314
  * @return array|null Either a menu in the internal format, or NULL if there is no custom menu available.
1315
- * @throws InvalidMenuException
1316
  */
1317
  public function load_custom_menu($config_id = null) {
1318
  if ( $config_id === null ) {
@@ -1429,6 +1435,28 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
1429
  }
1430
  }
1431
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1432
  /**
1433
  * Reset plugin access if the only allowed user no longer exists.
1434
  *
@@ -2128,7 +2156,10 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2128
  }
2129
 
2130
  //WPML support: Use translated menu titles where available.
2131
- if ( !$item['separator'] && $hasCustomMenuTitle && function_exists('icl_t') ) {
 
 
 
2132
  $item['menu_title'] = icl_t(
2133
  self::WPML_CONTEXT,
2134
  $this->get_wpml_name_for($item, 'menu_title'),
@@ -2570,6 +2601,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2570
  //Menu data compression.
2571
  $this->options['compress_custom_menu'] = !empty($this->post['compress_custom_menu']);
2572
 
 
 
 
2573
  //Active modules.
2574
  $activeModules = isset($this->post['active_modules']) ? (array)$this->post['active_modules'] : array();
2575
  $activeModules = array_fill_keys(array_map('strval', $activeModules), true);
178
  //but adds decompression overhead to very admin page.
179
  'compress_custom_menu' => false,
180
 
181
+ //Make custom menu and page titles translatable with WPML. They will appear in the "Strings" section.
182
+ //This only applies to custom (i.e. changed) titles.
183
+ 'wpml_support_enabled' => true,
184
+
185
  //Which modules are active or inactive. Format: ['module-id' => true/false].
186
  'is_active_module' => array(
187
  'highlight-new-menus' => false,
293
  'options-general.php?page=mace-general-settings' => true,
294
  //"What's Your Reaction"
295
  'options-general.php?page=wyr-fakes-settings' => true,
296
+ //WP-Job-Manager 1.34.1
297
+ 'index.php?page=job-manager-setup' => true,
298
  );
299
 
300
  //AJAXify screen options
877
  //jQuery Form plugin. This is a more recent version than the one included with WP.
878
  wp_register_auto_versioned_script('ame-jquery-form', plugins_url('js/jquery.form.js', $this->plugin_file), array('jquery'));
879
  //jQuery cookie plugin
880
+ wp_register_auto_versioned_script('ame-jquery-cookie', plugins_url('js/jquery.biscuit.js', $this->plugin_file), array('jquery'));
881
  }
882
 
883
  /**
1003
  $editor_dependencies = array(
1004
  'jquery', 'jquery-ui-sortable', 'jquery-ui-dialog', 'jquery-ui-tabs',
1005
  'ame-jquery-form', 'jquery-ui-droppable', 'jquery-qtip',
1006
+ 'jquery-sort', 'jquery-json', 'ame-jquery-cookie',
1007
  'wp-color-picker', 'ame-lodash', 'ame-access-editor', 'ame-actor-manager',
1008
  'ame-actor-selector',
1009
  );
1269
  *
1270
  * @param array|null $custom_menu
1271
  * @param string|null $config_id Supported values: 'network-admin', 'global' or 'site'
 
1272
  */
1273
  function set_custom_menu($custom_menu, $config_id = null) {
1274
  if ( $config_id === null ) {
1278
  $custom_menu = apply_filters('ame_pre_set_custom_menu', $custom_menu);
1279
 
1280
  $previous_custom_menu = $this->load_custom_menu($config_id);
1281
+ if ( !empty($this->options['wpml_support_enabled']) ) {
1282
+ $this->update_wpml_strings($previous_custom_menu, $custom_menu);
1283
+ }
1284
 
1285
  if ( !empty($custom_menu) ) {
1286
  $custom_menu['prebuilt_virtual_caps'] = $this->build_virtual_capability_list($custom_menu);
1319
  *
1320
  * @param null $config_id
1321
  * @return array|null Either a menu in the internal format, or NULL if there is no custom menu available.
 
1322
  */
1323
  public function load_custom_menu($config_id = null) {
1324
  if ( $config_id === null ) {
1435
  }
1436
  }
1437
 
1438
+ /**
1439
+ * Determine if a specific user can access the menu editor.
1440
+ *
1441
+ * @param int $userId
1442
+ * @return bool
1443
+ */
1444
+ public function user_can_edit_menu($userId) {
1445
+ $access = $this->options['plugin_access'];
1446
+ if ( $access === 'super_admin' ) {
1447
+ return is_super_admin($userId);
1448
+ } else if ( $access === 'specific_user' ) {
1449
+ return $userId == $this->options['allowed_user_id'];
1450
+ } else {
1451
+ $capability = apply_filters('admin_menu_editor-capability', $access);
1452
+ $user = get_user_by('id', $userId);
1453
+ if ( !$user ) {
1454
+ return false;
1455
+ }
1456
+ return $user->has_cap($capability);
1457
+ }
1458
+ }
1459
+
1460
  /**
1461
  * Reset plugin access if the only allowed user no longer exists.
1462
  *
2156
  }
2157
 
2158
  //WPML support: Use translated menu titles where available.
2159
+ if (
2160
+ !$item['separator'] && $hasCustomMenuTitle && function_exists('icl_t')
2161
+ && !empty($this->options['wpml_support_enabled'])
2162
+ ) {
2163
  $item['menu_title'] = icl_t(
2164
  self::WPML_CONTEXT,
2165
  $this->get_wpml_name_for($item, 'menu_title'),
2601
  //Menu data compression.
2602
  $this->options['compress_custom_menu'] = !empty($this->post['compress_custom_menu']);
2603
 
2604
+ //WPML support.
2605
+ $this->options['wpml_support_enabled'] = !empty($this->post['wpml_support_enabled']);
2606
+
2607
  //Active modules.
2608
  $activeModules = isset($this->post['active_modules']) ? (array)$this->post['active_modules'] : array();
2609
  $activeModules = array_fill_keys(array_map('strval', $activeModules), true);
includes/menu.php CHANGED
@@ -3,6 +3,8 @@ abstract class ameMenu {
3
  const format_name = 'Admin Menu Editor menu';
4
  const format_version = '7.0';
5
 
 
 
6
  /**
7
  * Load an admin menu from a JSON string.
8
  *
@@ -158,6 +160,10 @@ abstract class ameMenu {
158
  $menu['prebuilt_virtual_caps'] = $arr['prebuilt_virtual_caps'];
159
  }
160
 
 
 
 
 
161
  return $menu;
162
  }
163
 
@@ -213,7 +219,6 @@ abstract class ameMenu {
213
  gettype($result)
214
  );
215
  if ( function_exists('json_last_error') ) {
216
- /** @noinspection PhpComposerExtensionStubsInspection */
217
  $message .= sprintf(' JSON error code: %d.', json_last_error());
218
  }
219
  if ( function_exists('json_last_error_msg') ) {
@@ -512,11 +517,24 @@ abstract class ameMenu {
512
  }
513
  }
514
  }
 
 
 
 
 
 
 
515
  }
516
 
517
  class ameGrantedCapabilityFilter {
518
- private $post_types = array();
519
- private $taxonomies = array();
 
 
 
 
 
 
520
 
521
  public function __construct() {
522
  $this->post_types = get_post_types(array('public' => true, 'show_ui' => true), 'names', 'or');
@@ -582,4 +600,4 @@ class ameModifiedIconDetector {
582
 
583
  class InvalidMenuException extends Exception {}
584
 
585
- class ameInvalidJsonException extends RuntimeException {};
3
  const format_name = 'Admin Menu Editor menu';
4
  const format_version = '7.0';
5
 
6
+ protected static $custom_loaders = array();
7
+
8
  /**
9
  * Load an admin menu from a JSON string.
10
  *
160
  $menu['prebuilt_virtual_caps'] = $arr['prebuilt_virtual_caps'];
161
  }
162
 
163
+ foreach(self::$custom_loaders as $callback) {
164
+ $menu = call_user_func($callback, $menu, $arr);
165
+ }
166
+
167
  return $menu;
168
  }
169
 
219
  gettype($result)
220
  );
221
  if ( function_exists('json_last_error') ) {
 
222
  $message .= sprintf(' JSON error code: %d.', json_last_error());
223
  }
224
  if ( function_exists('json_last_error_msg') ) {
517
  }
518
  }
519
  }
520
+
521
+ /**
522
+ * @param callable $callback
523
+ */
524
+ public static function add_custom_loader($callback) {
525
+ self::$custom_loaders[] = $callback;
526
+ }
527
  }
528
 
529
  class ameGrantedCapabilityFilter {
530
+ /**
531
+ * @var string[]
532
+ */
533
+ private $post_types;
534
+ /**
535
+ * @var string[]
536
+ */
537
+ private $taxonomies;
538
 
539
  public function __construct() {
540
  $this->post_types = get_post_types(array('public' => true, 'show_ui' => true), 'names', 'or');
600
 
601
  class InvalidMenuException extends Exception {}
602
 
603
+ class ameInvalidJsonException extends RuntimeException {}
includes/settings-page.php CHANGED
@@ -354,6 +354,27 @@ $isProVersion = apply_filters('admin_menu_editor_is_pro', false);
354
  </td>
355
  </tr>
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  <tr>
358
  <th scope="row">Error verbosity level</th>
359
  <td>
354
  </td>
355
  </tr>
356
 
357
+ <tr>
358
+ <th scope="row">
359
+ WPML support
360
+ </th>
361
+ <td>
362
+ <p>
363
+ <label>
364
+ <input type="checkbox" name="wpml_support_enabled"
365
+ <?php checked($settings['wpml_support_enabled']); ?>>
366
+ Make edited menu titles translatable with WPML
367
+
368
+ <br><span class="description">
369
+ The titles will appear in the "Strings" section in WPML.
370
+ If you don't use WPML or a similar translation plugin,
371
+ you can safely disable this option.
372
+ </span>
373
+ </label>
374
+ </p>
375
+ </td>
376
+ </tr>
377
+
378
  <tr>
379
  <th scope="row">Error verbosity level</th>
380
  <td>
js/jquery.biscuit.js CHANGED
@@ -67,10 +67,11 @@
67
 
68
  return (document.cookie = [
69
  encode(key), '=', stringifyCookieValue(value),
70
- options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
71
- options.path ? '; path=' + options.path : '',
72
- options.domain ? '; domain=' + options.domain : '',
73
- options.secure ? '; secure' : ''
 
74
  ].join(''));
75
  }
76
 
@@ -103,7 +104,9 @@
103
  return result;
104
  };
105
 
106
- config.defaults = {};
 
 
107
 
108
  $.removeCookie = function (key, options) {
109
  if ($.cookie(key) !== undefined) {
67
 
68
  return (document.cookie = [
69
  encode(key), '=', stringifyCookieValue(value),
70
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
71
+ options.path ? '; path=' + options.path : '',
72
+ options.domain ? '; domain=' + options.domain : '',
73
+ options.samesite ? '; samesite=' + options.samesite : '',
74
+ options.secure ? '; secure' : ''
75
  ].join(''));
76
  }
77
 
104
  return result;
105
  };
106
 
107
+ config.defaults = {
108
+ 'samesite' : 'lax'
109
+ };
110
 
111
  $.removeCookie = function (key, options) {
112
  if ($.cookie(key) !== undefined) {
js/menu-editor.js CHANGED
@@ -306,6 +306,8 @@ function loadMenuConfiguration(adminMenu) {
306
 
307
  //Display the new admin menu.
308
  outputWpMenu(adminMenu.tree);
 
 
309
  }
310
 
311
  /*
@@ -1626,12 +1628,15 @@ function readMenuTreeState(){
1626
 
1627
  AmeCapabilityManager.pruneGrantedUserCapabilities();
1628
 
1629
- return {
1630
  tree: tree,
1631
  color_presets: $.extend(true, {}, colorPresets),
1632
  granted_capabilities: AmeCapabilityManager.getGrantedCapabilities(),
1633
  component_visibility: $.extend(true, {}, generalComponentVisibility)
1634
  };
 
 
 
1635
  }
1636
 
1637
  /**
@@ -4071,7 +4076,9 @@ function ameOnDomReady() {
4071
  //Toggle the second row of toolbar buttons.
4072
  $('#ws_toggle_toolbar').click(function() {
4073
  var visible = menuEditorNode.find('.ws_second_toolbar_row').toggle().is(':visible');
4074
- $.cookie('ame-show-second-toolbar', visible ? '1' : '0', {expires: 90});
 
 
4075
  });
4076
 
4077
 
@@ -4337,7 +4344,9 @@ function ameOnDomReady() {
4337
 
4338
  $('#ws_toggle_editor_layout').click(function () {
4339
  var isCompactLayoutEnabled = menuEditorNode.toggleClass('ws_compact_layout').hasClass('ws_compact_layout');
4340
- $.cookie('ame-compact-layout', isCompactLayoutEnabled ? '1' : '0', {expires: 90});
 
 
4341
 
4342
  var button = $(this);
4343
  if (button.is('input')) {
@@ -4682,11 +4691,13 @@ function ameOnDomReady() {
4682
 
4683
  $generalVisBox.find('.handlediv').click(function() {
4684
  $generalVisBox.toggleClass('closed');
4685
- $.cookie(
4686
- 'ame_vis_box_open',
4687
- ($generalVisBox.hasClass('closed') ? '0' : '1'),
4688
- { expires: 90 }
4689
- );
 
 
4690
  });
4691
 
4692
  actorSelectorWidget.onChange(function() {
@@ -4811,11 +4822,13 @@ function ameOnDomReady() {
4811
  var $howToBox = $("#ws_ame_how_to_box");
4812
  $howToBox.find(".handlediv").click(function() {
4813
  $howToBox.toggleClass('closed');
4814
- $.cookie(
4815
- 'ame_how_to_box_open',
4816
- ($howToBox.hasClass('closed') ? '0' : '1'),
4817
- { expires: 180 }
4818
- );
 
 
4819
  });
4820
 
4821
 
306
 
307
  //Display the new admin menu.
308
  outputWpMenu(adminMenu.tree);
309
+
310
+ $(document).trigger('menuConfigurationLoaded.adminMenuEditor', adminMenu);
311
  }
312
 
313
  /*
1628
 
1629
  AmeCapabilityManager.pruneGrantedUserCapabilities();
1630
 
1631
+ var result = {
1632
  tree: tree,
1633
  color_presets: $.extend(true, {}, colorPresets),
1634
  granted_capabilities: AmeCapabilityManager.getGrantedCapabilities(),
1635
  component_visibility: $.extend(true, {}, generalComponentVisibility)
1636
  };
1637
+
1638
+ $(document).trigger('getMenuConfiguration.adminMenuEditor', result);
1639
+ return result;
1640
  }
1641
 
1642
  /**
4076
  //Toggle the second row of toolbar buttons.
4077
  $('#ws_toggle_toolbar').click(function() {
4078
  var visible = menuEditorNode.find('.ws_second_toolbar_row').toggle().is(':visible');
4079
+ if (typeof $['cookie'] !== 'undefined') {
4080
+ $.cookie('ame-show-second-toolbar', visible ? '1' : '0', {expires: 90});
4081
+ }
4082
  });
4083
 
4084
 
4344
 
4345
  $('#ws_toggle_editor_layout').click(function () {
4346
  var isCompactLayoutEnabled = menuEditorNode.toggleClass('ws_compact_layout').hasClass('ws_compact_layout');
4347
+ if (typeof $['cookie'] !== 'undefined') {
4348
+ $.cookie('ame-compact-layout', isCompactLayoutEnabled ? '1' : '0', {expires: 90});
4349
+ }
4350
 
4351
  var button = $(this);
4352
  if (button.is('input')) {
4691
 
4692
  $generalVisBox.find('.handlediv').click(function() {
4693
  $generalVisBox.toggleClass('closed');
4694
+ if (typeof $['cookie'] !== 'undefined') {
4695
+ $.cookie(
4696
+ 'ame_vis_box_open',
4697
+ ($generalVisBox.hasClass('closed') ? '0' : '1'),
4698
+ { expires: 90 }
4699
+ );
4700
+ }
4701
  });
4702
 
4703
  actorSelectorWidget.onChange(function() {
4822
  var $howToBox = $("#ws_ame_how_to_box");
4823
  $howToBox.find(".handlediv").click(function() {
4824
  $howToBox.toggleClass('closed');
4825
+ if (typeof $['cookie'] !== 'undefined') {
4826
+ $.cookie(
4827
+ 'ame_how_to_box_open',
4828
+ ($howToBox.hasClass('closed') ? '0' : '1'),
4829
+ { expires: 180 }
4830
+ );
4831
+ }
4832
  });
4833
 
4834
 
menu-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
- Version: 1.9.5
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
+ Version: 1.9.6
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
modules/access-editor/access-editor.js CHANGED
@@ -216,7 +216,9 @@ window.AmeItemAccessEditor = (function ($) {
216
  $('#ws_ext_permissions_container').toggleClass('ws_ext_readable_names_enabled', readableNamesEnabled);
217
 
218
  //Remember the user's choice.
219
- $.cookie('ame-readable-capability-names', readableNamesEnabled ? '1' : '0', {expires: 90});
 
 
220
  });
221
 
222
  //Prevent the user from accidentally changing menu permissions when selecting a role.
@@ -346,7 +348,9 @@ window.AmeItemAccessEditor = (function ($) {
346
  isProVersion = _.get(config, 'isPro', false);
347
 
348
  //Read settings from cookies.
349
- readableNamesEnabled = $.cookie('ame-readable-capability-names');
 
 
350
  if (typeof readableNamesEnabled === 'undefined') {
351
  readableNamesEnabled = true;
352
  } else {
216
  $('#ws_ext_permissions_container').toggleClass('ws_ext_readable_names_enabled', readableNamesEnabled);
217
 
218
  //Remember the user's choice.
219
+ if (typeof $['cookie'] !== 'undefined') {
220
+ $.cookie('ame-readable-capability-names', readableNamesEnabled ? '1' : '0', {expires: 90});
221
+ }
222
  });
223
 
224
  //Prevent the user from accidentally changing menu permissions when selecting a role.
348
  isProVersion = _.get(config, 'isPro', false);
349
 
350
  //Read settings from cookies.
351
+ if (typeof $['cookie'] !== 'undefined') {
352
+ readableNamesEnabled = $.cookie('ame-readable-capability-names');
353
+ }
354
  if (typeof readableNamesEnabled === 'undefined') {
355
  readableNamesEnabled = true;
356
  } else {
modules/highlight-new-menus/wsNewMenuHighlighter.php CHANGED
@@ -194,7 +194,7 @@ class wsNewMenuHighlighter {
194
  ))
195
  ) {
196
  $GLOBALS['wp_menu_editor']->register_jquery_plugins();
197
- $dependencies[] = 'jquery-cookie';
198
  }
199
 
200
  wp_enqueue_script(
194
  ))
195
  ) {
196
  $GLOBALS['wp_menu_editor']->register_jquery_plugins();
197
+ $dependencies[] = 'ame-jquery-cookie';
198
  }
199
 
200
  wp_enqueue_script(
modules/plugin-visibility/plugin-visibility.php CHANGED
@@ -31,6 +31,9 @@ class amePluginVisibility extends amePersistentModule {
31
  //Remove "hidden" plugins from the list on the "Plugins -> Installed Plugins" page.
32
  add_filter('all_plugins', array($this, 'filterPluginList'), 15);
33
 
 
 
 
34
  //It's not possible to completely prevent a user from (de)activating "hidden" plugins because plugin API
35
  //functions like activate_plugin() and deactivate_plugins() don't provide a way to abort (de)activation.
36
  //However, we can still block edits and *some* other actions that WP verifies with check_admin_referer().
@@ -195,6 +198,37 @@ class amePluginVisibility extends amePersistentModule {
195
  return $plugins;
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  /**
199
  * Verify that the current user is allowed to see the plugin that they're trying to edit, activate or deactivate.
200
  * Note that this doesn't catch bulk (de-)activation or various plugin management plugins.
@@ -279,7 +313,6 @@ class amePluginVisibility extends amePersistentModule {
279
  if ( $action === 'save_plugin_visibility' ) {
280
  check_admin_referer($action);
281
 
282
- /** @noinspection PhpComposerExtensionStubsInspection */
283
  $this->settings = json_decode($post['settings'], true);
284
  $this->saveSettings();
285
 
31
  //Remove "hidden" plugins from the list on the "Plugins -> Installed Plugins" page.
32
  add_filter('all_plugins', array($this, 'filterPluginList'), 15);
33
 
34
+ //Hide updates for hidden plugins.
35
+ add_filter('site_transient_update_plugins', array($this, 'filterPluginUpdates'), 15);
36
+
37
  //It's not possible to completely prevent a user from (de)activating "hidden" plugins because plugin API
38
  //functions like activate_plugin() and deactivate_plugins() don't provide a way to abort (de)activation.
39
  //However, we can still block edits and *some* other actions that WP verifies with check_admin_referer().
198
  return $plugins;
199
  }
200
 
201
+ /**
202
+ * Filter out updates associated with plugins that are not visible to the current user.
203
+ *
204
+ * @param StdClass|null $updates
205
+ * @return StdClass|null
206
+ */
207
+ public function filterPluginUpdates($updates) {
208
+ if ( !isset($updates->response) || !is_array($updates->response) ) {
209
+ //Either there are no updates or we don't recognize the format.
210
+ return $updates;
211
+ }
212
+
213
+ //Let's not hide anything when no one is logged in. We don't check is_admin() here
214
+ //because plugin updates can appear in the Toolbar and that's visible in the front-end.
215
+ $user = wp_get_current_user();
216
+ if ( !$user->exists() || (defined('DOING_CRON') && DOING_CRON) ) {
217
+ return $updates;
218
+ }
219
+
220
+ $pluginFileNames = array_keys($updates->response);
221
+ foreach($pluginFileNames as $fileName) {
222
+ //Remove all hidden plugins.
223
+ if ( !$this->isPluginVisible($fileName, $user) ) {
224
+ unset($updates->response[$fileName]);
225
+ continue;
226
+ }
227
+ }
228
+
229
+ return $updates;
230
+ }
231
+
232
  /**
233
  * Verify that the current user is allowed to see the plugin that they're trying to edit, activate or deactivate.
234
  * Note that this doesn't catch bulk (de-)activation or various plugin management plugins.
313
  if ( $action === 'save_plugin_visibility' ) {
314
  check_admin_referer($action);
315
 
 
316
  $this->settings = json_decode($post['settings'], true);
317
  $this->saveSettings();
318
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: whiteshadow
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
- Tested up to: 5.4
7
- Stable tag: 1.9.5
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
@@ -63,6 +63,15 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
 
 
66
  = 1.9.5 =
67
  * Fixed a conflict with Media Ace, Snax and "What's Your Reaction?" plugins where activating Admin Menu Editor would cause a number of previously hidden menu items become visible.
68
  * Tested up to WP 5.4.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
+ Tested up to: 5.5
7
+ Stable tag: 1.9.6
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.9.6 =
67
+ * Added an option to disable WPML support.
68
+ * Fixed a minor WP 5.5 compatibility issue where some of the boxes shown on the menu settings page were displayed incorrectly.
69
+ * Fixed a bug where hidden plugins were still visible under "Dashboard -> Updates" and were included in the number of updates shown in the admin menu, Toolbar and other places.
70
+ * Fixed a conflict with WP Job Manager where activating Admin Menu Editor made the hidden "Dashboard -> Setup" menu visible.
71
+ * Fixed a browser warning about cookies using "SameSite: None".
72
+ * Fixed a conflict with plugins that use a different, incompatible version of the jquery-cookie library. For example: Participants Database Field Group Tabs.
73
+ * Tested with WP 5.5-RC1 and 5.6-alpha.
74
+
75
  = 1.9.5 =
76
  * Fixed a conflict with Media Ace, Snax and "What's Your Reaction?" plugins where activating Admin Menu Editor would cause a number of previously hidden menu items become visible.
77
  * Tested up to WP 5.4.