Changeset 13579 for trunk/wp-admin/menu-header.php
- Timestamp:
- 03/04/2010 12:15:55 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/menu-header.php
r12733 r13579 34 34 */ 35 35 function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { 36 global $self, $parent_file, $submenu_file, $plugin_page, $pagenow ;36 global $self, $parent_file, $submenu_file, $plugin_page, $pagenow, $typenow; 37 37 38 38 $first = true; … … 48 48 $class[] = 'wp-has-submenu'; 49 49 50 if ( ( $parent_file && $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') && strcmp($self, $item[2]) == 0) ) {50 if ( ( $parent_file && $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') && $self == $item[2] ) ) { 51 51 if ( !empty($submenu[$item[2]]) ) 52 52 $class[] = 'wp-has-current-submenu wp-menu-open'; … … 113 113 114 114 $menu_file = $item[2]; 115 115 116 if ( false !== $pos = strpos($menu_file, '?') ) 116 117 $menu_file = substr($menu_file, 0, $pos); 118 119 // Handle current for post_type=post|page|foo pages, which won't match $self. 120 if ( !empty($typenow) ) 121 $self_type = $self . '?post_type=' . $typenow; 122 else 123 $self_type = 'nothing'; 117 124 118 125 if ( isset($submenu_file) ) { … … 121 128 // If plugin_page is set the parent must either match the current page or not physically exist. 122 129 // This allows plugin pages with the same hook to exist under different parents. 123 } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self) )) || (!isset($plugin_page) && $self == $sub_item[2]) ) {130 } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($menu_file) || ($item[2] == $self) || ($item[2] == $self_type))) || (!isset($plugin_page) && $self == $sub_item[2]) ) { 124 131 $class[] = 'current'; 125 132 } … … 134 141 if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) { 135 142 // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir 136 137 $parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file); 138 if ( $parent_exists ) 139 echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>"; 140 elseif ( 'admin.php' == $pagenow || !$parent_exists ) 141 echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>"; 143 if ( (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}")) || file_exists($menu_file) ) 144 $sub_item_url = add_query_arg( array('page' => $sub_item[2]), $item[2] ); 142 145 else 143 echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>"; 146 $sub_item_url = add_query_arg( array('page' => $sub_item[2]), 'admin.php' ); 147 echo "<li$class><a href='$sub_item_url'$class$tabindex>{$sub_item[0]}</a></li>"; 144 148 } else { 145 149 echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
Note: See TracChangeset
for help on using the changeset viewer.