From 704b442a8292d61a89edf50fd014f25b6a73d13e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 3 Apr 2005 16:43:43 +0000 Subject: [PATCH] * Unicode instead of entities on the next/previous diff thingy * The code now doesn't brainfart if MW_DATE_USER_FORMAT is false * getMonthName not getMonthAbbreviation (now works as advertised) --- languages/Language.php | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/languages/Language.php b/languages/Language.php index 1f3528d6e5..41c75b5617 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1769,8 +1769,8 @@ ta[\'ca-nstab-category\'] = new Array(\'c\',\'View the category page\'); 'deletedrevision' => 'Deleted old revision $1.', # browsing diffs -'previousdiff' => '← Go to previous diff', -'nextdiff' => 'Go to next diff →', +'previousdiff' => '← Previous diff', +'nextdiff' => 'Next diff →', 'imagemaxsize' => 'Limit images on image description pages to: ', 'showbigimage' => 'Download high resolution version ($1x$2, $3 KB)', @@ -2016,23 +2016,23 @@ class Language { function date( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) { global $wgAmericanDates, $wgUser; - $ts=wfTimestamp(TS_MW,$ts); + $ts=wfTimestamp(TS_MW,$ts); // FIXME: Is this even needed anymore? if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } - - if ( $format == MW_DATE_USER_FORMAT ) { + // It's probably best to turn this whole mess into a function -ævar + if ( $format ) { $datePreference = $wgUser->getOption( 'date' ); } else { $options = $this->getDefaultUserOptions(); $datePreference = $options['date']; } - if ($datePreference == '0') { + if ($datePreference == '0') { // Not == 0 for the obvious reasons $datePreference = $wgAmericanDates ? 1 : 2; } - $month = $this->getMonthAbbreviation( substr( $ts, 4, 2 ) ); + $month = $this->getMonthName( substr( $ts, 4, 2 ) ); $day = $this->formatNum( 0 + substr( $ts, 6, 2 ) ); $year = $this->formatNum( substr( $ts, 0, 4 ) ); @@ -2043,15 +2043,22 @@ class Language { default: return "$month $day, $year"; } } - - function time( $ts, $adj = false, $seconds = false, $timecorrection = false ) { + + function time( $ts, $adj = false, $format = MW_DATE_USER_FORMAT, $timecorrection = false ) { global $wgUser; $ts=wfTimestamp(TS_MW,$ts); if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); } + if ( $format ) { + $datePreference = $wgUser->getOption( 'date' ); + } else { + $options = $this->getDefaultUserOptions(); + $datePreference = $options['date']; + } if ($datePreference == '0') {$datePreference = $wgAmericanDates ? 1 : 2;} + $t = substr( $ts, 8, 2 ) . ':' . substr( $ts, 10, 2 ); - if ( $seconds || $wgUser->getOption( 'date' ) == 'ISO 8601' ) { + if ( $seconds || $format == 'ISO 8601' ) { $t .= ':' . substr( $ts, 12, 2 ); } return $this->formatNum( $t ); @@ -2061,10 +2068,17 @@ class Language { global $wgUser; $ts=wfTimestamp(TS_MW,$ts); - switch ( $wgUser->getOption( 'date' ) ) { + if ( $format ) { + $datePreference = $wgUser->getOption( 'date' ); + } else { + $options = $this->getDefaultUserOptions(); + $datePreference = $options['date']; + } if ($datePreference == '0') {$datePreference = $wgAmericanDates ? 1 : 2;} + + switch ( $datePreference ) { case 'ISO 8601': return $this->date( $ts, $adj, $format, $timecorrection ) . ' ' . - $this->time( $ts, $adj, false, $timecorrection ); - default: return $this->time( $ts, $adj, false, $timecorrection ) . ', ' . + $this->time( $ts, $adj, $format, $timecorrection ); + default: return $this->time( $ts, $adj, $format, $timecorrection ) . ', ' . $this->date( $ts, $adj, $format, $timecorrection ); } } -- 2.20.1