70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
| ----------------------------------------------------------------
|
|
| HTTP Status Code Definitions
|
|
| ----------------------------------------------------------------
|
|
|
|
|
| Translate HTTP status codes from numerical to a more
|
|
| human-friendly string that's easier to remember.
|
|
|
|
|
*/
|
|
|
|
$codes = array(
|
|
// 200's (successful)
|
|
200 => 'HTTP_SUCCESS',
|
|
201 => 'HTTP_CREATED',
|
|
202 => 'HTTP_ACCEPTED',
|
|
204 => 'HTTP_NO_CONTENT',
|
|
205 => 'HTTP_RESET_CONTENT',
|
|
206 => 'HTTP_PARTIAL_CONTENT',
|
|
208 => 'HTTP_ALREADY_REPORTED',
|
|
|
|
// 300's (redirections)
|
|
301 => 'HTTP_MOVED_PERMANENTLY',
|
|
304 => 'HTTP_NOT_MODIFIED',
|
|
307 => 'HTTP_TEMP_REDIRECT',
|
|
308 => 'HTTP_PERMANENT_REDIRECT',
|
|
|
|
// 400's (app got the request but couldn't process it successfully, coding error)
|
|
400 => 'HTTP_BAD_REQUEST',
|
|
401 => 'HTTP_UNAUTHORIZED',
|
|
402 => 'HTTP_PAYMENT_REQUIRED',
|
|
403 => 'HTTP_FORBIDDEN',
|
|
404 => 'HTTP_NOT_FOUND',
|
|
405 => 'HTTP_METHOD_NOT_ALLOWED',
|
|
406 => 'HTTP_NOT_ACCEPTABLE',
|
|
408 => 'HTTP_TIMEOUT',
|
|
409 => 'HTTP_CONFLICT',
|
|
410 => 'HTTP_GONE',
|
|
412 => 'HTTP_PRECONDITION_FAILED',
|
|
413 => 'HTTP_PAYLOAD_TOO_LARGE',
|
|
415 => 'HTTP_UNSUPPORTED_MEDIA',
|
|
413 => 'HTTP_TOO_LARGE',
|
|
417 => 'HTTP_EXPECTATION_FAIL',
|
|
418 => 'HTTP_TEAPOT',
|
|
422 => 'HTTP_UNPROCESSABLE_ENTITY',
|
|
423 => 'HTTP_LOCKED',
|
|
424 => 'HTTP_FAILED_DEPENDENCY',
|
|
236 => 'HTTP_UPGRADE_REQUIRED',
|
|
428 => 'HTTP_PRECONDITION_REQUIRED',
|
|
429 => 'HTTP_TOO_MANY_REQUESTS',
|
|
451 => 'HTTP_GAG_ORDER',
|
|
|
|
// 500's (server-level problem, process died or configuration is incorrect)
|
|
500 => 'HTTP_SERVER_ERROR',
|
|
501 => 'HTTP_NOT_IMPLEMENTED',
|
|
503 => 'HTTP_UNAVAILABLE',
|
|
530 => 'HTTP_SUSPENDED',
|
|
);
|
|
|
|
foreach ( $codes as $code => $slug ) {
|
|
if ( ! defined( $slug ) ) {
|
|
define( $slug, $code );
|
|
}
|
|
}
|