create-prisma-php-app 3.3.13 → 3.3.14
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
CHANGED
|
@@ -1033,13 +1033,6 @@ try {
|
|
|
1033
1033
|
Bootstrap::createUpdateRequestData();
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
-
// If there’s caching
|
|
1037
|
-
if (isset(Bootstrap::$requestFilesData[Request::$decodedUri])) {
|
|
1038
|
-
if ($_ENV['CACHE_ENABLED'] === 'true') {
|
|
1039
|
-
CacheHandler::serveCache(Request::$decodedUri, intval($_ENV['CACHE_TTL']));
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
1036
|
// For wire calls, re-include the files if needed
|
|
1044
1037
|
if (Request::$isWire && !Bootstrap::$secondRequestC69CD) {
|
|
1045
1038
|
if (isset(Bootstrap::$requestFilesData[Request::$decodedUri])) {
|
|
@@ -1059,6 +1052,13 @@ try {
|
|
|
1059
1052
|
Bootstrap::wireCallback();
|
|
1060
1053
|
}
|
|
1061
1054
|
|
|
1055
|
+
// If there’s caching
|
|
1056
|
+
if ((!Request::$isWire && !Bootstrap::$secondRequestC69CD) && isset(Bootstrap::$requestFilesData[Request::$decodedUri])) {
|
|
1057
|
+
if ($_ENV['CACHE_ENABLED'] === 'true') {
|
|
1058
|
+
CacheHandler::serveCache(Request::$decodedUri, intval($_ENV['CACHE_TTL']));
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
1062
|
MainLayout::$children = MainLayout::$childLayoutChildren . Bootstrap::getLoadingsFiles();
|
|
1063
1063
|
|
|
1064
1064
|
ob_start();
|
|
@@ -1069,7 +1069,7 @@ try {
|
|
|
1069
1069
|
MainLayout::$html = "<!DOCTYPE html>\n" . MainLayout::$html;
|
|
1070
1070
|
|
|
1071
1071
|
if (
|
|
1072
|
-
http_response_code() === 200 && isset(Bootstrap::$requestFilesData[Request::$decodedUri]['fileName']) && $_ENV['CACHE_ENABLED'] === 'true'
|
|
1072
|
+
http_response_code() === 200 && isset(Bootstrap::$requestFilesData[Request::$decodedUri]['fileName']) && $_ENV['CACHE_ENABLED'] === 'true' && (!Request::$isWire && !Bootstrap::$secondRequestC69CD)
|
|
1073
1073
|
) {
|
|
1074
1074
|
CacheHandler::saveCache(Request::$decodedUri, MainLayout::$html);
|
|
1075
1075
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
declare(strict_types=1);
|
|
4
|
+
|
|
5
|
+
namespace Lib\PHPX;
|
|
6
|
+
|
|
7
|
+
use Lib\PHPX\PHPX;
|
|
8
|
+
|
|
9
|
+
class Fragment extends PHPX
|
|
10
|
+
{
|
|
11
|
+
/** @property ?string $as = div|span|section|article|nav|header|footer|main|aside */
|
|
12
|
+
public ?string $as = null;
|
|
13
|
+
public ?string $class = '';
|
|
14
|
+
|
|
15
|
+
public function __construct(array $props = [])
|
|
16
|
+
{
|
|
17
|
+
parent::__construct($props);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public function render(): string
|
|
21
|
+
{
|
|
22
|
+
if ($this->as !== null) {
|
|
23
|
+
$attributes = $this->getAttributes();
|
|
24
|
+
$class = $this->getMergeClasses($this->class);
|
|
25
|
+
$classAttr = $class ? "class=\"{$class}\"" : '';
|
|
26
|
+
|
|
27
|
+
return "<{$this->as} {$classAttr} {$attributes}>{$this->children}</{$this->as}>";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return $this->children;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -424,6 +424,8 @@ class TemplateCompiler
|
|
|
424
424
|
$sectionId = $idx === 0 ? $baseId : "{$baseId}{$idx}";
|
|
425
425
|
|
|
426
426
|
$html = $instance->render();
|
|
427
|
+
$html = self::preprocessFragmentSyntax($html);
|
|
428
|
+
|
|
427
429
|
$fragDom = self::convertToXml($html);
|
|
428
430
|
$root = $fragDom->documentElement;
|
|
429
431
|
foreach ($root->childNodes as $c) {
|
|
@@ -445,6 +447,14 @@ class TemplateCompiler
|
|
|
445
447
|
return $htmlOut;
|
|
446
448
|
}
|
|
447
449
|
|
|
450
|
+
private static function preprocessFragmentSyntax(string $content): string
|
|
451
|
+
{
|
|
452
|
+
$content = preg_replace('/<>/', '<Fragment>', $content);
|
|
453
|
+
$content = preg_replace('/<\/>/', '</Fragment>', $content);
|
|
454
|
+
|
|
455
|
+
return $content;
|
|
456
|
+
}
|
|
457
|
+
|
|
448
458
|
private static function selectComponentMapping(string $componentName): array
|
|
449
459
|
{
|
|
450
460
|
if (!isset(self::$classMappings[$componentName])) {
|