Coding Standards: Use more descriptive variable names in `add_menu_classes()`.
Follow-up to [9578], [53193], [53194]. See #54728. Built from https://develop.svn.wordpress.org/trunk@53195 git-svn-id: http://core.svn.wordpress.org/trunk@52784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a30a1efac4
commit
b32080c332
|
@ -214,38 +214,39 @@ function add_cssclass( $class_to_add, $classes ) {
|
|||
* @return array The array of administration menu items with the CSS classes added.
|
||||
*/
|
||||
function add_menu_classes( $menu ) {
|
||||
$first = false;
|
||||
$lastorder = false;
|
||||
$i = 0;
|
||||
$mc = count( $menu );
|
||||
$first_item = false;
|
||||
$last_order = false;
|
||||
$items_count = count( $menu );
|
||||
$i = 0;
|
||||
|
||||
foreach ( $menu as $order => $top ) {
|
||||
$i++;
|
||||
|
||||
if ( 0 == $order ) { // Dashboard is always shown/single.
|
||||
$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
|
||||
$lastorder = 0;
|
||||
$last_order = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( 0 === strpos( $top[2], 'separator' ) && false !== $lastorder ) { // If separator.
|
||||
$first = true;
|
||||
$c = $menu[ $lastorder ][4];
|
||||
$menu[ $lastorder ][4] = add_cssclass( 'menu-top-last', $c );
|
||||
if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator.
|
||||
$first_item = true;
|
||||
$classes = $menu[ $last_order ][4];
|
||||
$menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $first ) {
|
||||
$c = $menu[ $order ][4];
|
||||
$menu[ $order ][4] = add_cssclass( 'menu-top-first', $c );
|
||||
$first = false;
|
||||
if ( $first_item ) {
|
||||
$classes = $menu[ $order ][4];
|
||||
$menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes );
|
||||
$first_item = false;
|
||||
}
|
||||
|
||||
if ( $mc == $i ) { // Last item.
|
||||
$c = $menu[ $order ][4];
|
||||
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $c );
|
||||
if ( $i == items_count ) { // Last item.
|
||||
$classes = $menu[ $order ][4];
|
||||
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
|
||||
}
|
||||
|
||||
$lastorder = $order;
|
||||
$last_order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta1-53194';
|
||||
$wp_version = '6.0-beta1-53195';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue