64 lines
995 B
PHP
64 lines
995 B
PHP
<?php
|
|
|
|
class ErrorsHandler {
|
|
|
|
public function __construct () {
|
|
|
|
}
|
|
|
|
static public function kaput ($errorMsgs) {
|
|
|
|
|
|
ob_get_clean(); // to prevent error message to display inside an HTML container (case of error generated by get method calls)
|
|
|
|
|
|
if (!is_array($errorMsgs)) {
|
|
|
|
$errorMsgs = explode("\n", $errorMsgs);
|
|
}
|
|
|
|
echo '<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>'. _('Erreur critique') . '</title>
|
|
|
|
<style>
|
|
|
|
div {
|
|
|
|
overflow: auto;
|
|
word-wrap: break-word;
|
|
background-color: hsl(0, 100%, 69%);
|
|
color: hsl(0, 100%, 19%);
|
|
margin: 1em;
|
|
padding: 1em;
|
|
border-radius: 1em;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: calc(100% - 4em);
|
|
max-height: calc(100vh - 4em);
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div>';
|
|
|
|
|
|
foreach ($errorMsgs as $msg) {
|
|
|
|
echo '<pre>' . print_r($msg, true) . '</pre>';
|
|
}
|
|
|
|
echo '
|
|
</div>
|
|
</body>
|
|
</html>';
|
|
|
|
die;
|
|
}
|
|
|
|
|
|
} |