Page MenuHomePhabricator
Authored By
bzimport
Nov 21 2014, 9:21 PM
Size
2 KB
Referenced Files
None
Subscribers
None
--- CoreParserFunctions.php Sat Jul 15 04:17:34 2006
+++ xCoreParserFunctions.php Mon Jul 17 16:28:06 2006
@@ -145,6 +145,62 @@
$lang = $wgContLang->getLanguageName( strtolower( $arg ) );
return $lang != '' ? $lang : $arg;
}
+
+ // parallel functions with CURRENT... that handle a time offset
+ // user input valid range of 5 years
+ function limitedTimeOffset( $parser, $num ) {
+ $offset = intval($num);
+ if ( abs($offset) > 158112000 ) { # 3600*24*366 *5 leap years
+ $offset = 0;
+ }
+ return $parser->getRunTime() + $offset;
+ }
+
+ function anotherDay( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->formatNum( date( 'j', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherDay2( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->formatNum( date( 'd', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherDayOfWeek( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->formatNum( date( 'w', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherDayName( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->getWeekdayName( date( 'w', 1 + limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherMonth( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->formatNum( date( 'm', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherMonthName( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->getMonthName( date( 'n', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherMonthGenitive( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->getMonthNameGen( date( 'n', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherMonthAbbreviation( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->getMonthAbbreviation( date( 'n', limitedTimeOffset( $parser, $num ) ) );
+ }
+
+ function anotherYear( $parser, $num = '' ) {
+ global $wgContLang;
+ return $wgContLang->formatNum( date( 'Y', limitedTimeOffset( $parser, $num ) ), true );
+ }
+
}
?>

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2646
Default Alt Text
dCPF (2 KB)

Event Timeline