X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FWikiMap.php;h=473975389bbfb06baabe44e331722fecae6c1227;hb=61edb7525f9d496f8ff029d8047dcb6edef29852;hp=a1dbbfc098ca080672fe4f9356a7578d34457998;hpb=4f741418fcb0a85f1ccfa3a72e5faa34259b8e53;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WikiMap.php b/includes/WikiMap.php index a1dbbfc098..473975389b 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -37,13 +37,18 @@ class WikiMap { $wgConf->loadFullData(); list( $major, $minor ) = $wgConf->siteFromDB( $wikiID ); - if( $major === null ) { + if ( $major === null ) { return null; } - $canonicalServer = $wgConf->get( 'wgCanonicalServer', $wikiID, $major, - array( 'lang' => $minor, 'site' => $major ) ); $server = $wgConf->get( 'wgServer', $wikiID, $major, array( 'lang' => $minor, 'site' => $major ) ); + + $canonicalServer = $wgConf->get( 'wgCanonicalServer', $wikiID, $major, + array( 'lang' => $minor, 'site' => $major ) ); + if ( $canonicalServer === false || $canonicalServer === null ) { + $canonicalServer = $server; + } + $path = $wgConf->get( 'wgArticlePath', $wikiID, $major, array( 'lang' => $minor, 'site' => $major ) ); return new WikiReference( $major, $minor, $canonicalServer, $path, $server ); @@ -73,7 +78,7 @@ class WikiMap { * @param string $text link's text; optional, default to "User:$user" * @return String: HTML link or false if the wiki was not found */ - public static function foreignUserLink( $wikiID, $user, $text=null ) { + public static function foreignUserLink( $wikiID, $user, $text = null ) { return self::makeForeignLink( $wikiID, "User:$user", $text ); } @@ -85,7 +90,7 @@ class WikiMap { * @param string $text link's text; optional, default to $page * @return String: HTML link or false if the wiki was not found */ - public static function makeForeignLink( $wikiID, $page, $text=null ) { + public static function makeForeignLink( $wikiID, $page, $text = null ) { if ( !$text ) { $text = $page; } @@ -122,7 +127,7 @@ class WikiMap { class WikiReference { private $mMinor; ///< 'en', 'meta', 'mediawiki', etc private $mMajor; ///< 'wiki', 'wiktionary', etc - private $mCanonicalServer; ///< canonical server URL, e.g. 'http://www.mediawiki.org' + private $mCanonicalServer; ///< canonical server URL, e.g. 'https://www.mediawiki.org' private $mServer; ///< server URL, may be protocol-relative, e.g. '//www.mediawiki.org' private $mPath; ///< path, '/wiki/$1'