Admin Menu Editor - Version 1.1.4

Version Description

  • Fixed the updater's cron hook not being removed when the plugin is deactivated.
  • Fixed updates not showing up in some situations.
  • Fixed the "Feedback" button not responding to mouse clicks in some browsers.
  • Fixed "Feedback" button style to be consistent with other WP screen meta buttons.
  • Enforce the custom menu order by using the 'menu_order' filter. Fixes Jetpack menu not staying put.
  • You can now copy/paste as many menu separators as you like without worrying about some of them mysteriously disappearing on save.
  • Fixed a long-standing copying related bug where copied menus would all still refer to the same JS object instance.
  • Added ALT attributes to the toolbar icon images.
  • Removed the "Custom" checkbox. In retrospect, all it did was confuse people.
  • Made it impossible to edit separator properties.
  • Removed the deprecated "level_X" capabilities from the "Required capability" dropdown. You can still type them in manually if you want.
Download this release

Release Info

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

Code changes from version 1.1.3 to 1.1.4

css/menu-editor.css CHANGED
@@ -558,16 +558,27 @@ a.ws_button:hover {
558
  float: right;
559
  height: 22px;
560
  padding: 0;
561
- margin: 0 6px 0 0;
562
- font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
563
- background: #e3e3e3; /* original gray */
564
-
565
- border-bottom-left-radius: 3px;
566
- border-bottom-right-radius: 3px;
567
  -moz-border-radius-bottomleft: 3px;
568
  -moz-border-radius-bottomright: 3px;
569
  -webkit-border-bottom-left-radius: 3px;
570
  -webkit-border-bottom-right-radius: 3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  }
572
 
573
  #ws-ame-feedback-widget-wrap a.show-settings,
@@ -578,7 +589,8 @@ a.ws_button:hover {
578
 
579
  /* "Upgrade to Pro" */
580
  #ws-pro-version-notice {
581
- background-color: #00C31F;
 
582
  }
583
 
584
 
558
  float: right;
559
  height: 22px;
560
  padding: 0;
561
+ margin: 0 0 0 6px;
562
+ font-family: sans-serif;
563
+
 
 
 
564
  -moz-border-radius-bottomleft: 3px;
565
  -moz-border-radius-bottomright: 3px;
566
  -webkit-border-bottom-left-radius: 3px;
567
  -webkit-border-bottom-right-radius: 3px;
568
+ border-bottom-left-radius: 3px;
569
+ border-bottom-right-radius: 3px;
570
+
571
+ background: #e3e3e3;
572
+
573
+ border-right: 1px solid transparent;
574
+ border-left: 1px solid transparent;
575
+ border-bottom: 1px solid transparent;
576
+ background-image: -ms-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* IE10 */
577
+ background-image: -moz-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Firefox */
578
+ background-image: -o-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* Opera */
579
+ background-image: -webkit-gradient(linear, left bottom, left top, from(#dfdfdf), to(#f1f1f1)); /* old Webkit */
580
+ background-image: -webkit-linear-gradient(bottom, #dfdfdf, #f1f1f1); /* new Webkit */
581
+ background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
582
  }
583
 
584
  #ws-ame-feedback-widget-wrap a.show-settings,
589
 
590
  /* "Upgrade to Pro" */
591
  #ws-pro-version-notice {
592
+ background-color: #00C31F;
593
+ background-image: none;
594
  }
595
 
596
 
includes/menu-editor-core.php CHANGED
@@ -226,6 +226,32 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
226
  $this->filter_menu();
227
  }
228
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
 
230
  /**
231
  * Determine if the current user may use the menu editor.
@@ -842,46 +868,46 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
842
  $action = isset($post['action'])?$post['action']:(isset($get['action'])?$get['action']:'');
843
  do_action('admin_menu_editor_header', $action);
844
 
845
- //Handle form submissions
846
- if (isset($post['data'])){
847
- check_admin_referer('menu-editor-form');
848
-
849
- //Try to decode a menu tree encoded as JSON
850
- $data = $this->json_decode($post['data'], true);
851
- if (!$data || (count($data) < 2) ){
852
- $fixed = stripslashes($post['data']);
853
- $data = $this->json_decode( $fixed, true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  }
855
-
856
- $url = remove_query_arg('noheader');
857
- if ($data){
858
- //Ensure the user doesn't change the required capability to something they themselves don't have.
859
- if ( isset($data['options-general.php']['items']['menu_editor']) ){
860
- $item = $data['options-general.php']['items']['menu_editor'];
861
- if ( !empty($item['access_level']) && !current_user_can($item['access_level']) ){
862
- $item['access_level'] = null;
863
- $data['options-general.php']['items']['menu_editor'] = $item;
864
- }
865
- }
866
-
867
- //Save the custom menu
868
- $this->options['custom_menu'] = $data;
869
- $this->save_options();
870
- //Redirect back to the editor and display the success message
871
- wp_redirect( add_query_arg('message', 1, $url) );
872
- } else {
873
- //Or redirect & display the error message
874
- wp_redirect( add_query_arg('message', 2, $url) );
875
  }
876
- die();
877
- }
878
-
879
- //Attach a "Feedback" link to the screen meta panel.
880
- $this->print_uservoice_widget();
881
- //Kindly remind the user to give me money
882
- if ( !apply_filters('admin_menu_editor_is_pro', false) ){
883
- $this->print_upgrade_notice();
884
- }
885
  ?>
886
  <div class="wrap">
887
  <h2>
@@ -918,6 +944,14 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
918
 
919
  //Create a list of all known capabilities and roles. Used for the dropdown list on the access field.
920
  $all_capabilities = $this->get_all_capabilities();
 
 
 
 
 
 
 
 
921
  $all_capabilities = array_keys($all_capabilities);
922
  natcasesort($all_capabilities);
923
 
@@ -932,19 +966,19 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
932
  <div class='ws_main_container'>
933
  <div class='ws_toolbar'>
934
  <div class="ws_button_container">
935
- <a id='ws_cut_menu' class='ws_button' href='javascript:void(0)' title='Cut'><img src='<?php echo $images_url; ?>/cut.png' /></a>
936
- <a id='ws_copy_menu' class='ws_button' href='javascript:void(0)' title='Copy'><img src='<?php echo $images_url; ?>/page_white_copy.png' /></a>
937
- <a id='ws_paste_menu' class='ws_button' href='javascript:void(0)' title='Paste'><img src='<?php echo $images_url; ?>/page_white_paste.png' /></a>
938
 
939
  <div class="ws_separator">&nbsp;</div>
940
 
941
- <a id='ws_new_menu' class='ws_button' href='javascript:void(0)' title='New menu'><img src='<?php echo $images_url; ?>/page_white_add.png' /></a>
942
- <a id='ws_hide_menu' class='ws_button' href='javascript:void(0)' title='Show/Hide'><img src='<?php echo $images_url; ?>/plugin_disabled.png' /></a>
943
- <a id='ws_delete_menu' class='ws_button' href='javascript:void(0)' title='Delete menu'><img src='<?php echo $images_url; ?>/page_white_delete.png' /></a>
944
 
945
  <div class="ws_separator">&nbsp;</div>
946
 
947
- <a id='ws_new_separator' class='ws_button' href='javascript:void(0)' title='New separator'><img src='<?php echo $images_url; ?>/separator_add.png' /></a>
948
  </div>
949
  </div>
950
 
@@ -954,23 +988,23 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
954
  <div class='ws_main_container'>
955
  <div class='ws_toolbar'>
956
  <div class="ws_button_container">
957
- <a id='ws_cut_item' class='ws_button' href='javascript:void(0)' title='Cut'><img src='<?php echo $images_url; ?>/cut.png' /></a>
958
- <a id='ws_copy_item' class='ws_button' href='javascript:void(0)' title='Copy'><img src='<?php echo $images_url; ?>/page_white_copy.png' /></a>
959
- <a id='ws_paste_item' class='ws_button' href='javascript:void(0)' title='Paste'><img src='<?php echo $images_url; ?>/page_white_paste.png' /></a>
960
 
961
  <div class="ws_separator">&nbsp;</div>
962
 
963
- <a id='ws_new_item' class='ws_button' href='javascript:void(0)' title='New menu item'><img src='<?php echo $images_url; ?>/page_white_add.png' /></a>
964
- <a id='ws_hide_item' class='ws_button' href='javascript:void(0)' title='Show/Hide'><img src='<?php echo $images_url; ?>/plugin_disabled.png' /></a>
965
- <a id='ws_delete_item' class='ws_button' href='javascript:void(0)' title='Delete menu item'><img src='<?php echo $images_url; ?>/page_white_delete.png' /></a>
966
 
967
  <div class="ws_separator">&nbsp;</div>
968
 
969
  <a id='ws_sort_ascending' class='ws_button' href='javascript:void(0)' title='Sort ascending'>
970
- <img src='<?php echo $images_url; ?>/sort_ascending.png' />
971
  </a>
972
  <a id='ws_sort_descending' class='ws_button' href='javascript:void(0)' title='Sort descending'>
973
- <img src='<?php echo $images_url; ?>/sort_descending.png' />
974
  </a>
975
  </div>
976
  </div>
@@ -998,7 +1032,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
998
  </div>
999
 
1000
  <?php
1001
- //Createa a pop-up capability selector
1002
  $capSelector = array('<select id="ws_cap_selector" class="ws_dropdown" size="10">');
1003
 
1004
  $capSelector[] = '<optgroup label="Roles">';
@@ -1099,6 +1133,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1099
  * @return array Associative array with capability names as keys
1100
  */
1101
  function get_all_capabilities(){
 
1102
  global $wp_roles;
1103
 
1104
  $capabilities = array();
@@ -1108,7 +1143,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1108
  }
1109
 
1110
  //Iterate over all known roles and collect their capabilities
1111
- foreach($wp_roles->roles as $role_id => $role){
1112
  if ( !empty($role['capabilities']) && is_array($role['capabilities']) ){ //Being defensive here
1113
  $capabilities = array_merge($capabilities, $role['capabilities']);
1114
  }
@@ -1134,6 +1169,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1134
  * @return array Associative array with role IDs as keys and role display names as values
1135
  */
1136
  function get_all_roles(){
 
1137
  global $wp_roles;
1138
  $roles = array();
1139
 
@@ -1174,7 +1210,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1174
  <script type="text/javascript">
1175
  (function($){
1176
  $('#screen-meta-links').append(
1177
- '<div id="ws-ame-feedback-widget-wrap" class="hide-if-no-js screen-meta-toggle">' +
1178
  '<a href="http://feedback.w-shadow.com/forums/58572-admin-menu-editor" id="ws-ame-feedback-widget" class="show-settings" target="_blank" title="Open the user feedback forum">Feedback</a>' +
1179
  '</div>'
1180
  );
@@ -1193,7 +1229,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1193
  <script type="text/javascript">
1194
  (function($){
1195
  $('#screen-meta-links').append(
1196
- '<div id="ws-pro-version-notice" class="hide-if-no-js screen-meta-toggle">' +
1197
  '<a href="http://wpplugins.com/plugin/146/admin-menu-editor-pro" id="ws-pro-version-notice-link" class="show-settings" target="_blank" title="View Pro version details">Upgrade to Pro</a>' +
1198
  '</div>'
1199
  );
226
  $this->filter_menu();
227
  }
228
  }
229
+
230
+ /**
231
+ * Activate the 'menu_order' filter.
232
+ *
233
+ * @return bool
234
+ */
235
+ function hook_custom_menu_order(){
236
+ return true;
237
+ }
238
+
239
+ /**
240
+ * Override the order of the top-level menu entries.
241
+ *
242
+ * @param array $menu_order
243
+ * @return array
244
+ */
245
+ function hook_menu_order($menu_order){
246
+ $custom_menu_order = array();
247
+ foreach($this->custom_menu as $topmenu){
248
+ $filename = $this->get_menu_field($topmenu, 'file');
249
+ if ( in_array($filename, $menu_order) ){
250
+ $custom_menu_order[] = $filename;
251
+ }
252
+ }
253
+ return $custom_menu_order;
254
+ }
255
 
256
  /**
257
  * Determine if the current user may use the menu editor.
868
  $action = isset($post['action'])?$post['action']:(isset($get['action'])?$get['action']:'');
869
  do_action('admin_menu_editor_header', $action);
870
 
871
+ //Handle form submissions
872
+ if (isset($post['data'])){
873
+ check_admin_referer('menu-editor-form');
874
+
875
+ //Try to decode a menu tree encoded as JSON
876
+ $data = $this->json_decode($post['data'], true);
877
+ if (!$data || (count($data) < 2) ){
878
+ $fixed = stripslashes($post['data']);
879
+ $data = $this->json_decode( $fixed, true );
880
+ }
881
+
882
+ $url = remove_query_arg('noheader');
883
+ if ($data){
884
+ //Ensure the user doesn't change the required capability to something they themselves don't have.
885
+ if ( isset($data['options-general.php']['items']['menu_editor']) ){
886
+ $item = $data['options-general.php']['items']['menu_editor'];
887
+ if ( !empty($item['access_level']) && !current_user_can($item['access_level']) ){
888
+ $item['access_level'] = null;
889
+ $data['options-general.php']['items']['menu_editor'] = $item;
890
+ }
891
+ }
892
+
893
+ //Save the custom menu
894
+ $this->options['custom_menu'] = $data;
895
+ $this->save_options();
896
+ //Redirect back to the editor and display the success message
897
+ wp_redirect( add_query_arg('message', 1, $url) );
898
+ } else {
899
+ //Or redirect & display the error message
900
+ wp_redirect( add_query_arg('message', 2, $url) );
901
+ }
902
+ die();
903
  }
904
+
905
+ //Attach a "Feedback" link to the screen meta panel.
906
+ $this->print_uservoice_widget();
907
+ //Kindly remind the user to give me money
908
+ if ( !apply_filters('admin_menu_editor_is_pro', false) ){
909
+ $this->print_upgrade_notice();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
 
 
 
 
 
 
 
 
 
911
  ?>
912
  <div class="wrap">
913
  <h2>
944
 
945
  //Create a list of all known capabilities and roles. Used for the dropdown list on the access field.
946
  $all_capabilities = $this->get_all_capabilities();
947
+ //"level_X" capabilities are deprecated so we don't want people using them.
948
+ //This would look better with array_filter() and an anonymous function as a callback.
949
+ for($level = 0; $level <= 10; $level++){
950
+ $cap = 'level_' . $level;
951
+ if ( isset($all_capabilities[$cap]) ){
952
+ unset($all_capabilities[$cap]);
953
+ }
954
+ }
955
  $all_capabilities = array_keys($all_capabilities);
956
  natcasesort($all_capabilities);
957
 
966
  <div class='ws_main_container'>
967
  <div class='ws_toolbar'>
968
  <div class="ws_button_container">
969
+ <a id='ws_cut_menu' class='ws_button' href='javascript:void(0)' title='Cut'><img src='<?php echo $images_url; ?>/cut.png' alt="Cut" /></a>
970
+ <a id='ws_copy_menu' class='ws_button' href='javascript:void(0)' title='Copy'><img src='<?php echo $images_url; ?>/page_white_copy.png' alt="Copy" /></a>
971
+ <a id='ws_paste_menu' class='ws_button' href='javascript:void(0)' title='Paste'><img src='<?php echo $images_url; ?>/page_white_paste.png' alt="Paste" /></a>
972
 
973
  <div class="ws_separator">&nbsp;</div>
974
 
975
+ <a id='ws_new_menu' class='ws_button' href='javascript:void(0)' title='New menu'><img src='<?php echo $images_url; ?>/page_white_add.png' alt="New menu" /></a>
976
+ <a id='ws_hide_menu' class='ws_button' href='javascript:void(0)' title='Show/Hide'><img src='<?php echo $images_url; ?>/plugin_disabled.png' alt="Show/Hide" /></a>
977
+ <a id='ws_delete_menu' class='ws_button' href='javascript:void(0)' title='Delete menu'><img src='<?php echo $images_url; ?>/page_white_delete.png' alt="Delete menu" /></a>
978
 
979
  <div class="ws_separator">&nbsp;</div>
980
 
981
+ <a id='ws_new_separator' class='ws_button' href='javascript:void(0)' title='New separator'><img src='<?php echo $images_url; ?>/separator_add.png' alt="New separator" /></a>
982
  </div>
983
  </div>
984
 
988
  <div class='ws_main_container'>
989
  <div class='ws_toolbar'>
990
  <div class="ws_button_container">
991
+ <a id='ws_cut_item' class='ws_button' href='javascript:void(0)' title='Cut'><img src='<?php echo $images_url; ?>/cut.png' alt="Cut" /></a>
992
+ <a id='ws_copy_item' class='ws_button' href='javascript:void(0)' title='Copy'><img src='<?php echo $images_url; ?>/page_white_copy.png' alt="Copy" /></a>
993
+ <a id='ws_paste_item' class='ws_button' href='javascript:void(0)' title='Paste'><img src='<?php echo $images_url; ?>/page_white_paste.png' alt="Paste" /></a>
994
 
995
  <div class="ws_separator">&nbsp;</div>
996
 
997
+ <a id='ws_new_item' class='ws_button' href='javascript:void(0)' title='New menu item'><img src='<?php echo $images_url; ?>/page_white_add.png' alt="New menu item" /></a>
998
+ <a id='ws_hide_item' class='ws_button' href='javascript:void(0)' title='Show/Hide'><img src='<?php echo $images_url; ?>/plugin_disabled.png' alt="Show/Hide" /></a>
999
+ <a id='ws_delete_item' class='ws_button' href='javascript:void(0)' title='Delete menu item'><img src='<?php echo $images_url; ?>/page_white_delete.png' alt="Delete menu item" /></a>
1000
 
1001
  <div class="ws_separator">&nbsp;</div>
1002
 
1003
  <a id='ws_sort_ascending' class='ws_button' href='javascript:void(0)' title='Sort ascending'>
1004
+ <img src='<?php echo $images_url; ?>/sort_ascending.png' alt="Sort ascending" />
1005
  </a>
1006
  <a id='ws_sort_descending' class='ws_button' href='javascript:void(0)' title='Sort descending'>
1007
+ <img src='<?php echo $images_url; ?>/sort_descending.png' alt="Sort descending" />
1008
  </a>
1009
  </div>
1010
  </div>
1032
  </div>
1033
 
1034
  <?php
1035
+ //Create a pop-up capability selector
1036
  $capSelector = array('<select id="ws_cap_selector" class="ws_dropdown" size="10">');
1037
 
1038
  $capSelector[] = '<optgroup label="Roles">';
1133
  * @return array Associative array with capability names as keys
1134
  */
1135
  function get_all_capabilities(){
1136
+ /** @var WP_Roles $wp_roles */
1137
  global $wp_roles;
1138
 
1139
  $capabilities = array();
1143
  }
1144
 
1145
  //Iterate over all known roles and collect their capabilities
1146
+ foreach($wp_roles->roles as $role){
1147
  if ( !empty($role['capabilities']) && is_array($role['capabilities']) ){ //Being defensive here
1148
  $capabilities = array_merge($capabilities, $role['capabilities']);
1149
  }
1169
  * @return array Associative array with role IDs as keys and role display names as values
1170
  */
1171
  function get_all_roles(){
1172
+ /** @var WP_Roles $wp_roles */
1173
  global $wp_roles;
1174
  $roles = array();
1175
 
1210
  <script type="text/javascript">
1211
  (function($){
1212
  $('#screen-meta-links').append(
1213
+ '<div id="ws-ame-feedback-widget-wrap">' +
1214
  '<a href="http://feedback.w-shadow.com/forums/58572-admin-menu-editor" id="ws-ame-feedback-widget" class="show-settings" target="_blank" title="Open the user feedback forum">Feedback</a>' +
1215
  '</div>'
1216
  );
1229
  <script type="text/javascript">
1230
  (function($){
1231
  $('#screen-meta-links').append(
1232
+ '<div id="ws-pro-version-notice">' +
1233
  '<a href="http://wpplugins.com/plugin/146/admin-menu-editor-pro" id="ws-pro-version-notice-link" class="show-settings" target="_blank" title="View Pro version details">Upgrade to Pro</a>' +
1234
  '</div>'
1235
  );
js/menu-editor.js CHANGED
@@ -95,9 +95,9 @@ function buildTopMenu(menu){
95
  var contents = [];
96
  contents.push(
97
  '<div class="ws_item_head">',
98
- '<a class="ws_edit_link"> </a><div class="ws_flag_container"> </div>',
99
  '<span class="ws_item_title">',
100
- ((menu.menu_title!=null)?menu.menu_title:menu.defaults.menu_title),
101
  '&nbsp;</span>',
102
  '</div>',
103
  '<div class="ws_editbox" style="display: none;"></div>'
@@ -292,7 +292,7 @@ var knownMenuFields = {
292
  advanced: true,
293
  type: 'checkbox',
294
  defaultValue: false,
295
- visible: true
296
  }
297
  };
298
 
@@ -604,7 +604,7 @@ function readAllFields(container){
604
  var item_flags = {
605
  'custom_item' : 'This is a custom menu item',
606
  'unused' : 'This item was automatically (re)inserted into your custom menu because it is present in the default WordPress menu',
607
- 'missing' : 'This item is not present in the default WordPress menu. Tick the &quot;Custom&quot; checkbox if you want it to be visible anyway.',
608
  'hidden' : 'This item is hidden'
609
  }
610
 
@@ -660,9 +660,9 @@ var ws_paste_count = 0;
660
  $(document).ready(function(){
661
  if (window.wsMenuEditorPro) {
662
  knownMenuFields['open_in'].visible = true;
663
- };
664
-
665
- //Make the top menu box sortable (we only need to do this once)
666
  var mainMenuBox = $('#ws_menu_box');
667
  makeBoxSortable(mainMenuBox);
668
 
@@ -800,21 +800,21 @@ $(document).ready(function(){
800
 
801
 
802
  /***************************************************************************
803
- Dropdown list for combobox fields
804
  ***************************************************************************/
805
-
806
- var availableDropdowns = {
807
- 'ws_cap_selector' : {
808
- list : $('#ws_cap_selector'),
809
- currentOwner : null,
810
- timeoutForgetOwner : 0
811
- },
812
- 'ws_page_selector' : {
813
- list : $('#ws_page_selector'),
814
- currentOwner : null,
815
- timeoutForgetOwner : 0
816
- }
817
- }
818
 
819
  //Show/hide the capability dropdown list when the button is clicked
820
  $('#ws_menu_editor input.ws_dropdown_button').live('click',function(event){
@@ -1005,23 +1005,31 @@ $(document).ready(function(){
1005
 
1006
  //Remove the original menu and submenu
1007
  selection.remove();
1008
- $('#'+selection.data('submenu_id')).remove;
1009
  });
1010
 
1011
  //Paste menu
1012
  $('#ws_paste_menu').click(function () {
1013
  //Check if anything has been copied/cut
1014
  if (!menu_in_clipboard) return;
 
 
 
 
 
 
 
 
1015
  //Get the selected menu
1016
  var selection = $('#ws_menu_box .ws_active');
1017
 
1018
  if (selection.length > 0) {
1019
  //If a menu is selected add the pasted item after it
1020
- outputTopMenu(menu_in_clipboard, selection);
1021
  } else {
1022
  //Otherwise add the pasted item at the end
1023
- outputTopMenu(menu_in_clipboard);
1024
- };
1025
  });
1026
 
1027
  //New menu
@@ -1154,8 +1162,10 @@ $(document).ready(function(){
1154
  $('#ws_paste_item').click(function () {
1155
  //Check if anything has been copied/cut
1156
  if (!item_in_clipboard) return;
 
1157
  //Create a new editor widget for the copied item
1158
- var new_item = buildMenuItem(item_in_clipboard);
 
1159
 
1160
  //Get the selected menu
1161
  var selection = $('#ws_submenu_box .ws_submenu:visible .ws_active');
@@ -1165,7 +1175,7 @@ $(document).ready(function(){
1165
  } else {
1166
  //Otherwise add the pasted item at the end
1167
  $('#ws_submenu_box .ws_submenu:visible').append(new_item);
1168
- };
1169
 
1170
  new_item.show();
1171
  });
95
  var contents = [];
96
  contents.push(
97
  '<div class="ws_item_head">',
98
+ menu.separator ? '' : '<a class="ws_edit_link"> </a><div class="ws_flag_container"> </div>',
99
  '<span class="ws_item_title">',
100
+ ((menu.menu_title!=null) ? menu.menu_title : menu.defaults.menu_title),
101
  '&nbsp;</span>',
102
  '</div>',
103
  '<div class="ws_editbox" style="display: none;"></div>'
292
  advanced: true,
293
  type: 'checkbox',
294
  defaultValue: false,
295
+ visible: false
296
  }
297
  };
298
 
604
  var item_flags = {
605
  'custom_item' : 'This is a custom menu item',
606
  'unused' : 'This item was automatically (re)inserted into your custom menu because it is present in the default WordPress menu',
607
+ 'missing' : 'This item is not present in the default WordPress menu.',
608
  'hidden' : 'This item is hidden'
609
  }
610
 
660
  $(document).ready(function(){
661
  if (window.wsMenuEditorPro) {
662
  knownMenuFields['open_in'].visible = true;
663
+ }
664
+
665
+ //Make the top menu box sortable (we only need to do this once)
666
  var mainMenuBox = $('#ws_menu_box');
667
  makeBoxSortable(mainMenuBox);
668
 
800
 
801
 
802
  /***************************************************************************
803
+ Dropdown list for combobox fields
804
  ***************************************************************************/
805
+
806
+ var availableDropdowns = {
807
+ 'ws_cap_selector' : {
808
+ list : $('#ws_cap_selector'),
809
+ currentOwner : null,
810
+ timeoutForgetOwner : 0
811
+ },
812
+ 'ws_page_selector' : {
813
+ list : $('#ws_page_selector'),
814
+ currentOwner : null,
815
+ timeoutForgetOwner : 0
816
+ }
817
+ };
818
 
819
  //Show/hide the capability dropdown list when the button is clicked
820
  $('#ws_menu_editor input.ws_dropdown_button').live('click',function(event){
1005
 
1006
  //Remove the original menu and submenu
1007
  selection.remove();
1008
+ $('#'+selection.data('submenu_id')).remove();
1009
  });
1010
 
1011
  //Paste menu
1012
  $('#ws_paste_menu').click(function () {
1013
  //Check if anything has been copied/cut
1014
  if (!menu_in_clipboard) return;
1015
+
1016
+ var menu = $.extend(true, {}, menu_in_clipboard);
1017
+
1018
+ //The user shouldn't need to worry about giving separators a unique filename.
1019
+ if (menu.separator) {
1020
+ menu.defaults.file = 'separator_'+randomMenuId();
1021
+ }
1022
+
1023
  //Get the selected menu
1024
  var selection = $('#ws_menu_box .ws_active');
1025
 
1026
  if (selection.length > 0) {
1027
  //If a menu is selected add the pasted item after it
1028
+ outputTopMenu(menu, selection);
1029
  } else {
1030
  //Otherwise add the pasted item at the end
1031
+ outputTopMenu(menu);
1032
+ }
1033
  });
1034
 
1035
  //New menu
1162
  $('#ws_paste_item').click(function () {
1163
  //Check if anything has been copied/cut
1164
  if (!item_in_clipboard) return;
1165
+
1166
  //Create a new editor widget for the copied item
1167
+ var item = $.extend(true, {}, item_in_clipboard);
1168
+ var new_item = buildMenuItem(item);
1169
 
1170
  //Get the selected menu
1171
  var selection = $('#ws_submenu_box .ws_submenu:visible .ws_active');
1175
  } else {
1176
  //Otherwise add the pasted item at the end
1177
  $('#ws_submenu_box .ws_submenu:visible').append(new_item);
1178
+ }
1179
 
1180
  new_item.show();
1181
  });
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.1.3
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.1.4
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
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: 3.0
6
- Tested up to: 3.2
7
- Stable tag: 1.1.3
8
 
9
  Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
10
 
@@ -61,6 +61,19 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  = 1.1.3 =
65
  * Tests for WordPress 3.2 compatibility.
66
 
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: 3.0
6
+ Tested up to: 3.2.1
7
+ Stable tag: 1.1.4
8
 
9
  Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
10
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.1.4 =
65
+ * Fixed the updater's cron hook not being removed when the plugin is deactivated.
66
+ * Fixed updates not showing up in some situations.
67
+ * Fixed the "Feedback" button not responding to mouse clicks in some browsers.
68
+ * Fixed "Feedback" button style to be consistent with other WP screen meta buttons.
69
+ * Enforce the custom menu order by using the 'menu_order' filter. Fixes Jetpack menu not staying put.
70
+ * You can now copy/paste as many menu separators as you like without worrying about some of them mysteriously disappearing on save.
71
+ * Fixed a long-standing copying related bug where copied menus would all still refer to the same JS object instance.
72
+ * Added ALT attributes to the toolbar icon images.
73
+ * Removed the "Custom" checkbox. In retrospect, all it did was confuse people.
74
+ * Made it impossible to edit separator properties.
75
+ * Removed the deprecated "level_X" capabilities from the "Required capability" dropdown. You can still type them in manually if you want.
76
+
77
  = 1.1.3 =
78
  * Tests for WordPress 3.2 compatibility.
79