create-prisma-php-app 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.php +25 -0
- package/dist/src/app/layout.php +0 -11
- package/package.json +1 -1
package/dist/bootstrap.php
CHANGED
|
@@ -41,3 +41,28 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVE
|
|
|
41
41
|
$domainName = $_SERVER['HTTP_HOST'];
|
|
42
42
|
$scriptPath = dirname($_SERVER['SCRIPT_NAME']);
|
|
43
43
|
$baseUrl = $protocol . $domainName . rtrim($scriptPath, '/') . '/';
|
|
44
|
+
|
|
45
|
+
ob_start();
|
|
46
|
+
|
|
47
|
+
set_error_handler(function ($severity, $message, $file, $line) {
|
|
48
|
+
throw new ErrorException($message, 0, $severity, $file, $line);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
set_exception_handler(function ($exception) {
|
|
52
|
+
echo "<div class='error'>An error occurred: " . $exception->getMessage() . "</div>";
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
$result = determineContentToInclude();
|
|
57
|
+
$contentToInclude = $result['path'] ?? '';
|
|
58
|
+
|
|
59
|
+
if (!empty($contentToInclude)) {
|
|
60
|
+
require_once $contentToInclude;
|
|
61
|
+
} else {
|
|
62
|
+
require_once "not-found.php";
|
|
63
|
+
}
|
|
64
|
+
} catch (Throwable $e) {
|
|
65
|
+
echo "<div class='error'>An error occurred: " . $e->getMessage() . "</div>";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
$content = ob_get_clean();
|
package/dist/src/app/layout.php
CHANGED
|
@@ -2,16 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require_once "../../bootstrap.php";
|
|
4
4
|
|
|
5
|
-
$result = determineContentToInclude();
|
|
6
|
-
$contentToInclude = $result['path'] ?? '';
|
|
7
|
-
|
|
8
|
-
ob_start();
|
|
9
|
-
if (!empty($contentToInclude)) {
|
|
10
|
-
require_once $contentToInclude;
|
|
11
|
-
} else {
|
|
12
|
-
require_once "not-found.php";
|
|
13
|
-
}
|
|
14
|
-
$content = ob_get_clean();
|
|
15
5
|
?>
|
|
16
6
|
|
|
17
7
|
<!DOCTYPE html>
|
|
@@ -24,7 +14,6 @@ $content = ob_get_clean();
|
|
|
24
14
|
<title><?php echo htmlspecialchars($metadata['title']); ?></title>
|
|
25
15
|
<link rel="shortcut icon" href="<?php echo $baseUrl; ?>favicon.ico" type="image/x-icon">
|
|
26
16
|
<script>
|
|
27
|
-
// Define a global variable to store the base URL.
|
|
28
17
|
const baseUrl = '<?php echo $baseUrl; ?>';
|
|
29
18
|
</script>
|
|
30
19
|
</head>
|