From b04b29509d2718a0c8f854d44cec5be3129a240f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 24 Mar 2005 03:00:06 +0000 Subject: [PATCH] * (bug 1662) Implemented a new magic word, {{CURRENTMONTHABBREV}} which returns the abbreviation of the current month, cleaned up the sourcecode while I was at it to always display CURRENTMONTH, CURRENTMONTHNAME, CURRENTMONTHNAMEGEN and CURRENTMONTHABBREV in that order that's mnemonics for you. --- includes/MagicWord.php | 72 ++++++++++++++++++++++-------------------- includes/Parser.php | 2 ++ languages/Language.php | 3 +- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 143666a907..bb4cf497c4 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -15,50 +15,52 @@ define('MAG_NOTOC', 1); define('MAG_START', 2); define('MAG_CURRENTMONTH', 3); define('MAG_CURRENTMONTHNAME', 4); -define('MAG_CURRENTDAY', 5); -define('MAG_CURRENTDAYNAME', 6); -define('MAG_CURRENTYEAR', 7); -define('MAG_CURRENTTIME', 8); -define('MAG_NUMBEROFARTICLES', 9); -define('MAG_CURRENTMONTHNAMEGEN', 10); -define('MAG_MSG', 11); -define('MAG_SUBST', 12); -define('MAG_MSGNW', 13); -define('MAG_NOEDITSECTION', 14); -define('MAG_END', 15); -define('MAG_IMG_THUMBNAIL', 16); -define('MAG_IMG_RIGHT', 17); -define('MAG_IMG_LEFT', 18); -define('MAG_IMG_NONE', 19); -define('MAG_IMG_WIDTH', 20); -define('MAG_IMG_CENTER', 21); -define('MAG_INT', 22); -define('MAG_FORCETOC', 23); -define('MAG_SITENAME', 24); -define('MAG_NS', 25); -define('MAG_LOCALURL', 26); -define('MAG_LOCALURLE', 27); -define('MAG_SERVER', 28); -define('MAG_IMG_FRAMED', 29); -define('MAG_PAGENAME', 30); -define('MAG_PAGENAMEE', 31); -define('MAG_NAMESPACE', 32); -define('MAG_TOC', 33); -define('MAG_GRAMMAR', 34); -define('MAG_NOTITLECONVERT', 35); -define('MAG_NOCONTENTCONVERT', 36); -define('MAG_CURRENTWEEK', 37); -define('MAG_CURRENTDOW', 38); +define('MAG_CURRENTMONTHNAMEGEN', 5); +define('MAG_CURRENTMONTHABBREV', 6); +define('MAG_CURRENTDAY', 7); +define('MAG_CURRENTDAYNAME', 8); +define('MAG_CURRENTYEAR', 9); +define('MAG_CURRENTTIME', 10); +define('MAG_NUMBEROFARTICLES', 11); +define('MAG_MSG', 12); +define('MAG_SUBST', 13); +define('MAG_MSGNW', 14); +define('MAG_NOEDITSECTION', 15); +define('MAG_END', 16); +define('MAG_IMG_THUMBNAIL', 17); +define('MAG_IMG_RIGHT', 18); +define('MAG_IMG_LEFT', 19); +define('MAG_IMG_NONE', 20); +define('MAG_IMG_WIDTH', 21); +define('MAG_IMG_CENTER', 22); +define('MAG_INT', 23); +define('MAG_FORCETOC', 24); +define('MAG_SITENAME', 25); +define('MAG_NS', 26); +define('MAG_LOCALURL', 27); +define('MAG_LOCALURLE', 28); +define('MAG_SERVER', 29); +define('MAG_IMG_FRAMED', 30); +define('MAG_PAGENAME', 31); +define('MAG_PAGENAMEE', 32); +define('MAG_NAMESPACE', 33); +define('MAG_TOC', 34); +define('MAG_GRAMMAR', 35); +define('MAG_NOTITLECONVERT', 36); +define('MAG_NOCONTENTCONVERT', 37); +define('MAG_CURRENTWEEK', 38); +define('MAG_CURRENTDOW', 39); $wgVariableIDs = array( MAG_CURRENTMONTH, MAG_CURRENTMONTHNAME, + MAG_CURRENTMONTHNAMEGEN, + MAG_CURRENTMONTHABBREV, MAG_CURRENTDAY, MAG_CURRENTDAYNAME, MAG_CURRENTYEAR, MAG_CURRENTTIME, MAG_NUMBEROFARTICLES, - MAG_CURRENTMONTHNAMEGEN, MAG_SITENAME, MAG_SERVER, MAG_PAGENAME, diff --git a/includes/Parser.php b/includes/Parser.php index 596d20b61b..91c97a8967 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1712,6 +1712,8 @@ class Parser return $varCache[$index] = $wgContLang->getMonthName( date('n') ); case MAG_CURRENTMONTHNAMEGEN: return $varCache[$index] = $wgContLang->getMonthNameGen( date('n') ); + case MAG_CURRENTMONTHABBREV: + return $varCache[$index] = $wgContLang->getMonthAbbreviation( date('n') ); case MAG_CURRENTDAY: return $varCache[$index] = $wgContLang->formatNum( date('j') ); case MAG_PAGENAME: diff --git a/languages/Language.php b/languages/Language.php index c7c37f2d11..400611d2eb 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -209,12 +209,13 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_START => array( 0, '__START__' ), MAG_CURRENTMONTH => array( 1, 'CURRENTMONTH' ), MAG_CURRENTMONTHNAME => array( 1, 'CURRENTMONTHNAME' ), + MAG_CURRENTMONTHNAMEGEN => array( 1, 'CURRENTMONTHNAMEGEN' ), + MAG_CURRENTMONTHABBREV => array( 1, 'CURRENTMONTHABBREV' ), MAG_CURRENTDAY => array( 1, 'CURRENTDAY' ), MAG_CURRENTDAYNAME => array( 1, 'CURRENTDAYNAME' ), MAG_CURRENTYEAR => array( 1, 'CURRENTYEAR' ), MAG_CURRENTTIME => array( 1, 'CURRENTTIME' ), MAG_NUMBEROFARTICLES => array( 1, 'NUMBEROFARTICLES' ), - MAG_CURRENTMONTHNAMEGEN => array( 1, 'CURRENTMONTHNAMEGEN' ), MAG_PAGENAME => array( 1, 'PAGENAME' ), MAG_PAGENAMEE => array( 1, 'PAGENAMEE' ), MAG_NAMESPACE => array( 1, 'NAMESPACE' ), -- 2.20.1