From 284733886eb55881681f6b8ee1f55807f71107f7 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 12 Apr 2024 09:36:27 +0300 Subject: [PATCH] add escape method --- src/Pango.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Pango.php b/src/Pango.php index 69670e5..6c17092 100644 --- a/src/Pango.php +++ b/src/Pango.php @@ -31,7 +31,7 @@ class Pango { $lines[$index] = sprintf( '%s', - htmlentities( + self::escape( $h1 ) ); @@ -44,7 +44,7 @@ class Pango { $lines[$index] = sprintf( '%s', - htmlentities( + self::escape( $h2 ) ); @@ -57,7 +57,7 @@ class Pango { $lines[$index] = sprintf( '%s', - htmlentities( + self::escape( $h3 ) ); @@ -70,7 +70,7 @@ class Pango { if (!in_array($index, $escaped)) { - $lines[$index] = htmlentities( + $lines[$index] = self::escape( $line ); } @@ -83,4 +83,13 @@ class Pango $lines ); } + + public static function escape( + string $value + ): string + { + return htmlspecialchars( + $value + ); + } } \ No newline at end of file