[YoutubeBridge] Improve URL handling in video descriptions

This improves the translation of regular text to anchors by adding
support for additional characters '?&=-_' to fix common URLs.

Notice: The regex pattern is by no means complete. That means it is
likely to break in the future. More sophistiated solutions however
are insanely complex. See: http://stackoverflow.com/a/190405

References #520
This commit is contained in:
logmanoriginal 2017-05-02 22:03:38 +02:00
parent 5b541e380a
commit 627038e2fa

View file

@ -78,7 +78,7 @@ class YoutubeBridge extends BridgeAbstract {
// Make sure the description is easy on the eye :)
$desc = htmlspecialchars($desc);
$desc = nl2br($desc);
$desc = preg_replace('/(http[s]{0,1}\:\/\/[a-zA-Z0-9.\/]{4,})/ims',
$desc = preg_replace('/(http[s]{0,1}\:\/\/[a-zA-Z0-9.\/\?\&=\-_]{4,})/ims',
'<a href="$1" target="_blank">$1</a> ',
$desc);