MediaWiki r1431 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r1430‎ | r1431 (on ViewVC)‎ | r1432 >
Date:02:48, 6 July 2003
Author:timstarling
Status:old
Tags:
Comment:
Much improved ability to disable dynamic dates in LocalSettings
Modified paths:

Diff [purge]

Index: trunk/phase3/LocalSettings.sample
===================================================================
--- trunk/phase3/LocalSettings.sample	(revision 1430)
+++ trunk/phase3/LocalSettings.sample	(revision 1431)
@@ -47,6 +47,8 @@
 # $wgLanguageCode = "de";
 
 $wgUseTeX			= false;
+$wgUseDynamicDates	= true;
+
 $wgLocalInterwiki   = "w";
 
 $wgInputEncoding	= "ISO-8859-1";
Index: trunk/phase3/includes/SpecialPreferences.php
===================================================================
--- trunk/phase3/includes/SpecialPreferences.php	(revision 1430)
+++ trunk/phase3/includes/SpecialPreferences.php	(revision 1431)
@@ -1,7 +1,7 @@
 <?
 function wfSpecialPreferences()
 {
-	global $wgUser, $wgOut, $action;
+	global $wgUser, $wgOut, $wgUseDynamicDates, $action;
 	global $wpSaveprefs, $wpReset;
 
 	$fields = array( "wpOldpass", "wpNewpass", "wpRetype",
@@ -196,7 +196,7 @@
 
 /* private */ function mainPrefsForm( $err )
 {
-	global $wgUser, $wgOut, $wgLang;
+	global $wgUser, $wgOut, $wgLang, $wgUseDynamicDates;
 	global $wpQuickbar, $wpOldpass, $wpNewpass, $wpRetype;
 	global $wpSkin, $wpMath, $wpDate, $wpEmail, $wpEmailFlag, $wpNick, $wpSearch, $wpRecent;
 	global $wpRows, $wpCols, $wpSaveprefs, $wpReset, $wpHourDiff;
@@ -243,7 +243,7 @@
 	$yem = wfMsg( "youremail" );
 	$emf = wfMsg( "emailflag" );
 	$ynn = wfMsg( "yournick" );
-        $stt = wfMsg ( "stubthreshold" ) ;
+	$stt = wfMsg ( "stubthreshold" ) ;
 	$srh = wfMsg( "searchresultshead" );
 	$rpp = wfMsg( "resultsperpage" );
 	$scl = wfMsg( "contextlines" );
@@ -287,7 +287,11 @@
 
 	# Various checkbox options
 	#
-	$wgOut->addHTML( "</td><td rowspan=3 valign=top nowrap>\n" );
+	if ( $wgUseDynamicDates ) {
+		$wgOut->addHTML( "</td><td rowspan=3 valign=top nowrap>\n" );
+	} else {
+		$wgOut->addHTML( "</td><td rowspan=2 valign=top nowrap>\n" );
+	}
 	foreach ( $togs as $tname => $ttext ) {
 		if ( 1 == $wgUser->getOption( $tname ) ) {
 			$checked = " checked";
@@ -312,16 +316,19 @@
 	
 	# Date format
 	#
-	$wgOut->addHTML( "<tr><td valign=top nowrap><b>$dateFormat:</b><br>" );
-	for ( $i = 0; $i < count( $dateopts ); ++$i) {
-		if ( $i == $wpDate ) {
-			$checked = " checked";
-		} else {
-			$checked = "";
+	if ( $wgUseDynamicDates ) {
+		$wgOut->addHTML( "<tr><td valign=top nowrap><b>$dateFormat:</b><br>" );
+		for ( $i = 0; $i < count( $dateopts ); ++$i) {
+			if ( $i == $wpDate ) {
+				$checked = " checked";
+			} else {
+				$checked = "";
+			}
+			$wgOut->addHTML( "<label><input type=radio name=\"wpDate\" ".
+				"value=\"$i\"$checked> {$dateopts[$i]}</label><br>\n" );
 		}
-		$wgOut->addHTML( "<label><input type=radio name=\"wpDate\" value=\"$i\"$checked> {$dateopts[$i]}</label><br>\n" );
+		$wgOut->addHTML( "</td></tr>");
 	}
-	$wgOut->addHTML( "</td></tr>");
 	# Textbox rows, cols
 	#
 	$nowlocal = $wgLang->time( $now = wfTimestampNow(), true );
Index: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php	(revision 1430)
+++ trunk/phase3/includes/OutputPage.php	(revision 1431)
@@ -658,7 +658,7 @@
 	#
 	function doWikiPass2( $text, $linestart )
 	{
-		global $wgUser, $wgLang, $wgMungeDates;
+		global $wgUser, $wgLang, $wgUseDynamicDates;
 		wfProfileIn( "OutputPage::doWikiPass2" );
 		
 		$text = $this->removeHTMLtags( $text );
@@ -671,8 +671,10 @@
 		$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 );
 
Index: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php	(revision 1430)
+++ trunk/phase3/languages/Language.php	(revision 1431)
@@ -1222,12 +1222,16 @@
  
 	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 @@
 
 	function replaceDates( $text )
 	{
-		global $wgUser, $wgInputEncoding;
+		global $wgUser, $wgInputEncoding, $wgUseDynamicDates;
 		
+		# Feature can be disabled
+		if ( !$wgUseDynamicDates ) {
+			return;
+		}
+
 		# Setup
 		
 		$datePreference = $wgUser->getOption( 'date' );

Status & tagging log

  • 21:41, 11 October 2010 Reedy (Talk | contribs) changed the status of r1431 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox