create-prisma-php-app 1.19.2 → 1.19.4

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.
@@ -200,8 +200,8 @@ function findGroupFolder($uri): string
200
200
 
201
201
  function dynamicRoute($uri)
202
202
  {
203
- global $_filesListRoutes;
204
- global $dynamicRouteParams;
203
+ global $_filesListRoutes, $dynamicRouteParams;
204
+
205
205
  $uriMatch = null;
206
206
  $normalizedUri = ltrim(str_replace('\\', '/', $uri), './');
207
207
  $normalizedUriEdited = "src/app/$normalizedUri";
@@ -522,18 +522,20 @@ function wireCallback()
522
522
 
523
523
  function getLoadingsFiles()
524
524
  {
525
- global $_filesListRoutes;
525
+ global $_filesListRoutes, $uri, $pathname, $dynamicRouteParams, $params, $referer;
526
526
 
527
527
  $loadingFiles = array_filter($_filesListRoutes, function ($route) {
528
528
  $normalizedRoute = str_replace('\\', '/', $route);
529
- $isLoadingFile = preg_match('/\/loading\.php$/', $normalizedRoute);
530
- return $isLoadingFile;
529
+ return preg_match('/\/loading\.php$/', $normalizedRoute);
531
530
  });
532
531
 
533
- $haveLoadingFileContent = array_reduce($loadingFiles, function ($carry, $route) {
532
+ $haveLoadingFileContent = array_reduce($loadingFiles, function ($carry, $route) use ($uri, $pathname, $dynamicRouteParams, $params, $referer) {
534
533
  $normalizeUri = str_replace('\\', '/', $route);
535
534
  $fileUrl = str_replace('./src/app', '', $normalizeUri);
536
- $content = @file_get_contents($route);
535
+
536
+ ob_start();
537
+ include($route); // This will execute the PHP code in loading.php
538
+ $content = ob_get_clean();
537
539
 
538
540
  if ($content !== false) {
539
541
  $url = $fileUrl === '/loading.php' ? '/' : str_replace('/loading.php', '', $fileUrl);
@@ -32,6 +32,7 @@ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
32
32
  $domainName = $_SERVER['HTTP_HOST'];
33
33
  $scriptName = dirname($_SERVER['SCRIPT_NAME']) . '/';
34
34
  $baseUrl = $protocol . $domainName . rtrim($scriptName, '/') . '/src/app/';
35
+ $referer = $_SERVER['HTTP_REFERER'] ?? 'Unknown';
35
36
 
36
37
  $params = [];
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.19.2",
3
+ "version": "1.19.4",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",