Don't do sizeof() in a loop. Props DD32. see #7147
git-svn-id: http://svn.automattic.com/wordpress/trunk@8111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aa70c022ce
commit
290dbc03e0
|
@ -429,7 +429,8 @@ class Walker {
|
||||||
if ( $max_depth == 0 ||
|
if ( $max_depth == 0 ||
|
||||||
($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend
|
($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend
|
||||||
|
|
||||||
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
|
$num_elements = sizeof( $children_elements );
|
||||||
|
for ( $i = 0; $i < $num_elements; $i++ ) {
|
||||||
|
|
||||||
$child = $children_elements[$i];
|
$child = $children_elements[$i];
|
||||||
if ( $child->$parent_field == $element->$id_field ) {
|
if ( $child->$parent_field == $element->$id_field ) {
|
||||||
|
@ -442,6 +443,7 @@ class Walker {
|
||||||
}
|
}
|
||||||
|
|
||||||
array_splice( $children_elements, $i, 1 );
|
array_splice( $children_elements, $i, 1 );
|
||||||
|
$num_elements--;
|
||||||
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
|
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
|
||||||
$i = -1;
|
$i = -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue