Skip to content
Permalink
Browse files Browse the repository at this point in the history
RSS: Some URl manipulations
(cherry picked from commit 10981b1)
  • Loading branch information
mjansenDatabay committed May 11, 2018
1 parent 0a312ef commit 6b2217c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Services/Feeds/classes/class.ilExternalFeedItem.php
Expand Up @@ -92,8 +92,16 @@ function secureString($a_str)
while($old_str != $a_str)
{
$old_str = $a_str;
$a_str = preg_replace("/<a href=\"([^\"]*)\">/i",
"/<a href=\"\\1\" target=\"_blank\" rel=\"noopener\">/", $a_str);
$a_str = preg_replace_callback(
'/<a href=["\']([^\"]*)["\']>/i',
function($matches) {
return sprintf(
'<a href="%s" target="_blank" rel="noopener">',
\ilUtil::secureUrl($matches[1])
);
},
$a_str
);
}
return $a_str;
}
Expand Down

0 comments on commit 6b2217c

Please sign in to comment.