Index: trunk/extensions/Interlanguage/InterlanguageCentral.php |
— | — | @@ -39,6 +39,10 @@ |
40 | 40 | $wgAutoloadClasses['InterlanguageCentralExtension'] = dirname(__FILE__) . '/InterlanguageCentralExtension.php'; |
41 | 41 | $wgHooks['ParserFirstCallInit'][] = 'wfInterlanguageCentralExtension'; |
42 | 42 | |
| 43 | +/** |
| 44 | + * @param $parser Parser |
| 45 | + * @return bool |
| 46 | + */ |
43 | 47 | function wfInterlanguageCentralExtension( $parser ) { |
44 | 48 | global $wgHooks, $wgInterlanguageCentralExtension; |
45 | 49 | |
Index: trunk/extensions/Interlanguage/InterlanguageExtension.php |
— | — | @@ -25,8 +25,17 @@ |
26 | 26 | */ |
27 | 27 | |
28 | 28 | class InterlanguageExtension { |
| 29 | + |
| 30 | + /** |
| 31 | + * @var DatabaseBase |
| 32 | + */ |
29 | 33 | var $foreignDbr = false; |
30 | 34 | |
| 35 | + /** |
| 36 | + * @param $magicWords array |
| 37 | + * @param $langCode string |
| 38 | + * @return bool |
| 39 | + */ |
31 | 40 | function onLanguageGetMagic( &$magicWords, $langCode ) { |
32 | 41 | $magicWords['interlanguage'] = array(0, 'interlanguage'); |
33 | 42 | return true; |
— | — | @@ -35,12 +44,10 @@ |
36 | 45 | /** |
37 | 46 | * The meat of the extension, the function that handles {{interlanguage:}} magic. |
38 | 47 | * |
39 | | - * @param $parser - standard Parser object. |
40 | | - * @param $param - parameter passed to {{interlanguage:}}. |
| 48 | + * @param $parser Parser standard Parser object. |
| 49 | + * @param $param parameter passed to {{interlanguage:}}. |
41 | 50 | */ |
42 | 51 | function interlanguage( &$parser, $param ) { |
43 | | - global $wgMemc; |
44 | | - |
45 | 52 | $this->addPageLink( $parser->getOutput(), $param ); |
46 | 53 | $parser->getOutput()->addModules( 'ext.Interlanguage' ); |
47 | 54 | |
— | — | @@ -49,9 +56,7 @@ |
50 | 57 | |
51 | 58 | if($res === false) { |
52 | 59 | list( $res, $a ) = $this->preservePageLinks( $parser->mTitle->mArticleID ); |
53 | | - } |
54 | | - |
55 | | - if($res === true) { |
| 60 | + } elseif ($res === true) { |
56 | 61 | $this->sortLinks( $a ); |
57 | 62 | $res = $this->linksToWiki( $a ); |
58 | 63 | } |
— | — | @@ -173,6 +178,9 @@ |
174 | 179 | |
175 | 180 | /** |
176 | 181 | * Add a page to the list of page links. It will later be used by pageLinks(). |
| 182 | + * |
| 183 | + * @param $parserOutput ParserOutput |
| 184 | + * @param $param |
177 | 185 | */ |
178 | 186 | function addPageLink( &$parserOutput, $param ) { |
179 | 187 | $ilp = $parserOutput->getProperty( 'interlanguage_pages' ); |
— | — | @@ -186,7 +194,7 @@ |
187 | 195 | /** |
188 | 196 | * Get the list of page links. |
189 | 197 | * |
190 | | - * @param $parserOutput |
| 198 | + * @param $parserOutput ParserOutput |
191 | 199 | * @return Array of page links. Empty array if there are no links, literal false if links have not |
192 | 200 | * been yet set. |
193 | 201 | */ |
— | — | @@ -303,8 +311,8 @@ |
304 | 312 | /** |
305 | 313 | * Make an array of Titles from the array of links. |
306 | 314 | * |
307 | | - * @param $pagelinks Array of page links. |
308 | | - * @returns Array of Title objects. If there are no page links, an empty array is returned. |
| 315 | + * @param $pagelinks Array of page links. |
| 316 | + * @return Array of Title objects. If there are no page links, an empty array is returned. |
309 | 317 | */ |
310 | 318 | function makePageLinkTitles( $pagelinks ) { |
311 | 319 | global $wgInterlanguageExtensionInterwiki; |
— | — | @@ -328,7 +336,7 @@ |
329 | 337 | * on this wiki by {{interlanguage:}} magic. Pagenames are array keys. |
330 | 338 | * |
331 | 339 | * @param $articleid - ID of the article whose links should be returned. |
332 | | - * @returns The array. If there are no pages linked, an empty array is returned. |
| 340 | + * @return The array. If there are no pages linked, an empty array is returned. |
333 | 341 | */ |
334 | 342 | function loadPageLinks( $articleid ) { |
335 | 343 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -356,9 +364,9 @@ |
357 | 365 | * Read interlanguage links from a database, and return them in the same format that API |
358 | 366 | * uses. |
359 | 367 | * |
360 | | - * @param $dbr - Database. |
361 | | - * @param $articleid - ID of the article whose links should be returned. |
362 | | - * @returns The array with the links. If there are no links, an empty array is returned. |
| 368 | + * @param $dbr DatabaseBase |
| 369 | + * @param $articleid int ID of the article whose links should be returned. |
| 370 | + * @return The array with the links. If there are no links, an empty array is returned. |
363 | 371 | */ |
364 | 372 | function readLinksFromDB( $dbr, $articleid ) { |
365 | 373 | $res = $dbr->select( |
— | — | @@ -371,7 +379,6 @@ |
372 | 380 | foreach( $res as $row ) { |
373 | 381 | $a[] = array( 'lang' => $row->ll_lang, '*' => $row->ll_title ); |
374 | 382 | } |
375 | | - $res->free(); |
376 | 383 | return $a; |
377 | 384 | } |
378 | 385 | |
Index: trunk/extensions/Interlanguage/Interlanguage.php |
— | — | @@ -47,6 +47,10 @@ |
48 | 48 | 'remoteExtPath' => 'Interlanguage', |
49 | 49 | ); |
50 | 50 | |
| 51 | +/** |
| 52 | + * @param $parser Parser |
| 53 | + * @return bool |
| 54 | + */ |
51 | 55 | function wfInterlanguageExtension( $parser ) { |
52 | 56 | global $wgHooks, $wgInterlanguageExtension; |
53 | 57 | |