From 226f636360d29060f9d6d15ec47ce5de575a226c Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sun, 7 May 2017 13:45:59 +0100 Subject: [PATCH] remove $safe flag --- Parsedown.php | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 096c399..42b8298 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -1547,29 +1547,23 @@ class Parsedown { if ($this->safeLinksEnabled) { - $safe = false; - foreach ($this->safeLinksWhitelist as $scheme) { if (self::striAtStart($Element['attributes'][$attribute], $scheme)) { - $safe = true; - - break; + return $Element; } } - if ( ! $safe) - { - $Element['attributes'][$attribute] = preg_replace_callback( - '/[^\/#?&=%]++/', - function (array $match) - { - return urlencode($match[0]); - }, - $Element['attributes'][$attribute] - ); - } + $Element['attributes'][$attribute] = preg_replace_callback( + '/[^\/#?&=%]++/', + function (array $match) + { + return urlencode($match[0]); + }, + $Element['attributes'][$attribute] + ); + } return $Element;