* (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the month...
authorShinjiman <shinjiman@users.mediawiki.org>
Wed, 20 May 2009 07:14:03 +0000 (07:14 +0000)
committerShinjiman <shinjiman@users.mediawiki.org>
Wed, 20 May 2009 07:14:03 +0000 (07:14 +0000)
* added {{CURRENTMONTH2}} and {{LOCALMONTH2}} as alias of {{CURRENTMONTH}} and {{LOCALMONTH}} for consistency with other magic words

RELEASE-NOTES
includes/MagicWord.php
includes/parser/Parser.php
languages/messages/MessagesEn.php

index 255cf53..fd102bf 100644 (file)
@@ -63,6 +63,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Database: unionQueries function to be used for UNION sql construction, so 
   it can be overloaded on DB abstraction level for DB specific functionality
 * (bug 18849) Implement Japanese and North Korean calendars
+* (bug 5755) Introduce {{CURRENTMONTH1}} and {{LOCALMONTH1}} to display the
+  month number without the leading zero
 
 === Bug fixes in 1.16 ===
 
index 8fdfddc..b69d57e 100644 (file)
@@ -36,6 +36,7 @@ class MagicWord {
        static public $mVariableIDsInitialised = false;
        static public $mVariableIDs = array(
                'currentmonth',
+               'currentmonth1',
                'currentmonthname',
                'currentmonthnamegen',
                'currentmonthabbrev',
@@ -46,6 +47,7 @@ class MagicWord {
                'currenttime',
                'currenthour',
                'localmonth',
+               'localmonth1',
                'localmonthname',
                'localmonthnamegen',
                'localmonthabbrev',
@@ -106,6 +108,7 @@ class MagicWord {
        /* Array of caching hints for ParserCache */
        static public $mCacheTTLs = array (
                'currentmonth' => 86400,
+               'currentmonth1' => 86400,
                'currentmonthname' => 86400,
                'currentmonthnamegen' => 86400,
                'currentmonthabbrev' => 86400,
@@ -116,6 +119,7 @@ class MagicWord {
                'currenttime' => 3600,
                'currenthour' => 3600,
                'localmonth' => 86400,
+               'localmonth1' => 86400,
                'localmonthname' => 86400,
                'localmonthnamegen' => 86400,
                'localmonthabbrev' => 86400,
index 782d001..f17cf0a 100644 (file)
@@ -2341,6 +2341,7 @@ class Parser
                wfSuppressWarnings(); // E_STRICT system time bitching
                $localTimestamp = date( 'YmdHis', $ts );
                $localMonth = date( 'm', $ts );
+               $localMonth1 = date( 'n', $ts );
                $localMonthName = date( 'n', $ts );
                $localDay = date( 'j', $ts );
                $localDay2 = date( 'd', $ts );
@@ -2356,6 +2357,8 @@ class Parser
                switch ( $index ) {
                        case 'currentmonth':
                                return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'm', $ts ) );
+                       case 'currentmonth1':
+                               return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'n', $ts ) );
                        case 'currentmonthname':
                                return $this->mVarCache[$index] = $wgContLang->getMonthName( gmdate( 'n', $ts ) );
                        case 'currentmonthnamegen':
@@ -2368,6 +2371,8 @@ class Parser
                                return $this->mVarCache[$index] = $wgContLang->formatNum( gmdate( 'd', $ts ) );
                        case 'localmonth':
                                return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth );
+                       case 'localmonth1':
+                               return $this->mVarCache[$index] = $wgContLang->formatNum( $localMonth1 );
                        case 'localmonthname':
                                return $this->mVarCache[$index] = $wgContLang->getMonthName( $localMonthName );
                        case 'localmonthnamegen':
index 1bfa970..32913cf 100644 (file)
@@ -210,7 +210,8 @@ $magicWords = array(
        'toc'                    => array( 0,    '__TOC__'                ),
        'noeditsection'          => array( 0,    '__NOEDITSECTION__'      ),
        'noheader'               => array( 0,    '__NOHEADER__'           ),
-       'currentmonth'           => array( 1,    'CURRENTMONTH'           ),
+       'currentmonth'           => array( 1,    'CURRENTMONTH', 'CURRENTMONTH2' ),
+       'currentmonth1'          => array( 1,    'CURRENTMONTH1'          ),
        'currentmonthname'       => array( 1,    'CURRENTMONTHNAME'       ),
        'currentmonthnamegen'    => array( 1,    'CURRENTMONTHNAMEGEN'    ),
        'currentmonthabbrev'     => array( 1,    'CURRENTMONTHABBREV'     ),
@@ -220,7 +221,8 @@ $magicWords = array(
        'currentyear'            => array( 1,    'CURRENTYEAR'            ),
        'currenttime'            => array( 1,    'CURRENTTIME'            ),
        'currenthour'            => array( 1,    'CURRENTHOUR'            ),
-       'localmonth'             => array( 1,    'LOCALMONTH'             ),
+       'localmonth'             => array( 1,    'LOCALMONTH', 'LOCALMONTH2' ),
+       'localmonth1'            => array( 1,    'LOCALMONTH1'             ),
        'localmonthname'         => array( 1,    'LOCALMONTHNAME'         ),
        'localmonthnamegen'      => array( 1,    'LOCALMONTHNAMEGEN'      ),
        'localmonthabbrev'       => array( 1,    'LOCALMONTHABBREV'       ),