}
function execute() {
- global $wgUser, $wgOut, $wgUseDynamicDates;
+ global $wgUser, $wgOut;
if ( $wgUser->isAnon() ) {
$wgOut->errorpage( 'prefsnologin', 'prefsnologintext' );
* @access private
*/
function mainPrefsForm( $err ) {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgUseDynamicDates, $wgValidSkinNames;
+ global $wgUser, $wgOut, $wgLang, $wgContLang, $wgValidSkinNames;
global $wgAllowRealName, $wgImageLimits;
global $wgLanguageNames, $wgDisableLangConversion;
global $wgEmailNotificationForWatchlistPages, $wgEmailNotificationForUserTalkPages,$wgEmailNotificationForMinorEdits;
# Date format
#
- if ( $wgUseDynamicDates ) {
+
+ if ($dateopts) {
$wgOut->addHTML( "<fieldset>\n<legend>$dateFormat</legend>\n" );
- for ( $i = 0; $i < count( $dateopts ); ++$i) {
- if ( $i == $this->mDate ) {
- $checked = ' checked="checked"';
- } else {
- $checked = "";
- }
+ foreach($dateopts as $key => $option) {
+ ($key == $this->mDate) ? $checked = ' checked="checked"' : $checked = '';
$wgOut->addHTML( "<div><label><input type='radio' name=\"wpDate\" ".
- "value=\"$i\"$checked /> {$dateopts[$i]}</label></div>\n" );
+ "value=\"$key\"$checked />$option</label></div>\n" );
}
$wgOut->addHTML( "</fieldset>\n\n");
}
define( 'MW_DATE_USER_FORMAT', true );
/* private */ $wgDateFormatsEn = array(
- 'No preference',
- 'January 15, 2001',
- '15 January 2001',
- '2001 January 15',
- '2001-01-15'
+ 'Default',
+ '16:12, January 15, 2001',
+ '16:12, 15 January 2001',
+ '16:12, 2001 January 15',
+ 'ISO 8601' => '2001-01-15 16:12:34'
);
/* private */ $wgUserTogglesEn = array(
'specialloguserlabel' => 'User: ',
'speciallogtitlelabel' => 'Title: ',
-# labels for Group: and User: ond Special:Listusers
-'speciallistusersuserlabel' => 'User: ',
-'speciallistusersgrouplabel' => 'Group: ',
-
'passwordtooshort' => 'Your password is too short. It must have at least $1 characters.',
# external editor support
}
function date( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) {
- global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
-
+ global $wgAmericanDates, $wgUser;
+
$ts=wfTimestamp(TS_MW,$ts);
if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
- if ( $wgUseDynamicDates ) {
- if ( $format == MW_DATE_USER_FORMAT ) {
- $datePreference = $wgUser->getOption( 'date' );
- } else {
- $options = $this->getDefaultUserOptions();
- $datePreference = $options['date'];
- }
- if ( $datePreference == 0 ) {
- $datePreference = $wgAmericanDates ? 1 : 2;
- }
+
+ if ( $format == MW_DATE_USER_FORMAT ) {
+ $datePreference = $wgUser->getOption( 'date' );
} else {
+ $options = $this->getDefaultUserOptions();
+ $datePreference = $options['date'];
+ }
+
+ if ($datePreference == '0') {
$datePreference = $wgAmericanDates ? 1 : 2;
}
$month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) );
$day = $this->formatNum( 0 + substr( $ts, 6, 2 ) );
$year = $this->formatNum( substr( $ts, 0, 4 ) );
-
+
switch( $datePreference ) {
- case 1: return "$month $day, $year";
- case 2: return "$day $month $year";
- case 4: return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
- default: return "$year $month $day";
+ case '2': return "$day $month $year";
+ case '3': return "$year $month $day";
+ case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
+ default: return "$month $day, $year";
}
}
if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
$t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 );
- if ( $seconds || $wgUser->getOption( 'date' ) == 4) {
+ if ( $seconds || $wgUser->getOption( 'date' ) == 'ISO 8601' ) {
$t .= ':' . substr( $ts, 12, 2 );
}
return $this->formatNum( $t );
function timeanddate( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false, $dateandtime = false) {
global $wgUser;
$ts=wfTimestamp(TS_MW,$ts);
- if ( 4 == $wgUser->getOption( 'date' ) ) {
- return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' .
+
+ switch ( $wgUser->getOption( 'date' ) ) {
+ case 'ISO 8601': return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' .
$this->time( $ts, $adj, false, $timecorrection );
- } else {
- return $this->time( $ts, $adj, false, $timecorrection ) . ', ' .
+ default: return $this->time( $ts, $adj, false, $timecorrection ) . ', ' .
$this->date( $ts, $adj, $format, $timecorrection );
}
}
/* private */ $wgDateFormatsBg = array(
'Без предпочитание',
- 'януари 15, 2001',
- '15 януари 2001',
- '2001 януари 15',
- '2001-01-15'
);
/* private */ $wgDateFormatsBn = array(
"No preference",
- "January 15, 2001",
- "15 January 2001",
- "2001 January 15"
);
/* private */ $wgDateFormatsCa = array(
"No preference",
- "January 15, 2001",
- "15 January 2001",
- "2001 January 15",
- "2001-01-15"
);
/* private */ $wgDateFormatsCy = array(
"Dim dewis",
- "Ionawr 15, 2001",
- "15 Ionawr 2001",
- "2001 Ionawr 15",
- "2001-01-15"
);
/* private */ $wgBookstoreListCy = array(
/* private */ $wgDateFormatsDa = array(
"Ingen foretrukken",
- "januar 15, 2001",
- "15. januar 2001",
- "2001 januar 15",
- "2001-01-15"
);
/* private */ $wgDateFormatsEs = array(
"Sin preferencia",
- "enero 15, 2001",
- "15 de enero de 2001",
- "2001 enero 15"
);
/* Please customize this with some Spanish-language bookshops
/* private */ $wgDateFormatsFo = array(
"Ongi forrættindi",
- "januar 15, 2001",
- "15. januar 2001",
- "2001 januar 15",
- "2001-01-15"
);
/* private */ $wgBookstoreListFo = array(
/* private */ $wgDateFormatsFy = array(
- "Gjin foarkar",
- "jannewaris 8, 2001",
- "8 jannewaris 2001",
- "2001 jannewaris 8"
+ 'Gjin foarkar',
+ '16:12, jan 15, 2001',
+ '16:12, 15 jan 2001',
+ '16:12, 2001 jan 15',
+ 'ISO 8601' => '2001-01-15 16:12:34'
);
/* private */ $wgBookstoreListFy = array(
# Inherit userAdjust()
- function date( $ts, $adj = false )
- {
- global $wgAmericanDates, $wgUser, $wgUseDynamicDates;
+ function date( $ts, $adj = false ) {
+ global $wgUser;
if ( $adj ) { $ts = $this->userAdjust( $ts ); }
- if ( $wgUseDynamicDates ) {
- $datePreference = $wgUser->getOption( 'date' );
- if ( $datePreference == 0 ) {
- $datePreference = $wgAmericanDates ? 1 : 2;
- }
- } else {
- $datePreference = $wgAmericanDates ? 1 : 2;
+ switch ( $wgUser->getOption( 'date' ) ) {
+ # jan 8, 2001
+ case '0': case '1': return $d = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) )
+ . ' ' . (0 + substr( $ts, 6, 2 )) . ', ' . substr( $ts, 0, 4 );
+ # 8 jannewaris 2001
+ case '2': return (0 + substr( $ts, 6, 2 )) . ' ' .
+ $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . ' ' .
+ substr( $ts, 0, 4 );
+ case 'ISO 8601': return substr($ts, 0, 4). '-' . substr($ts, 4, 2). '-' .substr($ts, 6, 2);
+ # 2001 jannewaris 8
+ default: return substr( $ts, 0, 4 ) . ' ' .
+ $this->getMonthAbbreviation( substr( $ts, 4, 2 ) )
+ . ' ' . (0 + substr( $ts, 6, 2 ));
}
+ }
+ function timeanddate( $ts, $adj = false ) {
+ global $wgUser;
- if ( $datePreference == 1 ) {
- # MDY
- $d = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
- " " . (0 + substr( $ts, 6, 2 )) . ", " .
- substr( $ts, 0, 4 );
- } else if ( $datePreference == 2 ) {
- #DMY
- $d = (0 + substr( $ts, 6, 2 )) . " " .
- $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . " " .
- substr( $ts, 0, 4 );
- } else {
- #YMD
- $d = substr( $ts, 0, 4 ) . " " . $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) .
- " " . (0 + substr( $ts, 6, 2 ));
+ switch ( $wgUser->getOption( 'date' ) ) {
+ case 'ISO 8601': return $this->date( $ts, $adj ) . ' ' . $this->time( $ts, $adj );
+ default: return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
}
-
- return $d;
- }
-
- function time( $ts, $adj = false )
- {
- if ( $adj ) { $ts = $this->userAdjust( $ts ); }
-
- $t = substr( $ts, 8, 2 ) . "." . substr( $ts, 10, 2 );
- return $t;
}
-# Inherit timeanddate()
-
-# Inherit rfc1123()
-
function getValidSpecialPages()
{
global $wgValidSpecialPagesFy;
/* private */ $wgDateFormatsGa = array(
"Is cuma liom",
- "Eanáir 15, 2001",
- "15 Eanáir 2001",
- "2001 Eanáir 15",
- "2001-01-15"
);
# If possible, find Irish language book services on the Internet, searchable by ISBN
/* private */ $wgDateFormatsHu = array(
"Mindegy",
- "Július 8, 2003",
- "8 Július, 2003",
- "2003 Július 8"
);
/* private */ $wgDateFormatsId = array(
"Tiada pilihan",
- "Januari 15, 2001",
- "15 Januari 2001",
- "2001 Januari 15",
- "2001-01-15"
);
/* private */ $wgUserTogglesId = array(
switch( $wgUser->getOption( 'date' ) ) {
# 15. jan. 2001 kl. 16:12 || 16:12, 15. jan. 2001
- case 2: case 4: return (0 + substr( $ts, 6, 2 )) . '. ' .
+ case '2': case '4': return (0 + substr( $ts, 6, 2 )) . '. ' .
$this->getMonthAbbreviation( substr( $ts, 4, 2 ) ) . '. ' .
substr($ts, 0, 4);
# 2001-01-15 16:12:34
switch ( $wgUser->getOption( 'date' ) ) {
# 16:12, 15. janúar 2001 || 16:12, 15. jan. 2001
- case 3: case 4: return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
+ case '3': case '4': return $this->time( $ts, $adj ) . ', ' . $this->date( $ts, $adj );
# 2001-01-15 16:12:34
case 'ISO 8601': return $this->date( $ts, $adj ) . ' ' . $this->time( $ts, $adj );
# 15. janúar 2001 kl. 16:12 || 15. jan. 2001 kl. 16:12
/* private */ $wgDateFormatsLt = array(
"Nesvarbu",
- "Sausio 15, 2001",
- "15 Sausio 2001",
- "2001 Sausio 15",
- "2001-01-15"
);
/* private */ $wgWeekdayNamesLt = array(
/* private */ $wgDateFormatsMs = array(
"Tiada pilihan", # "No preference",
- "15 Januari 2001", # "Januari 15, 2001",
- "15 Januari 2001", # "2001 Januari 15"
);
/* private */ $wgDateFormatsNn = array(
'Ingen preferanse',
- 'januar 15, 2001',
- '15 januar 2001',
- '2001 januar 15',
- '2001-01-15'
);
/* private */ $wgBookstoreListNn = array(
/* private */ $wgDateFormatsNv = array(
'No preference',
- 'Yas Niłt\'ees 15, 2001',
- '15 Yas Niłt\'ees 2001',
- '2001 Yas Niłt\'ees 15',
- '2001-01-15'
);
/* private */ $wgUserTogglesNv = array(
/* private */ $wgDateFormatsPt = array(
"Sem preferência",
- "Janeiro 15, 2001",
- "15 Janeiro 2001",
- "2001 Janeiro 15"
);
/* private */ $wgDateFormatsRo = array(
"Nici o preferinţă",
- "Ianuarie 15, 2001",
- "15 Ianuarie 2001",
- "2001 Ianuarie 15"
);
/* private */ $wgBookstoreListRo = array(
/* private */ $wgDateFormatsSl = array(
'No preference',
- 'januar 15, 2001',
- '15 januar 2001',
- '2001 januar 15',
- '2001-01-15'
);
/* private */ $wgDateFormatsSq = array(
"Pa preferencë",
- "Janar 15, 2001",
- "15 Janar 2001",
- "2001 Janar 15"
);
/* private */ $wgDateFormatsSr = array(
"Без посебних жеља",
- "Јануар 15, 2001",
- "15 Јануар 2001",
- "2001 Јануар 15"
);
/* private */ $wgDateFormatsSv = array(
"Ingen inställning",
- "Januari 15, 2001",
- "15 Januari 2001",
- "2001 Januari 15",
- "2001-01-15"
);
/* private */ $wgBookstoreListSv = array(
/* private */ $wgDateFormatsTa = array(
"முன்னுரிமை இல்லை",
- "ஜனவரி 15, 2001",
- "15 ஜனவரி 2001",
- "2001 ஜனவரி 15"
);
/* private */ $wgDateFormatsTh = array(
"No preference",
- "มกราคม 15, 2001",
- "15 มกราคม 2001",
- "2001 มกราคม 15",
- "2001-01-15"
);
/* private */ $wgDateFormatsTt = array(
"köyläwsez",
- "Ğínwar 15, 2001",
- "15. Ğínwar 2001",
- "2001 Ğínwar 15",
- "2001-01-15"
);
/* Non-std date formats are only enabled for English, which is idiosyncratic that way */
/* private */ $wgDateFormatsUk = array(
"Немає значення",
- "Січень 15, 2001",
- "15 січня 2001",
- "2001 січень 15"
);
/* private */ $wgDateFormatsWa = array( /* cwè fé chal ??? */
"Nole preferince",
- "January 15, 2001",
- "15 January 2001",
- "2001 January 15",
- "2001-01-15"
);
/* private */ $wgBookstoreListWa = array(