Admin Menu Editor - Version 1.1.6

Version Description

  • Tested on WP 3.3.1.
  • Fixed a couple 404's in the readme and the plugin itself.
Download this release

Release Info

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

Code changes from version 1.1.5 to 1.1.6

css/menu-editor.css CHANGED
@@ -553,7 +553,6 @@ a.ws_button:hover {
553
  *************************************/
554
 
555
  /* All buttons */
556
- #ws-ame-feedback-widget-wrap,
557
  #ws-pro-version-notice {
558
  float: right;
559
  height: 22px;
@@ -581,7 +580,6 @@ a.ws_button:hover {
581
  background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
582
  }
583
 
584
- #ws-ame-feedback-widget-wrap a.show-settings,
585
  #ws-pro-version-notice a.show-settings {
586
  background-image: none;
587
  padding:0 6px 0 6px;
553
  *************************************/
554
 
555
  /* All buttons */
 
556
  #ws-pro-version-notice {
557
  float: right;
558
  height: 22px;
580
  background-image: linear-gradient(bottom, #dfdfdf, #f1f1f1); /* proposed W3C Markup */
581
  }
582
 
 
583
  #ws-pro-version-notice a.show-settings {
584
  background-image: none;
585
  padding:0 6px 0 6px;
includes/menu-editor-core.php CHANGED
@@ -15,8 +15,11 @@ if ( !class_exists('WPMenuEditor') ) :
15
 
16
  class WPMenuEditor extends MenuEd_ShadowPluginFramework {
17
 
18
- protected $default_wp_menu = null; //Holds the default WP menu for later use in the editor
19
  protected $default_wp_submenu = null; //Holds the default WP menu for later use
 
 
 
20
  protected $title_lookups = array(); //A list of page titles indexed by $item['file']. Used to
21
  //fix the titles of moved plugin pages.
22
  private $custom_menu = null; //The current custom menu with defaults merged in
@@ -218,12 +221,14 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
218
  }
219
  //Merge in data from the default menu
220
  $tree = $this->menu_merge($this->options['custom_menu'], $menu, $submenu);
221
- //Apply the custom menu
222
- list($menu, $submenu, $this->title_lookups) = $this->tree2wp($tree);
223
  //Save for later - the editor page will need it
224
  $this->custom_menu = $tree;
 
 
225
  //Re-filter the menu (silly WP should do that itself, oh well)
226
  $this->filter_menu();
 
 
227
  }
228
  }
229
 
@@ -247,8 +252,8 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
247
  return $menu_order;
248
  }
249
  $custom_menu_order = array();
250
- foreach($this->custom_menu as $topmenu){
251
- $filename = $this->get_menu_field($topmenu, 'file');
252
  if ( in_array($filename, $menu_order) ){
253
  $custom_menu_order[] = $filename;
254
  }
@@ -819,7 +824,6 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
819
  }
820
  }
821
  }
822
-
823
  return array($menu, $submenu, $title_lookup);
824
  }
825
 
@@ -905,8 +909,6 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
905
  die();
906
  }
907
 
908
- //Attach a "Feedback" link to the screen meta panel.
909
- $this->print_uservoice_widget();
910
  //Kindly remind the user to give me money
911
  if ( !apply_filters('admin_menu_editor_is_pro', false) ){
912
  $this->print_upgrade_notice();
@@ -1197,31 +1199,14 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1197
  * @return array Filtered version of $allcaps
1198
  */
1199
  function hook_user_has_cap($allcaps, $required_caps, $args){
1200
- if ( in_array('super_admin', $required_caps) ){
 
 
1201
  $allcaps['super_admin'] = is_multisite() && is_super_admin($args[1]);
1202
  }
1203
  return $allcaps;
1204
  }
1205
 
1206
- /**
1207
- * Output the JavaScript that adds the "Feedback" widget to screen meta.
1208
- *
1209
- * @return void
1210
- */
1211
- function print_uservoice_widget(){
1212
- ?>
1213
- <script type="text/javascript">
1214
- (function($){
1215
- $('#screen-meta-links').append(
1216
- '<div id="ws-ame-feedback-widget-wrap">' +
1217
- '<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>' +
1218
- '</div>'
1219
- );
1220
- })(jQuery);
1221
- </script>
1222
- <?php
1223
- }
1224
-
1225
  /**
1226
  * Output the "Upgrade to Pro" message
1227
  *
@@ -1233,7 +1218,7 @@ window.wsMenuEditorPro = false; //Will be overwritten if extras are loaded
1233
  (function($){
1234
  $('#screen-meta-links').append(
1235
  '<div id="ws-pro-version-notice">' +
1236
- '<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>' +
1237
  '</div>'
1238
  );
1239
  })(jQuery);
15
 
16
  class WPMenuEditor extends MenuEd_ShadowPluginFramework {
17
 
18
+ protected $default_wp_menu = null; //Holds the default WP menu for later use in the editor
19
  protected $default_wp_submenu = null; //Holds the default WP menu for later use
20
+ private $filtered_wp_menu = null; //The final, ready-for-display top-level menu and sub-menu.
21
+ private $filtered_wp_submenu = null;
22
+
23
  protected $title_lookups = array(); //A list of page titles indexed by $item['file']. Used to
24
  //fix the titles of moved plugin pages.
25
  private $custom_menu = null; //The current custom menu with defaults merged in
221
  }
222
  //Merge in data from the default menu
223
  $tree = $this->menu_merge($this->options['custom_menu'], $menu, $submenu);
 
 
224
  //Save for later - the editor page will need it
225
  $this->custom_menu = $tree;
226
+ //Apply the custom menu
227
+ list($menu, $submenu, $this->title_lookups) = $this->tree2wp($tree);
228
  //Re-filter the menu (silly WP should do that itself, oh well)
229
  $this->filter_menu();
230
+ $this->filtered_wp_menu = $menu;
231
+ $this->filtered_wp_submenu = $submenu;
232
  }
233
  }
234
 
252
  return $menu_order;
253
  }
254
  $custom_menu_order = array();
255
+ foreach($this->filtered_wp_menu as $topmenu){
256
+ $filename = $topmenu[2];
257
  if ( in_array($filename, $menu_order) ){
258
  $custom_menu_order[] = $filename;
259
  }
824
  }
825
  }
826
  }
 
827
  return array($menu, $submenu, $title_lookup);
828
  }
829
 
909
  die();
910
  }
911
 
 
 
912
  //Kindly remind the user to give me money
913
  if ( !apply_filters('admin_menu_editor_is_pro', false) ){
914
  $this->print_upgrade_notice();
1199
  * @return array Filtered version of $allcaps
1200
  */
1201
  function hook_user_has_cap($allcaps, $required_caps, $args){
1202
+ //Be careful not to overwrite a super_admin cap added by other plugins
1203
+ //For example, Advanced Access Manager also adds this capability.
1204
+ if ( in_array('super_admin', $required_caps) && !isset($allcaps['super_admin']) ){
1205
  $allcaps['super_admin'] = is_multisite() && is_super_admin($args[1]);
1206
  }
1207
  return $allcaps;
1208
  }
1209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
  /**
1211
  * Output the "Upgrade to Pro" message
1212
  *
1218
  (function($){
1219
  $('#screen-meta-links').append(
1220
  '<div id="ws-pro-version-notice">' +
1221
+ '<a href="http://w-shadow.com/AdminMenuEditor/" id="ws-pro-version-notice-link" class="show-settings" target="_blank" title="View Pro version details">Upgrade to Pro</a>' +
1222
  '</div>'
1223
  );
1224
  })(jQuery);
includes/shadow_plugin_framework.php CHANGED
@@ -33,8 +33,8 @@ class MenuEd_ShadowPluginFramework {
33
  public $is_mu_plugin = null; //True if installed in the mu-plugins directory, false otherwise
34
 
35
  protected $options = array();
36
- public $option_name = ''; //should be set or overriden by the plugin
37
- protected $defaults = array(); //should be set or overriden by the plugin
38
  protected $sitewide_options = false; //WPMU only : save the setting in a site-wide option
39
  protected $serialize_with_json = false; //Use the JSON format for option storage
40
 
@@ -49,10 +49,10 @@ class MenuEd_ShadowPluginFramework {
49
 
50
  /**
51
  * Class constructor. Populates some internal fields, then calls the plugin's own
52
- * intializer (if any).
53
  *
54
- * @param string $plugin_file Plugin's filename. Usuallly you can just use __FILE__.
55
- * @return void
56
  */
57
  function __construct( $plugin_file = '', $option_name = null ){
58
  if ($plugin_file == ''){
33
  public $is_mu_plugin = null; //True if installed in the mu-plugins directory, false otherwise
34
 
35
  protected $options = array();
36
+ public $option_name = ''; //should be set or overridden by the plugin
37
+ protected $defaults = array(); //should be set or overridden by the plugin
38
  protected $sitewide_options = false; //WPMU only : save the setting in a site-wide option
39
  protected $serialize_with_json = false; //Use the JSON format for option storage
40
 
49
 
50
  /**
51
  * Class constructor. Populates some internal fields, then calls the plugin's own
52
+ * initializer (if any).
53
  *
54
+ * @param string $plugin_file Plugin's filename. Usually you can just use __FILE__.
55
+ * @param string $option_name
56
  */
57
  function __construct( $plugin_file = '', $option_name = null ){
58
  if ($plugin_file == ''){
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.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.1.6
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.1
7
- Stable tag: 1.1.5
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
 
@@ -19,9 +19,9 @@ Admin Menu Editor lets you manually edit the Dashboard menu. You can reorder the
19
  * Hide/show any menu or menu item. A hidden menu is invisible to all users, including administrators.
20
  * Create custom menus that point to any part of the Dashboard or an external URL.
21
 
22
- The [Pro version](http://wpplugins.com/plugin/146/admin-menu-editor-pro) of the plugin lets you also import/export menu configurations, make menu items open in a new window, and use [shortcodes](http://wpplugins.com/plugin/146/admin-menu-editor-pro?view=notes) in the Dashboard menu.
23
 
24
- [Suggest new features and improvements here](http://feedback.w-shadow.com/forums/58572-admin-menu-editor)
25
 
26
  **Notes**
27
 
@@ -61,6 +61,14 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
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.
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.3.1
7
+ Stable tag: 1.1.6
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
 
19
  * Hide/show any menu or menu item. A hidden menu is invisible to all users, including administrators.
20
  * Create custom menus that point to any part of the Dashboard or an external URL.
21
 
22
+ The [Pro version](http://w-shadow.com/AdminMenuEditor/) of the plugin lets you also import/export menu configurations, make menu items open in a new window, and use shortcodes in the Dashboard menu.
23
 
24
+ [Suggest new features and improvements here](http://w-shadow.com/admin-menu-editor-pro/contact/)
25
 
26
  **Notes**
27
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.1.6 =
65
+ * Tested on WP 3.3.1.
66
+ * Fixed a couple 404's in the readme and the plugin itself.
67
+
68
+ = 1.1.5 =
69
+ * Fixed an error where there would be no custom menu to show.
70
+ * Removed the "Feedback" button due to lack of use. You can still provide feedback via blog comments or email, of course.
71
+
72
  = 1.1.4 =
73
  * Fixed the updater's cron hook not being removed when the plugin is deactivated.
74
  * Fixed updates not showing up in some situations.