protected function remove_aws_query_strings($content, $base_url = '')
{
$pattern = '\\?[^\\s"<\\?]*(?:X-Amz-Algorithm|AWSAccessKeyId)=[^\\s"<\\?]+';
$group = 0;
if (!empty($base_url)) {
$pattern = preg_quote($base_url, '/') . '[^\\s"<\\?]+(' . $pattern . ')';
$group = 1;
}
if (!preg_match_all('/' . $pattern . '/', $content, $matches) || !isset($matches[$group])) {
// No query strings found, return
return $content;
}
$matches = array_unique($matches[$group]);
foreach ($matches as $match) {
$content = str_replace($match, '', $content);
}
return $content;
}