create-prisma-php-app 1.26.530 → 1.26.531

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.
@@ -67,25 +67,39 @@ class PHPX implements IPHPX
67
67
  /**
68
68
  * Generates and returns a string of HTML attributes from the provided props.
69
69
  * Excludes 'class' and 'children' props from being added as attributes.
70
- *
71
- * @return string The generated HTML attributes.
70
+ * Prioritizes attributes from `$this->props` if duplicates are found in `$params`.
71
+ *
72
+ * @param array $params Optional additional attributes to merge with props.
73
+ *
74
+ * @return string The generated HTML attributes as a space-separated string.
72
75
  */
73
- protected function getAttributes(): string
76
+ protected function getAttributes(array $params = []): string
74
77
  {
75
78
  // Filter out 'class' and 'children' props
76
- $filteredProps = array_filter($this->props, function ($key) {
77
- return !in_array($key, ['class', 'children']);
78
- }, ARRAY_FILTER_USE_KEY);
79
+ $filteredProps = array_filter(
80
+ $this->props,
81
+ function ($key) {
82
+ return !in_array($key, ["class", "children"]);
83
+ },
84
+ ARRAY_FILTER_USE_KEY
85
+ );
86
+
87
+ // Merge attributes, prioritizing props in case of duplicates
88
+ $attributes = array_merge($params, $filteredProps);
79
89
 
80
- // Build attributes string by escaping keys and values
81
- $attributes = [];
82
- foreach ($filteredProps as $key => $value) {
83
- $escapedKey = htmlspecialchars($key, ENT_QUOTES, 'UTF-8');
84
- $escapedValue = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
85
- $attributes[] = "$escapedKey='$escapedValue'";
90
+ // Build the attributes string by escaping keys and values
91
+ $attributeStrings = [];
92
+ foreach ($attributes as $key => $value) {
93
+ $escapedKey = htmlspecialchars($key, ENT_QUOTES, "UTF-8");
94
+ $escapedValue = htmlspecialchars(
95
+ (string) $value,
96
+ ENT_QUOTES,
97
+ "UTF-8"
98
+ );
99
+ $attributeStrings[] = "$escapedKey='$escapedValue'";
86
100
  }
87
101
 
88
- return implode(' ', $attributes);
102
+ return implode(" ", $attributeStrings);
89
103
  }
90
104
 
91
105
  /**
@@ -37,6 +37,9 @@ class TemplateCompiler
37
37
  self::initializeClassMappings();
38
38
  }
39
39
 
40
+ // Escape `&` characters that are not part of valid XML entities
41
+ $templateContent = preg_replace('/&(?![a-zA-Z0-9#]+;)/', '&', $templateContent);
42
+
40
43
  $dom = new DOMDocument();
41
44
  libxml_use_internal_errors(true);
42
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.26.530",
3
+ "version": "1.26.531",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",