diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 5b7ff0f7ca..7b332bf1db 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -732,14 +732,29 @@ function get_admin_page_parent() { return ''; } -function add_options_page($page_title, $menu_title, $access_level, $file) { +function add_menu_page($page_title, $menu_title, $access_level, $file) { + global $menu; + + $file = basename($file); + + $menu[] = array($menu_title, $access_level, $file, $page_title); +} + +function add_submenu_page($parent, $page_title, $menu_title, $access_level, $file) { global $submenu; $file = basename($file); - $submenu['options-general.php'][] = array($menu_title, $access_level, $file, $page_title); + $submenu[$parent][] = array($menu_title, $access_level, $file, $page_title); } +function add_options_page($page_title, $menu_title, $access_level, $file) { + add_submenu_page('options-general.php', $page_title, $menu_title, $access_level, $file); +} + +function add_management_page($page_title, $menu_title, $access_level, $file) { + add_submenu_page('edit.php', $page_title, $menu_title, $access_level, $file); +} function validate_file_to_edit($file, $allowed_files = '') { if ('..' == substr($file,0,2)) diff --git a/wp-admin/menu-header.php b/wp-admin/menu-header.php index 7c1696e73f..08e067352d 100644 --- a/wp-admin/menu-header.php +++ b/wp-admin/menu-header.php @@ -8,17 +8,21 @@ get_admin_page_parent(); foreach ($menu as $item) { $class = ''; - // 0 = name, 1 = user_level, 2 = file - if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"'; + // 0 = name, 1 = user_level, 2 = file + if ((substr($self, -10) == substr($item[2], -10) && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"'; - if ($user_level >= $item[1]) { - if ( -('upload.php' == $item[2] && -get_settings('use_fileupload') && -($user_level >= get_settings('fileupload_minlevel')) - ) || 'upload.php' != $item[2]) - echo "\n\t