From 4f9295a729742ea8d7c0fdf2d489e1f56d7a7c5a Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 25 Aug 2005 00:39:07 +0000 Subject: [PATCH] Somehow fix #2108 --- includes/Skin.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index 35b7e7dfcb..4f99006bb7 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -436,22 +436,30 @@ END; # get a big array of the parents tree $parenttree = $wgTitle->getParentCategoryTree(); - # Skin object passed by reference cause it can not be - # accessed under the method subfunction walkThrough. - $s .= Skin::drawCategoryBrowser($parenttree, $this); + # accessed under the method subfunction drawCategoryBrowser + $tempout = explode("\n", Skin::drawCategoryBrowser($parenttree, $this) ); + # Clean out bogus first entry and sort them + unset($tempout[0]); + asort($tempout); + # Output one per line + $s .= implode("
\n", $tempout); } return $s; } - # Render the array as a serie of links - function drawCategoryBrowser ($tree, &$skin) { + /** Render the array as a serie of links. + * @param array $tree Categories tree returned by Title::getParentCategoryTree + * @param object &skin Skin passed by reference + * @return string separated by >, terminate with "\n" + */ + function drawCategoryBrowser($tree, &$skin) { $return = ''; foreach ($tree as $element => $parent) { if (empty($parent)) { # element start a new list - $return .= "
\n"; + $return .= "\n"; } else { # grab the others elements $return .= Skin::drawCategoryBrowser($parent, $skin) . ' > '; -- 2.20.1