Skip to content

Commit

Permalink
Use the returned modified copy.
Browse files Browse the repository at this point in the history
Remove the empty entries.
  • Loading branch information
mikelittle committed Apr 10, 2024
1 parent 48f5801 commit 50b9cbb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ function remove_emoji() {
/**
* Remove domains from DNS prefetching.
*
* @param array $urls URLs for resources.
* @param array $urls URLs for resources.
* @param string $relation_type Relation type.
*
* @return array New array with resources.
*/
function remove_domains_from_dns_prefetch( array $urls, string $relation_type ) : array {
Expand All @@ -246,14 +247,14 @@ function remove_domains_from_dns_prefetch( array $urls, string $relation_type )

$url = $url['href'];
}
array_map( function ( $domain ) use ( $key, $url, $urls ) {
$urls = array_map( function ( $domain ) use ( $key, $url, $urls ) {
if ( str_contains( $url, $domain ) ) {
unset( $urls[ $key ] );
}
}, $domains_to_remove );

}
return $urls;

return array_filter( $urls );
}

/**
Expand All @@ -264,8 +265,8 @@ function remove_domains_from_dns_prefetch( array $urls, string $relation_type )
function get_prefetch_domains_to_remove() : array {
$domains = [
'https://s.w.org/images/core/emoji/',
] ;
if ( defined('S3_UPLOADS_BUCKET_URL') ) {
];
if ( defined( 'S3_UPLOADS_BUCKET_URL' ) ) {
$domains[] = S3_UPLOADS_BUCKET_URL;
}

Expand Down

0 comments on commit 50b9cbb

Please sign in to comment.