r77512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77511‎ | r77512 | r77513 >
Date:23:46, 30 November 2010
Author:platonides
Status:ok
Tags:
Comment:
Use constants. Add spacing.
Modified paths:
  • /trunk/phase3/includes/normal/UtfNormalTest2.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/normal/UtfNormalTest2.php
@@ -13,8 +13,13 @@
1414
1515 // From http://unicode.org/Public/UNIDATA/NormalizationTest.txt
1616 $file = "NormalizationTest.txt";
17 -$sep = ';';
18 -$comment = "#";
 17+
 18+// Anything after this character is a comment
 19+define ( 'COMMENT', '#' );
 20+
 21+// Semicolons are used to separate the columns
 22+define ( 'SEPARATOR', ';' );
 23+
1924 $f = fopen($file, "r");
2025
2126 /**
@@ -208,12 +213,10 @@
209214 }
210215
211216 function getRow( $f ) {
212 - global $comment, $sep;
213 -
214217 $row = fgets( $f );
215218 if( $row === false ) return false;
216219 $row = rtrim($row);
217 - $pos = strpos( $row, $comment );
 220+ $pos = strpos( $row, COMMENT );
218221 $pos2 = strpos( $row, ")" );
219222 if( $pos === 0 ) return array($row);
220223 $c = "";
@@ -225,8 +228,8 @@
226229 }
227230
228231 $ret = array();
229 - foreach(explode( $sep, $row ) as $ent) {
230 - if(trim($ent) !== "") {
 232+ foreach( explode( SEPARATOR, $row ) as $ent ) {
 233+ if( trim( $ent ) !== "" ) {
231234 $ret[] = unistr($ent);
232235 }
233236 }

Status & tagging log