Changeset 37735 for trunk/src/wp-includes/class-wp-site-query.php
- Timestamp:
- 06/16/2016 11:08:30 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-site-query.php
r37477 r37735 142 142 * @type int $deleted Limit results to deleted sites. Accepts '1' or '0'. Default empty. 143 143 * @type string $search Search term(s) to retrieve matching sites for. Default empty. 144 * @type array $search_columns Array of column names to be searched. Accepts 'domain' and 'path'. 145 * Default empty array. 144 146 * @type bool $update_site_cache Whether to prime the cache for found sites. Default false. 145 147 * } … … 171 173 'deleted' => null, 172 174 'search' => '', 175 'search_columns' => array(), 173 176 'count' => false, 174 177 'date_query' => null, // See WP_Date_Query … … 482 485 // Falsey search strings are ignored. 483 486 if ( strlen( $this->query_vars['search'] ) ) { 484 $this->sql_clauses['where']['search'] = $this->get_search_sql( 485 $this->query_vars['search'], 486 array( 'domain', 'path' ) 487 ); 487 $search_columns = array(); 488 489 if ( $this->query_vars['search_columns'] ) { 490 $search_columns = array_intersect( $this->query_vars['search_columns'], array( 'domain', 'path' ) ); 491 } 492 493 if ( ! $search_columns ) { 494 $search_columns = array( 'domain', 'path' ); 495 } 496 497 /** 498 * Filters the columns to search in a WP_Site_Query search. 499 * 500 * The default columns include 'domain' and 'path. 501 * 502 * @since 4.6.0 503 * 504 * @param array $search_columns Array of column names to be searched. 505 * @param string $search Text being searched. 506 * @param WP_Site_Query $this The current WP_Site_Query instance. 507 */ 508 $search_columns = apply_filters( 'site_search_columns', $search_columns, $this->query_vars['search'], $this ); 509 510 $this->sql_clauses['where']['search'] = $this->get_search_sql( $this->query_vars['search'], $search_columns ); 488 511 } 489 512 … … 564 587 global $wpdb; 565 588 566 $like = '%' . $wpdb->esc_like( $string ) . '%'; 589 if ( false !== strpos( $string, '*' ) ) { 590 $like = '%' . implode( '%', array_map( array( $wpdb, 'esc_like' ), explode( '*', $string ) ) ) . '%'; 591 } else { 592 $like = '%' . $wpdb->esc_like( $string ) . '%'; 593 } 567 594 568 595 $searches = array();
Note: See TracChangeset
for help on using the changeset viewer.