From: Antoine Musso Date: Sun, 6 Jun 2004 02:49:47 +0000 (+0000) Subject: Enable links in the dmoz-like category browser X-Git-Tag: 1.5.0alpha1~3020 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=89df78ec8185fcd6dc876c042f10331449e9fa8c;p=lhc%2Fweb%2Fwiklou.git Enable links in the dmoz-like category browser --- diff --git a/includes/Skin.php b/includes/Skin.php index 81d1f2c138..1d72b69c9f 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -360,7 +360,7 @@ class Skin { function getCategoryLinks () { global $wgOut, $wgTitle, $wgUser, $wgParser; - global $wgUseCategoryMagic; + global $wgUseCategoryMagic, $wgLang; if( !$wgUseCategoryMagic ) return "" ; if( count( $wgOut->mCategoryLinks ) == 0 ) return ""; if( !$wgOut->isArticle() ) return ""; @@ -375,7 +375,7 @@ class Skin { $wgTitle->getAllParentCategories(&$catstack); foreach ($catstack as $key => $cat) { - $s .= $key." > ".$cat."
\n"; + $s .= $this->makeLink($wgLang->getNSText( Namespace::getCategory() ).":".$key, $key )." > ".$cat."
\n"; } return $s; diff --git a/includes/Title.php b/includes/Title.php index 48ac5bf0a6..cc5be068ef 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1197,6 +1197,9 @@ class Title { # will get the parents and grand-parents function getAllParentCategories(&$stack) { + global $wgUser; + $sk =& $wgUser->getSkin() ; + # getting parents $parents = $this->getParentCategories( ); @@ -1205,10 +1208,13 @@ class Title { # create a title object for the parent $tpar = Title::newFromID($parent->cur_id); - $stack[$tpar->getText()] = $this->getText(); if(isset($stack[$this->getText()])) { + $stack[$tpar->getText()] = $sk->makeLink( $this->getPrefixedDBkey(), $this->getText() ); $stack[$tpar->getText()] .= " > ".$stack[$this->getText()]; + } else { + # don't make a link for current page + $stack[$tpar->getText()] = $this->getText(); } unset( $stack[$this->getText()] );