Ticket #31178: menu.php.patch
File menu.php.patch, 2.1 KB (added by , 10 years ago) |
---|
-
src/wp-admin/menu.php
22 22 * @var array 23 23 */ 24 24 25 $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );26 25 26 function get_safe_index( $target_index, $target_array ){ 27 if( ! array_key_exists( $target_index, $target_array ) ){ 28 return $target_index; 29 } 30 while( array_key_exists( $target_index, $target_array ) ){ 31 $target_index = $target_index . '.' . rand( 1, 1000 ); 32 } 33 return $target_index; 34 } 35 36 37 $menu[ get_safe_index( 2, $menu ) ] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' ); 38 27 39 $submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' ); 28 40 29 41 if ( is_multisite() ) { … … 126 138 * by a hard-coded value below, increment the position. 127 139 */ 128 140 $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99); 129 while ( isset( $menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )141 while ( isset( $menu[$ptype_menu_position] ) || in_array( $ptype_menu_position, $core_menu_positions ) ){ 130 142 $ptype_menu_position++; 143 } 131 144 132 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 145 146 $menu[get_safe_index( $ptype_menu_position, $menu )] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 133 147 $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype"); 134 148 $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype" ); 135 149