Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2340,173 +2340,235 @@ |
2341 | 2341 | |
2342 | 2342 | switch ( $index ) { |
2343 | 2343 | case 'currentmonth': |
2344 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'm', $ts ) ); |
| 2344 | + $value = $wgContLang->formatNum( gmdate( 'm', $ts ) ); |
| 2345 | + break; |
2345 | 2346 | case 'currentmonth1': |
2346 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'n', $ts ) ); |
| 2347 | + $value = $wgContLang->formatNum( gmdate( 'n', $ts ) ); |
| 2348 | + break; |
2347 | 2349 | case 'currentmonthname': |
2348 | | - return $this->mVarCache[$index] = $wgContLang->getMonthName( gmdate( 'n', $ts ) ); |
| 2350 | + $value = $wgContLang->getMonthName( gmdate( 'n', $ts ) ); |
| 2351 | + break; |
2349 | 2352 | case 'currentmonthnamegen': |
2350 | | - return $this->mVarCache[$index] = $wgContLang->getMonthNameGen( gmdate( 'n', $ts ) ); |
| 2353 | + $value = $wgContLang->getMonthNameGen( gmdate( 'n', $ts ) ); |
| 2354 | + break; |
2351 | 2355 | case 'currentmonthabbrev': |
2352 | | - return $this->mVarCache[$index] = $wgContLang->getMonthAbbreviation( gmdate( 'n', $ts ) ); |
| 2356 | + $value = $wgContLang->getMonthAbbreviation( gmdate( 'n', $ts ) ); |
| 2357 | + break; |
2353 | 2358 | case 'currentday': |
2354 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'j', $ts ) ); |
| 2359 | + $value = $wgContLang->formatNum( gmdate( 'j', $ts ) ); |
| 2360 | + break; |
2355 | 2361 | case 'currentday2': |
2356 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'd', $ts ) ); |
| 2362 | + $value = $wgContLang->formatNum( gmdate( 'd', $ts ) ); |
| 2363 | + break; |
2357 | 2364 | case 'localmonth': |
2358 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth ); |
| 2365 | + $value = $wgContLang->formatNum( $localMonth ); |
| 2366 | + break; |
2359 | 2367 | case 'localmonth1': |
2360 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth1 ); |
| 2368 | + $value = $wgContLang->formatNum( $localMonth1 ); |
| 2369 | + break; |
2361 | 2370 | case 'localmonthname': |
2362 | | - return $this->mVarCache[$index] = $wgContLang->getMonthName( $localMonthName ); |
| 2371 | + $value = $wgContLang->getMonthName( $localMonthName ); |
| 2372 | + break; |
2363 | 2373 | case 'localmonthnamegen': |
2364 | | - return $this->mVarCache[$index] = $wgContLang->getMonthNameGen( $localMonthName ); |
| 2374 | + $value = $wgContLang->getMonthNameGen( $localMonthName ); |
| 2375 | + break; |
2365 | 2376 | case 'localmonthabbrev': |
2366 | | - return $this->mVarCache[$index] = $wgContLang->getMonthAbbreviation( $localMonthName ); |
| 2377 | + $value = $wgContLang->getMonthAbbreviation( $localMonthName ); |
| 2378 | + break; |
2367 | 2379 | case 'localday': |
2368 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localDay ); |
| 2380 | + $value = $wgContLang->formatNum( $localDay ); |
| 2381 | + break; |
2369 | 2382 | case 'localday2': |
2370 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localDay2 ); |
| 2383 | + $value = $wgContLang->formatNum( $localDay2 ); |
| 2384 | + break; |
2371 | 2385 | case 'pagename': |
2372 | | - return wfEscapeWikiText( $this->mTitle->getText() ); |
| 2386 | + $value = wfEscapeWikiText( $this->mTitle->getText() ); |
| 2387 | + break; |
2373 | 2388 | case 'pagenamee': |
2374 | | - return $this->mTitle->getPartialURL(); |
| 2389 | + $value = $this->mTitle->getPartialURL(); |
| 2390 | + break; |
2375 | 2391 | case 'fullpagename': |
2376 | | - return wfEscapeWikiText( $this->mTitle->getPrefixedText() ); |
| 2392 | + $value = wfEscapeWikiText( $this->mTitle->getPrefixedText() ); |
| 2393 | + break; |
2377 | 2394 | case 'fullpagenamee': |
2378 | | - return $this->mTitle->getPrefixedURL(); |
| 2395 | + $value = $this->mTitle->getPrefixedURL(); |
| 2396 | + break; |
2379 | 2397 | case 'subpagename': |
2380 | | - return wfEscapeWikiText( $this->mTitle->getSubpageText() ); |
| 2398 | + $value = wfEscapeWikiText( $this->mTitle->getSubpageText() ); |
| 2399 | + break; |
2381 | 2400 | case 'subpagenamee': |
2382 | | - return $this->mTitle->getSubpageUrlForm(); |
| 2401 | + $value = $this->mTitle->getSubpageUrlForm(); |
| 2402 | + break; |
2383 | 2403 | case 'basepagename': |
2384 | | - return wfEscapeWikiText( $this->mTitle->getBaseText() ); |
| 2404 | + $value = wfEscapeWikiText( $this->mTitle->getBaseText() ); |
| 2405 | + break; |
2385 | 2406 | case 'basepagenamee': |
2386 | | - return wfUrlEncode( str_replace( ' ', '_', $this->mTitle->getBaseText() ) ); |
| 2407 | + $value = wfUrlEncode( str_replace( ' ', '_', $this->mTitle->getBaseText() ) ); |
| 2408 | + break; |
2387 | 2409 | case 'talkpagename': |
2388 | 2410 | if( $this->mTitle->canTalk() ) { |
2389 | 2411 | $talkPage = $this->mTitle->getTalkPage(); |
2390 | | - return wfEscapeWikiText( $talkPage->getPrefixedText() ); |
| 2412 | + $value = wfEscapeWikiText( $talkPage->getPrefixedText() ); |
2391 | 2413 | } else { |
2392 | | - return ''; |
| 2414 | + $value = ''; |
2393 | 2415 | } |
| 2416 | + break; |
2394 | 2417 | case 'talkpagenamee': |
2395 | 2418 | if( $this->mTitle->canTalk() ) { |
2396 | 2419 | $talkPage = $this->mTitle->getTalkPage(); |
2397 | | - return $talkPage->getPrefixedUrl(); |
| 2420 | + $value = $talkPage->getPrefixedUrl(); |
2398 | 2421 | } else { |
2399 | | - return ''; |
| 2422 | + $value = ''; |
2400 | 2423 | } |
| 2424 | + break; |
2401 | 2425 | case 'subjectpagename': |
2402 | 2426 | $subjPage = $this->mTitle->getSubjectPage(); |
2403 | | - return wfEscapeWikiText( $subjPage->getPrefixedText() ); |
| 2427 | + $value = wfEscapeWikiText( $subjPage->getPrefixedText() ); |
| 2428 | + break; |
2404 | 2429 | case 'subjectpagenamee': |
2405 | 2430 | $subjPage = $this->mTitle->getSubjectPage(); |
2406 | | - return $subjPage->getPrefixedUrl(); |
| 2431 | + $value = $subjPage->getPrefixedUrl(); |
| 2432 | + break; |
2407 | 2433 | case 'revisionid': |
2408 | 2434 | // Let the edit saving system know we should parse the page |
2409 | 2435 | // *after* a revision ID has been assigned. |
2410 | 2436 | $this->mOutput->setFlag( 'vary-revision' ); |
2411 | 2437 | wfDebug( __METHOD__ . ": {{REVISIONID}} used, setting vary-revision...\n" ); |
2412 | | - return $this->mRevisionId; |
| 2438 | + $value = $this->mRevisionId; |
| 2439 | + break; |
2413 | 2440 | case 'revisionday': |
2414 | 2441 | // Let the edit saving system know we should parse the page |
2415 | 2442 | // *after* a revision ID has been assigned. This is for null edits. |
2416 | 2443 | $this->mOutput->setFlag( 'vary-revision' ); |
2417 | 2444 | wfDebug( __METHOD__ . ": {{REVISIONDAY}} used, setting vary-revision...\n" ); |
2418 | | - return intval( substr( $this->getRevisionTimestamp(), 6, 2 ) ); |
| 2445 | + $value = intval( substr( $this->getRevisionTimestamp(), 6, 2 ) ); |
| 2446 | + break; |
2419 | 2447 | case 'revisionday2': |
2420 | 2448 | // Let the edit saving system know we should parse the page |
2421 | 2449 | // *after* a revision ID has been assigned. This is for null edits. |
2422 | 2450 | $this->mOutput->setFlag( 'vary-revision' ); |
2423 | 2451 | wfDebug( __METHOD__ . ": {{REVISIONDAY2}} used, setting vary-revision...\n" ); |
2424 | | - return substr( $this->getRevisionTimestamp(), 6, 2 ); |
| 2452 | + $value = substr( $this->getRevisionTimestamp(), 6, 2 ); |
| 2453 | + break; |
2425 | 2454 | case 'revisionmonth': |
2426 | 2455 | // Let the edit saving system know we should parse the page |
2427 | 2456 | // *after* a revision ID has been assigned. This is for null edits. |
2428 | 2457 | $this->mOutput->setFlag( 'vary-revision' ); |
2429 | 2458 | wfDebug( __METHOD__ . ": {{REVISIONMONTH}} used, setting vary-revision...\n" ); |
2430 | | - return intval( substr( $this->getRevisionTimestamp(), 4, 2 ) ); |
| 2459 | + $value = intval( substr( $this->getRevisionTimestamp(), 4, 2 ) ); |
| 2460 | + break; |
2431 | 2461 | case 'revisionyear': |
2432 | 2462 | // Let the edit saving system know we should parse the page |
2433 | 2463 | // *after* a revision ID has been assigned. This is for null edits. |
2434 | 2464 | $this->mOutput->setFlag( 'vary-revision' ); |
2435 | 2465 | wfDebug( __METHOD__ . ": {{REVISIONYEAR}} used, setting vary-revision...\n" ); |
2436 | | - return substr( $this->getRevisionTimestamp(), 0, 4 ); |
| 2466 | + $value = substr( $this->getRevisionTimestamp(), 0, 4 ); |
| 2467 | + break; |
2437 | 2468 | case 'revisiontimestamp': |
2438 | 2469 | // Let the edit saving system know we should parse the page |
2439 | 2470 | // *after* a revision ID has been assigned. This is for null edits. |
2440 | 2471 | $this->mOutput->setFlag( 'vary-revision' ); |
2441 | 2472 | wfDebug( __METHOD__ . ": {{REVISIONTIMESTAMP}} used, setting vary-revision...\n" ); |
2442 | | - return $this->getRevisionTimestamp(); |
| 2473 | + $value = $this->getRevisionTimestamp(); |
| 2474 | + break; |
2443 | 2475 | case 'revisionuser': |
2444 | 2476 | // Let the edit saving system know we should parse the page |
2445 | 2477 | // *after* a revision ID has been assigned. This is for null edits. |
2446 | 2478 | $this->mOutput->setFlag( 'vary-revision' ); |
2447 | 2479 | wfDebug( __METHOD__ . ": {{REVISIONUSER}} used, setting vary-revision...\n" ); |
2448 | | - return $this->getRevisionUser(); |
| 2480 | + $value = $this->getRevisionUser(); |
| 2481 | + break; |
2449 | 2482 | case 'namespace': |
2450 | | - return str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) ); |
| 2483 | + $value = str_replace('_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) ); |
| 2484 | + break; |
2451 | 2485 | case 'namespacee': |
2452 | | - return wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) ); |
| 2486 | + $value = wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) ); |
| 2487 | + break; |
2453 | 2488 | case 'talkspace': |
2454 | | - return $this->mTitle->canTalk() ? str_replace('_',' ',$this->mTitle->getTalkNsText()) : ''; |
| 2489 | + $value = $this->mTitle->canTalk() ? str_replace('_',' ',$this->mTitle->getTalkNsText()) : ''; |
| 2490 | + break; |
2455 | 2491 | case 'talkspacee': |
2456 | | - return $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : ''; |
| 2492 | + $value = $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : ''; |
| 2493 | + break; |
2457 | 2494 | case 'subjectspace': |
2458 | | - return $this->mTitle->getSubjectNsText(); |
| 2495 | + $value = $this->mTitle->getSubjectNsText(); |
| 2496 | + break; |
2459 | 2497 | case 'subjectspacee': |
2460 | | - return( wfUrlencode( $this->mTitle->getSubjectNsText() ) ); |
| 2498 | + $value = ( wfUrlencode( $this->mTitle->getSubjectNsText() ) ); |
| 2499 | + break; |
2461 | 2500 | case 'currentdayname': |
2462 | | - return $this->mVarCache[$index] = $wgContLang->getWeekdayName( gmdate( 'w', $ts ) + 1 ); |
| 2501 | + $value = $wgContLang->getWeekdayName( gmdate( 'w', $ts ) + 1 ); |
| 2502 | + break; |
2463 | 2503 | case 'currentyear': |
2464 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'Y', $ts ), true ); |
| 2504 | + $value = $wgContLang->formatNum( gmdate( 'Y', $ts ), true ); |
| 2505 | + break; |
2465 | 2506 | case 'currenttime': |
2466 | | - return $this->mVarCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ), false, false ); |
| 2507 | + $value = $wgContLang->time( wfTimestamp( TS_MW, $ts ), false, false ); |
| 2508 | + break; |
2467 | 2509 | case 'currenthour': |
2468 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'H', $ts ), true ); |
| 2510 | + $value = $wgContLang->formatNum( gmdate( 'H', $ts ), true ); |
| 2511 | + break; |
2469 | 2512 | case 'currentweek': |
2470 | 2513 | // @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to |
2471 | 2514 | // int to remove the padding |
2472 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( (int)gmdate( 'W', $ts ) ); |
| 2515 | + $value = $wgContLang->formatNum( (int)gmdate( 'W', $ts ) ); |
| 2516 | + break; |
2473 | 2517 | case 'currentdow': |
2474 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'w', $ts ) ); |
| 2518 | + $value = $wgContLang->formatNum( gmdate( 'w', $ts ) ); |
| 2519 | + break; |
2475 | 2520 | case 'localdayname': |
2476 | | - return $this->mVarCache[$index] = $wgContLang->getWeekdayName( $localDayOfWeek + 1 ); |
| 2521 | + $value = $wgContLang->getWeekdayName( $localDayOfWeek + 1 ); |
| 2522 | + break; |
2477 | 2523 | case 'localyear': |
2478 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localYear, true ); |
| 2524 | + $value = $wgContLang->formatNum( $localYear, true ); |
| 2525 | + break; |
2479 | 2526 | case 'localtime': |
2480 | | - return $this->mVarCache[$index] = $wgContLang->time( $localTimestamp, false, false ); |
| 2527 | + $value = $wgContLang->time( $localTimestamp, false, false ); |
| 2528 | + break; |
2481 | 2529 | case 'localhour': |
2482 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localHour, true ); |
| 2530 | + $value = $wgContLang->formatNum( $localHour, true ); |
| 2531 | + break; |
2483 | 2532 | case 'localweek': |
2484 | 2533 | // @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to |
2485 | 2534 | // int to remove the padding |
2486 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( (int)$localWeek ); |
| 2535 | + $value = $wgContLang->formatNum( (int)$localWeek ); |
| 2536 | + break; |
2487 | 2537 | case 'localdow': |
2488 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( $localDayOfWeek ); |
| 2538 | + $value = $wgContLang->formatNum( $localDayOfWeek ); |
| 2539 | + break; |
2489 | 2540 | case 'numberofarticles': |
2490 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::articles() ); |
| 2541 | + $value = $wgContLang->formatNum( SiteStats::articles() ); |
| 2542 | + break; |
2491 | 2543 | case 'numberoffiles': |
2492 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::images() ); |
| 2544 | + $value = $wgContLang->formatNum( SiteStats::images() ); |
| 2545 | + break; |
2493 | 2546 | case 'numberofusers': |
2494 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::users() ); |
| 2547 | + $value = $wgContLang->formatNum( SiteStats::users() ); |
| 2548 | + break; |
2495 | 2549 | case 'numberofactiveusers': |
2496 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::activeUsers() ); |
| 2550 | + $value = $wgContLang->formatNum( SiteStats::activeUsers() ); |
| 2551 | + break; |
2497 | 2552 | case 'numberofpages': |
2498 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::pages() ); |
| 2553 | + $value = $wgContLang->formatNum( SiteStats::pages() ); |
| 2554 | + break; |
2499 | 2555 | case 'numberofadmins': |
2500 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::numberingroup('sysop') ); |
| 2556 | + $value = $wgContLang->formatNum( SiteStats::numberingroup('sysop') ); |
| 2557 | + break; |
2501 | 2558 | case 'numberofedits': |
2502 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::edits() ); |
| 2559 | + $value = $wgContLang->formatNum( SiteStats::edits() ); |
| 2560 | + break; |
2503 | 2561 | case 'numberofviews': |
2504 | | - return $this->mVarCache[$index] = $wgContLang->formatNum( SiteStats::views() ); |
| 2562 | + $value = $wgContLang->formatNum( SiteStats::views() ); |
| 2563 | + break; |
2505 | 2564 | case 'currenttimestamp': |
2506 | | - return $this->mVarCache[$index] = wfTimestamp( TS_MW, $ts ); |
| 2565 | + $value = wfTimestamp( TS_MW, $ts ); |
| 2566 | + break; |
2507 | 2567 | case 'localtimestamp': |
2508 | | - return $this->mVarCache[$index] = $localTimestamp; |
| 2568 | + $value = $localTimestamp; |
| 2569 | + break; |
2509 | 2570 | case 'currentversion': |
2510 | | - return $this->mVarCache[$index] = SpecialVersion::getVersion(); |
| 2571 | + $value = SpecialVersion::getVersion(); |
| 2572 | + break; |
2511 | 2573 | case 'sitename': |
2512 | 2574 | return $wgSitename; |
2513 | 2575 | case 'server': |
— | — | @@ -2515,8 +2577,6 @@ |
2516 | 2578 | return $wgServerName; |
2517 | 2579 | case 'scriptpath': |
2518 | 2580 | return $wgScriptPath; |
2519 | | - case 'stylepath': |
2520 | | - return $wgStylePath; |
2521 | 2581 | case 'directionmark': |
2522 | 2582 | return $wgContLang->getDirMark(); |
2523 | 2583 | case 'contentlanguage': |
— | — | @@ -2529,6 +2589,11 @@ |
2530 | 2590 | else |
2531 | 2591 | return null; |
2532 | 2592 | } |
| 2593 | + |
| 2594 | + if ( $index ) |
| 2595 | + $this->mVarCache[$index] = $value; |
| 2596 | + |
| 2597 | + return $value; |
2533 | 2598 | } |
2534 | 2599 | |
2535 | 2600 | /** |