Skip to content

Commit

Permalink
update formatting for exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
remyperona committed Dec 11, 2024
1 parent 641884c commit 507ae78
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion inc/Engine/Media/Fonts/Frontend/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,13 @@ private function is_excluded( string $url, array $exclusions ): bool {
// Escape each exclusion pattern to prevent regex issues.
$escaped_exclusions = array_map(
function ( $exclusion ) {
return preg_quote( $exclusion, '#' ); // '#' is used as the delimiter.
$query_string = preg_replace( '@(https?:)?(//)?fonts\.googleapis\.com/css2?\?@i', '', $exclusion );

return str_replace(
[ '.', '*', '#' ],
[ '\.', '\*', '\#' ],
$query_string
);
},
$exclusions
);
Expand Down

0 comments on commit 507ae78

Please sign in to comment.