| Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php |
| — | — | @@ -322,8 +322,10 @@ |
| 323 | 323 | $link = self::getSubdomain( $prefixdata['lang'], |
| 324 | 324 | $prefixdata['project'], ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . |
| 325 | 325 | str_replace( ' ', '_', $prefixdata['realtitle'] ) ); |
| | 326 | + # faking external link to support prot-rel URLs |
| | 327 | + $link = "[$link ". self::makeExternalLinkText( $link ) . "]"; |
| 326 | 328 | $result[] = array( 'wminc-error-wiki-exists', $link ); |
| 327 | | - return false; |
| | 329 | + return $action == 'delete' ? true : false; |
| 328 | 330 | } |
| 329 | 331 | |
| 330 | 332 | if( !self::shouldWeShowUnprefixedError( $title ) || $action != 'create' ) { |
| — | — | @@ -467,7 +469,6 @@ |
| 468 | 470 | if( $prefix['error'] ) { # We are not on info pages |
| 469 | 471 | global $wmincSisterProjects; |
| 470 | 472 | $prefix2 = self::analyzePrefix( $title->getText(), false, true ); |
| 471 | | - $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; |
| 472 | 473 | $p = isset( $prefix2['project' ] ) ? $prefix2['project'] : ''; |
| 473 | 474 | if( self::getDBState( $prefix2 ) == 'existing' ) { |
| 474 | 475 | $link = self::getSubdomain( $prefix2['lang'], $p, |
| — | — | @@ -478,7 +479,7 @@ |
| 479 | 480 | return true; |
| 480 | 481 | } else { |
| 481 | 482 | # Show a link to the existing wiki |
| 482 | | - $showLink = $linker->makeExternalLink( $link, $link ); |
| | 483 | + $showLink = self::makeExternalLinkText( $link, true ); |
| 483 | 484 | $wgOut->addHtml( '<div class="wminc-wiki-exists">' . |
| 484 | 485 | wfMsgHtml( 'wminc-error-wiki-exists', $showLink ) . |
| 485 | 486 | '</div>' ); |
| — | — | @@ -487,7 +488,7 @@ |
| 488 | 489 | # A sister project is not hosted here, so direct the user to the relevant wiki |
| 489 | 490 | $link = self::getSubdomain( $prefix2['lang'], $p, |
| 490 | 491 | ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . $prefix2['realtitle'] ); |
| 491 | | - $showLink = $linker->makeExternalLink( $link, $link ); |
| | 492 | + $showLink = self::makeExternalLinkText( $link, true ); |
| 492 | 493 | $wgOut->addHtml( '<div class="wminc-wiki-sister">' . |
| 493 | 494 | wfMsgHtml( 'wminc-error-wiki-sister', $showLink ) . |
| 494 | 495 | '</div>' ); |
| — | — | @@ -754,4 +755,15 @@ |
| 755 | 756 | private static function preg_quote_slash( $str ) { |
| 756 | 757 | return preg_quote( $str, '/' ); |
| 757 | 758 | } |
| | 759 | + |
| | 760 | + /** |
| | 761 | + * @param $url String |
| | 762 | + * @param $callLinker Boolean Whether to call makeExternalLink() |
| | 763 | + */ |
| | 764 | + public static function makeExternalLinkText( $url, $callLinker = false ) { |
| | 765 | + # when displaying a URL, if it contains 'http://' or 'https://' it's ok to leave it, |
| | 766 | + # but for protocol-relative URLs, it's nicer to remove the '//' |
| | 767 | + $linktext = ltrim( $url, '/' ); |
| | 768 | + return $callLinker ? Linker::makeExternalLink( $url, $linktext ) : $linktext; |
| | 769 | + } |
| 758 | 770 | } |
| Index: trunk/extensions/WikimediaIncubator/InfoPage.php |
| — | — | @@ -49,7 +49,6 @@ |
| 50 | 50 | * @return String |
| 51 | 51 | */ |
| 52 | 52 | public function makeLogo( $project, $clickable = true, $width = 25, $height = '', $url = '', $args = array() ) { |
| 53 | | - global $wgUser; |
| 54 | 53 | $projectForFile = preg_replace('/ /', '-', strtolower( $project ) ); |
| 55 | 54 | $imageobj = wfFindFile( wfMsg( 'wminc-logo-' . $projectForFile ) ); |
| 56 | 55 | $useUrl = $url ? $url : IncubatorTest::getSubdomain( 'www', IncubatorTest::getProject( $project, false, true ) ); |
| — | — | @@ -57,7 +56,7 @@ |
| 58 | 57 | if( !$clickable ) { |
| 59 | 58 | return $logo; |
| 60 | 59 | } |
| 61 | | - return $wgUser->getSkin()->makeExternalLink( $useUrl, $project, false ); |
| | 60 | + return Linker::makeExternalLink( $useUrl, $project, false ); |
| 62 | 61 | } |
| 63 | 62 | if( $clickable ) { |
| 64 | 63 | $args['link-url'] = $useUrl; |
| — | — | @@ -68,7 +67,7 @@ |
| 69 | 68 | if( $height ) { |
| 70 | 69 | $handlerParams['height'] = $height; |
| 71 | 70 | } |
| 72 | | - return $wgUser->getSkin()->makeImageLink2( $this->mTitle, $imageobj, |
| | 71 | + return Linker::makeImageLink2( $this->mTitle, $imageobj, |
| 73 | 72 | array( 'alt' => $project, 'caption' => $project ) + $args, $handlerParams |
| 74 | 73 | ); |
| 75 | 74 | } |
| — | — | @@ -159,14 +158,14 @@ |
| 160 | 159 | * @return String |
| 161 | 160 | */ |
| 162 | 161 | public function showIncubatingWiki() { |
| 163 | | - global $wgUser, $wgLang; |
| | 162 | + global $wgLang; |
| 164 | 163 | $substatus = $this->mSubStatus; |
| 165 | 164 | if( $substatus == 'imported' && $this->mIsSister ) { |
| 166 | 165 | $substatus = 'closedsister'; |
| 167 | 166 | } |
| 168 | | - $portalLink = $wgUser->getSkin()->makeExternalLink( $this->mPortal, $this->mProjectName ); |
| | 167 | + $portalLink = Linker::makeExternalLink( $this->mPortal, $this->mProjectName ); |
| 169 | 168 | if( $this->mThisLangData['type'] != 'invalid' ) { |
| 170 | | - $gotoLink = $wgUser->getSkin()->link( |
| | 169 | + $gotoLink = Linker::link( |
| 171 | 170 | Title::newFromText( IncubatorTest::getMainPage( $this->mLangCode, $this->mPrefix ) ), |
| 172 | 171 | wfMsgNoTrans( 'wminc-infopage-enter' ) ); |
| 173 | 172 | $gotoMainPage = Html::rawElement( 'span', |
| — | — | @@ -174,7 +173,7 @@ |
| 175 | 174 | $wgLang->getArrow() . ' ' . ( $this->mIsSister ? $portalLink : $gotoLink ) ); |
| 176 | 175 | } |
| 177 | 176 | $subdomain = IncubatorTest::getSubdomain( $this->mLangCode, $this->mProjectCode ); |
| 178 | | - $subdomainLink = $wgUser->getSkin()->makeExternalLink( $subdomain, $subdomain ); |
| | 177 | + $subdomainLink = IncubatorTest::makeExternalLinkText( $subdomain, true ); |
| 179 | 178 | $content = Html::rawElement( 'div', array( 'class' => 'wminc-infopage-status' ), |
| 180 | 179 | wfMsgWikiHtml( 'wminc-infopage-status-' . $substatus, $subdomainLink, $portalLink ) ); |
| 181 | 180 | if( $this->mSubStatus != 'approved' && $this->mThisLangData['type'] != 'invalid' ) { |
| — | — | @@ -189,11 +188,11 @@ |
| 190 | 189 | * @return String |
| 191 | 190 | */ |
| 192 | 191 | public function showExistingWiki() { |
| 193 | | - global $wgLang, $wgUser; |
| | 192 | + global $wgLang; |
| 194 | 193 | $created = isset( $this->mCreated ) ? $this->mCreated : ''; # for future use |
| 195 | 194 | $bug = isset( $this->mBug ) ? $this->mBug : ''; # for future use |
| 196 | 195 | $subdomain = IncubatorTest::getSubdomain( $this->mLangCode, $this->mProjectCode ); |
| 197 | | - $subdomainLink = $wgUser->getSkin()->makeExternalLink( $subdomain, $subdomain ); |
| | 196 | + $subdomainLink = IncubatorTest::makeExternalLinkText( $subdomain, true ); |
| 198 | 197 | if( $this->mThisLangData['type'] != 'invalid' ) { |
| 199 | 198 | $gotoSubdomain = Html::rawElement( 'span', |
| 200 | 199 | array( 'class' => 'wminc-infopage-entertest' ), |