From cf58e51e100a5ab41c42b8b694ec46dad2deefab Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Sun, 6 Jul 2003 02:48:06 +0000 Subject: [PATCH] Much improved ability to disable dynamic dates in LocalSettings --- LocalSettings.sample | 2 ++ includes/OutputPage.php | 6 ++++-- includes/SpecialPreferences.php | 31 +++++++++++++++++++------------ languages/Language.php | 19 ++++++++++++++----- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/LocalSettings.sample b/LocalSettings.sample index 0bafdf70e5..3a35391bab 100644 --- a/LocalSettings.sample +++ b/LocalSettings.sample @@ -47,6 +47,8 @@ $wgDBtransactions = false; # Set to true if using InnoDB tables # $wgLanguageCode = "de"; $wgUseTeX = false; +$wgUseDynamicDates = true; + $wgLocalInterwiki = "w"; $wgInputEncoding = "ISO-8859-1"; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index b026906de6..17586b07f6 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -658,7 +658,7 @@ class OutputPage { # function doWikiPass2( $text, $linestart ) { - global $wgUser, $wgLang, $wgMungeDates; + global $wgUser, $wgLang, $wgUseDynamicDates; wfProfileIn( "OutputPage::doWikiPass2" ); $text = $this->removeHTMLtags( $text ); @@ -671,8 +671,10 @@ class OutputPage { $text = $this->doHeadings( $text ); $text = $this->doBlockLevels( $text, $linestart ); - if($wgMungeDates) + if($wgUseDynamicDates) { $text = $wgLang->replaceDates( $text ); + } + $text = $this->replaceExternalLinks( $text ); $text = $this->replaceInternalLinks ( $text ); diff --git a/includes/SpecialPreferences.php b/includes/SpecialPreferences.php index edb705c578..0712d5a142 100644 --- a/includes/SpecialPreferences.php +++ b/includes/SpecialPreferences.php @@ -1,7 +1,7 @@ {$skins[$i]}
\n" ); # Various checkbox options # - $wgOut->addHTML( "\n" ); + if ( $wgUseDynamicDates ) { + $wgOut->addHTML( "\n" ); + } else { + $wgOut->addHTML( "\n" ); + } foreach ( $togs as $tname => $ttext ) { if ( 1 == $wgUser->getOption( $tname ) ) { $checked = " checked"; @@ -312,16 +316,19 @@ value=\"$i\"$checked> {$mathopts[$i]}
\n" ); # Date format # - $wgOut->addHTML( "$dateFormat:
" ); - for ( $i = 0; $i < count( $dateopts ); ++$i) { - if ( $i == $wpDate ) { - $checked = " checked"; - } else { - $checked = ""; + if ( $wgUseDynamicDates ) { + $wgOut->addHTML( "$dateFormat:
" ); + for ( $i = 0; $i < count( $dateopts ); ++$i) { + if ( $i == $wpDate ) { + $checked = " checked"; + } else { + $checked = ""; + } + $wgOut->addHTML( "
\n" ); } - $wgOut->addHTML( "
\n" ); + $wgOut->addHTML( ""); } - $wgOut->addHTML( ""); # Textbox rows, cols # $nowlocal = $wgLang->time( $now = wfTimestampNow(), true ); diff --git a/languages/Language.php b/languages/Language.php index 355adcb3be..ec946a75a9 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1222,12 +1222,16 @@ class Language { function date( $ts, $adj = false ) { - global $wgAmericanDates, $wgUser; + global $wgAmericanDates, $wgUser, $wgUseDynamicDates; if ( $adj ) { $ts = $this->userAdjust( $ts ); } - - $datePreference = $wgUser->getOption( 'date' ); - if ( $datePreference == 0 ) { + + if ( $wgUseDynamicDates ) { + $datePreference = $wgUser->getOption( 'date' ); + if ( $datePreference == 0 ) { + $datePreference = $wgAmericanDates ? 1 : 2; + } + } else { $datePreference = $wgAmericanDates ? 1 : 2; } @@ -1371,8 +1375,13 @@ class Language { function replaceDates( $text ) { - global $wgUser, $wgInputEncoding; + global $wgUser, $wgInputEncoding, $wgUseDynamicDates; + # Feature can be disabled + if ( !$wgUseDynamicDates ) { + return; + } + # Setup $datePreference = $wgUser->getOption( 'date' ); -- 2.20.1