Skip to content

Commit

Permalink
Merge branch 'municipio-se:stage' into stage
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianthulin authored Dec 9, 2024
2 parents 876c72e + dc629cd commit a63a9e3
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/wp-content/*
!/wp-content/plugins/cookies-and-content-security-policy-vars.php
!/wp-content/object-cache.php
!/wp-content/php-error.php
!/wp-content/sunrise.php
/wp-content/mu-plugins/*
!/wp-content/mu-plugins
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"helsingborg-stad/better-post-ui": "~3.0.3",
"helsingborg-stad/blade": "3.5.1",
"helsingborg-stad/broken-link-detector": "4.2.2",
"helsingborg-stad/component-library": "4.34.7",
"helsingborg-stad/component-library": "4.34.9",
"helsingborg-stad/content-scheduler": "~3.1.2",
"helsingborg-stad/custom-short-links": "~3.0.4",
"helsingborg-stad/customer-feedback": "4.0.10",
Expand All @@ -61,11 +61,11 @@
"helsingborg-stad/gdi-modularity-my-pages-about-me": "~1.0.4",
"helsingborg-stad/job-listings": "~4.1.4",
"helsingborg-stad/kirki": "~5.1.2",
"helsingborg-stad/like-posts": "2.8.2",
"helsingborg-stad/like-posts": "2.9.0",
"helsingborg-stad/lix-calculator": "~4.1.1",
"helsingborg-stad/media-usage": "~3.0.7",
"helsingborg-stad/mod-my-pages": "~1.0.5",
"helsingborg-stad/modularity": "6.47.3",
"helsingborg-stad/modularity": "6.47.7",
"helsingborg-stad/modularity-contact-banner": "3.2.0",
"helsingborg-stad/modularity-entryscape": "^4.0.1",
"helsingborg-stad/modularity-form-builder": "3.3.0",
Expand All @@ -81,7 +81,7 @@
"helsingborg-stad/modularity-timeline": "4.1.0",
"helsingborg-stad/multi-network-urls": "~2.0.0",
"helsingborg-stad/multisite-role-propagation": "3.0.6",
"helsingborg-stad/municipio": "5.78.1",
"helsingborg-stad/municipio": "5.78.4",
"helsingborg-stad/redirection-extended": "~3.0.4",
"helsingborg-stad/s3-uploads-custom-endpoint": "~2.0.0",
"helsingborg-stad/search-notices": "~3.0.3",
Expand Down
153 changes: 153 additions & 0 deletions wp-content/php-error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
<?php
if (!defined('ABSPATH')) {
exit; // Prevent direct access.
}

// Capture the error details.
$errorMessage = isset($error['message']) ? $error['message'] : __('Unknown error', 'default');
$errorFile = isset($error['file']) ? $error['file'] : __('Unknown file', 'default');
$errorLine = isset($error['line']) ? $error['line'] : __('Unknown line', 'default');

// Check if we're in debug mode.
$debugMode = defined('WP_DEBUG') && WP_DEBUG === true;

// Get current locale
$locale = get_locale();

// Define the error messages based on locale
switch ($locale) {
case 'sv_SE': // Swedish
$errorTitle = __('Sidfel', 'default');
$errorMessage = __('Den här webbplatsen har tekniska problem och kunde inte laddas för tillfället. Försök igen senare.', 'default');
break;

default: // English or fallback
$errorTitle = __('Page Error', 'default');
$errorMessage = __('This website is experiencing technical difficulties and could not be loaded at the moment. Please, try again later.', 'default');
break;
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php _e('Critical Error', 'default'); ?></title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f8f9fa;
color: #212529;
padding: 2rem;
margin: 0;
height: 100vh;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}

.error-container {
max-width: 600px;
width: 100%;
margin: auto;
padding: 1.5rem;
background: #fff;
border: 1px solid #dee2e6;
border-radius: 0.25rem;
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

h1 {
margin: 0 0 1rem 0;
}

pre {
background: #f8f9fa;
padding: 1rem;
border: 1px solid #dee2e6;
border-radius: 0.25rem;
overflow-x: auto;
border-radius: 0 0 0.25rem 0.25rem;
margin: 1.5rem -1.5rem -1.5rem -1.5rem;
border-right: none;
border-left: none;
border-bottom: none;
margin: 0;
padding: 8px;
background-color: #f1f1f1;
border: 1px solid #ccc;
border-radius: 4px;
overflow-x: auto;
font-family: monospace;
}

.debug-table {
border: 1px solid #dee2e6;
width: 100%;
border-collapse: collapse;
font-family: Arial, sans-serif;
margin-top: 1rem;
background-color: #fff;
border: none;
overflow: auto; /* Add this line */
display: block; /* This is important to enable scrolling within the table */
max-height: 300px; /* Optional: set a max height to control the scrolling area */
}

.debug-table th, .debug-table td {
padding: 8px;
border: 1px solid #dee2e6;
text-align: left;
}

.debug-table th {
background-color: #f8f9fa;
font-weight: bold;
}

.debug-table tr:nth-child(even) {
background-color: #f8f9fa;
}
</style>
</head>
<body>
<div class="error-container">
<h1><?php echo $errorTitle; ?></h1>
<p><?php echo $errorMessage; ?></p>

<?php if ($debugMode): ?>
<div class="debug-info">
<table class="debug-table">
<thead>
<tr>
<th><?php _e('Property', 'default'); ?></th>
<th><?php _e('Value', 'default'); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td><?php _e('Message', 'default'); ?></td>
<td><?= htmlspecialchars($errorMessage, ENT_QUOTES, 'UTF-8'); ?></td>
</tr>
<tr>
<td><?php _e('File', 'default'); ?></td>
<td><?= htmlspecialchars($errorFile, ENT_QUOTES, 'UTF-8'); ?></td>
</tr>
<tr>
<td><?php _e('Line', 'default'); ?></td>
<td><?= htmlspecialchars($errorLine, ENT_QUOTES, 'UTF-8'); ?></td>
</tr>
<tr>
<td colspan="2">
<pre><?= debug_print_backtrace(); ?></pre>
</td>
</tr>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</body>
</html>

0 comments on commit a63a9e3

Please sign in to comment.