Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlockStatus.php |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | $out->addWikiMsg( 'globalblocking-whitelist-dewhitelisted', $ip, $id ); |
133 | 133 | } |
134 | 134 | |
135 | | - $link = $wgUser->getSkin()->makeKnownLinkObj( SpecialPage::getTitleFor( 'GlobalBlockList' ), wfMsg( 'globalblocking-return' ) ); |
| 135 | + $link = Linker::makeKnownLinkObj( SpecialPage::getTitleFor( 'GlobalBlockList' ), wfMsg( 'globalblocking-return' ) ); |
136 | 136 | $out->addHTML( $link ); |
137 | 137 | |
138 | 138 | $out->setSubtitle(wfMsg('globalblocking-whitelist-successsub')); |
Index: trunk/extensions/Gadgets/Gadgets_body.php |
— | — | @@ -18,10 +18,11 @@ |
19 | 19 | * @param $article Article |
20 | 20 | * @param $user User |
21 | 21 | * @param $text String: New page text |
| 22 | + * @return bool |
22 | 23 | */ |
23 | 24 | public static function articleSaveComplete( $article, $user, $text ) { |
24 | 25 | // update cache if MediaWiki:Gadgets-definition was edited |
25 | | - $title = $article->mTitle; |
| 26 | + $title = $article->getTitle(); |
26 | 27 | if ( $title->getNamespace() == NS_MEDIAWIKI && $title->getText() == 'Gadgets-definition' ) { |
27 | 28 | Gadget::loadStructuredList( $text ); |
28 | 29 | } |
— | — | @@ -31,12 +32,18 @@ |
32 | 33 | /** |
33 | 34 | * UserGetDefaultOptions hook handler |
34 | 35 | * @param $defaultOptions Array of default preference keys and values |
| 36 | + * @return bool |
35 | 37 | */ |
36 | 38 | public static function userGetDefaultOptions( &$defaultOptions ) { |
37 | 39 | $gadgets = Gadget::loadStructuredList(); |
38 | | - if ( !$gadgets ) return true; |
| 40 | + if ( !$gadgets ) { |
| 41 | + return true; |
| 42 | + } |
39 | 43 | |
40 | | - foreach ( $gadgets as $section => $thisSection ) { |
| 44 | + /** |
| 45 | + * @var $gadget Gadget |
| 46 | + */ |
| 47 | + foreach ( $gadgets as $thisSection ) { |
41 | 48 | foreach ( $thisSection as $gadgetId => $gadget ) { |
42 | 49 | if ( $gadget->isOnByDefault() ) { |
43 | 50 | $defaultOptions['gadget-' . $gadgetId] = 1; |
— | — | @@ -51,10 +58,10 @@ |
52 | 59 | * GetPreferences hook handler. |
53 | 60 | * @param $user User |
54 | 61 | * @param $preferences Array: Preference descriptions |
| 62 | + * @return bool |
55 | 63 | */ |
56 | 64 | public static function getPreferences( $user, &$preferences ) { |
57 | 65 | $gadgets = Gadget::loadStructuredList(); |
58 | | - |
59 | 66 | if ( !$gadgets ) { |
60 | 67 | return true; |
61 | 68 | } |
— | — | @@ -64,6 +71,9 @@ |
65 | 72 | foreach ( $gadgets as $section => $thisSection ) { |
66 | 73 | $available = array(); |
67 | 74 | |
| 75 | + /** |
| 76 | + * @var $gadget Gadget |
| 77 | + */ |
68 | 78 | foreach ( $thisSection as $gadget ) { |
69 | 79 | if ( $gadget->isAllowed( $user ) ) { |
70 | 80 | $gname = $gadget->getName(); |
— | — | @@ -115,14 +125,17 @@ |
116 | 126 | /** |
117 | 127 | * ResourceLoaderRegisterModules hook handler. |
118 | 128 | * @param $resourceLoader ResourceLoader |
| 129 | + * @return bool |
119 | 130 | */ |
120 | 131 | public static function registerModules( &$resourceLoader ) { |
121 | 132 | $gadgets = Gadget::loadList(); |
122 | | - |
123 | 133 | if ( !$gadgets ) { |
124 | 134 | return true; |
125 | 135 | } |
126 | 136 | |
| 137 | + /** |
| 138 | + * @var $g Gadget |
| 139 | + */ |
127 | 140 | foreach ( $gadgets as $g ) { |
128 | 141 | $module = $g->getModule(); |
129 | 142 | if ( $module ) { |
— | — | @@ -136,6 +149,7 @@ |
137 | 150 | /** |
138 | 151 | * BeforePageDisplay hook handler. |
139 | 152 | * @param $out OutputPage |
| 153 | + * @return bool |
140 | 154 | */ |
141 | 155 | public static function beforePageDisplay( $out ) { |
142 | 156 | global $wgUser; |
— | — | @@ -152,6 +166,9 @@ |
153 | 167 | $lb->setCaller( __METHOD__ ); |
154 | 168 | $pages = array(); |
155 | 169 | |
| 170 | + /** |
| 171 | + * @var $gadget Gadget |
| 172 | + */ |
156 | 173 | foreach ( $gadgets as $gadget ) { |
157 | 174 | if ( $gadget->isEnabled( $wgUser ) && $gadget->isAllowed( $wgUser ) ) { |
158 | 175 | if ( $gadget->hasModule() ) { |
— | — | @@ -212,6 +229,7 @@ |
213 | 230 | /** |
214 | 231 | * UnitTestsList hook handler |
215 | 232 | * @param $files Array: List of extension test files |
| 233 | + * @return bool |
216 | 234 | */ |
217 | 235 | public static function unitTestsList( $files ) { |
218 | 236 | $files[] = dirname( __FILE__ ) . '/Gadgets_tests.php'; |
— | — | @@ -244,7 +262,7 @@ |
245 | 263 | /** |
246 | 264 | * Creates an instance of this class from definition in MediaWiki:Gadgets-definition |
247 | 265 | * @param $definition String: Gadget definition |
248 | | - * @return Mixed: Instance of Gadget class or false if $definition is invalid |
| 266 | + * @return Gadget|bool Instance of Gadget class or false if $definition is invalid |
249 | 267 | */ |
250 | 268 | public static function newFromDefinition( $definition ) { |
251 | 269 | $m = array(); |
— | — | @@ -497,7 +515,7 @@ |
498 | 516 | } |
499 | 517 | |
500 | 518 | $gadgets = array(); |
501 | | - foreach ( $struct as $section => $entries ) { |
| 519 | + foreach ( $struct as $entries ) { |
502 | 520 | $gadgets = array_merge( $gadgets, $entries ); |
503 | 521 | } |
504 | 522 | wfProfileOut( __METHOD__ ); |
— | — | @@ -507,13 +525,19 @@ |
508 | 526 | |
509 | 527 | /** |
510 | 528 | * Checks whether gadget list from cache can be used. |
| 529 | + * @param $gadgets array |
511 | 530 | * @return Boolean |
512 | 531 | */ |
513 | 532 | private static function isValidList( $gadgets ) { |
514 | | - if ( !is_array( $gadgets ) ) return false; |
| 533 | + if ( !is_array( $gadgets ) ) { |
| 534 | + return false; |
| 535 | + } |
515 | 536 | // Check if we have 1) array of gadgets 2) the gadgets are up to date |
516 | 537 | // One check is enough |
517 | | - foreach ( $gadgets as $section => $list ) { |
| 538 | + /** |
| 539 | + * @var $g Gadget |
| 540 | + */ |
| 541 | + foreach ( $gadgets as $list ) { |
518 | 542 | foreach ( $list as $g ) { |
519 | 543 | if ( !( $g instanceof Gadget ) || $g->isOutdated() ) { |
520 | 544 | return false; |
— | — | @@ -574,8 +598,7 @@ |
575 | 599 | $m = array(); |
576 | 600 | if ( preg_match( '/^==+ *([^*:\s|]+?)\s*==+\s*$/', $line, $m ) ) { |
577 | 601 | $section = $m[1]; |
578 | | - } |
579 | | - else { |
| 602 | + } else { |
580 | 603 | $gadget = self::newFromDefinition( $line ); |
581 | 604 | if ( $gadget ) { |
582 | 605 | $gadgets[$section][$gadget->getName()] = $gadget; |
— | — | @@ -617,6 +640,7 @@ |
618 | 641 | |
619 | 642 | /** |
620 | 643 | * Overrides the abstract function from ResourceLoaderWikiModule class |
| 644 | + * @param $context ResourceLoaderContext |
621 | 645 | * @return Array: $pages passed to __construct() |
622 | 646 | */ |
623 | 647 | protected function getPages( ResourceLoaderContext $context ) { |
Index: trunk/extensions/Gadgets/ApiQueryGadgets.php |
— | — | @@ -76,6 +76,9 @@ |
77 | 77 | $data = array(); |
78 | 78 | $result = $this->getResult(); |
79 | 79 | |
| 80 | + /** |
| 81 | + * @var $g Gadget |
| 82 | + */ |
80 | 83 | foreach ( $gadgets as $g ) { |
81 | 84 | $row = array(); |
82 | 85 | if ( isset( $this->props['id'] ) ) { |
Index: trunk/extensions/Gadgets/SpecialGadgets.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Main execution function |
24 | | - * @param $par Parameters passed to the page |
| 24 | + * @param $par array Parameters passed to the page |
25 | 25 | */ |
26 | 26 | function execute( $par ) { |
27 | 27 | $parts = explode( '/', $par ); |
— | — | @@ -38,8 +38,6 @@ |
39 | 39 | public function showMainForm() { |
40 | 40 | global $wgOut, $wgUser, $wgLang, $wgContLang; |
41 | 41 | |
42 | | - $skin = $wgUser->getSkin(); |
43 | | - |
44 | 42 | $this->setHeaders(); |
45 | 43 | $wgOut->setPagetitle( wfMsg( "gadgets-title" ) ); |
46 | 44 | $wgOut->addWikiMsg( 'gadgets-pagetext' ); |
— | — | @@ -62,7 +60,7 @@ |
63 | 61 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-section-$section$lang" ); |
64 | 62 | if ( $editInterfaceAllowed ) { |
65 | 63 | $lnkTarget = $t |
66 | | - ? $skin->link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ) |
| 64 | + ? Linker::link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ) |
67 | 65 | : htmlspecialchars( $section ); |
68 | 66 | $lnk = "    [$lnkTarget]"; |
69 | 67 | } else { |
— | — | @@ -79,6 +77,9 @@ |
80 | 78 | $wgOut->addHTML( Html::rawElement( 'h2', array(), $ttext . $lnk ) . "\n" ); |
81 | 79 | } |
82 | 80 | |
| 81 | + /** |
| 82 | + * @var $gadget Gadget |
| 83 | + */ |
83 | 84 | foreach ( $entries as $gadget ) { |
84 | 85 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "Gadget-{$gadget->getName()}$lang" ); |
85 | 86 | |
— | — | @@ -88,10 +89,10 @@ |
89 | 90 | |
90 | 91 | $links = array(); |
91 | 92 | if ( $editInterfaceAllowed ) { |
92 | | - $links[] = $skin->link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ); |
| 93 | + $links[] = Linker::link( $t, wfMsgHTML( 'edit' ), array(), array( 'action' => 'edit' ) ); |
93 | 94 | } |
94 | 95 | |
95 | | - $links[] = $skin->link( $this->getTitle( "export/{$gadget->getName()}" ), wfMsgHtml( 'gadgets-export' ) ); |
| 96 | + $links[] = Linker::link( $this->getTitle( "export/{$gadget->getName()}" ), wfMsgHtml( 'gadgets-export' ) ); |
96 | 97 | |
97 | 98 | $ttext = wfMsgExt( "gadget-{$gadget->getName()}", $msgOpt ); |
98 | 99 | |
— | — | @@ -114,7 +115,7 @@ |
115 | 116 | continue; |
116 | 117 | } |
117 | 118 | |
118 | | - $lnk[] = $skin->link( $t, htmlspecialchars( $t->getText() ) ); |
| 119 | + $lnk[] = Linker::link( $t, htmlspecialchars( $t->getText() ) ); |
119 | 120 | } |
120 | 121 | $wgOut->addHTML( $wgLang->commaList( $lnk ) ); |
121 | 122 | |
— | — | @@ -169,6 +170,9 @@ |
170 | 171 | return; |
171 | 172 | } |
172 | 173 | |
| 174 | + /** |
| 175 | + * @var $g Gadget |
| 176 | + */ |
173 | 177 | $g = $gadgets[$gadget]; |
174 | 178 | $this->setHeaders(); |
175 | 179 | $wgOut->setPagetitle( wfMsg( "gadgets-export-title" ) ); |