From: Antoine Musso Date: Wed, 23 Feb 2005 22:25:00 +0000 (+0000) Subject: Fix category browser. $this is not defined in a method subfunction so we have to... X-Git-Tag: 1.5.0alpha1~701 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=4ed9b16528aabac980f4dd0768640f187a889647;p=lhc%2Fweb%2Fwiklou.git Fix category browser. $this is not defined in a method subfunction so we have to pass $this object by reference. --- diff --git a/includes/Skin.php b/includes/Skin.php index 46c2cb90be..9baec636cd 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -414,7 +414,8 @@ class Skin extends Linker { $parenttree = $wgTitle->getParentCategoryTree(); # Render the array as a serie of links - function walkThrough ($tree) { + # Need to give skin cause $this is undefined at this level + function walkThrough ($tree, &$skin) { $return = ''; foreach($tree as $element => $parent) { if(empty($parent)) { @@ -422,17 +423,19 @@ class Skin extends Linker { $return .= '
'; } else { # grab the others elements - $return .= walkThrough($parent); + $return .= walkThrough($parent, $skin); } # add our current element to the list $eltitle = Title::NewFromText($element); # FIXME : should be makeLink() [AV] - $return .= $this->makeLinkObj( $eltitle, $eltitle->getText() ) . ' > '; + $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) . ' > '; } return $return; } - $s .= walkThrough($parenttree); + # Skin object passed by reference cause it can not be + # accessed under the method subfunction walkThrough. + $s .= walkThrough($parenttree, $this); } return $s;