root/branches/2.0/wp-admin/menu-header.php

Revision 3588, 1.8 kB (checked in by ryan, 2 years ago)

Back port of #2398 to 2.0 branch. fixes #2398

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <ul id="adminmenu">
2 <?php
3 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
4 $self = preg_replace('|^.*/plugins/|i', '', $self);
5
6 get_admin_page_parent();
7
8 foreach ($menu as $item) {
9     $class = '';
10
11     // 0 = name, 1 = capability, 2 = file
12     if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
13     
14     if ( current_user_can($item[1]) ) {
15         if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
16             echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";           
17         else
18             echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
19     }
20 }
21
22 ?>
23 </ul>
24
25 <?php
26 // Sub-menu
27 if ( isset($submenu["$parent_file"]) ) :
28 ?>
29 <ul id="submenu">
30 <?php
31 foreach ($submenu["$parent_file"] as $item) :
32      if ( !current_user_can($item[1]) )
33          continue;
34
35 if ( isset($submenu_file) ) {
36     if ( $submenu_file == $item[2] ) $class = ' class="current"';
37     else $class = '';
38 } else if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && $self == $item[2]) ) $class = ' class="current"';
39 else $class = '';
40
41 $menu_hook = get_plugin_page_hook($item[2], $parent_file);
42
43 if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
44      if ( 'admin.php' == $pagenow )
45         echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
46     else
47         echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
48  } else {
49     echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
50  }
51 endforeach;
52 ?>
53
54 </ul>
55 <?php
56
57 endif;
58
59 do_action('admin_notices');
60
61 ?>
Note: See TracBrowser for help on using the browser.