Admin Menu Editor - Version 1.1.1

Version Description

  • WordPress 3.1.3 compatibility. Should also be compatible with the upcoming 3.2.
  • Fixed spurious slashes sometimes showing up in menus.
  • Fixed a fatal error concerning "Services_JSON".
Download this release

Release Info

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

Code changes from version 1.1 to 1.1.1

includes/menu-editor-core.php CHANGED
@@ -831,17 +831,25 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
831
  die("Access denied");
832
  }
833
 
834
- $action = isset($_POST['action'])?$_POST['action']:(isset($_GET['action'])?$_GET['action']:'');
 
 
 
 
 
 
 
 
835
  do_action('admin_menu_editor_header', $action);
836
 
837
  //Handle form submissions
838
- if (isset($_POST['data'])){
839
  check_admin_referer('menu-editor-form');
840
 
841
  //Try to decode a menu tree encoded as JSON
842
- $data = $this->json_decode($_POST['data'], true);
843
  if (!$data || count(($data) < 2) ){
844
- $fixed = stripslashes($_POST['data']);
845
  $data = $this->json_decode( $fixed, true );
846
  }
847
 
831
  die("Access denied");
832
  }
833
 
834
+ $post = $_POST;
835
+ $get = $_GET;
836
+ if ( function_exists('wp_magic_quotes') ){
837
+ //Ceterum censeo, WP shouldn't mangle superglobals.
838
+ $post = stripslashes_deep($post);
839
+ $get = stripslashes_deep($get);
840
+ }
841
+
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
 
includes/shadow_plugin_framework.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  /**
4
  * @author W-Shadow
5
- * @copyright 2008-2010
6
  */
7
 
8
  //Make sure the needed constants are defined
@@ -17,12 +17,18 @@ if ( ! defined( 'WP_PLUGIN_DIR' ) )
17
 
18
 
19
  //Load JSON functions for PHP < 5.2
20
- if (!class_exists('Services_JSON')){
21
- require ABSPATH . WPINC . '/class-json.php';
 
 
 
 
 
 
22
  }
23
 
24
  class MenuEd_ShadowPluginFramework {
25
- public static $framework_version = '0.4';
26
 
27
  public $is_mu_plugin = null; //True if installed in the mu-plugins directory, false otherwise
28
 
@@ -179,9 +185,16 @@ class MenuEd_ShadowPluginFramework {
179
  if ( function_exists('json_decode') ){
180
  return json_decode($data, $assoc);
181
  }
182
- $flag = $assoc?SERVICES_JSON_LOOSE_TYPE:0;
183
- $json = new Services_JSON($flag);
184
- return( $json->decode($data) );
 
 
 
 
 
 
 
185
  }
186
 
187
  /**
@@ -191,10 +204,19 @@ class MenuEd_ShadowPluginFramework {
191
  * @return string
192
  */
193
  function json_encode($data) {
194
- $json = new Services_JSON();
195
- return( $json->encodeUnsafe($data) );
196
- }
197
-
 
 
 
 
 
 
 
 
 
198
 
199
 
200
  /**
2
 
3
  /**
4
  * @author W-Shadow
5
+ * @copyright 2008-2011
6
  */
7
 
8
  //Make sure the needed constants are defined
17
 
18
 
19
  //Load JSON functions for PHP < 5.2
20
+ if ( !(function_exists('json_encode') && function_exists('json_decode')) && !(class_exists('Services_JSON') || class_exists('Moxiecode_JSON')) ){
21
+ $class_json_path = ABSPATH.WPINC.'/class-json.php';
22
+ $class_moxiecode_json_path = ABSPATH.WPINC.'/js/tinymce/plugins/spellchecker/classes/utils/JSON.php';
23
+ if ( file_exists($class_json_path) ){
24
+ require $class_json_path;
25
+ } elseif ( file_exists($class_moxiecode_json_path) ) {
26
+ require $class_moxiecode_json_path;
27
+ }
28
  }
29
 
30
  class MenuEd_ShadowPluginFramework {
31
+ public static $framework_version = '0.4.1';
32
 
33
  public $is_mu_plugin = null; //True if installed in the mu-plugins directory, false otherwise
34
 
185
  if ( function_exists('json_decode') ){
186
  return json_decode($data, $assoc);
187
  }
188
+ if ( class_exists('Services_JSON') ){
189
+ $flag = $assoc?SERVICES_JSON_LOOSE_TYPE:0;
190
+ $json = new Services_JSON($flag);
191
+ return( $json->decode($data) );
192
+ } elseif ( class_exists('Moxiecode_JSON') ){
193
+ $json = new Moxiecode_JSON();
194
+ return $json->decode($data);
195
+ } else {
196
+ trigger_error('No JSON parser available', E_USER_ERROR);
197
+ }
198
  }
199
 
200
  /**
204
  * @return string
205
  */
206
  function json_encode($data) {
207
+ if ( function_exists('json_encode') ){
208
+ return json_encode($data);
209
+ }
210
+ if ( class_exists('Services_JSON') ){
211
+ $json = new Services_JSON();
212
+ return( $json->encodeUnsafe($data) );
213
+ } elseif ( class_exists('Moxiecode_JSON') ){
214
+ $json = new Moxiecode_JSON();
215
+ return $json->encode($data);
216
+ } else {
217
+ trigger_error('No JSON parser available', E_USER_ERROR);
218
+ }
219
+ }
220
 
221
 
222
  /**
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
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.1
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.1
7
- Stable tag: 1.1
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,11 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
64
  = 1.1 =
65
  * WordPress 3.1 compatibility.
66
  * Added the ability to drag & drop a menu item to a different menu.
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.1.3
7
+ Stable tag: 1.1.1
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.1 =
65
+ * WordPress 3.1.3 compatibility. Should also be compatible with the upcoming 3.2.
66
+ * Fixed spurious slashes sometimes showing up in menus.
67
+ * Fixed a fatal error concerning "Services_JSON".
68
+
69
  = 1.1 =
70
  * WordPress 3.1 compatibility.
71
  * Added the ability to drag & drop a menu item to a different menu.