mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Move _wp_search_sql() into WP_Object_Query. Introduce WP_Comment_Search. See #15032
git-svn-id: https://develop.svn.wordpress.org/trunk@15723 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -546,7 +546,7 @@ class WP_Object_Query {
|
||||
/*
|
||||
* Populates the $meta_query property
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param array $qv The query variables
|
||||
@@ -570,7 +570,7 @@ class WP_Object_Query {
|
||||
/*
|
||||
* Used internally to generate an SQL string for searching across multiple meta key = value pairs
|
||||
*
|
||||
* @access private
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param string $primary_table
|
||||
@@ -621,6 +621,26 @@ class WP_Object_Query {
|
||||
|
||||
return array( $join, $where );
|
||||
}
|
||||
|
||||
/*
|
||||
* Used internally to generate an SQL string for searching across multiple columns
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @param string $string
|
||||
* @param array $cols
|
||||
* @return string
|
||||
*/
|
||||
function get_search_sql( $string, $cols ) {
|
||||
$string = esc_sql( $string );
|
||||
|
||||
$searches = array();
|
||||
foreach ( $cols as $col )
|
||||
$searches[] = "$col LIKE '%$string%'";
|
||||
|
||||
return ' AND (' . implode(' OR ', $searches) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user