Skip to content

Commit d374ae2

Browse files
committed
adhere to cloudinary naming convention, use and in_array method
1 parent e2ead80 commit d374ae2

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

php/class-delivery.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,17 @@ protected function setup_hooks() {
765765
*/
766766
public function dns_prefetch( $urls, $relation_type ) {
767767

768-
$relation_type = apply_filters('cld_dns_prefetch', $relation_type);
768+
/**
769+
* Filter to provide option to omit prefetch.
770+
*
771+
* @hook cloudinary_dns_prefetch_types
772+
*
773+
*/
774+
$resource_hints = apply_filters( 'cloudinary_dns_prefetch_types', array ( 'dns-prefetch', 'preconnect' ) );
769775

770-
if ( 'dns-prefetch' === $relation_type || 'preconnect' === $relation_type ) {
771-
$urls[] = $this->media->base_url;
772-
}
776+
if ( in_array( $relation_type, $resource_hints, true ) {
777+
$urls[] = $this->media->base_url;
778+
}
773779

774780
return $urls;
775781
}

0 commit comments

Comments
 (0)