r7518 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7517‎ | r7518 | r7519 >
Date:22:25, 23 February 2005
Author:hashar
Status:old
Tags:
Comment:
Fix category browser. $this is not defined in a method subfunction so we have to pass $this object by reference.
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -414,7 +414,8 @@
415415 $parenttree = $wgTitle->getParentCategoryTree();
416416
417417 # Render the array as a serie of links
418 - function walkThrough ($tree) {
 418+ # Need to give skin cause $this is undefined at this level
 419+ function walkThrough ($tree, &$skin) {
419420 $return = '';
420421 foreach($tree as $element => $parent) {
421422 if(empty($parent)) {
@@ -422,17 +423,19 @@
423424 $return .= '<br />';
424425 } else {
425426 # grab the others elements
426 - $return .= walkThrough($parent);
 427+ $return .= walkThrough($parent, $skin);
427428 }
428429 # add our current element to the list
429430 $eltitle = Title::NewFromText($element);
430431 # FIXME : should be makeLink() [AV]
431 - $return .= $this->makeLinkObj( $eltitle, $eltitle->getText() ) . ' &gt; ';
 432+ $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) . ' &gt; ';
432433 }
433434 return $return;
434435 }
435436
436 - $s .= walkThrough($parenttree);
 437+ # Skin object passed by reference cause it can not be
 438+ # accessed under the method subfunction walkThrough.
 439+ $s .= walkThrough($parenttree, $this);
437440 }
438441
439442 return $s;

Status & tagging log