ACF_Rest_Request::set_http_method
Determine the HTTP method of the current request.
Метод класса: ACF_Rest_Request{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->set_http_method();
Код ACF_Rest_Request::set_http_method() ACF Rest Request::set http method ACF 6.4.2
private function set_http_method() {
$this->http_method = 'GET';
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) ) {
$this->http_method = strtoupper( sanitize_text_field( $_SERVER['REQUEST_METHOD'] ) );
}
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Verified elsewhere.
// HTTP method override for clients that can't use PUT/PATCH/DELETE. This is identical to WordPress'
// handling in \WP_REST_Server::serve_request(). This block of code should always be identical to that
// in core.
if ( isset( $_GET['_method'] ) ) {
$this->http_method = strtoupper( sanitize_text_field( $_GET['_method'] ) );
} elseif ( isset( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ) {
$this->http_method = strtoupper( sanitize_text_field( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
}