diff options
Diffstat (limited to 'extensions/ParserFunctions/ParserFunctions_body.php')
-rw-r--r-- | extensions/ParserFunctions/ParserFunctions_body.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/extensions/ParserFunctions/ParserFunctions_body.php b/extensions/ParserFunctions/ParserFunctions_body.php index 879b7a15..3567cc58 100644 --- a/extensions/ParserFunctions/ParserFunctions_body.php +++ b/extensions/ParserFunctions/ParserFunctions_body.php @@ -360,9 +360,6 @@ class ExtParserFunctions { return $else; } else { $pdbk = $title->getPrefixedDBkey(); - if ( !$parser->incrementExpensiveFunctionCount() ) { - return $else; - } $lc = LinkCache::singleton(); $id = $lc->getGoodLinkID( $pdbk ); if ( $id != 0 ) { @@ -372,6 +369,9 @@ class ExtParserFunctions { $parser->mOutput->addLink( $title, 0 ); return $else; } + if ( !$parser->incrementExpensiveFunctionCount() ) { + return $else; + } $id = $title->getArticleID(); $parser->mOutput->addLink( $title, $id ); if ( $id ) { @@ -452,10 +452,10 @@ class ExtParserFunctions { } else { $tz = new DateTimeZone( date_default_timezone_get() ); } - $dateObject->setTimezone( $tz ); } else { - $dateObject->setTimezone( $utc ); + $tz = $utc; } + $dateObject->setTimezone( $tz ); # Generate timestamp $ts = $dateObject->format( 'YmdHis' ); @@ -471,14 +471,16 @@ class ExtParserFunctions { if ( self::$mTimeChars > self::$mMaxTimeChars ) { return '<strong class="error">' . wfMessage( 'pfunc_time_too_long' )->inContentLanguage()->escaped() . '</strong>'; } else { - if ( $ts < 100000000000000 ) { // Language can't deal with years after 9999 + if ( $ts < 0 ) { // Language can't deal with BC years + return '<strong class="error">' . wfMessage( 'pfunc_time_too_small' )->inContentLanguage()->escaped() . '</strong>'; + } elseif ( $ts < 100000000000000 ) { // Language can't deal with years after 9999 if ( $language !== '' && Language::isValidBuiltInCode( $language ) ) { // use whatever language is passed as a parameter $langObject = Language::factory( $language ); - $result = $langObject->sprintfDate( $format, $ts ); + $result = $langObject->sprintfDate( $format, $ts, $tz ); } else { // use wiki's content language - $result = $parser->getFunctionLang()->sprintfDate( $format, $ts ); + $result = $parser->getFunctionLang()->sprintfDate( $format, $ts, $tz ); } } else { return '<strong class="error">' . wfMessage( 'pfunc_time_too_big' )->inContentLanguage()->escaped() . '</strong>'; |