r85658 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85657‎ | r85658 | r85659 >
Date:05:26, 8 April 2011
Author:yaron
Status:deferred
Tags:
Comment:
Another fix for the byte-order mark; some more small formatting fixes
Modified paths:
  • /trunk/extensions/DataTransfer/specials/DT_ImportCSV.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DataTransfer/specials/DT_ImportCSV.php
@@ -7,7 +7,7 @@
88
99 if ( !defined( 'MEDIAWIKI' ) ) die();
1010
11 -class DTPage {
 11+class DTPage {
1212 var $mName;
1313 var $mTemplates;
1414 var $mFreeText;
@@ -119,7 +119,7 @@
120120 array( 'name' => 'encoding' ),
121121 "\n" . $utf8OptionText . $utf16OptionText. "\t" ) . "\n\t";
122122 $formText .= "\t" . Xml::tags( 'p', null, wfMsg( 'dt_import_encodingtype', 'CSV' ) . " " . $encodingSelectText ) . "\n";
123 - $formText .= "\t" . '<hr style="margin: 10px 0 10px 0" />' . "\n";
 123+ $formText .= "\t" . '<hr style="margin: 10px 0 10px 0" />' . "\n";
124124 $formText .= DTUtils::printExistingPagesHandling();
125125 $formText .= DTUtils::printImportSummaryInput( 'CSV' );
126126 $formText .= DTUtils::printSubmitButton();
@@ -169,12 +169,15 @@
170170 $byteOrderMark = pack( "CCC", 0xef, 0xbb, 0xbf );
171171 if ( 0 == strncmp( $table[0][0], $byteOrderMark, 3 ) ) {
172172 $table[0][0] = substr( $table[0][0], 3 );
 173+ // If there were quotation marks around this value,
 174+ // they didn't get removed, so remove them now.
 175+ $table[0][0] = trim( $table[0][0], '"' );
173176 }
174177
175178 // check header line to make sure every term is in the
176179 // correct format
177 - $title_label = wfMsgForContent( 'dt_xml_title' );
178 - $free_text_label = wfMsgForContent( 'dt_xml_freetext' );
 180+ $title_label = wfMsgForContent( 'dt_xml_title' );
 181+ $free_text_label = wfMsgForContent( 'dt_xml_freetext' );
179182 foreach ( $table[0] as $i => $header_val ) {
180183 if ( $header_val !== $title_label && $header_val !== $free_text_label &&
181184 ! preg_match( '/^[^\[\]]+\[[^\[\]]+]$/', $header_val ) ) {
@@ -219,7 +222,7 @@
220223 $jobs[] = new DTImportJob( $title, $jobParams );
221224 }
222225 Job::batchInsert( $jobs );
223 - $text .= wfMsgExt( 'dt_import_success', array( 'parse' ), $wgLang->formatNum( count( $jobs ) ), 'CSV' );
 226+ $text .= wfMsgExt( 'dt_import_success', array( 'parse' ), $wgLang->formatNum( count( $jobs ) ), 'CSV' );
224227
225228 return $text;
226229 }

Status & tagging log