PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
wpsso / lib / com / exception.php

exception.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/com/exception.php

247 lines 7.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * License: GPLv3
4 * License URI: https://www.gnu.org/licenses/gpl.txt
5 * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9
10 die( 'These aren\'t the droids you\'re looking for.' );
11 }
12
13 if ( ! class_exists( 'SucomErrorException' ) ) {
14
15 class SucomErrorException extends ErrorException {
16
17 protected static $codes = array(
18
19 'curl' => array(
20 1 => 'CURLE_UNSUPPORTED_PROTOCOL',
21 2 => 'CURLE_FAILED_INIT',
22 3 => 'CURLE_URL_MALFORMAT',
23 4 => 'CURLE_URL_MALFORMAT_USER',
24 5 => 'CURLE_COULDNT_RESOLVE_PROXY',
25 6 => 'CURLE_COULDNT_RESOLVE_HOST',
26 7 => 'CURLE_COULDNT_CONNECT',
27 8 => 'CURLE_FTP_WEIRD_SERVER_REPLY',
28 9 => 'CURLE_REMOTE_ACCESS_DENIED',
29 11 => 'CURLE_FTP_WEIRD_PASS_REPLY',
30 13 => 'CURLE_FTP_WEIRD_PASV_REPLY',
31 14 => 'CURLE_FTP_WEIRD_227_FORMAT',
32 15 => 'CURLE_FTP_CANT_GET_HOST',
33 17 => 'CURLE_FTP_COULDNT_SET_TYPE',
34 18 => 'CURLE_PARTIAL_FILE',
35 19 => 'CURLE_FTP_COULDNT_RETR_FILE',
36 21 => 'CURLE_QUOTE_ERROR',
37 22 => 'CURLE_HTTP_RETURNED_ERROR',
38 23 => 'CURLE_WRITE_ERROR',
39 25 => 'CURLE_UPLOAD_FAILED',
40 26 => 'CURLE_READ_ERROR',
41 27 => 'CURLE_OUT_OF_MEMORY',
42 28 => 'CURLE_OPERATION_TIMEDOUT',
43 30 => 'CURLE_FTP_PORT_FAILED',
44 31 => 'CURLE_FTP_COULDNT_USE_REST',
45 33 => 'CURLE_RANGE_ERROR',
46 34 => 'CURLE_HTTP_POST_ERROR',
47 35 => 'CURLE_SSL_CONNECT_ERROR',
48 36 => 'CURLE_BAD_DOWNLOAD_RESUME',
49 37 => 'CURLE_FILE_COULDNT_READ_FILE',
50 38 => 'CURLE_LDAP_CANNOT_BIND',
51 39 => 'CURLE_LDAP_SEARCH_FAILED',
52 41 => 'CURLE_FUNCTION_NOT_FOUND',
53 42 => 'CURLE_ABORTED_BY_CALLBACK',
54 43 => 'CURLE_BAD_FUNCTION_ARGUMENT',
55 45 => 'CURLE_INTERFACE_FAILED',
56 47 => 'CURLE_TOO_MANY_REDIRECTS',
57 48 => 'CURLE_UNKNOWN_TELNET_OPTION',
58 49 => 'CURLE_TELNET_OPTION_SYNTAX',
59 51 => 'CURLE_PEER_FAILED_VERIFICATION',
60 52 => 'CURLE_GOT_NOTHING',
61 53 => 'CURLE_SSL_ENGINE_NOTFOUND',
62 54 => 'CURLE_SSL_ENGINE_SETFAILED',
63 55 => 'CURLE_SEND_ERROR',
64 56 => 'CURLE_RECV_ERROR',
65 58 => 'CURLE_SSL_CERTPROBLEM',
66 59 => 'CURLE_SSL_CIPHER',
67 60 => 'CURLE_SSL_CACERT',
68 61 => 'CURLE_BAD_CONTENT_ENCODING',
69 62 => 'CURLE_LDAP_INVALID_URL',
70 63 => 'CURLE_FILESIZE_EXCEEDED',
71 64 => 'CURLE_USE_SSL_FAILED',
72 65 => 'CURLE_SEND_FAIL_REWIND',
73 66 => 'CURLE_SSL_ENGINE_INITFAILED',
74 67 => 'CURLE_LOGIN_DENIED',
75 68 => 'CURLE_TFTP_NOTFOUND',
76 69 => 'CURLE_TFTP_PERM',
77 70 => 'CURLE_REMOTE_DISK_FULL',
78 71 => 'CURLE_TFTP_ILLEGAL',
79 72 => 'CURLE_TFTP_UNKNOWNID',
80 73 => 'CURLE_REMOTE_FILE_EXISTS',
81 74 => 'CURLE_TFTP_NOSUCHUSER',
82 75 => 'CURLE_CONV_FAILED',
83 76 => 'CURLE_CONV_REQD',
84 77 => 'CURLE_SSL_CACERT_BADFILE',
85 78 => 'CURLE_REMOTE_FILE_NOT_FOUND',
86 79 => 'CURLE_SSH',
87 80 => 'CURLE_SSL_SHUTDOWN_FAILED',
88 81 => 'CURLE_AGAIN',
89 82 => 'CURLE_SSL_CRL_BADFILE',
90 83 => 'CURLE_SSL_ISSUER_ERROR',
91 84 => 'CURLE_FTP_PRET_FAILED',
92 84 => 'CURLE_FTP_PRET_FAILED',
93 85 => 'CURLE_RTSP_CSEQ_ERROR',
94 86 => 'CURLE_RTSP_SESSION_ERROR',
95 87 => 'CURLE_FTP_BAD_FILE_LIST',
96 88 => 'CURLE_CHUNK_FAILED',
97 ),
98
99 /*
100 * CURLINFO_HTTP_CODE.
101 */
102 'http' => array(
103 100 => 'Continue',
104 101 => 'Switching Protocols',
105 102 => 'Processing',
106 103 => 'Early Hints',
107 200 => 'OK',
108 201 => 'Created',
109 202 => 'Accepted',
110 203 => 'Non-Authoritative Information',
111 204 => 'No Content',
112 205 => 'Reset Content',
113 206 => 'Partial Content',
114 207 => 'Multi-Status',
115 208 => 'Already Reported',
116 226 => 'IM Used',
117 300 => 'Multiple Choices',
118 301 => 'Moved Permanently',
119 302 => 'Found',
120 303 => 'See Other',
121 304 => 'Not Modified',
122 305 => 'Use Proxy',
123 306 => '(Unused)',
124 307 => 'Temporary Redirect',
125 308 => 'Permanent Redirect',
126 400 => 'Bad Request',
127 401 => 'Unauthorized',
128 402 => 'Payment Required',
129 403 => 'Forbidden',
130 404 => 'Not Found',
131 405 => 'Method Not Allowed',
132 406 => 'Not Acceptable',
133 407 => 'Proxy Authentication Required',
134 408 => 'Request Timeout',
135 409 => 'Conflict',
136 411 => 'Length Required',
137 412 => 'Precondition Failed',
138 413 => 'Request Entity Too Large',
139 414 => 'Request-URI Too Long',
140 415 => 'Unsupported Media Type',
141 416 => 'Requested Range Not Satisfiable',
142 417 => 'Expectation Failed',
143 418 => 'I\'m a teapot',
144 421 => 'Misdirected Request',
145 422 => 'Unprocessable Content',
146 423 => 'Locked',
147 424 => 'Failed Dependency',
148 425 => 'Too Early',
149 426 => 'Upgrade Required',
150 428 => 'Precondition Required',
151 429 => 'Too Many Requests',
152 431 => 'Request Header Fields Too Large',
153 451 => 'Unavailable For Legal Reasons',
154 500 => 'Internal Server Error',
155 501 => 'Not Implemented',
156 502 => 'Bad Gateway',
157 503 => 'Service Unavailable',
158 504 => 'Gateway Timeout',
159 505 => 'HTTP Version Not Supported',
160 506 => 'Variant Also Negotiates',
161 507 => 'Insufficient Storage',
162 508 => 'Loop Detected',
163 510 => 'Not Extended',
164 511 => 'Network Authentication Required',
165 ),
166
167 /*
168 * CURLINFO_SSL_VERIFYRESULT.
169 */
170 'ssl' => array(
171 0 => 'Operation successful',
172 2 => 'Unable to get issuer certificate',
173 3 => 'Unable to get certificate CRL',
174 4 => 'Unable to decrypt certificate\'s signature',
175 5 => 'Unable to decrypt CRL\'s signature',
176 6 => 'Unable to decode issuer public key',
177 7 => 'Certificate signature failure',
178 8 => 'CRL signature failure',
179 9 => 'Certificate is not yet valid',
180 10 => 'Certificate has expired',
181 11 => 'CRL is not yet valid',
182 12 => 'CRL has expired',
183 13 => 'Format error in certificate\'s notBefore field',
184 14 => 'Format error in certificate\'s notAfter field',
185 15 => 'Format error in CRL\'s lastUpdate field',
186 16 => 'Format error in CRL\'s nextUpdate field',
187 17 => 'Out of memory',
188 18 => 'Self signed certificate',
189 19 => 'Self signed certificate in certificate chain',
190 20 => 'Unable to get local issuer certificate',
191 21 => 'Unable to verify the first certificate',
192 22 => 'Certificate chain too long',
193 23 => 'Certificate revoked',
194 24 => 'Invalid CA certificate',
195 25 => 'Path length constraint exceeded',
196 26 => 'Unsupported certificate purpose',
197 27 => 'Certificate not trusted',
198 28 => 'Certificate rejected',
199 29 => 'Subject issuer mismatch',
200 30 => 'Authority and subject key identifier mismatch',
201 31 => 'Authority and issuer serial number mismatch',
202 32 => 'Key usage does not include certificate signing',
203 50 => 'Application Verification Failure',
204 ),
205 );
206
207 public function __construct( $errstr = '', $errcode = null, $severity = E_ERROR, $filename = __FILE__, $lineno = __LINE__, ?Exception $previous = null ) {
208
209 if ( isset( self::$codes[ 'http' ][ $errcode ] ) ) {
210
211 $errstr = trim( $errstr . ' HTTP ' . $errcode . ' ' . self::$codes[ 'http' ][ $errcode ] . '.' );
212 }
213
214 parent::__construct( $errstr, $errcode, $severity, $filename, $lineno, $previous ); // Calls ErrorException::__construct().
215 }
216
217 public static function http_error( $errcode, $context = '' ) {
218
219 if ( isset( self::$codes[ 'http' ][ $errcode ] ) ) {
220
221 $http_error = $errcode . ' ' . self::$codes[ 'http' ][ $errcode ];
222
223 header( 'HTTP/1.1 ' . $http_error ); // Must be HTTP/1.1 for error code and error message.
224
225 if ( ! empty( $context ) ) {
226
227 header( 'Content-Type: text/html' );
228
229 echo '<!DOCTYPE html>';
230 echo '<html>';
231 echo '<head>';
232 echo '<title>' . $http_error . '</title>';
233 echo '</head>';
234 echo '<body>';
235 echo '<h1>' . $http_error . '</h1>';
236 echo '<p>' . $context . '</p>';
237 echo '</body>';
238 echo '</html>';
239 }
240
241 } else header( 'HTTP/1.0 ' . $errcode );
242
243 exit();
244 }
245 }
246 }
247