Changeset 9073 for trunk/src/bp-xprofile/bp-xprofile-filters.php
- Timestamp:
- 10/08/2014 02:14:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-filters.php
r8815 r9073 336 336 global $wpdb; 337 337 338 $raw_q = $q; 339 340 /* 341 * Replace quoted content with __QUOTE__ to avoid false positives. 342 * This regular expression will match nested quotes. 343 */ 344 $quoted_regex = "/'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/s"; 345 preg_match_all( $quoted_regex, $q, $quoted_matches ); 346 $q = preg_replace( $quoted_regex, '__QUOTE__', $q ); 347 338 348 // Get the first word of the command 339 349 preg_match( '/^(\S+)/', $q, $first_word_matches ); 340 350 341 351 if ( empty( $first_word_matches[0] ) ) { 342 return $ q;352 return $raw_q; 343 353 } 344 354 … … 347 357 348 358 if ( empty( $matches[0] ) || empty( $matches[1] ) ) { 349 return $ q;359 return $raw_q; 350 360 } 351 361 … … 416 426 } 417 427 428 // Put quoted content back into the string. 429 if ( ! empty( $quoted_matches[0] ) ) { 430 for ( $i = 0; $i < count( $quoted_matches[0] ); $i++ ) { 431 $quote_pos = strpos( $q, '__QUOTE__' ); 432 $q = substr_replace( $q, $quoted_matches[0][ $i ], $quote_pos, 9 ); 433 } 434 } 435 418 436 return $q; 419 437 }
Note: See TracChangeset
for help on using the changeset viewer.