2004-10-19 03:03:06 +00:00
|
|
|
<ul id="adminmenu">
|
|
|
|
<?php
|
|
|
|
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
|
|
|
|
$self = preg_replace('|^.*/plugins/|i', '', $self);
|
|
|
|
|
2006-11-18 06:09:48 +00:00
|
|
|
foreach ( $submenu as $parent => $subpages ) {
|
|
|
|
foreach ( $subpages as $page ) {
|
|
|
|
// 0 menu title, 1 cap, 2 file or slug, 3 page title
|
|
|
|
if ( $self == $page[2] )
|
|
|
|
$parent_file = $parent;
|
|
|
|
}
|
|
|
|
}
|
2004-10-19 03:03:06 +00:00
|
|
|
|
|
|
|
foreach ($menu as $item) {
|
|
|
|
$class = '';
|
|
|
|
|
2005-07-17 19:29:55 +00:00
|
|
|
// 0 = name, 1 = capability, 2 = file
|
2005-02-12 02:00:56 +00:00
|
|
|
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
|
2004-10-19 03:03:06 +00:00
|
|
|
|
2006-02-17 00:57:10 +00:00
|
|
|
if ( !empty($submenu[$item[2]]) || current_user_can($item[1]) ) {
|
2006-09-21 20:46:39 +00:00
|
|
|
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") )
|
2006-11-02 06:07:59 +00:00
|
|
|
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
2004-12-14 09:53:16 +00:00
|
|
|
else
|
2006-11-02 06:07:59 +00:00
|
|
|
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
2004-11-26 01:50:37 +00:00
|
|
|
}
|
2004-10-19 03:03:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
// Sub-menu
|
|
|
|
if ( isset($submenu["$parent_file"]) ) :
|
|
|
|
?>
|
2005-09-05 23:33:10 +00:00
|
|
|
<ul id="submenu">
|
2004-10-19 03:03:06 +00:00
|
|
|
<?php
|
|
|
|
foreach ($submenu["$parent_file"] as $item) :
|
2005-07-13 16:04:14 +00:00
|
|
|
if ( !current_user_can($item[1]) )
|
2004-10-19 03:03:06 +00:00
|
|
|
continue;
|
|
|
|
|
2005-03-02 16:30:00 +00:00
|
|
|
if ( isset($submenu_file) ) {
|
2005-03-21 04:18:16 +00:00
|
|
|
if ( $submenu_file == $item[2] ) $class = ' class="current"';
|
2005-03-02 16:30:00 +00:00
|
|
|
else $class = '';
|
2005-03-21 04:18:16 +00:00
|
|
|
} else if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && $self == $item[2]) ) $class = ' class="current"';
|
2004-12-24 20:55:36 +00:00
|
|
|
else $class = '';
|
2004-10-19 03:03:06 +00:00
|
|
|
|
2005-02-25 16:11:27 +00:00
|
|
|
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
|
|
|
|
|
2006-09-21 20:46:39 +00:00
|
|
|
if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
|
2005-02-25 16:11:27 +00:00
|
|
|
if ( 'admin.php' == $pagenow )
|
2006-11-02 06:07:59 +00:00
|
|
|
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
2005-02-25 16:11:27 +00:00
|
|
|
else
|
2006-11-02 06:07:59 +00:00
|
|
|
echo "\n\t<li><a href='{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
|
2005-02-07 01:15:06 +00:00
|
|
|
} else {
|
2006-11-02 06:07:59 +00:00
|
|
|
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
2005-02-07 01:15:06 +00:00
|
|
|
}
|
2004-10-19 03:03:06 +00:00
|
|
|
endforeach;
|
|
|
|
?>
|
|
|
|
|
|
|
|
</ul>
|
2006-02-09 09:03:13 +00:00
|
|
|
<?php
|
2006-10-06 01:14:47 +00:00
|
|
|
else :
|
|
|
|
?>
|
|
|
|
<div id="minisub"></div>
|
|
|
|
<?php
|
2006-02-09 09:03:13 +00:00
|
|
|
|
|
|
|
endif;
|
|
|
|
|
|
|
|
do_action('admin_notices');
|
|
|
|
|
2006-11-18 06:09:48 +00:00
|
|
|
?>
|