1 | <?php |
---|
2 | |
---|
3 | $wp_header_to_desc = array( |
---|
4 | 100 => 'Continue', |
---|
5 | 101 => 'Switching Protocols', |
---|
6 | 102 => 'Processing', |
---|
7 | |
---|
8 | 200 => 'OK', |
---|
9 | 201 => 'Created', |
---|
10 | 202 => 'Accepted', |
---|
11 | 203 => 'Non-Authoritative Information', |
---|
12 | 204 => 'No Content', |
---|
13 | 205 => 'Reset Content', |
---|
14 | 206 => 'Partial Content', |
---|
15 | 207 => 'Multi-Status', |
---|
16 | 226 => 'IM Used', |
---|
17 | |
---|
18 | 300 => 'Multiple Choices', |
---|
19 | 301 => 'Moved Permanently', |
---|
20 | 302 => 'Found', |
---|
21 | 303 => 'See Other', |
---|
22 | 304 => 'Not Modified', |
---|
23 | 305 => 'Use Proxy', |
---|
24 | 306 => 'Reserved', |
---|
25 | 307 => 'Temporary Redirect', |
---|
26 | |
---|
27 | 400 => 'Bad Request', |
---|
28 | 401 => 'Unauthorized', |
---|
29 | 402 => 'Payment Required', |
---|
30 | 403 => 'Forbidden', |
---|
31 | 404 => 'Not Found', |
---|
32 | 405 => 'Method Not Allowed', |
---|
33 | 406 => 'Not Acceptable', |
---|
34 | 407 => 'Proxy Authentication Required', |
---|
35 | 408 => 'Request Timeout', |
---|
36 | 409 => 'Conflict', |
---|
37 | 410 => 'Gone', |
---|
38 | 411 => 'Length Required', |
---|
39 | 412 => 'Precondition Failed', |
---|
40 | 413 => 'Request Entity Too Large', |
---|
41 | 414 => 'Request-URI Too Long', |
---|
42 | 415 => 'Unsupported Media Type', |
---|
43 | 416 => 'Requested Range Not Satisfiable', |
---|
44 | 417 => 'Expectation Failed', |
---|
45 | 418 => 'I\'m a teapot', |
---|
46 | 422 => 'Unprocessable Entity', |
---|
47 | 423 => 'Locked', |
---|
48 | 424 => 'Failed Dependency', |
---|
49 | 426 => 'Upgrade Required', |
---|
50 | 428 => 'Precondition Required', |
---|
51 | 429 => 'Too Many Requests', |
---|
52 | 431 => 'Request Header Fields Too Large', |
---|
53 | |
---|
54 | 500 => 'Internal Server Error', |
---|
55 | 501 => 'Not Implemented', |
---|
56 | 502 => 'Bad Gateway', |
---|
57 | 503 => 'Service Unavailable', |
---|
58 | 504 => 'Gateway Timeout', |
---|
59 | 505 => 'HTTP Version Not Supported', |
---|
60 | 506 => 'Variant Also Negotiates', |
---|
61 | 507 => 'Insufficient Storage', |
---|
62 | 510 => 'Not Extended', |
---|
63 | 511 => 'Network Authentication Required', |
---|
64 | ); |
---|
65 | |
---|
66 | if ( isset( $_GET['status'] ) ) { |
---|
67 | |
---|
68 | $status = intval( $_GET['status'] ); |
---|
69 | |
---|
70 | if ( isset( $wp_header_to_desc[ $status ] ) ) { |
---|
71 | $status_header = "HTTP/1.1 {$status} {$wp_header_to_desc[ $status ]}"; |
---|
72 | } else { |
---|
73 | $status_header = "HTTP/1.1 {$status} Unknown"; |
---|
74 | } |
---|
75 | |
---|
76 | header( $status_header, true, $status ); |
---|
77 | |
---|
78 | } |
---|