Revision: 50190
Author:   siebrand
Date:     2009-05-04 18:10:04 +0000 (Mon, 04 May 2009)

Log Message:
-----------
* fix typo in 'wminc-prefinfo-language'
* stylize.php, trailing whitespace removed, updated indentation

No functional changes

Modified Paths:
--------------
    trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
    trunk/extensions/WikimediaIncubator/IncubatorTest.php
    trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
    trunk/extensions/WikimediaIncubator/TestWikiRC.php
    trunk/extensions/WikimediaIncubator/WikimediaIncubator.alias.php
    trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php
    trunk/extensions/WikimediaIncubator/WikimediaIncubator.php

Modified: trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
===================================================================
--- trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php       
2009-05-04 18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php       
2009-05-04 18:10:04 UTC (rev 50190)
@@ -4,27 +4,27 @@
 * This can be used to work with my toolserver project 
(http://toolserver.org/~robin/?tool=proposewiki), so users don't *have* to 
change their preferences (automatically is always better :p)
 */
 class AutoTestWiki {
-       function UserCreateForm($template) {
+       function UserCreateForm( $template ) {
                global $wgRequest;
-               $projectvalue = strtolower($wgRequest->getVal( 
'testwikiproject', '' ));
-               $codevalue = strtolower($wgRequest->getVal( 'testwikicode', '' 
));
-               if(preg_match('/[a-z][a-z][a-z]?/', $codevalue) && 
in_array($projectvalue, array('p','b','t','q','n'))) {
-                       $template->set( 'header', '<input type="hidden" 
name="testwiki-project" value="'.$projectvalue.'" />
-       <input type="hidden" name="testwiki-code" value="'.$codevalue.'" />
+               $projectvalue = strtolower( $wgRequest->getVal( 
'testwikiproject', '' ) );
+               $codevalue = strtolower( $wgRequest->getVal( 'testwikicode', '' 
) );
+               if ( preg_match( '/[a-z][a-z][a-z]?/', $codevalue ) && 
in_array( $projectvalue, array( 'p', 'b', 't', 'q', 'n' ) ) ) {
+                       $template->set( 'header', '<input type="hidden" 
name="testwiki-project" value="' . $projectvalue . '" />
+       <input type="hidden" name="testwiki-code" value="' . $codevalue . '" />
        ' );
                }
                return true;
        }
-       
-       function AddNewAccount($user) {
+
+       function AddNewAccount( $user ) {
                global $wgRequest, $wmincPref;
                $getprojectvalue = $wgRequest->getVal( 'testwiki-project' );
                $getcodevalue = $wgRequest->getVal( 'testwiki-code' );
-               if($getprojectvalue && $getcodevalue) {
-                       $user->setOption($wmincPref.'-project', 
$getprojectvalue);
-                       $user->setOption($wmincPref.'-code', $getcodevalue);
+               if ( $getprojectvalue && $getcodevalue ) {
+                       $user->setOption( $wmincPref . '-project', 
$getprojectvalue );
+                       $user->setOption( $wmincPref . '-code', $getcodevalue );
                        $user->saveSettings();
                }
                return true;
        }
-}
\ No newline at end of file
+}

Modified: trunk/extensions/WikimediaIncubator/IncubatorTest.php
===================================================================
--- trunk/extensions/WikimediaIncubator/IncubatorTest.php       2009-05-04 
18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/IncubatorTest.php       2009-05-04 
18:10:04 UTC (rev 50190)
@@ -3,49 +3,51 @@
 * Implement test wiki preference, magic word and prefix check on edit page
 */
 
-class IncubatorTest {
+class IncubatorTest
+{
        static function AddPreferences( $user, &$preferences ) {
-       global $wmincPref, $wmincPrefProject, $wmincPrefNone;
+               global $wmincPref, $wmincPrefProject, $wmincPrefNone;
+
                $preferences['language']['help-message'] = 
'wminc-prefinfo-language';
-               
-               $prefinsert[$wmincPref.'-project'] = array(
+
+               $prefinsert[$wmincPref . '-project'] = array(
                        'type' => 'select',
-                       'options' => array(     
wfMsg('wminc-testwiki-none')=>'none',           'wikipedia'=>'p',               
'wikibooks'=>'b',
-                       'wiktionary'=>'t',      'wikiquote'=>'q',       
'wikinews'=>'n',                'incubator'=>'inc' ),
+                       'options' => array(     wfMsg( 'wminc-testwiki-none' ) 
=> 'none',               'wikipedia' => 'p',             'wikibooks' => 'b',
+                       'wiktionary' => 't',    'wikiquote' => 'q',     
'wikinews' => 'n',              'incubator' => 'inc' ),
                        'section' => 'personal/i18n',
                        'label-message' => 'wminc-testwiki',
-                       'id' => $wmincPref.'-project',
+                       'id' => $wmincPref . '-project',
                        'help-message' => 'wminc-prefinfo-project',
                );
-               $prefinsert[$wmincPref.'-code'] = array(
+               $prefinsert[$wmincPref . '-code'] = array(
                        'type' => 'text',
                        'section' => 'personal/i18n',
                        'label-message' => 'wminc-testwiki',
-                       'id' => $wmincPref.'-code',
+                       'id' => $wmincPref . '-code',
                        'maxlength' => 3,
                        'size' => 3,
                        'help-message' => 'wminc-prefinfo-code',
-                       'validation-callback' => 
array('IncubatorTest','CodeValidation'),
+                       'validation-callback' => array( 'IncubatorTest', 
'CodeValidation' ),
                );
 
                $preferences = wfArrayInsertAfter( $preferences, $prefinsert, 
'language' );
-               
+
                return true;
        }
-       
-       function CodeValidation($input, $alldata) {
+
+       function CodeValidation( $input, $alldata ) {
                global $wmincPref;
                // If the user selected a project that NEEDS a language code, 
but the user DID NOT enter a language code, give an error
-               
if(!in_array($alldata[$wmincPref.'-project'],array('','none','inc')) && 
!$input) {
-                       return Xml::element( 'span', array( 'class'=>'error' ), 
wfMsg( 'wminc-prefinfo-error' ) );
+               if ( !in_array( $alldata[$wmincPref . '-project'], array( '', 
'none', 'inc' ) ) && !$input ) {
+                       return Xml::element( 'span', array( 'class' => 'error' 
), wfMsg( 'wminc-prefinfo-error' ) );
                } else {
                        return true;
                }
        }
-       
+
        function NormalPrefix() {
                global $wgUser, $wmincPref;
-               
if(in_array($wgUser->mOptions[$wmincPref.'-project'],array('','none','inc'))) {
+               if ( in_array( $wgUser->mOptions[$wmincPref . '-project'], 
array( '', 'none', 'inc' ) ) ) {
                        return false; // false because this is NOT a normal 
prefix
                } else {
                        return true; // true because this is a normal prefix
@@ -53,25 +55,25 @@
        }
        function DisplayPrefix() {
                global $wgUser, $wmincPref;
-               if(self::NormalPrefix() == true) {
-                       return 
'W'.$wgUser->mOptions[$wmincPref.'-project'].'/'. 
$wgUser->mOptions[$wmincPref.'-code']; // return the prefix
+               if ( self::NormalPrefix() == true ) {
+                       return 'W' . $wgUser->mOptions[$wmincPref . '-project'] 
. '/' . $wgUser->mOptions[$wmincPref . '-code']; // return the prefix
                } else {
-                       return $wgUser->mOptions[$wmincPref.'-project']; // 
still provide the value
+                       return $wgUser->mOptions[$wmincPref . '-project']; // 
still provide the value
                }
        }
-       
-       function DisplayPrefixedTitle($title, $namespace='') {
+
+       function DisplayPrefixedTitle( $title, $namespace = '' ) {
                global $wgUser, $wmincPref;
                $out = '';
-               if(self::NormalPrefix()) {
-                       if($namespace) { $out .= $namespace.':'; }
+               if ( self::NormalPrefix() ) {
+                       if ( $namespace ) { $out .= $namespace . ':'; }
                        $out .= self::DisplayPrefix() . '/' . $title;
                } else {
                        $out .= self::DisplayPrefix();
                }
                return $out;
        }
-       
+
        function MagicWordVariable( &$magicWords ) {
                $magicWords[] = 'usertestwiki';
                return true;
@@ -79,30 +81,30 @@
 
        function MagicWord( &$magicWords, $langCode ) {
                $magicWords['usertestwiki'] = array( 0, 'USERTESTWIKI' );
-               return true;  
+               return true;
        }
-       
+
        function MagicWordValue( &$parser, &$cache, &$magicWordId, &$ret ) {
                $ret = self::DisplayPrefix();
                return true;
        }
-       
-       function EditPageCheckPrefix($editpage) {
+
+       function EditPageCheckPrefix( $editpage ) {
                // If user has "project" as test wiki preference, it isn't 
needed to check
-               if(self::DisplayPrefix() != 'inc') {
+               if ( self::DisplayPrefix() != 'inc' ) {
                        global $wgTitle;
                        $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, 
NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
                        // If it is in one of the above namespace, check if the 
page title has a prefix
-                       if(in_array($wgTitle->getNamespace(), $namespaces) && 
!preg_match('/W[bnpqt]\/[a-z][a-z][a-z]?/', $wgTitle->getText())) {
+                       if ( in_array( $wgTitle->getNamespace(), $namespaces ) 
&& !preg_match( '/W[bnpqt]\/[a-z][a-z][a-z]?/', $wgTitle->getText() ) ) {
                                global $wgOut;
                                wfLoadExtensionMessages( 'WikimediaIncubator' );
                                        $warning = '<div 
id="wminc-warning"><span id="wm-warning-unprefixed">'
                                                . wfMsg( 
'wminc-warning-unprefixed' )
                                                . '</span>';
                                        // If the user has a test wiki pref, 
suggest a page title with prefix
-                                       if(self::NormalPrefix()) {
+                                       if ( self::NormalPrefix() ) {
                                                $warning .= ' <span 
id="wminc-warning-suggest">'
-                                                       . wfMsg( 
'wminc-warning-suggest', self::DisplayPrefixedTitle($wgTitle->getText(), 
$wgTitle->getNsText()) )
+                                                       . wfMsg( 
'wminc-warning-suggest', self::DisplayPrefixedTitle( $wgTitle->getText(), 
$wgTitle->getNsText() ) )
                                                        . '</span>';
                                        }
                                        $warning .= '</div>';
@@ -119,9 +121,9 @@
   * Based on code from extension LookupUser made by Tim Starling
  * @return true
  */
-function efLoadViewUserLangLink( $id, $nt, &$links ){
+function efLoadViewUserLangLink( $id, $nt, &$links ) {
        global $wgUser;
-       if( $wgUser->isAllowed( 'viewuserlang' ) ) {
+       if ( $wgUser->isAllowed( 'viewuserlang' ) ) {
                wfLoadExtensionMessages( 'WikimediaIncubator' );
                $links[] = $wgUser->getSkin()->makeKnownLinkObj(
                                        SpecialPage::getTitleFor( 
'ViewUserLang' ),
@@ -129,4 +131,4 @@
                                        '&target=' . urlencode( $nt->getText() 
) );
        }
        return true;
-}
\ No newline at end of file
+}

Modified: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
===================================================================
--- trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php 2009-05-04 
18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php 2009-05-04 
18:10:04 UTC (rev 50190)
@@ -8,8 +8,9 @@
  *
  * @file
  */
-class SpecialViewUserLang extends SpecialPage {
 
+class SpecialViewUserLang extends SpecialPage
+{
        public function __construct() {
                parent::__construct( 'ViewUserLang', 'viewuserlang' );
        }
@@ -93,17 +94,17 @@
                                ) ) );
                        $wgOut->addWikiText(
                                '*' . wfMsg( 'loginlanguagelabel',
-                               $wgLanguageNames[$user->mOptions['language']] . 
' ('.$user->mOptions['language'].')'
+                               $wgLanguageNames[$user->mOptions['language']] . 
' (' . $user->mOptions['language'] . ')'
                                )
                        );
-                       if(IncubatorTest::NormalPrefix() == true) {
-                               $testwiki = 
'[[W'.$user->mOptions[$wmincPref.'-project'].'/'.$user->mOptions[$wmincPref.'-code'].']]';
-                       } elseif(IncubatorTest::DisplayPrefix() == 'inc') {
+                       if ( IncubatorTest::NormalPrefix() == true ) {
+                               $testwiki = '[[W' . $user->mOptions[$wmincPref 
. '-project'] . '/' . $user->mOptions[$wmincPref . '-code'] . ']]';
+                       } elseif ( IncubatorTest::DisplayPrefix() == 'inc' ) {
                                $testwiki = 'Incubator';
                        } else {
-                               $testwiki = wfMsg('wminc-testwiki-none' );
+                               $testwiki = wfMsg( 'wminc-testwiki-none' );
                        }
-                               $wgOut->addWikiText( '*' . wfMsg( 
'wminc-testwiki' ) . ' '.$testwiki );
+                               $wgOut->addWikiText( '*' . wfMsg( 
'wminc-testwiki' ) . ' ' . $testwiki );
                }
        }
 }

Modified: trunk/extensions/WikimediaIncubator/TestWikiRC.php
===================================================================
--- trunk/extensions/WikimediaIncubator/TestWikiRC.php  2009-05-04 18:01:35 UTC 
(rev 50189)
+++ trunk/extensions/WikimediaIncubator/TestWikiRC.php  2009-05-04 18:10:04 UTC 
(rev 50190)
@@ -4,19 +4,19 @@
 */
 
 class TestWikiRC {
-       static function RcQuery(&$conds, &$tables, &$join_conds, $opts) {
+       static function RcQuery( &$conds, &$tables, &$join_conds, $opts ) {
                global $wgUser, $wgRequest, $wmincPref;
-               $projectvalue = strtolower($wgRequest->getVal( 
'rc-testwiki-project', $wgUser->mOptions[$wmincPref.'-project'] ));
-               $codevalue = strtolower($wgRequest->getVal( 'rc-testwiki-code', 
$wgUser->mOptions[$wmincPref.'-code'] ));
-               $fullprefix = 'W'.$projectvalue.'/'.$codevalue;
+               $projectvalue = strtolower( $wgRequest->getVal( 
'rc-testwiki-project', $wgUser->mOptions[$wmincPref . '-project'] ) );
+               $codevalue = strtolower( $wgRequest->getVal( 
'rc-testwiki-code', $wgUser->mOptions[$wmincPref . '-code'] ) );
+               $fullprefix = 'W' . $projectvalue . '/' . $codevalue;
                $opts->add( 'rc-testwiki-project', false );
                $opts->setValue( 'rc-testwiki-project', $projectvalue );
                $opts->add( 'rc-testwiki-code', false );
                $opts->setValue( 'rc-testwiki-code', $codevalue );
-               if($projectvalue == 'none') {
+               if ( $projectvalue == 'none' ) {
                        // If "none" is selected, display normal recent changes
                        return true;
-               } elseif($projectvalue == 'inc') {
+               } elseif ( $projectvalue == 'inc' ) {
                        // If "inc" (incubator) is selected, display all 
changes except test wiki changes
                        $conds[] = 'rc_title not like \'W_/%%\' OR 
\'W_/%%/%%\'';
                        return true;
@@ -25,19 +25,19 @@
                        $dbr = wfGetDB( DB_SLAVE );
                        $namespaces = array( NS_MAIN, NS_TALK, NS_TEMPLATE, 
NS_TEMPLATE_TALK, NS_CATEGORY, NS_CATEGORY_TALK );
                        $conds[] = 'rc_namespace IN (' . $dbr->makeList( 
$namespaces ) . ')';
-                       $conds[] = 'rc_title like \''.$fullprefix.'/%\' OR 
rc_title like \''.$fullprefix.'\'';
+                       $conds[] = 'rc_title like \'' . $fullprefix . '/%\' OR 
rc_title like \'' . $fullprefix . '\'';
                        return true;
                }
        }
-       
-       static function RcForm(&$items, $opts) {
+
+       static function RcForm( &$items, $opts ) {
                global $wgUser, $wgRequest, $wmincPref;
                wfLoadExtensionMessages( 'WikimediaIncubator' );
-               $projectvalue = $wgRequest->getVal( 'rc-testwiki-project', 
$wgUser->mOptions[$wmincPref.'-project'] );
-               $langcodevalue = $wgRequest->getVal( 'rc-testwiki-code', 
$wgUser->mOptions[$wmincPref.'-code'] );
+               $projectvalue = $wgRequest->getVal( 'rc-testwiki-project', 
$wgUser->mOptions[$wmincPref . '-project'] );
+               $langcodevalue = $wgRequest->getVal( 'rc-testwiki-code', 
$wgUser->mOptions[$wmincPref . '-code'] );
                $opts->consumeValue( 'rc-testwiki-project' );
                $opts->consumeValue( 'rc-testwiki-code' );
-               $label = Xml::label( wfMsg('wminc-testwiki'), 'rc-testwiki' );
+               $label = Xml::label( wfMsg( 'wminc-testwiki' ), 'rc-testwiki' );
                $select = new XmlSelect( 'rc-testwiki-project', 
'rc-testwiki-project', $projectvalue );
                $select->addOption( wfMsg( 'wminc-testwiki-none' ), 'none' );
                $select->addOption( 'wikipedia', 'p' );
@@ -47,7 +47,7 @@
                $select->addOption( 'wikinews', 'n' );
                $select->addOption( 'incubator', 'inc' );
                $langcode = Xml::input( 'rc-testwiki-code', 3, $langcodevalue, 
array( 'id' => 'rc-testwiki-code', 'maxlength' => 3 ) );
-               $items['testwiki'] = array( $label, $select->getHTML() .' '. 
$langcode );
+               $items['testwiki'] = array( $label, $select->getHTML() . ' ' . 
$langcode );
                return true;
        }
-}
\ No newline at end of file
+}

Modified: trunk/extensions/WikimediaIncubator/WikimediaIncubator.alias.php
===================================================================
--- trunk/extensions/WikimediaIncubator/WikimediaIncubator.alias.php    
2009-05-04 18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/WikimediaIncubator.alias.php    
2009-05-04 18:10:04 UTC (rev 50190)
@@ -13,9 +13,7 @@
        'ViewUserLang' => array( 'ViewUserLang' ),
 );
 
-
 /** Dutch (Nederlands) */
 $aliases['nl'] = array(
        'ViewUserLang' => array( 'GebruikerstaalOpzoeken' ),
 );
-

Modified: trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php
===================================================================
--- trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php     
2009-05-04 18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php     
2009-05-04 18:10:04 UTC (rev 50190)
@@ -15,7 +15,7 @@
        'wminc-viewuserlang' => 'Look up user language and test wiki',
        'wminc-testwiki' => 'Test wiki:',
        'wminc-testwiki-none' => 'None/All',
-       'wminc-prefinfo-language' => 'Your interface language - independant 
from your test wiki',
+       'wminc-prefinfo-language' => 'Your interface language - independent 
from your test wiki',
        'wminc-prefinfo-code' => 'The ISO 639 language code',
        'wminc-prefinfo-project' => 'Select the Wikimedia project (Incubator 
option is for users who do general work)',
        'wminc-prefinfo-error' => 'You selected a project that needs a language 
code.',
@@ -23,7 +23,6 @@
        'wminc-warning-suggest' => 'You can create a page at [[$1]].',
 );
 
-
 /** Dutch (Nederlands)
  * @author SPQRobin
  */

Modified: trunk/extensions/WikimediaIncubator/WikimediaIncubator.php
===================================================================
--- trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2009-05-04 
18:01:35 UTC (rev 50189)
+++ trunk/extensions/WikimediaIncubator/WikimediaIncubator.php  2009-05-04 
18:10:04 UTC (rev 50190)
@@ -1,5 +1,5 @@
 <?php
-if( !defined( 'MEDIAWIKI' ) ) { die( "This file is an extension to the 
MediaWiki software and cannot be used standalone.\n" ); }
+if ( !defined( 'MEDIAWIKI' ) ) { die( "This file is an extension to the 
MediaWiki software and cannot be used standalone.\n" ); }
 /**
  * An extension that adds test wiki features (such as a preference, recent 
changes for a test wiki, ...) specifically for the Wikimedia Incubator
  *
@@ -8,9 +8,9 @@
 
 $wgExtensionCredits['other'][] = array(
        'name' => 'Wikimedia Incubator',
-       'author' =>'SPQRobin',
-       'version' => '2.1.0',
-       'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator', 
+       'author' => 'SPQRobin',
+       'version' => '2.1.1',
+       'url' => 'http://www.mediawiki.org/wiki/Extension:WikimediaIncubator',
        'description' => 'Test wiki features for Wikimedia Incubator',
        'descriptionmsg' => 'wminc-desc',
 );
@@ -22,7 +22,7 @@
 $wgGroupPermissions['sysop']['viewuserlang'] = true;
 
 /* General */
-$dir = dirname(__FILE__) . '/';
+$dir = dirname( __FILE__ ) . '/';
 $wgExtensionMessagesFiles['WikimediaIncubator'] = $dir . 
'WikimediaIncubator.i18n.php';
 
 /* Special:ViewUserLang */
@@ -49,7 +49,7 @@
 $wgHooks['SpecialRecentChangesPanel'][] = 'TestWikiRC::RcForm';
 
 /* Automatic pref on account creation */
-if($wmincEnableAutoTestWiki == true) {
+if ( $wmincEnableAutoTestWiki == true ) {
        $wgAutoloadClasses['AutoTestWiki'] = $dir . 'CreateAccountTestWiki.php';
        $wgHooks['UserCreateForm'][] = 'AutoTestWiki::UserCreateForm';
        $wgHooks['AddNewAccount'][] = 'AutoTestWiki::AddNewAccount';



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to