From 54a17f5230fcfb8f77cbd8ed3af8d56df9636dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 8 May 2014 13:49:21 +0200 Subject: [PATCH] Simplify code for rendering node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 3cad7f034f..736423e066 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -1003,20 +1003,16 @@ class PMA_NavigationTree $children = $node->children; usort($children, array('PMA_NavigationTree', 'sortNode')); $buffer = ''; + $extra_class = ''; for ($i=0, $nbChildren = count($children); $i < $nbChildren; $i++) { - if ($i + 1 != $nbChildren) { - $buffer .= $this->_renderNode( - $children[$i], - true, - $children[$i]->classes - ); - } else { - $buffer .= $this->_renderNode( - $children[$i], - true, - $children[$i]->classes . ' last' - ); + if ($i + 1 == $nbChildren) { + $extra_class = ' last'; } + $buffer .= $this->_renderNode( + $children[$i], + true, + $children[$i]->classes . $extra_class + ); } if (! empty($buffer)) { if ($wrap) {