https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111840

Revision: 111840
Author:   robin
Date:     2012-02-18 19:33:34 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Remove own getLanguageNames function (no longer needed). Fix broken action 
'create' and instead check 'edit' and title->exists().
Other minor things (simplify a bit of code, use https for extension link, link 
-> linkKnown).

Modified Paths:
--------------
    trunk/extensions/WikimediaIncubator/IncubatorTest.php
    trunk/extensions/WikimediaIncubator/InfoPage.php
    trunk/extensions/WikimediaIncubator/WikimediaIncubator.php

Modified: trunk/extensions/WikimediaIncubator/IncubatorTest.php
===================================================================
--- trunk/extensions/WikimediaIncubator/IncubatorTest.php       2012-02-18 
19:32:20 UTC (rev 111839)
+++ trunk/extensions/WikimediaIncubator/IncubatorTest.php       2012-02-18 
19:33:34 UTC (rev 111840)
@@ -67,9 +67,8 @@
                        !$input ) {
                        return Xml::element( 'span', array( 'class' => 'error' 
),
                                wfMessage( 'wminc-prefinfo-error' )->plain() );
-               } else {
-                       return true;
                }
+               return true;
        }
 
        /**
@@ -269,11 +268,8 @@
        }
 
        static function magicWordValue( &$parser, &$cache, &$magicWordId, &$ret 
) {
-               if( !self::displayPrefix() ) {
-                       $ret = 'none';
-               } else {
-                       $ret = self::displayPrefix();
-               }
+               $p = self::displayPrefix();
+               $ret = $p ? $p : 'none';
                return true;
        }
 
@@ -331,7 +327,7 @@
                        return $action != 'edit';
                }
 
-               if( !self::shouldWeShowUnprefixedError( $title ) || $action != 
'create' ) {
+               if( !self::shouldWeShowUnprefixedError( $title ) || $action != 
'edit' || $title->exists() ) {
                        # only check if needed & if on page creation
                        return true;
                } elseif( $prefixdata['error'] == 'invalidlangcode' ) {
@@ -374,7 +370,7 @@
                global $wgUser;
                if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
                        $user = $nt->getText();
-                       $links[] = Linker::link(
+                       $links[] = Linker::linkKnown(
                                SpecialPage::getTitleFor( 'ViewUserLang', $user 
),
                                wfMessage( 'wminc-viewuserlang' )->escaped()
                        );
@@ -383,16 +379,6 @@
        }
 
        /**
-        * This loads language names. Also from CLDR if that extension is found.
-        * @return Array with language names
-        */
-       static public function getLanguageNames( $code = null ) {
-               global $wgLang;
-               $langcode = ( $code ? $code : $wgLang->getCode() );
-               return Language::getTranslatedLanguageNames( $langcode );
-       }
-
-       /**
         * Do we know the databases of the existing wikis?
         * @return Boolean
         */

Modified: trunk/extensions/WikimediaIncubator/InfoPage.php
===================================================================
--- trunk/extensions/WikimediaIncubator/InfoPage.php    2012-02-18 19:32:20 UTC 
(rev 111839)
+++ trunk/extensions/WikimediaIncubator/InfoPage.php    2012-02-18 19:33:34 UTC 
(rev 111840)
@@ -25,7 +25,7 @@
         * @param $prefixdata
         */
        public function __construct( $title, $prefixdata ) {
-               global $wmincProjects, $wmincSisterProjects;
+               global $wmincProjects, $wmincSisterProjects, $wgLang;
                $this->mTitle = $title;
                $this->mPrefix = $prefixdata['prefix'];
                $this->mLangCode = $prefixdata['lang'];
@@ -41,7 +41,7 @@
                $this->mDBStatus = '';
                $this->mSubStatus = '';
                $this->mThisLangData = array( 'type' => 'valid' ); # For later 
code check feature
-               $this->mLangNames = IncubatorTest::getLanguageNames();
+               $this->mLangNames = Language::getTranslatedLanguageNames( 
$wgLang->getCode() );
                $this->mLangName = isset( $this->mLangNames[$this->mLangCode] ) 
?
                        $this->mLangNames[$this->mLangCode] : null;
                $titleParam = $this->mLangName ? $this->mLangName : '"' . 
$this->mLangCode . '"'; # Name, else code

Modified: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
===================================================================
--- trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2012-02-18 
19:32:20 UTC (rev 111839)
+++ trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2012-02-18 
19:33:34 UTC (rev 111840)
@@ -17,7 +17,7 @@
        'name' => 'Wikimedia Incubator',
        'author' => 'SPQRobin',
        'version' => '4.8',
-       'url' => '//www.mediawiki.org/wiki/Extension:WikimediaIncubator',
+       'url' => 'https://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
        'descriptionmsg' => 'wminc-desc',
 );
 


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to