From: Gabriel Wicke Date: Wed, 5 May 2004 12:01:54 +0000 (+0000) Subject: added makeUrl functions to make them available in other skins as well X-Git-Tag: 1.3.0beta1~145 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=94d2ff038729938005c8153a28f6236d7cfe4e25;p=lhc%2Fweb%2Fwiklou.git added makeUrl functions to make them available in other skins as well --- diff --git a/includes/Skin.php b/includes/Skin.php index 35b6f9eb43..c4686d12d5 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1630,6 +1630,45 @@ class Skin { return "{$prefix}{$text}{$inside}{$trail}"; } + /* these are used extensively in SkinPHPTal, but also some other places */ + /*static*/ function makeSpecialUrl( $name, $urlaction='' ) { + $title = Title::makeTitle( NS_SPECIAL, $name ); + $this->checkTitle(&$title, &$name); + return $title->getLocalURL( $urlaction ); + } + /*static*/ function makeTalkUrl ( $name, $urlaction='' ) { + $title = Title::newFromText( $name ); + $title = $title->getTalkPage(); + $this->checkTitle(&$title, &$name); + return $title->getLocalURL( $urlaction ); + } + /*static*/ function makeArticleUrl ( $name, $urlaction='' ) { + $title = Title::newFromText( $name ); + $title= $title->getSubjectPage(); + $this->checkTitle(&$title, &$name); + return $title->getLocalURL( $urlaction ); + } + /*static*/ function makeI18nUrl ( $name, $urlaction='' ) { + $title = Title::newFromText( wfMsg($name) ); + $this->checkTitle(&$title, &$name); + return $title->getLocalURL( $urlaction ); + } + /*static*/ function makeUrl ( $name, $urlaction='' ) { + $title = Title::newFromText( $name ); + $this->checkTitle(&$title, &$name); + return $title->getLocalURL( $urlaction ); + } + + # make sure we have some title to operate on, mind the '&' + /*static*/ function &checkTitle ( $title, $name ) { + if(!is_object($title)) { + $title = Title::newFromText( $name ); + if(!is_object($title)) { + $title = Title::newFromText( '' ); + } + } + } + function fnamePart( $url ) { $basename = strrchr( $url, "/" );