r50813 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50812‎ | r50813 | r50814 >
Date:07:48, 20 May 2009
Author:thedevilonline
Status:deferred
Tags:
Comment:
Changed eregi_foo functions into preg_foo functions
Modified paths:
  • /trunk/extensions/LocalisationUpdate/LocalisationUpdate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LocalisationUpdate/LocalisationUpdate.php
@@ -28,7 +28,7 @@
2929
3030 // If the key also contains the language code remove the language code from the key
3131 if($isFullKey) {
32 - $lckey = eregi_replace("/".$langcode,"",$lckey);
 32+ $lckey = preg_replace("/\/".$langcode."/","",$lckey);
3333 }
3434
3535 //If message is in the cache, don't get an update!
@@ -166,8 +166,8 @@
167167 //Remove all unneeded content
168168 function cleanupFile($contents) {
169169 //We don't need any PHP tags
170 - $contents = eregi_replace("<\?php","",$contents);
171 - $contents = eregi_replace("\?>","",$contents);
 170+ $contents = preg_replace("/<\\?php/","",$contents);
 171+ $contents = preg_replace("/\?>/","",$contents);
172172 $results = array();
173173 //And we only want the messages array
174174 preg_match("/\\\$messages(.*\s)*?\);/",$contents,$results);
@@ -180,7 +180,7 @@
181181 }
182182
183183 //Windows vs Unix always stinks when comparing files
184 - $contents = eregi_replace("\\\r","",$contents);
 184+ $contents = preg_replace("/\\\r/","",$contents);
185185
186186 //return the cleaned up file
187187 return $contents;
@@ -219,7 +219,7 @@
220220 $basefilecontents = cleanupFile($basefilecontents);
221221
222222 //Change the variable name
223 - $basefilecontents = eregi_replace("\\\$messages","\$base_messages",$basefilecontents);
 223+ $basefilecontents = preg_replace("/\\\$messages/","\$base_messages",$basefilecontents);
224224
225225 $basehash = md5($basefilecontents);
226226 //If this is the remote file check if the file has changed since our last update
@@ -256,7 +256,7 @@
257257 $comparefilecontents = cleanupFile($comparefilecontents);
258258
259259 //rename the array
260 - $comparefilecontents = eregi_replace("\\\$messages","\$compare_messages",$comparefilecontents);
 260+ $comparefilecontents = preg_replace("/\\\$messages/","\$compare_messages",$comparefilecontents);
261261
262262 $comparehash = md5($comparefilecontents);
263263 //If this is the remote file check if the file has changed since our last update
@@ -339,8 +339,8 @@
340340
341341 function cleanupExtensionFile($contents) {
342342 //We don't want PHP tags
343 - $contents = eregi_replace("<\?php","",$contents);
344 - $contents = eregi_replace("\?>","",$contents);
 343+ $contents = preg_replace("/<\?php/","",$contents);
 344+ $contents = preg_replace("/\?>/","",$contents);
345345 $results = array();
346346 //And we only want message arrays
347347 preg_match_all("/\\\$messages(.*\s)*?\);/",$contents,$results);
@@ -348,7 +348,7 @@
349349 $contents = implode("\n\n",$results[0]);
350350
351351 //And we hate the windows vs linux linebreaks
352 - $contents = eregi_replace("\\\r","",$contents);
 352+ $contents = preg_replace("/\\\r/","",$contents);
353353 return $contents;
354354 }
355355
@@ -378,7 +378,7 @@
379379 $basefilecontents = cleanupExtensionFile($basefilecontents);
380380
381381 //Rename the arrays
382 - $basefilecontents = eregi_replace("\\\$messages","\$base_messages",$basefilecontents);
 382+ $basefilecontents = preg_replace("/\\\$messages/","\$base_messages",$basefilecontents);
383383
384384 $basehash = md5($basefilecontents);
385385 //If this is the remote file
@@ -416,7 +416,7 @@
417417 $comparefilecontents = cleanupExtensionFile($comparefilecontents);
418418
419419 //Rename the array
420 - $comparefilecontents = eregi_replace("\\\$messages","\$compare_messages",$comparefilecontents);
 420+ $comparefilecontents = preg_replace("/\\\$messages/","\$compare_messages",$comparefilecontents);
421421 $comparehash = md5($comparefilecontents);
422422 if(preg_match("/^http/",$comparefile) && !$alwaysGetResult) {
423423 //Check if the remote file has changed

Status & tagging log