create-prisma-php-app 1.21.500 → 1.22.1
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 +189 -153
- package/dist/index.js +1 -1133
- package/dist/settings/bs-config.cjs +1 -0
- package/dist/settings/files-list-config.js +61 -0
- package/dist/settings/start-dev.js +4 -4
- package/dist/src/Lib/Headers/Boom.php +39 -0
- package/dist/src/app/layout.php +1 -1
- package/dist/tailwind.config.js +3 -6
- package/dist/tsconfig.json +9 -9
- package/package.json +1 -1
package/dist/bootstrap.php
CHANGED
|
@@ -25,8 +25,17 @@ function determineContentToInclude()
|
|
|
25
25
|
$baseDir = APP_PATH;
|
|
26
26
|
$includePath = '';
|
|
27
27
|
$layoutsToInclude = [];
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ============ Middleware Management ============
|
|
31
|
+
* AuthMiddleware is invoked to handle authentication logic for the current route ($uri).
|
|
32
|
+
* ================================================
|
|
33
|
+
*/
|
|
29
34
|
AuthMiddleware::handle($uri);
|
|
35
|
+
/**
|
|
36
|
+
* ============ End of Middleware Management ======
|
|
37
|
+
* ================================================
|
|
38
|
+
*/
|
|
30
39
|
|
|
31
40
|
$isDirectAccessToPrivateRoute = preg_match('/\/_/', $uri);
|
|
32
41
|
if ($isDirectAccessToPrivateRoute) {
|
|
@@ -107,31 +116,23 @@ function getFilePrecedence()
|
|
|
107
116
|
global $_filesListRoutes;
|
|
108
117
|
|
|
109
118
|
// Normalize the file paths for consistent comparison
|
|
110
|
-
$_filesListRoutes
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return preg_match('/^\.\/src\/app\/route\.php$/', $route);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// If route.php is found, return just the file name
|
|
120
|
-
if (!empty($routeFile)) {
|
|
121
|
-
return '/route.php';
|
|
119
|
+
foreach ($_filesListRoutes as $route) {
|
|
120
|
+
$normalizedRoute = str_replace('\\', '/', $route);
|
|
121
|
+
// First, check for route.php
|
|
122
|
+
if (preg_match('/^\.\/src\/app\/route\.php$/', $normalizedRoute)) {
|
|
123
|
+
return '/route.php';
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
// If route.php is
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (!empty($indexFile)) {
|
|
131
|
-
return '/index.php';
|
|
127
|
+
// If no route.php is found, check for index.php
|
|
128
|
+
foreach ($_filesListRoutes as $route) {
|
|
129
|
+
$normalizedRoute = str_replace('\\', '/', $route);
|
|
130
|
+
if (preg_match('/^\.\/src\/app\/index\.php$/', $normalizedRoute)) {
|
|
131
|
+
return '/index.php';
|
|
132
|
+
}
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
// If neither file is found, return null
|
|
135
|
+
// If neither file is found, return null
|
|
135
136
|
return null;
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -145,42 +146,19 @@ function uriExtractor(string $scriptUrl): string
|
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
$escapedIdentifier = preg_quote($projectName, '/');
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (!empty($matches[1])) {
|
|
151
|
-
$leftTrim = ltrim($matches[1], '/');
|
|
152
|
-
$rightTrim = rtrim($leftTrim, '/');
|
|
153
|
-
return "$rightTrim";
|
|
154
|
-
}
|
|
149
|
+
if (preg_match("/(?:.*$escapedIdentifier)(\/.*)$/", $scriptUrl, $matches) && !empty($matches[1])) {
|
|
150
|
+
return rtrim(ltrim($matches[1], '/'), '/');
|
|
155
151
|
}
|
|
156
152
|
|
|
157
153
|
return "/";
|
|
158
154
|
}
|
|
159
155
|
|
|
160
|
-
function
|
|
156
|
+
function getFilesListRoutes()
|
|
161
157
|
{
|
|
162
|
-
|
|
163
|
-
$
|
|
164
|
-
|
|
165
|
-
if (is_dir($directory)) {
|
|
166
|
-
$filesList = [];
|
|
167
|
-
|
|
168
|
-
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
|
|
169
|
-
|
|
170
|
-
foreach ($iterator as $file) {
|
|
171
|
-
if ($file->isFile()) {
|
|
172
|
-
$filesList[] = $file->getPathname();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
$jsonData = json_encode($filesList, JSON_PRETTY_PRINT);
|
|
177
|
-
$jsonFileName = SETTINGS_PATH . '/files-list.json';
|
|
178
|
-
file_put_contents($jsonFileName, $jsonData);
|
|
158
|
+
$jsonFileName = SETTINGS_PATH . '/files-list.json';
|
|
159
|
+
$routeFiles = file_exists($jsonFileName) ? json_decode(file_get_contents($jsonFileName), true) : [];
|
|
179
160
|
|
|
180
|
-
|
|
181
|
-
$_filesListRoutes = json_decode(file_get_contents($jsonFileName), true);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
161
|
+
return $routeFiles;
|
|
184
162
|
}
|
|
185
163
|
|
|
186
164
|
function findGroupFolder($uri): string
|
|
@@ -213,14 +191,21 @@ function dynamicRoute($uri)
|
|
|
213
191
|
foreach ($_filesListRoutes as $route) {
|
|
214
192
|
$normalizedRoute = trim(str_replace('\\', '/', $route), '.');
|
|
215
193
|
$routeSegments = explode('/', ltrim($normalizedRoute, '/'));
|
|
194
|
+
|
|
195
|
+
$filteredRouteSegments = array_values(array_filter($routeSegments, function ($segment) {
|
|
196
|
+
return !preg_match('/\(.+\)/', $segment); // Skip segments with parentheses (groups)
|
|
197
|
+
}));
|
|
198
|
+
|
|
216
199
|
$singleDynamic = preg_match_all('/\[[^\]]+\]/', $normalizedRoute, $matches) === 1 && !strpos($normalizedRoute, '[...');
|
|
217
200
|
if ($singleDynamic) {
|
|
218
|
-
$segmentMatch = singleDynamicRoute($uriSegments, $
|
|
219
|
-
|
|
201
|
+
$segmentMatch = singleDynamicRoute($uriSegments, $filteredRouteSegments);
|
|
202
|
+
$index = array_search($segmentMatch, $filteredRouteSegments);
|
|
203
|
+
if ($index !== false && isset($uriSegments[$index])) {
|
|
220
204
|
$trimSegmentMatch = trim($segmentMatch, '[]');
|
|
221
|
-
$dynamicRouteParams = new \ArrayObject([$trimSegmentMatch => $uriSegments[
|
|
222
|
-
|
|
223
|
-
$dynamicRouteUri =
|
|
205
|
+
$dynamicRouteParams = new \ArrayObject([$trimSegmentMatch => $uriSegments[$index]], \ArrayObject::ARRAY_AS_PROPS);
|
|
206
|
+
$dynamicRouteUri = str_replace($segmentMatch, $uriSegments[$index], $normalizedRoute);
|
|
207
|
+
$dynamicRouteUri = preg_replace('/\(.+\)/', '', $dynamicRouteUri);
|
|
208
|
+
$dynamicRouteUri = preg_replace('/\/+/', '/', $dynamicRouteUri);
|
|
224
209
|
$dynamicRouteUriDirname = dirname($dynamicRouteUri);
|
|
225
210
|
$dynamicRouteUriDirname = rtrim($dynamicRouteUriDirname, '/');
|
|
226
211
|
|
|
@@ -235,30 +220,41 @@ function dynamicRoute($uri)
|
|
|
235
220
|
}
|
|
236
221
|
}
|
|
237
222
|
} elseif (strpos($normalizedRoute, '[...') !== false) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
223
|
+
// Clean and normalize the route
|
|
224
|
+
$cleanedNormalizedRoute = preg_replace('/\(.+\)/', '', $normalizedRoute); // Remove any public/private segment
|
|
225
|
+
$cleanedNormalizedRoute = preg_replace('/\/+/', '/', $cleanedNormalizedRoute); // Replace multiple slashes
|
|
226
|
+
$dynamicSegmentRoute = preg_replace('/\[\.\.\..*?\].*/', '', $cleanedNormalizedRoute); // Remove the dynamic segment
|
|
227
|
+
|
|
228
|
+
// Check if the normalized URI starts with the cleaned route
|
|
229
|
+
if (strpos("/src/app/$normalizedUri", $dynamicSegmentRoute) === 0) {
|
|
230
|
+
$trimmedUri = str_replace($dynamicSegmentRoute, '', "/src/app/$normalizedUri");
|
|
231
|
+
$uriParts = explode('/', trim($trimmedUri, '/'));
|
|
232
|
+
|
|
233
|
+
// Extract the dynamic segment content
|
|
234
|
+
if (preg_match('/\[\.\.\.(.*?)\]/', $normalizedRoute, $matches)) {
|
|
235
|
+
$dynamicParam = $matches[1];
|
|
236
|
+
$dynamicRouteParams = new \ArrayObject([$dynamicParam => $uriParts], \ArrayObject::ARRAY_AS_PROPS);
|
|
248
237
|
}
|
|
238
|
+
|
|
239
|
+
// Check for 'route.php'
|
|
249
240
|
if (strpos($normalizedRoute, 'route.php') !== false) {
|
|
250
241
|
$uriMatch = $normalizedRoute;
|
|
251
242
|
break;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Handle matching routes ending with 'index.php'
|
|
246
|
+
if (strpos($normalizedRoute, 'index.php') !== false) {
|
|
247
|
+
$segmentMatch = "[...$dynamicParam]";
|
|
248
|
+
$index = array_search($segmentMatch, $filteredRouteSegments);
|
|
249
|
+
|
|
250
|
+
if ($index !== false && isset($uriSegments[$index])) {
|
|
251
|
+
// Generate the dynamic URI
|
|
252
|
+
$dynamicRouteUri = str_replace($segmentMatch, implode('/', $uriParts), $cleanedNormalizedRoute);
|
|
253
|
+
$dynamicRouteUriDirname = rtrim(dirname($dynamicRouteUri), '/');
|
|
258
254
|
|
|
259
|
-
$expectedUri =
|
|
260
|
-
$expectedUri = rtrim($expectedUri, '/');
|
|
255
|
+
$expectedUri = rtrim("/src/app/$normalizedUri", '/');
|
|
261
256
|
|
|
257
|
+
// Compare the expected and dynamic URIs
|
|
262
258
|
if ($expectedUri === $dynamicRouteUriDirname) {
|
|
263
259
|
$uriMatch = $normalizedRoute;
|
|
264
260
|
break;
|
|
@@ -280,6 +276,7 @@ function isGroupIdentifier($segment): bool
|
|
|
280
276
|
function matchGroupFolder($constructedPath): ?string
|
|
281
277
|
{
|
|
282
278
|
global $_filesListRoutes;
|
|
279
|
+
|
|
283
280
|
$bestMatch = null;
|
|
284
281
|
$normalizedConstructedPath = ltrim(str_replace('\\', '/', $constructedPath), './');
|
|
285
282
|
|
|
@@ -330,6 +327,10 @@ function singleDynamicRoute($uriSegments, $routeSegments)
|
|
|
330
327
|
|
|
331
328
|
function checkForDuplicateRoutes()
|
|
332
329
|
{
|
|
330
|
+
if ($_ENV['APP_ENV'] !== 'development') {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
333
334
|
global $_filesListRoutes;
|
|
334
335
|
$normalizedRoutesMap = [];
|
|
335
336
|
foreach ($_filesListRoutes as $route) {
|
|
@@ -363,72 +364,27 @@ function checkForDuplicateRoutes()
|
|
|
363
364
|
}
|
|
364
365
|
}
|
|
365
366
|
|
|
366
|
-
function setupErrorHandling(&$content)
|
|
367
|
-
{
|
|
368
|
-
set_error_handler(function ($severity, $message, $file, $line) use (&$content) {
|
|
369
|
-
$content .= "<div class='error'>Error: {$severity} - {$message} in {$file} on line {$line}</div>";
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
set_exception_handler(function ($exception) use (&$content) {
|
|
373
|
-
$content .= "<div class='error'>Exception: " . htmlspecialchars($exception->getMessage(), ENT_QUOTES, 'UTF-8') . "</div>";
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
register_shutdown_function(function () use (&$content) {
|
|
377
|
-
$error = error_get_last();
|
|
378
|
-
if ($error !== null && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR])) {
|
|
379
|
-
$formattedError = "<div class='error'>Fatal Error: " . htmlspecialchars($error['message'], ENT_QUOTES, 'UTF-8') .
|
|
380
|
-
" in " . htmlspecialchars($error['file'], ENT_QUOTES, 'UTF-8') .
|
|
381
|
-
" on line " . $error['line'] . "</div>";
|
|
382
|
-
$content .= $formattedError;
|
|
383
|
-
modifyOutputLayoutForError($content);
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
|
|
388
367
|
|
|
389
368
|
function containsChildContent($filePath)
|
|
390
369
|
{
|
|
391
370
|
$fileContent = file_get_contents($filePath);
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
return true;
|
|
399
|
-
} else {
|
|
400
|
-
return false;
|
|
401
|
-
}
|
|
371
|
+
|
|
372
|
+
// Regular expression to match different ways of echoing $childContent
|
|
373
|
+
$pattern = '/\<\?=\s*\$childContent\s*;?\s*\?>|echo\s*\$childContent\s*;?/';
|
|
374
|
+
|
|
375
|
+
// Return true if $childContent variables are found, false otherwise
|
|
376
|
+
return preg_match($pattern, $fileContent) === 1;
|
|
402
377
|
}
|
|
403
378
|
|
|
404
379
|
function containsContent($filePath)
|
|
405
380
|
{
|
|
406
381
|
$fileContent = file_get_contents($filePath);
|
|
407
|
-
if (
|
|
408
|
-
(strpos($fileContent, 'echo $content') === false &&
|
|
409
|
-
strpos($fileContent, 'echo $content;') === false) &&
|
|
410
|
-
(strpos($fileContent, '<?= $content ?>') === false) &&
|
|
411
|
-
(strpos($fileContent, '<?= $content; ?>') === false)
|
|
412
|
-
) {
|
|
413
|
-
return true;
|
|
414
|
-
} else {
|
|
415
|
-
return false;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function modifyOutputLayoutForError($contentToAdd)
|
|
420
|
-
{
|
|
421
|
-
if ($_ENV['SHOW_ERRORS'] === "false") exit;
|
|
422
382
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
$newBodyContent = "<body class=\"fatal-error\">$contentToAdd</body>";
|
|
383
|
+
// Improved regular expression to match different ways of echoing $content
|
|
384
|
+
$pattern = '/\<\?=\s*\$content\s*;?\s*\?>|echo\s*\$content\s*;?/';
|
|
426
385
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
echo $modifiedNotFoundContent;
|
|
430
|
-
exit;
|
|
431
|
-
}
|
|
386
|
+
// Return true if content variables are found, false otherwise
|
|
387
|
+
return preg_match($pattern, $fileContent) === 1;
|
|
432
388
|
}
|
|
433
389
|
|
|
434
390
|
function convertToArrayObject($data)
|
|
@@ -579,17 +535,7 @@ function getLoadingsFiles()
|
|
|
579
535
|
return '';
|
|
580
536
|
}
|
|
581
537
|
|
|
582
|
-
|
|
583
|
-
{
|
|
584
|
-
$token = getBearerToken();
|
|
585
|
-
if ($token) {
|
|
586
|
-
$auth = Auth::getInstance();
|
|
587
|
-
$verifyToken = $auth->verifyToken($token);
|
|
588
|
-
if ($verifyToken) {
|
|
589
|
-
$auth->authenticate($verifyToken);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
538
|
+
|
|
593
539
|
|
|
594
540
|
function getPrismaSettings(): \ArrayObject
|
|
595
541
|
{
|
|
@@ -607,15 +553,103 @@ function getPrismaSettings(): \ArrayObject
|
|
|
607
553
|
}
|
|
608
554
|
}
|
|
609
555
|
|
|
610
|
-
|
|
556
|
+
function modifyOutputLayoutForError($contentToAdd)
|
|
557
|
+
{
|
|
558
|
+
global
|
|
559
|
+
$baseUrl,
|
|
560
|
+
$metadata,
|
|
561
|
+
$content,
|
|
562
|
+
$childContent,
|
|
563
|
+
$uri,
|
|
564
|
+
$pathname,
|
|
565
|
+
$dynamicRouteParams,
|
|
566
|
+
$params,
|
|
567
|
+
$referer,
|
|
568
|
+
$mainLayoutHead,
|
|
569
|
+
$mainLayoutFooter;
|
|
570
|
+
|
|
571
|
+
$errorFile = APP_PATH . '/error.php';
|
|
572
|
+
$errorFileExists = file_exists($errorFile);
|
|
573
|
+
|
|
574
|
+
if ($_ENV['SHOW_ERRORS'] === "false") {
|
|
575
|
+
if ($errorFileExists) {
|
|
576
|
+
$contentToAdd = "<div class='error'>An error occurred</div>";
|
|
577
|
+
} else {
|
|
578
|
+
exit; // Exit if SHOW_ERRORS is false and no error file exists
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if ($errorFileExists) {
|
|
583
|
+
|
|
584
|
+
$errorContent = $contentToAdd;
|
|
585
|
+
|
|
586
|
+
$layoutFile = APP_PATH . '/layout.php';
|
|
587
|
+
if (file_exists($layoutFile)) {
|
|
588
|
+
|
|
589
|
+
ob_start();
|
|
590
|
+
include_once $errorFile;
|
|
591
|
+
$content = ob_get_clean();
|
|
592
|
+
include $layoutFile;
|
|
593
|
+
} else {
|
|
594
|
+
echo $errorContent;
|
|
595
|
+
}
|
|
596
|
+
} else {
|
|
597
|
+
echo $contentToAdd;
|
|
598
|
+
}
|
|
599
|
+
exit;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
set_error_handler(function ($severity, $message, $file, $line) {
|
|
603
|
+
if (!(error_reporting() & $severity)) {
|
|
604
|
+
// This error code is not included in error_reporting
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// Capture the specific severity types, including warnings (E_WARNING)
|
|
609
|
+
$errorContent = "<div class='error'>Error: {$severity} - {$message} in {$file} on line {$line}</div>";
|
|
610
|
+
|
|
611
|
+
// If needed, log it or output immediately based on severity
|
|
612
|
+
if ($severity === E_WARNING || $severity === E_NOTICE) {
|
|
613
|
+
modifyOutputLayoutForError($errorContent);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
|
|
617
|
+
set_exception_handler(function ($exception) {
|
|
618
|
+
$errorContent = "<div class='error'>Exception: " . htmlspecialchars($exception->getMessage(), ENT_QUOTES, 'UTF-8') . "</div>";
|
|
619
|
+
modifyOutputLayoutForError($errorContent);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
register_shutdown_function(function () {
|
|
623
|
+
$error = error_get_last();
|
|
624
|
+
if ($error !== null && in_array($error['type'], [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR])) {
|
|
625
|
+
$formattedError = "<div class='error'>Fatal Error: " . htmlspecialchars($error['message'], ENT_QUOTES, 'UTF-8') .
|
|
626
|
+
" in " . htmlspecialchars($error['file'], ENT_QUOTES, 'UTF-8') .
|
|
627
|
+
" on line " . $error['line'] . "</div>";
|
|
628
|
+
$errorContent = $formattedError;
|
|
629
|
+
modifyOutputLayoutForError($errorContent);
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
611
633
|
require_once SETTINGS_PATH . '/public-functions.php';
|
|
612
634
|
require_once SETTINGS_PATH . '/request-methods.php';
|
|
613
635
|
$_metadataFile = APP_PATH . '/metadata.php';
|
|
614
636
|
$_metadataArray = file_exists($_metadataFile) ? require_once $_metadataFile : [];
|
|
615
|
-
$_filesListRoutes =
|
|
637
|
+
$_filesListRoutes = getFilesListRoutes();
|
|
616
638
|
$_prismaPHPSettings = getPrismaSettings();
|
|
617
639
|
$_fileToInclude = '';
|
|
618
640
|
|
|
641
|
+
function authenticateUserToken()
|
|
642
|
+
{
|
|
643
|
+
$token = getBearerToken();
|
|
644
|
+
if ($token) {
|
|
645
|
+
$auth = Auth::getInstance();
|
|
646
|
+
$verifyToken = $auth->verifyToken($token);
|
|
647
|
+
if ($verifyToken) {
|
|
648
|
+
$auth->authenticate($verifyToken);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
619
653
|
/**
|
|
620
654
|
* @var array $metadata Metadata information
|
|
621
655
|
*/
|
|
@@ -656,7 +690,10 @@ try {
|
|
|
656
690
|
$_layoutsToInclude = $_determineContentToInclude['layouts'] ?? [];
|
|
657
691
|
$uri = $_determineContentToInclude['uri'] ?? '';
|
|
658
692
|
$pathname = $uri ? "/" . $uri : "/";
|
|
659
|
-
$_fileToInclude =
|
|
693
|
+
$_fileToInclude = null;
|
|
694
|
+
if (is_file($_contentToInclude)) {
|
|
695
|
+
$_fileToInclude = basename($_contentToInclude); // returns the file name
|
|
696
|
+
}
|
|
660
697
|
authenticateUserToken();
|
|
661
698
|
|
|
662
699
|
if (empty($_contentToInclude)) {
|
|
@@ -710,11 +747,11 @@ try {
|
|
|
710
747
|
|
|
711
748
|
$_isContentIncluded = false;
|
|
712
749
|
$_isChildContentIncluded = false;
|
|
713
|
-
|
|
750
|
+
$_isContentVariableIncluded = containsContent($_parentLayoutPath);
|
|
751
|
+
if (!$_isContentVariableIncluded) {
|
|
714
752
|
$_isContentIncluded = true;
|
|
715
753
|
}
|
|
716
754
|
|
|
717
|
-
ob_start();
|
|
718
755
|
if (!empty($_contentToInclude)) {
|
|
719
756
|
if (!$_isParentLayout) {
|
|
720
757
|
ob_start();
|
|
@@ -726,7 +763,8 @@ try {
|
|
|
726
763
|
continue;
|
|
727
764
|
}
|
|
728
765
|
|
|
729
|
-
|
|
766
|
+
$_isChildContentVariableIncluded = containsChildContent($layoutPath);
|
|
767
|
+
if (!$_isChildContentVariableIncluded) {
|
|
730
768
|
$_isChildContentIncluded = true;
|
|
731
769
|
}
|
|
732
770
|
|
|
@@ -759,18 +797,16 @@ try {
|
|
|
759
797
|
}
|
|
760
798
|
} else {
|
|
761
799
|
if ($_isContentIncluded) {
|
|
762
|
-
|
|
763
|
-
modifyOutputLayoutForError($content);
|
|
800
|
+
echo "<div class='error'>The parent layout file does not contain <?php echo \$content; ?> Or <?= \$content ?><br>" . "<strong>$_parentLayoutPath</strong></div>";
|
|
764
801
|
} else {
|
|
765
|
-
$
|
|
766
|
-
modifyOutputLayoutForError($
|
|
802
|
+
$errorDetails = "<div class='error'>The layout file does not contain <?php echo \$childContent; ?> or <?= \$childContent ?><br><strong>$layoutPath</strong></div>";
|
|
803
|
+
modifyOutputLayoutForError($errorDetails);
|
|
767
804
|
}
|
|
768
805
|
}
|
|
769
806
|
} catch (Throwable $e) {
|
|
770
|
-
$content = ob_get_clean();
|
|
771
807
|
$errorDetails = "Unhandled Exception: " . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8');
|
|
772
808
|
$errorDetails .= "<br>File: " . htmlspecialchars($e->getFile(), ENT_QUOTES, 'UTF-8');
|
|
773
809
|
$errorDetails .= "<br>Line: " . htmlspecialchars($e->getLine(), ENT_QUOTES, 'UTF-8');
|
|
774
|
-
$
|
|
775
|
-
modifyOutputLayoutForError($
|
|
810
|
+
$errorDetails = "<div class='error'>$errorDetails</div>";
|
|
811
|
+
modifyOutputLayoutForError($errorDetails);
|
|
776
812
|
}
|