r70289 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70288‎ | r70289 | r70290 >
Date:19:50, 1 August 2010
Author:dale
Status:deferred
Tags:
Comment:
added single quote support to strip log statements
Modified paths:
  • /branches/MwEmbedStandAlone/ResourceLoader.php (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/ResourceLoader.php
@@ -878,6 +878,7 @@
879879 $parenthesesDepth = 0;
880880 $ignorenext = false;
881881 $inquote = false;
 882+ $inSingleQuote = false;
882883 for ( $i = $startOfLogIndex; $i < strlen( $jsString ); $i++ ) {
883884 $char = $jsString[$i];
884885 if ( $ignorenext ) {
@@ -886,23 +887,30 @@
887888 // Search for a close ) that is not in quotes
888889 switch( $char ) {
889890 case '"':
890 - $inquote = !$inquote;
891 - break;
 891+ if( !$inSingleQuote ){
 892+ $inquote = !$inquote;
 893+ }
 894+ break;
 895+ case '\'':
 896+ if( !$inquote ){
 897+ $inSingleQuote = !$inSingleQuote;
 898+ }
 899+ break;
892900 case '(':
893 - if( ! $inquote){
 901+ if( !$inquote && !$inSingleQuote ){
894902 $parenthesesDepth++;
895903 }
896904 break;
897905 case ')':
898 - if( ! $inquote ){
 906+ if( ! $inquote && !$inSingleQuote ){
899907 $parenthesesDepth--;
900908 }
901909 break;
902910 case '\\':
903911 if ( $inquote ) $ignorenext = true;
904 - break;
 912+ break;
905913 }
906 - // done with close parentheses search for next mw.log in outer loop:
 914+ // Done with close parentheses search for next mw.log in outer loop:
907915 if( $parenthesesDepth === 0 ){
908916 break;
909917 }

Status & tagging log