1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

remove $safe flag

This commit is contained in:
Aidan Woods 2017-05-07 13:45:59 +01:00
parent 2e4afde68d
commit 226f636360
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -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;