create-prisma-php-app 1.11.9 → 1.11.10
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 +37 -17
- package/dist/src/app/index.php +1 -1
- package/package.json +1 -1
package/dist/bootstrap.php
CHANGED
|
@@ -250,9 +250,12 @@ $childContent = "";
|
|
|
250
250
|
function containsChildContent($filePath)
|
|
251
251
|
{
|
|
252
252
|
$fileContent = file_get_contents($filePath);
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
253
|
+
if (
|
|
254
|
+
(strpos($fileContent, 'echo $childContent') === false &&
|
|
255
|
+
strpos($fileContent, 'echo $childContent;') === false) &&
|
|
256
|
+
(strpos($fileContent, '<?= $childContent ?>') === false) &&
|
|
257
|
+
(strpos($fileContent, '<?= $childContent; ?>') === false)
|
|
258
|
+
) {
|
|
256
259
|
return true;
|
|
257
260
|
} else {
|
|
258
261
|
return false;
|
|
@@ -262,8 +265,12 @@ function containsChildContent($filePath)
|
|
|
262
265
|
function containsContent($filePath)
|
|
263
266
|
{
|
|
264
267
|
$fileContent = file_get_contents($filePath);
|
|
265
|
-
|
|
266
|
-
|
|
268
|
+
if (
|
|
269
|
+
(strpos($fileContent, 'echo $content') === false &&
|
|
270
|
+
strpos($fileContent, 'echo $content;') === false) &&
|
|
271
|
+
(strpos($fileContent, '<?= $content ?>') === false) &&
|
|
272
|
+
(strpos($fileContent, '<?= $content; ?>') === false)
|
|
273
|
+
) {
|
|
267
274
|
return true;
|
|
268
275
|
} else {
|
|
269
276
|
return false;
|
|
@@ -300,8 +307,10 @@ try {
|
|
|
300
307
|
$parentLayoutPath = APP_PATH . '/layout.php';
|
|
301
308
|
$isParentLayout = !empty($layoutsToInclude) && strpos($layoutsToInclude[0], 'src/app/layout.php') !== false;
|
|
302
309
|
|
|
303
|
-
|
|
304
|
-
|
|
310
|
+
$isContentIncluded = false;
|
|
311
|
+
$isChildContentIncluded = false;
|
|
312
|
+
if (containsContent($parentLayoutPath)) {
|
|
313
|
+
$isContentIncluded = true;
|
|
305
314
|
}
|
|
306
315
|
|
|
307
316
|
ob_start();
|
|
@@ -312,13 +321,16 @@ try {
|
|
|
312
321
|
$childContent = ob_get_clean();
|
|
313
322
|
}
|
|
314
323
|
foreach (array_reverse($layoutsToInclude) as $layoutPath) {
|
|
315
|
-
|
|
316
|
-
|
|
324
|
+
if ($parentLayoutPath === $layoutPath) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
|
|
317
328
|
if (containsChildContent($layoutPath)) {
|
|
318
|
-
|
|
319
|
-
} else {
|
|
320
|
-
$content .= "<div class='error'>The layout file does not contain <?php echo \$childContent ?> Or <?= \$childContent ?><br>" . "<strong>$layoutPath</strong></div>";
|
|
329
|
+
$isChildContentIncluded = true;
|
|
321
330
|
}
|
|
331
|
+
|
|
332
|
+
ob_start();
|
|
333
|
+
require_once $layoutPath;
|
|
322
334
|
$childContent = ob_get_clean();
|
|
323
335
|
}
|
|
324
336
|
} else {
|
|
@@ -333,11 +345,19 @@ try {
|
|
|
333
345
|
$childContent = ob_get_clean();
|
|
334
346
|
}
|
|
335
347
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
348
|
+
if (!$isContentIncluded && !$isChildContentIncluded) {
|
|
349
|
+
$content .= $childContent;
|
|
350
|
+
ob_start();
|
|
351
|
+
require_once APP_PATH . '/layout.php';
|
|
352
|
+
} else {
|
|
353
|
+
if ($isContentIncluded) {
|
|
354
|
+
$content .= "<div class='error'>The parent layout file does not contain <?php echo \$content; ?> Or <?= \$content ?><br>" . "<strong>$parentLayoutPath</strong></div>";
|
|
355
|
+
modifyOutputLayoutForError($content);
|
|
356
|
+
} else {
|
|
357
|
+
$content .= "<div class='error'>The layout file does not contain <?php echo \$childContent; ?> or <?= \$childContent ?><br><strong>$layoutPath</strong></div>";
|
|
358
|
+
modifyOutputLayoutForError($content);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
341
361
|
} catch (Throwable $e) {
|
|
342
362
|
$content = ob_get_clean();
|
|
343
363
|
$content .= "<div class='error'>Unhandled Exception: " . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . "</div>";
|
package/dist/src/app/index.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="flex flex-col min-h-[100vh]">
|
|
2
2
|
<header class="px-4 lg:px-6 h-14 flex items-center">
|
|
3
|
-
<a class="flex items-center justify-center" href="
|
|
3
|
+
<a class="flex items-center justify-center" href="/">
|
|
4
4
|
<img class="h-10 w-10" src="<?= $baseUrl ?>assets/images/prisma-php.png" alt="Prisma PHP">
|
|
5
5
|
<span class="sr-only">Prisma PHP</span>
|
|
6
6
|
</a>
|