From c8fa2b9be19bdae24de433e00bcabecef95554a2 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 2 May 2023 16:35:01 +0200 Subject: [PATCH] wait #5903 @0.5 --- src/Links/Link.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Links/Link.php b/src/Links/Link.php index 60edcdf..10bab6d 100644 --- a/src/Links/Link.php +++ b/src/Links/Link.php @@ -75,6 +75,9 @@ class Link { public $allowsAnimation = true; + protected static $_encryptedTypes = [14, 15, 35, 39]; + protected static $_encryptedAttributes = ['image_rollover']; + /** * * @var CompilerInterface @@ -682,6 +685,9 @@ class Link { * @throws \SodiumException */ public static function decryptLink($link) { + if (!in_array($link['type'], self::$_encryptedTypes)) { + return $link; + } foreach ($link as $attr => $item) { if (!str_starts_with($item, '///')) { continue; @@ -700,6 +706,7 @@ class Link { public static function decryptLinks($links) { $res = []; foreach ($links as $key => $link) { + $res[$key] = self::decryptLink($link); } return $res; @@ -718,14 +725,11 @@ class Link { * @throws SodiumException */ public static function encryptLinkAttrs($link) { - $crypted = [13, 14, 35]; - - if (!isset($link['type']) || !in_array($link['type'], $crypted)) { + if (!isset($link['type']) || !in_array($link['type'], self::$_encryptedTypes)) { return $link; } - $attrs = ['image_rollover']; - foreach ($attrs as $attr) { + foreach (self::$_encryptedAttributes as $attr) { if (!isset($link[$attr])) { continue; } -- 2.39.5