WC_REST_Authentication::is_request_to_rest_api() protected WC 1.0
Check if is request to our REST API.
{} Это метод класса: WC_REST_Authentication{}
Хуки из метода
Возвращает
true/false.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->is_request_to_rest_api();
Код WC_REST_Authentication::is_request_to_rest_api() WC REST Authentication::is request to rest api WC 4.9.0
protected function is_request_to_rest_api() {
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
return false;
}
$rest_prefix = trailingslashit( rest_get_url_prefix() );
$request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
// Check if the request is to the WC API endpoints.
$woocommerce = ( false !== strpos( $request_uri, $rest_prefix . 'wc/' ) );
// Allow third party plugins use our authentication methods.
$third_party = ( false !== strpos( $request_uri, $rest_prefix . 'wc-' ) );
return apply_filters( 'woocommerce_rest_is_request_to_rest_api', $woocommerce || $third_party );
}