mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
add_menu_page(), add_submenu_page(), add_management_page().
git-svn-id: http://svn.automattic.com/wordpress/trunk@1886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0ddd331190
commit
8b9b4d71da
@ -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))
|
||||
|
@ -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<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
}
|
||||
if ($user_level >= $item[1]) {
|
||||
if (
|
||||
('upload.php' == $item[2] &&
|
||||
get_settings('use_fileupload') &&
|
||||
($user_level >= get_settings('fileupload_minlevel'))
|
||||
) || 'upload.php' != $item[2]) {
|
||||
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}"))
|
||||
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user