SiteMods:Variables:Yesterday
From my brain
Contents |
Overview
In order to use this software as a blogspace, I really wanted to include a "Today" and "Yesterday" link on the sidebar. The Today link was easy enough to add:
{{CURRENTMONTHNAME}}_{{CURRENTDAY}}|Today
Worked easily enough. However, "Yesterday" posed more problems because of moving from "beginings" whether they be the begining of the week, month, or year.
So, I started wandering around and figured out how the various variables worked. Pretzled my brain, but I finally found all of the places where the mod needs to be applied. Now, all I need to add to the sidebar is:
{{YESTERDAYMONTHNAME}}_{{YESTERDAYDAY}}|Yesterday
If you want to make the change to your Wiki to use a "Yesterday" date functions, simply find each of the following php scripts in your files and splice in the folowing lines. Each subheading corresponds to a search text you can use to find out where things need splice in.
Parser.php
switch ( $index ) {
case MAG_YESTERDAYMONTHNAME: return $varCache[$index] = $wgContLang->getMonthName( date( 'n', $ts - 86400 ) ); case MAG_YESTERDAYMONTHNAMEGEN: return $varCache[$index] = $wgContLang->getMonthNameGen( date( 'n', $ts - 86400 ) ); case MAG_YESTERDAYMONTHABBREV: return $varCache[$index] = $wgContLang->getMonthAbbreviation( date( 'n', $ts - 86400 ) ); case MAG_YESTERDAYDAY: return $varCache[$index] = $wgContLang->formatNum( date( 'j', $ts - 86400 ) ); case MAG_YESTERDAYDAY2: return $varCache[$index] = $wgContLang->formatNum( date( 'd', $ts - 86400 ) ); case MAG_YESTERDAYDAYNAME: return $varCache[$index] = $wgContLang->getWeekdayName( date( 'w', $ts - 86400 ) + 1 ); case MAG_YESTERDAYYEAR: return $varCache[$index] = $wgContLang->formatNum( date( 'Y', $ts - 86400 ), true ); case MAG_YESTERDAYWEEK: return $varCache[$index] = $wgContLang->formatNum( (int)date( 'W', $ts ) ); case MAG_YESTERDAYDOW: return $varCache[$index] = $wgContLang->formatNum( date( 'w', $ts ) );
Language.php
$wgMagicWordsEn (an array)
MAG_YESTERDAYMONTH => array( 1, 'YESTERDAYMONTH' ), MAG_YESTERDAYMONTHNAME => array( 1, 'YESTERDAYMONTHNAME' ), MAG_YESTERDAYMONTHNAMEGEN => array( 1, 'YESTERDAYMONTHNAMEGEN' ), MAG_YESTERDAYMONTHABBREV => array( 1, 'YESTERDAYMONTHABBREV' ), MAG_YESTERDAYDAY => array( 1, 'YESTERDAYDAY' ), MAG_YESTERDAYDAY2 => array( 1, 'YESTERDAYDAY2' ), MAG_YESTERDAYDAYNAME => array( 1, 'YESTERDAYDAYNAME' ), MAG_YESTERDAYYEAR => array( 1, 'YESTERDAYYEAR' ), MAG_YESTERDAYTIME => array( 1, 'YESTERDAYTIME' ), MAG_YESTERDAYWEEK => array( 1, 'YESTERDAYWEEK' ), MAG_YESTERDAYDOW => array( 1, 'YESTERDAYDOW' ),
MagicWord.php
$magicWords (an array)
'MAG_YESTERDAYMONTH', 'MAG_YESTERDAYMONTHNAME', 'MAG_YESTERDAYMONTHNAMEGEN', 'MAG_YESTERDAYMONTHABBREV', 'MAG_YESTERDAYDAY', 'MAG_YESTERDAYDAY2', 'MAG_YESTERDAYDAYNAME', 'MAG_YESTERDAYYEAR', 'MAG_YESTERDAYWEEK', 'MAG_YESTERDAYDOW',
$wgVariableIDs (an array)
MAG_YESTERDAYMONTH, MAG_YESTERDAYMONTHNAME, MAG_YESTERDAYMONTHNAMEGEN, MAG_YESTERDAYMONTHABBREV, MAG_YESTERDAYDAY, MAG_YESTERDAYDAY2, MAG_YESTERDAYDAYNAME, MAG_YESTERDAYYEAR, MAG_YESTERDAYWEEK, MAG_YESTERDAYDOW,
