r9840 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9839‎ | r9840 | r9841 >
Date:22:39, 2 July 2005
Author:kateturner
Status:old
Tags:
Comment:
avoid breaking on php5
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -430,34 +430,33 @@
431431 # get a big array of the parents tree
432432 $parenttree = $wgTitle->getParentCategoryTree();
433433
434 - # Render the array as a serie of links
435 - # Need to give skin cause $this is undefined at this level
436 - function walkThrough ($tree, &$skin) {
437 - $return = '';
438 - foreach($tree as $element => $parent) {
439 - if(empty($parent)) {
440 - # element start a new list
441 - $return .= '<br />';
442 - } else {
443 - # grab the others elements
444 - $return .= walkThrough($parent, $skin);
445 - }
446 - # add our current element to the list
447 - $eltitle = Title::NewFromText($element);
448 - if(!empty($parent)) $return .= ' &gt; ';
449 - $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
450 - }
451 - return $return;
452 - }
453 -
454434 # Skin object passed by reference cause it can not be
455435 # accessed under the method subfunction walkThrough.
456 - $s .= walkThrough($parenttree, $this);
 436+ $s .= Skin::drawCategoryBrowser($parenttree, $this);
457437 }
458438
459439 return $s;
460440 }
461441
 442+ # Render the array as a serie of links
 443+ function drawCategoryBrowser ($tree, &$skin) {
 444+ $return = '';
 445+ foreach ($tree as $element => $parent) {
 446+ if (empty($parent)) {
 447+ # element start a new list
 448+ $return .= '<br />';
 449+ } else {
 450+ # grab the others elements
 451+ $return .= Skin::drawCategoryBrowser($parent, $skin);
 452+ }
 453+ # add our current element to the list
 454+ $eltitle = Title::NewFromText($element);
 455+ if (!empty($parent)) $return .= ' &gt; ';
 456+ $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
 457+ }
 458+ return $return;
 459+ }
 460+
462461 function getCategories() {
463462 $catlinks=$this->getCategoryLinks();
464463 if(!empty($catlinks)) {

Status & tagging log