Permalink
Browse files

Fixed a bug that the default sub-menu page of a custom top-level menu…

… page could not be removed when the PHP class with a namespace is used. Fixes #270
  • Loading branch information...
michaeluno committed Jun 11, 2017
1 parent 8a22f04 commit ee71a72064ef2f6a4ae85584469954c6fe18679a
@@ -6,7 +6,7 @@
* Author: Michael Uno
* Author URI: http://en.michaeluno.jp/
* Requirements: PHP 5.2.4 or above, WordPress 3.3 or above.
* Version: 3.8.15
* Version: 3.8.16b01
*/
/**
@@ -16,7 +16,7 @@
*/
class AdminPageFrameworkLoader_Registry_Base {
const VERSION = '3.8.15'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const VERSION = '3.8.16b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing.
const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc.
const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.';
@@ -35,11 +35,11 @@
* @download_latest https://github.com/michaeluno/admin-page-framework/archive/master.zip
* @download_stable http://downloads.wordpress.org/plugin/admin-page-framework.latest-stable.zip
* @catchcopy The framework for all WordPress developers.
* @version 3.8.15
* @version 3.8.16b01
*/
abstract class AdminPageFramework_Registry_Base {
const VERSION = '3.8.15'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const VERSION = '3.8.16b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
const NAME = 'Admin Page Framework';
const DESCRIPTION = 'Facilitates WordPress plugin and theme development.';
const URI = 'http://en.michaeluno.jp/admin-page-framework';
@@ -575,9 +575,20 @@ public function _replyToRemoveRootMenuPage() {
if ( $this->oFactory->oProp->bIsAdminAjax ) {
return;
}
/**
* Namespace slugs have backslashes but the registered slugs backslashes are all converted to forward-slashes.
* @since 3.5.16
*/
$_sMenuSlug = str_replace(
'\\',
'/',
$this->oFactory->oProp->aRootMenu[ 'sPageSlug' ]
);
remove_submenu_page(
$this->oFactory->oProp->aRootMenu[ 'sPageSlug' ],
$this->oFactory->oProp->aRootMenu[ 'sPageSlug' ]
$_sMenuSlug, // parent menu slug
$_sMenuSlug // sub-menu slug
);
}
View
@@ -505,6 +505,9 @@ See examples, https://gist.github.com/michaeluno/c30713fcfe0d9d45d89f, https://g
== Changelog ==
= 3.8.16 =
- Fixed a bug that the default sub-menu page of a custom top-level menu page could not be removed when the PHP class with a namespace is used.
= 3.8.15 - 2017/01/23 =
- Fixed a bug that caused an undefined method warning in the admin notice class.

0 comments on commit ee71a72

Please sign in to comment.