Automattic\WooCommerce\StoreApi
Authentication::has_store_api_route_as_get_parameter
Checks if the request has a store API route as a GET rest_route parameter.
Метод класса: Authentication{}
Хуков нет.
Возвращает
true|false.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->has_store_api_route_as_get_parameter(): bool;
Список изменений
| С версии 10.6.0 | Введена. |
Код Authentication::has_store_api_route_as_get_parameter() Authentication::has store api route as get parameter WC 10.9.4
protected function has_store_api_route_as_get_parameter(): bool {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Store API
if ( ! isset( $_GET['rest_route'] ) || ! is_string( $_GET['rest_route'] ) ) {
return false;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Store API context check.
$rest_route = rawurldecode( esc_url_raw( wp_unslash( $_GET['rest_route'] ) ) );
return 0 === strpos( $rest_route, '/wc/store/' );
}