Changeset 17189 for trunk/wp-includes/user.php
- Timestamp:
- 12/30/2010 11:38:21 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/user.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/user.php
r17170 r17189 466 466 $search = trim( $qv['search'] ); 467 467 if ( $search ) { 468 $wild = false; 469 if ( false !== strpos($search, '*') ) { 470 $wild = true; 468 $leading_wild = ( ltrim($search, '*') != $search ); 469 $trailing_wild = ( rtrim($search, '*') != $search ); 470 if ( $leading_wild && $trailing_wild ) 471 $wild = 'both'; 472 elseif ( $leading_wild ) 473 $wild = 'leading'; 474 elseif ( $trailing_wild ) 475 $wild = 'trailing'; 476 else 477 $wild = false; 478 if ( $wild ) 471 479 $search = trim($search, '*'); 472 } 480 473 481 if ( false !== strpos( $search, '@') ) 474 482 $search_columns = array('user_email'); … … 565 573 * @param string $string 566 574 * @param array $cols 567 * @param bool $wild Whether to allow trailing wildcard searches. Default is false. 575 * @param bool $wild Whether to allow wildcard searches. Default is false for Network Admin, true for 576 * single site. Single site allows leading and trailing wildcards, Network Admin only trailing. 568 577 * @return string 569 578 */ … … 572 581 573 582 $searches = array(); 574 $wild_char = ( $wild ) ? '%' : ''; 583 $leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : ''; 584 $trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : ''; 575 585 foreach ( $cols as $col ) { 576 586 if ( 'ID' == $col ) 577 587 $searches[] = "$col = '$string'"; 578 588 else 579 $searches[] = "$col LIKE ' " . like_escape($string) . "$wild_char'";589 $searches[] = "$col LIKE '$leading_wild" . like_escape($string) . "$trailing_wild'"; 580 590 } 581 591
Note: See TracChangeset
for help on using the changeset viewer.