Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3076
dCPF
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:21 PM
2014-11-21 21:21:09 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
dCPF
View Options
--- 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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2646
Default Alt Text
dCPF (2 KB)
Attached To
Mode
T8693: time math, anotherDay, anotherMonth, anotherYear
Attached
Detach File
Event Timeline
Log In to Comment