create-prisma-php-app 1.17.2 → 1.17.3

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.
@@ -448,7 +448,7 @@ function wireCallback()
448
448
  // Prepare success response
449
449
  $response = [
450
450
  'success' => true,
451
- 'response' => htmlspecialchars($callbackResponse)
451
+ 'response' => $callbackResponse
452
452
  ];
453
453
  } else {
454
454
  // Handle non-string responses
@@ -89,6 +89,8 @@ class AuthMiddleware
89
89
  // Handle the case where the requestUri is empty, which means home or "/"
90
90
  if (empty($requestUri) || $requestUri === '/') {
91
91
  $requestUri = '/';
92
+ } else {
93
+ $requestUri = "/" . $requestUri;
92
94
  }
93
95
 
94
96
  $regex = "#^/?" . preg_quote($pattern, '#') . "(/.*)?$#";
@@ -12,12 +12,20 @@ class Validator
12
12
  /**
13
13
  * Validate and sanitize a string.
14
14
  *
15
- * @param mixed $value The value to validate.
16
- * @return string The sanitized string.
15
+ * This function ensures that the input is a valid string, trims any leading
16
+ * or trailing whitespace, and converts special characters to HTML entities
17
+ * to prevent XSS attacks. If the input is not a string, an empty string is returned.
18
+ *
19
+ * @param mixed $value The value to validate and sanitize.
20
+ * @return string The sanitized string or an empty string if the input is not a string.
17
21
  */
18
22
  public static function string($value): string
19
23
  {
20
- return $value !== null ? htmlspecialchars(trim($value), ENT_QUOTES, 'UTF-8') : '';
24
+ if (is_string($value)) {
25
+ return htmlspecialchars(trim($value), ENT_QUOTES, 'UTF-8');
26
+ }
27
+
28
+ return '';
21
29
  }
22
30
 
23
31
  /**
@@ -210,4 +218,127 @@ class Validator
210
218
  $purifier = new HTMLPurifier($config);
211
219
  return $purifier->purify($html);
212
220
  }
221
+
222
+ /**
223
+ * Converts emojis or special characters in the message content to appropriate HTML entities or format.
224
+ *
225
+ * @param string $content The content to process.
226
+ * @return string The processed content.
227
+ */
228
+ public static function emojis($content): string
229
+ {
230
+ static $emojiMap = [
231
+ ':)' => '😊',
232
+ ':-)' => '😊',
233
+ ':(' => 'â˜šī¸',
234
+ ':-(' => 'â˜šī¸',
235
+ ':D' => '😄',
236
+ ':-D' => '😄',
237
+ ':P' => '😛',
238
+ ':-P' => '😛',
239
+ ';)' => '😉',
240
+ ';-)' => '😉',
241
+ ':o' => '😮',
242
+ ':-o' => '😮',
243
+ ':O' => '😮',
244
+ ':-O' => '😮',
245
+ 'B)' => '😎',
246
+ 'B-)' => '😎',
247
+ ':|' => '😐',
248
+ ':-|' => '😐',
249
+ ':/' => '😕',
250
+ ':-/' => '😕',
251
+ ':\\' => '😕',
252
+ ':-\\' => '😕',
253
+ ':*' => '😘',
254
+ ':-*' => '😘',
255
+ '<3' => 'â¤ī¸',
256
+ '</3' => '💔',
257
+ ':@' => '😡',
258
+ ':-@' => '😡',
259
+ ':S' => '😖',
260
+ ':-S' => '😖',
261
+ ':$' => 'đŸ˜ŗ',
262
+ ':-$' => 'đŸ˜ŗ',
263
+ ':X' => '🤐',
264
+ ':-X' => '🤐',
265
+ ':#' => '🤐',
266
+ ':-#' => '🤐',
267
+ ':^)' => '😊',
268
+ ':v' => '😋',
269
+ ':3' => 'đŸ˜ē',
270
+ 'O:)' => '😇',
271
+ 'O:-)' => '😇',
272
+ '>:)' => '😈',
273
+ '>:-)' => '😈',
274
+ 'D:' => '😧',
275
+ 'D-:' => '😧',
276
+ ':-o' => 'đŸ˜¯',
277
+ ':p' => '😋',
278
+ ':-p' => '😋',
279
+ ':b' => '😋',
280
+ ':-b' => '😋',
281
+ ':^/' => '😕',
282
+ ':-^/' => '😕',
283
+ '>_<' => 'đŸ˜Ŗ',
284
+ '-_-' => '😑',
285
+ '^_^' => '😊',
286
+ 'T_T' => 'đŸ˜ĸ',
287
+ 'TT_TT' => '😭',
288
+ 'xD' => '😆',
289
+ 'XD' => '😆',
290
+ 'xP' => '😝',
291
+ 'XP' => '😝',
292
+ ':wave:' => '👋',
293
+ ':thumbsup:' => '👍',
294
+ ':thumbsdown:' => '👎',
295
+ ':clap:' => '👏',
296
+ ':fire:' => 'đŸ”Ĩ',
297
+ ':100:' => 'đŸ’¯',
298
+ ':poop:' => '💩',
299
+ ':smile:' => '😄',
300
+ ':smirk:' => '😏',
301
+ ':sob:' => '😭',
302
+ ':heart:' => 'â¤ī¸',
303
+ ':broken_heart:' => '💔',
304
+ ':grin:' => '😁',
305
+ ':joy:' => '😂',
306
+ ':cry:' => 'đŸ˜ĸ',
307
+ ':angry:' => '😠',
308
+ ':sunglasses:' => '😎',
309
+ ':kiss:' => '😘',
310
+ ':thinking:' => '🤔',
311
+ ':shocked:' => '😲',
312
+ ':shhh:' => 'đŸ¤Ģ',
313
+ ':nerd:' => '🤓',
314
+ ':cool:' => '😎',
315
+ ':scream:' => '😱',
316
+ ':zzz:' => '💤',
317
+ ':celebrate:' => '🎉',
318
+ ':ok_hand:' => '👌',
319
+ ':pray:' => '🙏',
320
+ ':muscle:' => 'đŸ’Ē',
321
+ ':tada:' => '🎉',
322
+ ':eyes:' => '👀',
323
+ ':star:' => '⭐',
324
+ ':bulb:' => '💡',
325
+ ':chicken:' => '🐔',
326
+ ':cow:' => '🐮',
327
+ ':dog:' => 'đŸļ',
328
+ ':cat:' => '🐱',
329
+ ':fox:' => 'đŸĻŠ',
330
+ ':lion:' => 'đŸĻ',
331
+ ':penguin:' => '🐧',
332
+ ':pig:' => '🐷',
333
+ ':rabbit:' => '🐰',
334
+ ':tiger:' => 'đŸ¯',
335
+ ':unicorn:' => 'đŸĻ„',
336
+ ':bear:' => 'đŸģ',
337
+ ':elephant:' => '🐘',
338
+ ':monkey:' => '🐒',
339
+ ':panda:' => 'đŸŧ',
340
+ ];
341
+
342
+ return strtr($content, $emojiMap);
343
+ }
213
344
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.17.2",
3
+ "version": "1.17.3",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",