Changeset 17189
- Timestamp:
- 12/30/2010 11:38:21 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-ms-users-list-table.php
r17013 r17189 31 31 'fields' => 'all_with_meta' 32 32 ); 33 34 $args['search'] = ltrim($args['search'], '*'); 33 35 34 36 if ( $role == 'super' ) { -
trunk/wp-admin/includes/class-wp-users-list-table.php
r17102 r17189 51 51 'fields' => 'all_with_meta' 52 52 ); 53 54 $args['search'] = '*' . $args['search'] . '*'; 53 55 54 56 if ( $this->is_site_users ) -
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.