avoid breaking on php5
This commit is contained in:
parent
37f7039ee6
commit
ca83d97808
1 changed files with 20 additions and 21 deletions
|
|
@ -430,34 +430,33 @@ END;
|
|||
# get a big array of the parents tree
|
||||
$parenttree = $wgTitle->getParentCategoryTree();
|
||||
|
||||
# Render the array as a serie of links
|
||||
# Need to give skin cause $this is undefined at this level
|
||||
function walkThrough ($tree, &$skin) {
|
||||
$return = '';
|
||||
foreach($tree as $element => $parent) {
|
||||
if(empty($parent)) {
|
||||
# element start a new list
|
||||
$return .= '<br />';
|
||||
} else {
|
||||
# grab the others elements
|
||||
$return .= walkThrough($parent, $skin);
|
||||
}
|
||||
# add our current element to the list
|
||||
$eltitle = Title::NewFromText($element);
|
||||
if(!empty($parent)) $return .= ' > ';
|
||||
$return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
# Skin object passed by reference cause it can not be
|
||||
# accessed under the method subfunction walkThrough.
|
||||
$s .= walkThrough($parenttree, $this);
|
||||
$s .= Skin::drawCategoryBrowser($parenttree, $this);
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
# Render the array as a serie of links
|
||||
function drawCategoryBrowser ($tree, &$skin) {
|
||||
$return = '';
|
||||
foreach ($tree as $element => $parent) {
|
||||
if (empty($parent)) {
|
||||
# element start a new list
|
||||
$return .= '<br />';
|
||||
} else {
|
||||
# grab the others elements
|
||||
$return .= Skin::drawCategoryBrowser($parent, $skin);
|
||||
}
|
||||
# add our current element to the list
|
||||
$eltitle = Title::NewFromText($element);
|
||||
if (!empty($parent)) $return .= ' > ';
|
||||
$return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function getCategories() {
|
||||
$catlinks=$this->getCategoryLinks();
|
||||
if(!empty($catlinks)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue