ActionScheduler_Abstract_ListTable::get_items_query_search()protectedWC 1.0

Check if the current request is doing a "full text" search. If that is the case prepares the SQL to search texts using LIKE.

If the current request does not have any search or if this list table does not support that feature it will return an empty string.

Метод класса: ActionScheduler_Abstract_ListTable{}

Хуков нет.

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_items_query_search();

Код ActionScheduler_Abstract_ListTable::get_items_query_search() WC 8.7.0

protected function get_items_query_search() {
	global $wpdb;

	if ( empty( $_GET['s'] ) || empty( $this->search_by ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
		return '';
	}

	$search_string = sanitize_text_field( wp_unslash( $_GET['s'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended

	$filter = array();
	foreach ( $this->search_by as $column ) {
		$wild     = '%';
		$sql_like = $wild . $wpdb->esc_like( $search_string ) . $wild;
		$filter[] = $wpdb->prepare( '`' . $column . '` LIKE %s', $sql_like ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.DB.PreparedSQL.NotPrepared
	}
	return implode( ' OR ', $filter );
}