From 0a747bd0cc487e5b35a88fdb7ee94757fac962b9 Mon Sep 17 00:00:00 2001 From: Julien Turbide Date: Wed, 21 Feb 2024 01:29:16 -0500 Subject: [PATCH] fix deprecated and json escaper --- src/Tag.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Tag.php b/src/Tag.php index b06c835b..3dd28134 100644 --- a/src/Tag.php +++ b/src/Tag.php @@ -109,22 +109,23 @@ public static function implodeSprintf(array $array, string $format = '%s', ?stri public static function escapeParam($value = null, ?string $attr = null, string $glue = ' '): array { $escaper = self::getEscaperService(); + assert($escaper instanceof \Zemit\Html\Escaper); - $attr = $escaper->escapeHtmlAttr($attr); + $attr = $escaper->attributes($attr); switch ($attr) { case 'css': case 'style': - $value = $escaper->escapeCss($value); + $value = $escaper->css($value); break; case 'js': case 'javascript': - $value = $escaper->escapeJs($value); + $value = $escaper->js($value); break; case 'href': case 'url': - $value = $escaper->escapeUrl($value); + $value = $escaper->url($value); break; default: @@ -132,7 +133,7 @@ public static function escapeParam($value = null, ?string $attr = null, string $ if (is_array($value)) { if (isset($value[0]) && is_string($value[0])) { foreach ($value as &$v) { - $v = $escaper->escapeHtmlAttr($v); + $v = $escaper->attributes($v); } $value = implode($glue, $value); } @@ -148,7 +149,7 @@ public static function escapeParam($value = null, ?string $attr = null, string $ } // default escaper else { - $value = $escaper->escapeHtmlAttr($value); + $value = $escaper->attributes($value); } break; }