25 const DELETE =
'DELETE';
29 const PATCH =
"PATCH";
36 public function requestMethods()
40 self::POST => self::POST,
41 self::GET => self::GET,
42 self::DELETE => self::DELETE,
43 self::PUT => self::PUT,
46 return apply_filters(
'wpdk_http_verbs', $verbs );
61 class WPDKHTTPRequest {
71 public static function isAjax()
73 if ( defined(
'DOING_AJAX' ) ) {
76 if ( isset( $_SERVER[
'HTTP_X_REQUESTED_WITH'] ) &&
77 strtolower( $_SERVER[
'HTTP_X_REQUESTED_WITH'] ) ==
'xmlhttprequest'
95 public static function isRequest( $verb )
97 $verb = strtolower( $verb );
98 return ( $verb == strtolower( $_SERVER[
'REQUEST_METHOD'] ) );
108 public static function isRequestGET()
110 return self::isRequest( WPDKHTTPVerbs::GET );
120 public static function isRequestPOST()
122 return self::isRequest( WPDKHTTPVerbs::POST );