Changeset 11092 for trunk/wp-admin/menu.php
- Timestamp:
- 04/27/2009 05:09:50 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/menu.php
r11032 r11092 28 28 $menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' ); 29 29 30 $menu[4] = array( '', 'read', ' ', '', 'wp-menu-separator' );30 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 31 31 32 32 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top', 'menu-posts', 'div' ); … … 66 66 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group 67 67 68 $menu[59] = array( '', 'read', ' ', '', 'wp-menu-separator' );68 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); 69 69 70 70 $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top', 'menu-appearance', 'div' ); … … 117 117 $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group 118 118 119 $menu[99] = array( '', 'read', ' ', '', 'wp-menu-separator-last' );119 $menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator-last' ); 120 120 121 121 // Back-compat for old top-levels … … 239 239 240 240 if ( 0 == $order ) { // dashboard is always shown/single 241 $menu[0][4] = add_cssclass('menu-top-first menu-top-last', $top[4]); 241 $menu[0][4] = add_cssclass('menu-top-first', $top[4]); 242 $lastorder = 0; 242 243 continue; 243 244 } 244 245 245 if ( empty($top[2]) ) { // if separator246 if ( 0 === strpos($top[2], 'separator') ) { // if separator 246 247 $first = true; 247 if ( $lastorder ) { 248 $c = $menu[$lastorder][4]; 249 $menu[$lastorder][4] = add_cssclass('menu-top-last', $c); 250 } 248 $c = $menu[$lastorder][4]; 249 $menu[$lastorder][4] = add_cssclass('menu-top-last', $c); 251 250 continue; 252 251 } … … 271 270 uksort($menu, "strnatcasecmp"); // make it all pretty 272 271 272 if ( apply_filters('custom_menu_order', false) ) { 273 $menu_order = array(); 274 foreach ( $menu as $menu_item ) { 275 $menu_order[] = $menu_item[2]; 276 } 277 unset($menu_item); 278 $default_menu_order = $menu_order; 279 $menu_order = apply_filters('menu_order', $menu_order); 280 $menu_order = array_flip($menu_order); 281 $default_menu_order = array_flip($default_menu_order); 282 283 function sort_menu($a, $b) { 284 global $menu_order, $default_menu_order; 285 $a = $a[2]; 286 $b = $b[2]; 287 if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) { 288 return -1; 289 } elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) { 290 return 1; 291 } elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) { 292 if ( $menu_order[$a] == $menu_order[$b] ) 293 return 0; 294 return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1; 295 } else { 296 return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1; 297 } 298 } 299 300 usort($menu, 'sort_menu'); 301 unset($menu_order, $default_menu_order); 302 } 303 273 304 $menu = add_menu_classes($menu); 274 305
Note: See TracChangeset
for help on using the changeset viewer.