protected function filterUrls($source) { $router =
$this->
get(RouterInterface::
class);
$baseFile =
preg_quote($router->
getContext()->
getBaseFile(), '#'
);
$regex = '#<(a|form|iframe|link|img)[^<>]*(href|src|action)="(' .
$baseFile . '[^"]*)".*>#Umsi';
if (preg_match_all($regex,
$source,
$matches) > 0
) { $urls =
array_map('htmlspecialchars_decode',
$matches[3
]);
$combinedUrls =
array_combine($matches[3
],
$router->
generateList($urls));
if (\
is_array($combinedUrls)) { $this->urls =
$combinedUrls;
} } // Rewrite urls in rss and atom feeds
$regex = '#<(guid|link|id)>(' .
$baseFile . '[^<]*)</(guid|link|id)>#Umsi';
if (preg_match_all($regex,
$source,
$matches) > 0
) { $urls =
array_map('htmlspecialchars_decode',
$matches[2
]);
$urls =
array_combine($matches[2
],
$router->
generateList($urls));
if (!\
is_array($urls)) { throw new RuntimeException('Arrays could not be combined'
);
}