Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php |
— | — | @@ -16,6 +16,9 @@ |
17 | 17 | parent::__construct( 'ViewUserLang', 'viewuserlang' ); |
18 | 18 | } |
19 | 19 | |
| 20 | + /** |
| 21 | + * @return String |
| 22 | + */ |
20 | 23 | function getDescription() { return wfMsg( 'wminc-viewuserlang' ); } |
21 | 24 | |
22 | 25 | /** |
— | — | @@ -70,7 +73,8 @@ |
71 | 74 | global $wgOut, $wmincPref, $wmincProjectSite; |
72 | 75 | if( User::isIP( $target ) ) { |
73 | 76 | # show error if it is an IP address |
74 | | - return $wgOut->addHTML( Xml::span( wfMsg( 'wminc-ip', $target ), 'error' ) ); |
| 77 | + $wgOut->addHTML( Xml::span( wfMsg( 'wminc-ip', $target ), 'error' ) ); |
| 78 | + return; |
75 | 79 | } |
76 | 80 | $user = User::newFromName( $target ); |
77 | 81 | $name = $user->getName(); |
— | — | @@ -79,7 +83,8 @@ |
80 | 84 | $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker; |
81 | 85 | if ( $user == null || $id == 0 ) { |
82 | 86 | # show error if a user with that name does not exist |
83 | | - return $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) ); |
| 87 | + $wgOut->addHTML( Xml::span( wfMsg( 'wminc-userdoesnotexist', $target ), 'error' ) ); |
| 88 | + return; |
84 | 89 | } |
85 | 90 | $userproject = $user->getOption( $wmincPref . '-project' ); |
86 | 91 | $userproject = ( $userproject ? $userproject : 'none' ); |
Index: trunk/extensions/WikimediaIncubator/ListUsersTestWiki.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | if( $input == strtolower( $wmincProjectSite['name'] ) || $input == strtolower( $wmincProjectSite['short'] ) ) { |
16 | 16 | return $wmincProjectSite; |
17 | 17 | } |
18 | | - return; |
| 18 | + return null; |
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
— | — | @@ -31,13 +31,20 @@ |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Show a message that you are viewing a list of users of a certain test wiki |
| 35 | + * @param $pager |
| 36 | + * @param $out |
| 37 | + * @return bool |
35 | 38 | */ |
36 | 39 | static function onSpecialListusersHeader( $pager, &$out ) { |
37 | | - if( $project = self::getProjectInput() ) { |
| 40 | + $project = self::getProjectInput(); |
| 41 | + if( $project ) { |
38 | 42 | $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', '"' . $project['name'] . '"' ); |
39 | | - } elseif( $testwiki = IncubatorTest::getUrlParam() ) { |
40 | | - $link = Linker::linkKnown( Title::newFromText( $testwiki['prefix'] ) ); |
41 | | - $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', $link ); |
| 43 | + } else { |
| 44 | + $testwiki = IncubatorTest::getUrlParam(); |
| 45 | + if ( $testwiki ) { |
| 46 | + $link = Linker::linkKnown( Title::newFromText( $testwiki['prefix'] ) ); |
| 47 | + $out .= wfMsgWikiHtml( 'wminc-listusers-testwiki', $link ); |
| 48 | + } |
42 | 49 | } |
43 | 50 | return true; |
44 | 51 | } |
Index: trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php |
— | — | @@ -12,6 +12,11 @@ |
13 | 13 | */ |
14 | 14 | |
15 | 15 | class AutoTestWiki { |
| 16 | + |
| 17 | + /** |
| 18 | + * @param $template UsercreateTemplate|UserloginTemplate |
| 19 | + * @return bool |
| 20 | + */ |
16 | 21 | public static function onUserCreateForm( $template ) { |
17 | 22 | global $wgRequest, $wmincProjects; |
18 | 23 | $projectvalue = strtolower( $wgRequest->getVal( 'testwikiproject', '' ) ); |
— | — | @@ -25,6 +30,10 @@ |
26 | 31 | return true; |
27 | 32 | } |
28 | 33 | |
| 34 | + /** |
| 35 | + * @param $user User |
| 36 | + * @return bool |
| 37 | + */ |
29 | 38 | public static function onAddNewAccount( $user ) { |
30 | 39 | global $wgRequest, $wmincProjects, $wmincPref; |
31 | 40 | $projectvalue = $wgRequest->getVal( 'testwiki-project' ); |
Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php |
— | — | @@ -13,7 +13,9 @@ |
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Add preferences |
17 | | - * @return True |
| 17 | + * @param $user User |
| 18 | + * @param $preferences array |
| 19 | + * @return true |
18 | 20 | */ |
19 | 21 | static function onGetPreferences( $user, &$preferences ) { |
20 | 22 | global $wmincPref, $wmincProjects, $wmincProjectSite, |
— | — | @@ -52,6 +54,8 @@ |
53 | 55 | |
54 | 56 | /** |
55 | 57 | * For the preferences above |
| 58 | + * @param $input |
| 59 | + * @param $alldata |
56 | 60 | * @return String or true |
57 | 61 | */ |
58 | 62 | static function validateCodePreference( $input, $alldata ) { |
— | — | @@ -135,15 +139,15 @@ |
136 | 140 | |
137 | 141 | /** |
138 | 142 | * This returns simply true or false based on analyzePrefix(). |
| 143 | + * @param $title Title |
| 144 | + * @param $onlyprefix bool |
139 | 145 | * @return Boolean |
140 | 146 | */ |
141 | 147 | static function validatePrefix( $title, $onlyprefix = false ) { |
142 | 148 | $data = self::analyzePrefix( $title, $onlyprefix ); |
143 | | - if( !$data['error'] ) { return true; } |
144 | | - return false; |
| 149 | + return !$data['error']; |
145 | 150 | } |
146 | 151 | |
147 | | - |
148 | 152 | /** |
149 | 153 | * Get &testwiki=wx/xx and validate that prefix. |
150 | 154 | * Returns the array of analyzePrefix() on success. |
— | — | @@ -197,6 +201,10 @@ |
198 | 202 | |
199 | 203 | /** |
200 | 204 | * Returns a simple boolean based on getProject() |
| 205 | + * @param $project string |
| 206 | + * @param $returnName bool |
| 207 | + * @param $returnName bool |
| 208 | + * @param $includeSister bool |
201 | 209 | * @return Bool |
202 | 210 | */ |
203 | 211 | static function isContentProject( $project = '', $returnName = false, $includeSister = false ) { |
— | — | @@ -400,7 +408,7 @@ |
401 | 409 | } |
402 | 410 | return true; # Should work now |
403 | 411 | } |
404 | | - |
| 412 | + |
405 | 413 | /** |
406 | 414 | * Given an incubator testwiki prefix, get the database name of the |
407 | 415 | * corresponding wiki, whether it exists or not |
— | — | @@ -527,7 +535,7 @@ |
528 | 536 | $wgOut->addHtml( $infopage->showExistingWiki() ); |
529 | 537 | } elseif( $dbstate == 'closed' ) { |
530 | 538 | $infopage->mSubStatus = 'imported'; |
531 | | - $wgOut->addHtml( $infopage->showIncubatingWiki() ); |
| 539 | + $wgOut->addHtml( $infopage->showIncubatingWiki() ); |
532 | 540 | } else { |
533 | 541 | $wgOut->addHtml( $infopage->showMissingWiki() ); |
534 | 542 | } |
Index: trunk/extensions/WikimediaIncubator/InfoPage.php |
— | — | @@ -19,6 +19,11 @@ |
20 | 20 | */ |
21 | 21 | |
22 | 22 | class InfoPage { |
| 23 | + |
| 24 | + /** |
| 25 | + * @param $title Title |
| 26 | + * @param $prefixdata |
| 27 | + */ |
23 | 28 | public function __construct( $title, $prefixdata ) { |
24 | 29 | global $wmincProjects, $wmincSisterProjects; |
25 | 30 | $this->mTitle = $title; |
— | — | @@ -54,9 +59,9 @@ |
55 | 60 | $useUrl = $url ? $url : IncubatorTest::getSubdomain( 'www', IncubatorTest::getProject( $project, false, true ) ); |
56 | 61 | if ( !$imageobj ) { # image not found |
57 | 62 | if( !$clickable ) { |
58 | | - return $logo; |
| 63 | + return $logo; // FIXME: $logo is undefined |
59 | 64 | } |
60 | | - return Linker::makeExternalLink( $useUrl, $project, false ); |
| 65 | + return Linker::makeExternalLink( $useUrl, $project, false ); |
61 | 66 | } |
62 | 67 | if( $clickable ) { |
63 | 68 | $args['link-url'] = $useUrl; |
— | — | @@ -79,6 +84,7 @@ |
80 | 85 | public function listOtherProjects() { |
81 | 86 | global $wmincProjects, $wmincSisterProjects; |
82 | 87 | $otherProjects = $wmincProjects + $wmincSisterProjects; |
| 88 | + $listOtherProjects = array(); |
83 | 89 | foreach( $otherProjects as $code => $name ) { |
84 | 90 | $listOtherProjects[$code] = '<li>' . $this->makeLogo( $name, true, |
85 | 91 | 75, null, IncubatorTest::getSubdomain( $this->mLangCode, $code ) ) . '</li>'; |
— | — | @@ -94,7 +100,8 @@ |
95 | 101 | */ |
96 | 102 | public function listMultilingualProjects() { |
97 | 103 | global $wmincMultilingualProjects; |
98 | | - if( !is_array( $wmincMultilingualProjects ) ) { return; } |
| 104 | + if( !is_array( $wmincMultilingualProjects ) ) { return ''; } |
| 105 | + $list = array(); |
99 | 106 | foreach( $wmincMultilingualProjects as $url => $name ) { |
100 | 107 | $list[$url] = '<li>' . $this->makeLogo( $name, true, |
101 | 108 | 75, null, '//'.$url.'/') . '</li>'; |
— | — | @@ -136,7 +143,7 @@ |
137 | 144 | array( 'class' => 'wminc-infopage-status' ), |
138 | 145 | wfMsgWikiHtml( 'wminc-infopage-missingwiki-text', |
139 | 146 | $this->mProjectName, $this->mLangName ) |
140 | | - ) . |
| 147 | + ) . |
141 | 148 | Html::rawElement( 'ul', array( 'class' => 'wminc-infopage-options' ), |
142 | 149 | Html::rawElement( 'li', null, |
143 | 150 | wfMsgExt( $this->mIsSister ? 'wminc-infopage-option-startsister' : 'wminc-infopage-option-startwiki', |
— | — | @@ -209,4 +216,4 @@ |
210 | 217 | ); |
211 | 218 | return $this->StandardInfoPage( $this->showWelcome(), $gotoSubdomain, $content ); |
212 | 219 | } |
213 | | -} |
\ No newline at end of file |
| 220 | +} |