| @@ 1058-1069 (lines=12) @@ | ||
| 1055 | * @param array $cols |
|
| 1056 | * @return string |
|
| 1057 | */ |
|
| 1058 | protected function get_search_sql( $string, $cols ) { |
|
| 1059 | global $wpdb; |
|
| 1060 | ||
| 1061 | $like = '%' . $wpdb->esc_like( $string ) . '%'; |
|
| 1062 | ||
| 1063 | $searches = array(); |
|
| 1064 | foreach ( $cols as $col ) { |
|
| 1065 | $searches[] = $wpdb->prepare( "$col LIKE %s", $like ); |
|
| 1066 | } |
|
| 1067 | ||
| 1068 | return ' AND (' . implode(' OR ', $searches) . ')'; |
|
| 1069 | } |
|
| 1070 | ||
| 1071 | /** |
|
| 1072 | * Parse and sanitize 'orderby' keys passed to the comment query. |
|
| @@ 492-503 (lines=12) @@ | ||
| 489 | * |
|
| 490 | * @return string Search SQL. |
|
| 491 | */ |
|
| 492 | protected function get_search_sql( $string, $columns ) { |
|
| 493 | global $wpdb; |
|
| 494 | ||
| 495 | $like = '%' . $wpdb->esc_like( $string ) . '%'; |
|
| 496 | ||
| 497 | $searches = array(); |
|
| 498 | foreach ( $columns as $column ) { |
|
| 499 | $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); |
|
| 500 | } |
|
| 501 | ||
| 502 | return '(' . implode( ' OR ', $searches ) . ')'; |
|
| 503 | } |
|
| 504 | ||
| 505 | /** |
|
| 506 | * Parses and sanitizes 'orderby' keys passed to the network query. |
|