Split get_search_sql(). See #15170. See #15032

git-svn-id: https://develop.svn.wordpress.org/trunk@16351 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
scribu
2010-11-13 18:18:45 +00:00
parent a4ee63c95a
commit e19c83933a
3 changed files with 46 additions and 26 deletions

View File

@@ -341,6 +341,26 @@ class WP_Comment_Query extends WP_Object_Query {
return $comments;
}
/*
* 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) . ')';
}
}
/**