Changes in trunk/wp-admin/includes/menu.php [16471:18109]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/menu.php
r16471 r18109 103 103 $_wp_menu_nopriv[$data[2]] = true; 104 104 105 // If there is only one submenu and it is has same destination as the parent, 106 // remove the submenu. 107 if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) { 108 $subs = $submenu[$data[2]]; 109 $first_sub = array_shift($subs); 110 if ( $data[2] == $first_sub[2] ) 111 unset( $submenu[$data[2]] ); 112 } 113 105 114 // If submenu is empty... 106 115 if ( empty($submenu[$data[2]]) ) { … … 111 120 } 112 121 } 113 unset($id, $data );114 115 // Remove any duplicated sep erators116 $sep erator_found = false;122 unset($id, $data, $subs, $first_sub); 123 124 // Remove any duplicated separators 125 $separator_found = false; 117 126 foreach ( $menu as $id => $data ) { 118 127 if ( 0 == strcmp('wp-menu-separator', $data[4] ) ) { 119 if (false == $sep erator_found) {120 $sep erator_found = true;128 if (false == $separator_found) { 129 $separator_found = true; 121 130 } else { 122 131 unset($menu[$id]); 123 $sep erator_found = false;132 $separator_found = false; 124 133 } 125 134 } else { 126 $sep erator_found = false;135 $separator_found = false; 127 136 } 128 137 } … … 206 215 } 207 216 217 // Remove the last menu item if it is a separator. 218 $last_menu_key = array_pop( array_keys( $menu ) ); 219 if ( 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) 220 unset( $menu[ $last_menu_key ] ); 221 unset( $last_menu_key ); 222 208 223 if ( !user_can_access_admin_page() ) { 209 224 do_action('admin_page_access_denied');
Note: See TracChangeset
for help on using the changeset viewer.