mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 09:53:15 +00:00
better regex, not 100% url strict but ok enough
This commit is contained in:
@@ -120,7 +120,7 @@ class TwigServiceProvider implements ServiceProviderInterface
|
||||
|
||||
$twig->addFilter(new \Twig_SimpleFilter('linkify', function (\Twig_Environment $twig, $string) use ($app) {
|
||||
return preg_replace(
|
||||
"(([^']{1})((https?|file):((/{2,4})|(\\{2,4}))[\w:#%/;$()~_?/\-=\\\.&]*)([^']{1}))"
|
||||
"/(\\W|^)(https?:\/{2,4}[\\w:#%\/;$()~_?\/\-=\\\.&]+)/m"
|
||||
,
|
||||
'$1$2 <a title="' . $app['translator']->trans('Open the URL in a new window') . '" class="ui-icon ui-icon-extlink" href="$2" style="display:inline;padding:2px 5px;margin:0 4px 0 2px;" target="_blank"> </a>$7'
|
||||
, $string
|
||||
|
Reference in New Issue
Block a user