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.
|
* @return array The array of administration menu items with the CSS classes added.
|
||||||
*/
|
*/
|
||||||
function add_menu_classes( $menu ) {
|
function add_menu_classes( $menu ) {
|
||||||
$first = false;
|
$first_item = false;
|
||||||
$lastorder = false;
|
$last_order = false;
|
||||||
|
$items_count = count( $menu );
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$mc = count( $menu );
|
|
||||||
foreach ( $menu as $order => $top ) {
|
foreach ( $menu as $order => $top ) {
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
if ( 0 == $order ) { // Dashboard is always shown/single.
|
if ( 0 == $order ) { // Dashboard is always shown/single.
|
||||||
$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
|
$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
|
||||||
$lastorder = 0;
|
$last_order = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 0 === strpos( $top[2], 'separator' ) && false !== $lastorder ) { // If separator.
|
if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator.
|
||||||
$first = true;
|
$first_item = true;
|
||||||
$c = $menu[ $lastorder ][4];
|
$classes = $menu[ $last_order ][4];
|
||||||
$menu[ $lastorder ][4] = add_cssclass( 'menu-top-last', $c );
|
$menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $first ) {
|
if ( $first_item ) {
|
||||||
$c = $menu[ $order ][4];
|
$classes = $menu[ $order ][4];
|
||||||
$menu[ $order ][4] = add_cssclass( 'menu-top-first', $c );
|
$menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes );
|
||||||
$first = false;
|
$first_item = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $mc == $i ) { // Last item.
|
if ( $i == items_count ) { // Last item.
|
||||||
$c = $menu[ $order ][4];
|
$classes = $menu[ $order ][4];
|
||||||
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $c );
|
$menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastorder = $order;
|
$last_order = $order;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue