Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -148,6 +148,7 @@ |
149 | 149 | var $mTplExpandCache; # empty-frame expansion cache |
150 | 150 | var $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores; |
151 | 151 | var $mExpensiveFunctionCount; # number of expensive parser function calls |
| 152 | + var $mShowToc, $mForceTocPosition; |
152 | 153 | |
153 | 154 | /** |
154 | 155 | * @var User |
— | — | @@ -181,6 +182,8 @@ |
182 | 183 | |
183 | 184 | /** |
184 | 185 | * Constructor |
| 186 | + * |
| 187 | + * @param $conf array |
185 | 188 | */ |
186 | 189 | public function __construct( $conf = array() ) { |
187 | 190 | $this->mConf = $conf; |
— | — | @@ -797,6 +800,10 @@ |
798 | 801 | * Add an item to the strip state |
799 | 802 | * Returns the unique tag which must be inserted into the stripped text |
800 | 803 | * The tag will be replaced with the original text in unstrip() |
| 804 | + * |
| 805 | + * @param $text string |
| 806 | + * |
| 807 | + * @return string |
801 | 808 | */ |
802 | 809 | function insertStripItem( $text ) { |
803 | 810 | $rnd = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}-" . self::MARKER_SUFFIX; |
— | — | @@ -809,6 +816,10 @@ |
810 | 817 | * parse the wiki syntax used to render tables |
811 | 818 | * |
812 | 819 | * @private |
| 820 | + * |
| 821 | + * @param $text string |
| 822 | + * |
| 823 | + * @return string |
813 | 824 | */ |
814 | 825 | function doTableStuff( $text ) { |
815 | 826 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1020,10 +1031,13 @@ |
1021 | 1032 | * Helper function for doTableStuff(). This converts the structured array into html. |
1022 | 1033 | * |
1023 | 1034 | * @private |
| 1035 | + * |
| 1036 | + * @param $table array |
| 1037 | + * |
| 1038 | + * @return string |
1024 | 1039 | */ |
1025 | 1040 | function generateTableHTML( &$table ) { |
1026 | | - $return = ""; |
1027 | | - $return .= str_repeat( '<dl><dd>' , $table['indent'] ); |
| 1041 | + $return = str_repeat( '<dl><dd>' , $table['indent'] ); |
1028 | 1042 | $return .= '<table'; |
1029 | 1043 | $return .= isset( $table['attributes'] ) ? $table['attributes'] : ''; |
1030 | 1044 | $return .= '>'; |
— | — | @@ -1105,6 +1119,8 @@ |
1106 | 1120 | * no numric elements and an array itself if not previously defined. |
1107 | 1121 | * |
1108 | 1122 | * @private |
| 1123 | + * |
| 1124 | + * @param $arr array |
1109 | 1125 | */ |
1110 | 1126 | function &last ( &$arr ) { |
1111 | 1127 | for ( $i = count( $arr ); ( !isset( $arr[$i] ) && $i > 0 ); $i-- ) { } |
— | — | @@ -1116,8 +1132,14 @@ |
1117 | 1133 | * HTML. Only called for $mOutputType == self::OT_HTML. |
1118 | 1134 | * |
1119 | 1135 | * @private |
| 1136 | + * |
| 1137 | + * @param $text string |
| 1138 | + * @param $isMain bool |
| 1139 | + * @param $frame bool |
| 1140 | + * |
| 1141 | + * @return string |
1120 | 1142 | */ |
1121 | | - function internalParse( $text, $isMain = true, $frame=false ) { |
| 1143 | + function internalParse( $text, $isMain = true, $frame = false ) { |
1122 | 1144 | wfProfileIn( __METHOD__ ); |
1123 | 1145 | |
1124 | 1146 | $origText = $text; |
— | — | @@ -1183,6 +1205,10 @@ |
1184 | 1206 | * |
1185 | 1207 | * DML |
1186 | 1208 | * @private |
| 1209 | + * |
| 1210 | + * @param $text string |
| 1211 | + * |
| 1212 | + * @return string |
1187 | 1213 | */ |
1188 | 1214 | function doMagicLinks( $text ) { |
1189 | 1215 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1256,7 +1282,10 @@ |
1257 | 1283 | |
1258 | 1284 | /** |
1259 | 1285 | * Make a free external link, given a user-supplied URL |
1260 | | - * @return HTML |
| 1286 | + * |
| 1287 | + * @param $url string |
| 1288 | + * |
| 1289 | + * @return string HTML |
1261 | 1290 | * @private |
1262 | 1291 | */ |
1263 | 1292 | function makeFreeExternalLink( $url ) { |
— | — | @@ -1309,6 +1338,10 @@ |
1310 | 1339 | * Parse headers and return html |
1311 | 1340 | * |
1312 | 1341 | * @private |
| 1342 | + * |
| 1343 | + * @param $text string |
| 1344 | + * |
| 1345 | + * @return string |
1313 | 1346 | */ |
1314 | 1347 | function doHeadings( $text ) { |
1315 | 1348 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1324,6 +1357,9 @@ |
1325 | 1358 | /** |
1326 | 1359 | * Replace single quotes with HTML markup |
1327 | 1360 | * @private |
| 1361 | + * |
| 1362 | + * @param $text string |
| 1363 | + * |
1328 | 1364 | * @return string the altered text |
1329 | 1365 | */ |
1330 | 1366 | function doAllQuotes( $text ) { |
— | — | @@ -1340,6 +1376,10 @@ |
1341 | 1377 | |
1342 | 1378 | /** |
1343 | 1379 | * Helper function for doAllQuotes() |
| 1380 | + * |
| 1381 | + * @param $text string |
| 1382 | + * |
| 1383 | + * @return string |
1344 | 1384 | */ |
1345 | 1385 | public function doQuotes( $text ) { |
1346 | 1386 | $arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE ); |
— | — | @@ -1504,6 +1544,10 @@ |
1505 | 1545 | * Make sure to run maintenance/parserTests.php if you change this code. |
1506 | 1546 | * |
1507 | 1547 | * @private |
| 1548 | + * |
| 1549 | + * @param $text string |
| 1550 | + * |
| 1551 | + * @return string |
1508 | 1552 | */ |
1509 | 1553 | function replaceExternalLinks( $text ) { |
1510 | 1554 | global $wgContLang; |
— | — | @@ -1580,9 +1624,9 @@ |
1581 | 1625 | * (depending on configuration, namespace, and the URL's domain) and/or a |
1582 | 1626 | * target attribute (depending on configuration). |
1583 | 1627 | * |
1584 | | - * @param $url String: optional URL, to extract the domain from for rel => |
| 1628 | + * @param $url String|bool optional URL, to extract the domain from for rel => |
1585 | 1629 | * nofollow if appropriate |
1586 | | - * @return Array: associative array of HTML attributes |
| 1630 | + * @return Array associative array of HTML attributes |
1587 | 1631 | */ |
1588 | 1632 | function getExternalLinkAttribs( $url = false ) { |
1589 | 1633 | $attribs = array(); |
— | — | @@ -1629,6 +1673,10 @@ |
1630 | 1674 | /** |
1631 | 1675 | * Callback function used in replaceUnusualEscapes(). |
1632 | 1676 | * Replaces unusual URL escape codes with their equivalent character |
| 1677 | + * |
| 1678 | + * @param $matches array |
| 1679 | + * |
| 1680 | + * @return string |
1633 | 1681 | */ |
1634 | 1682 | private static function replaceUnusualEscapesCallback( $matches ) { |
1635 | 1683 | $char = urldecode( $matches[0] ); |
— | — | @@ -1647,6 +1695,10 @@ |
1648 | 1696 | * make an image if it's allowed, either through the global |
1649 | 1697 | * option, through the exception, or through the on-wiki whitelist |
1650 | 1698 | * @private |
| 1699 | + * |
| 1700 | + * $param $url string |
| 1701 | + * |
| 1702 | + * @return string |
1651 | 1703 | */ |
1652 | 1704 | function maybeMakeExternalImage( $url ) { |
1653 | 1705 | $imagesfrom = $this->mOptions->getAllowExternalImagesFrom(); |
— | — | @@ -1693,6 +1745,9 @@ |
1694 | 1746 | |
1695 | 1747 | /** |
1696 | 1748 | * Process [[ ]] wikilinks |
| 1749 | + * |
| 1750 | + * @param $s string |
| 1751 | + * |
1697 | 1752 | * @return String: processed text |
1698 | 1753 | * |
1699 | 1754 | * @private |
— | — | @@ -2121,6 +2176,11 @@ |
2122 | 2177 | * getCommon() returns the length of the longest common substring |
2123 | 2178 | * of both arguments, starting at the beginning of both. |
2124 | 2179 | * @private |
| 2180 | + * |
| 2181 | + * @param $st1 string |
| 2182 | + * @param $st2 string |
| 2183 | + * |
| 2184 | + * @return int |
2125 | 2185 | */ |
2126 | 2186 | function getCommon( $st1, $st2 ) { |
2127 | 2187 | $fl = strlen( $st1 ); |
— | — | @@ -2142,6 +2202,8 @@ |
2143 | 2203 | * element appropriate to the prefix character passed into them. |
2144 | 2204 | * @private |
2145 | 2205 | * |
| 2206 | + * @param $char char |
| 2207 | + * |
2146 | 2208 | * @return string |
2147 | 2209 | */ |
2148 | 2210 | function openList( $char ) { |
— | — | @@ -2405,10 +2467,10 @@ |
2406 | 2468 | * Split up a string on ':', ignoring any occurences inside tags |
2407 | 2469 | * to prevent illegal overlapping. |
2408 | 2470 | * |
2409 | | - * @param $str String: the string to split |
2410 | | - * @param &$before String: set to everything before the ':' |
2411 | | - * @param &$after String: set to everything after the ':' |
2412 | | - * return String: the position of the ':', or false if none found |
| 2471 | + * @param $str String the string to split |
| 2472 | + * @param &$before String set to everything before the ':' |
| 2473 | + * @param &$after String set to everything after the ':' |
| 2474 | + * @return String the position of the ':', or false if none found |
2413 | 2475 | */ |
2414 | 2476 | function findColonNoLinks( $str, &$before, &$after ) { |
2415 | 2477 | wfProfileIn( __METHOD__ ); |
— | — | @@ -2573,8 +2635,10 @@ |
2574 | 2636 | * |
2575 | 2637 | * @param $index integer |
2576 | 2638 | * @param $frame PPFrame |
| 2639 | + * |
| 2640 | + * @return string |
2577 | 2641 | */ |
2578 | | - function getVariableValue( $index, $frame=false ) { |
| 2642 | + function getVariableValue( $index, $frame = false ) { |
2579 | 2643 | global $wgContLang, $wgSitename, $wgServer; |
2580 | 2644 | global $wgArticlePath, $wgScriptPath, $wgStylePath; |
2581 | 2645 | |
— | — | @@ -2879,8 +2943,9 @@ |
2880 | 2944 | } |
2881 | 2945 | } |
2882 | 2946 | |
2883 | | - if ( $index ) |
| 2947 | + if ( $index ) { |
2884 | 2948 | $this->mVarCache[$index] = $value; |
| 2949 | + } |
2885 | 2950 | |
2886 | 2951 | return $value; |
2887 | 2952 | } |
— | — | @@ -2932,6 +2997,8 @@ |
2933 | 2998 | /** |
2934 | 2999 | * Return a three-element array: leading whitespace, string contents, trailing whitespace |
2935 | 3000 | * |
| 3001 | + * @param $s string |
| 3002 | + * |
2936 | 3003 | * @return array |
2937 | 3004 | */ |
2938 | 3005 | public static function splitWhitespace( $s ) { |
— | — | @@ -2957,11 +3024,11 @@ |
2958 | 3025 | * self::OT_PREPROCESS: templates but not extension tags |
2959 | 3026 | * self::OT_HTML: all templates and extension tags |
2960 | 3027 | * |
2961 | | - * @param $text String: the text to transform |
| 3028 | + * @param $text String the text to transform |
2962 | 3029 | * @param $frame PPFrame Object describing the arguments passed to the template. |
2963 | 3030 | * Arguments may also be provided as an associative array, as was the usual case before MW1.12. |
2964 | 3031 | * Providing arguments this way may be useful for extensions wishing to perform variable replacement explicitly. |
2965 | | - * @param $argsOnly Boolean: only do argument (triple-brace) expansion, not double-brace expansion |
| 3032 | + * @param $argsOnly Boolean only do argument (triple-brace) expansion, not double-brace expansion |
2966 | 3033 | * @private |
2967 | 3034 | * |
2968 | 3035 | * @return string |
— | — | @@ -2991,6 +3058,8 @@ |
2992 | 3059 | /** |
2993 | 3060 | * Clean up argument array - refactored in 1.9 so parserfunctions can use it, too. |
2994 | 3061 | * |
| 3062 | + * @param $args array |
| 3063 | + * |
2995 | 3064 | * @return array |
2996 | 3065 | */ |
2997 | 3066 | static function createAssocArgs( $args ) { |
— | — | @@ -3394,6 +3463,8 @@ |
3395 | 3464 | * Get the semi-parsed DOM representation of a template with a given title, |
3396 | 3465 | * and its redirect destination title. Cached. |
3397 | 3466 | * |
| 3467 | + * @param $title Title |
| 3468 | + * |
3398 | 3469 | * @return array |
3399 | 3470 | */ |
3400 | 3471 | function getTemplateDom( $title ) { |
— | — | @@ -3460,6 +3531,9 @@ |
3461 | 3532 | * Static function to get a template |
3462 | 3533 | * Can be overridden via ParserOptions::setTemplateCallback(). |
3463 | 3534 | * |
| 3535 | + * @parma $title Title |
| 3536 | + * @param $parser Parser |
| 3537 | + * |
3464 | 3538 | * @return array |
3465 | 3539 | */ |
3466 | 3540 | static function statelessFetchTemplate( $title, $parser = false ) { |
— | — | @@ -3537,7 +3611,7 @@ |
3538 | 3612 | * @param Title $title |
3539 | 3613 | * @param string $time MW timestamp |
3540 | 3614 | * @param string $sha1 base 36 SHA-1 |
3541 | | - * @return mixed File or false |
| 3615 | + * @return File|false |
3542 | 3616 | */ |
3543 | 3617 | function fetchFile( $title, $time = false, $sha1 = false ) { |
3544 | 3618 | $res = $this->fetchFileAndTitle( $title, $time, $sha1 ); |
— | — | @@ -3800,6 +3874,10 @@ |
3801 | 3875 | /** |
3802 | 3876 | * Strip double-underscore items like __NOGALLERY__ and __NOTOC__ |
3803 | 3877 | * Fills $this->mDoubleUnderscores, returns the modified text |
| 3878 | + * |
| 3879 | + * @param $text string |
| 3880 | + * |
| 3881 | + * @return string |
3804 | 3882 | */ |
3805 | 3883 | function doDoubleUnderscore( $text ) { |
3806 | 3884 | wfProfileIn( __METHOD__ ); |
— | — | @@ -4281,6 +4359,11 @@ |
4282 | 4360 | /** |
4283 | 4361 | * Pre-save transform helper function |
4284 | 4362 | * @private |
| 4363 | + * |
| 4364 | + * @param $text string |
| 4365 | + * @param $user User |
| 4366 | + * |
| 4367 | + * @return string |
4285 | 4368 | */ |
4286 | 4369 | function pstPass2( $text, $user ) { |
4287 | 4370 | global $wgContLang, $wgLocaltimezone; |
— | — | @@ -4372,8 +4455,8 @@ |
4373 | 4456 | * as it may have changed if it's the $wgParser. |
4374 | 4457 | * |
4375 | 4458 | * @param $user User |
4376 | | - * @param $nickname String: nickname to use or false to use user's default nickname |
4377 | | - * @param $fancySig Boolean: whether the nicknname is the complete signature |
| 4459 | + * @param $nickname String|bool nickname to use or false to use user's default nickname |
| 4460 | + * @param $fancySig Boolean|null whether the nicknname is the complete signature |
4378 | 4461 | * or null to use default value |
4379 | 4462 | * @return string |
4380 | 4463 | */ |
— | — | @@ -4435,7 +4518,7 @@ |
4436 | 4519 | * 2) Substitute all transclusions |
4437 | 4520 | * |
4438 | 4521 | * @param $text String |
4439 | | - * @param $parsing Whether we're cleaning (preferences save) or parsing |
| 4522 | + * @param $parsing bool Whether we're cleaning (preferences save) or parsing |
4440 | 4523 | * @return String: signature text |
4441 | 4524 | */ |
4442 | 4525 | function cleanSig( $text, $parsing = false ) { |
— | — | @@ -4485,11 +4568,22 @@ |
4486 | 4569 | /** |
4487 | 4570 | * Set up some variables which are usually set up in parse() |
4488 | 4571 | * so that an external function can call some class members with confidence |
| 4572 | + * |
| 4573 | + * @param $title Title|null |
| 4574 | + * @param $options ParserOptions |
| 4575 | + * @param $outputType |
| 4576 | + * @param $clearState bool |
4489 | 4577 | */ |
4490 | 4578 | public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { |
4491 | 4579 | $this->startParse( $title, $options, $outputType, $clearState ); |
4492 | 4580 | } |
4493 | 4581 | |
| 4582 | + /** |
| 4583 | + * @param $title Title|null |
| 4584 | + * @param $options ParserOptions |
| 4585 | + * @param $outputType |
| 4586 | + * @param $clearState bool |
| 4587 | + */ |
4494 | 4588 | private function startParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { |
4495 | 4589 | $this->setTitle( $title ); |
4496 | 4590 | $this->mOptions = $options; |
— | — | @@ -4720,7 +4814,11 @@ |
4721 | 4815 | * @todo FIXME: Update documentation. makeLinkObj() is deprecated. |
4722 | 4816 | * Replace <!--LINK--> link placeholders with actual links, in the buffer |
4723 | 4817 | * Placeholders created in Skin::makeLinkObj() |
4724 | | - * Returns an array of link CSS classes, indexed by PDBK. |
| 4818 | + * |
| 4819 | + * @param $text string |
| 4820 | + * @param $options int |
| 4821 | + * |
| 4822 | + * @return array of link CSS classes, indexed by PDBK. |
4725 | 4823 | */ |
4726 | 4824 | function replaceLinkHolders( &$text, $options = 0 ) { |
4727 | 4825 | return $this->mLinkHolders->replace( $text ); |
— | — | @@ -4747,7 +4845,7 @@ |
4748 | 4846 | * 'A tree'. |
4749 | 4847 | * |
4750 | 4848 | * @param string $text |
4751 | | - * @param array $param |
| 4849 | + * @param array $params |
4752 | 4850 | * @return string HTML |
4753 | 4851 | */ |
4754 | 4852 | function renderImageGallery( $text, $params ) { |
— | — | @@ -4832,6 +4930,10 @@ |
4833 | 4931 | return $ig->toHTML(); |
4834 | 4932 | } |
4835 | 4933 | |
| 4934 | + /** |
| 4935 | + * @param $handler |
| 4936 | + * @return array |
| 4937 | + */ |
4836 | 4938 | function getImageParams( $handler ) { |
4837 | 4939 | if ( $handler ) { |
4838 | 4940 | $handlerClass = get_class( $handler ); |
— | — | @@ -4877,7 +4979,7 @@ |
4878 | 4980 | * |
4879 | 4981 | * @param $title Title |
4880 | 4982 | * @param $options String |
4881 | | - * @param $holders LinkHolderArray |
| 4983 | + * @param $holders LinkHolderArray|false |
4882 | 4984 | * @return string HTML |
4883 | 4985 | */ |
4884 | 4986 | function makeImage( $title, $options, $holders = false ) { |
— | — | @@ -5499,6 +5601,11 @@ |
5500 | 5602 | /** |
5501 | 5603 | * strip/replaceVariables/unstrip for preprocessor regression testing |
5502 | 5604 | * |
| 5605 | + * @param $text string |
| 5606 | + * @param $title Title |
| 5607 | + * @param $options ParserOptions |
| 5608 | + * @param $outputType int |
| 5609 | + * |
5503 | 5610 | * @return string |
5504 | 5611 | */ |
5505 | 5612 | function testSrvus( $text, Title $title, ParserOptions $options, $outputType = self::OT_HTML ) { |
— | — | @@ -5510,10 +5617,22 @@ |
5511 | 5618 | return $text; |
5512 | 5619 | } |
5513 | 5620 | |
| 5621 | + /** |
| 5622 | + * @param $text string |
| 5623 | + * @param $title Title |
| 5624 | + * @param $options ParserOptions |
| 5625 | + * @return string |
| 5626 | + */ |
5514 | 5627 | function testPst( $text, Title $title, ParserOptions $options ) { |
5515 | 5628 | return $this->preSaveTransform( $text, $title, $options->getUser(), $options ); |
5516 | 5629 | } |
5517 | 5630 | |
| 5631 | + /** |
| 5632 | + * @param $text |
| 5633 | + * @param $title Title |
| 5634 | + * @param $options ParserOptions |
| 5635 | + * @return string |
| 5636 | + */ |
5518 | 5637 | function testPreprocess( $text, Title $title, ParserOptions $options ) { |
5519 | 5638 | return $this->testSrvus( $text, $title, $options, self::OT_PREPROCESS ); |
5520 | 5639 | } |
— | — | @@ -5529,6 +5648,9 @@ |
5530 | 5649 | * two strings will be replaced with the value returned by the callback in |
5531 | 5650 | * each case. |
5532 | 5651 | * |
| 5652 | + * @param $s string |
| 5653 | + * @param $callback |
| 5654 | + * |
5533 | 5655 | * @return string |
5534 | 5656 | */ |
5535 | 5657 | function markerSkipCallback( $s, $callback ) { |
— | — | @@ -5567,6 +5689,8 @@ |
5568 | 5690 | * unserializeHalfParsedText(). The text can then be safely incorporated into |
5569 | 5691 | * the return value of a parser hook. |
5570 | 5692 | * |
| 5693 | + * @param $text string |
| 5694 | + * |
5571 | 5695 | * @return array |
5572 | 5696 | */ |
5573 | 5697 | function serializeHalfParsedText( $text ) { |
Index: trunk/phase3/includes/api/ApiFeedContributions.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | if( $title ) { |
101 | 101 | $date = $row->rev_timestamp; |
102 | 102 | $comments = $title->getTalkPage()->getFullURL(); |
103 | | - $revision = Revision::newFromRow( $row); |
| 103 | + $revision = Revision::newFromRow( $row ); |
104 | 104 | |
105 | 105 | return new FeedItem( |
106 | 106 | $title->getPrefixedText(), |