HEX
Server: Apache/2
System: Linux vps33975.sdns.vn 3.10.0-1160.15.2.el7.x86_64 #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64
User: agritom (1060)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/agritom/public_html/wp-content/plugins/breeze/inc/class-breeze-dns-prefetch.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit;
}

class Breeze_DNS_Prefetch {

	function __construct() {
		add_filter( 'wp_resource_hints', array( &$this, 'breeze_dns_prefetch' ), 10, 2 );
	}

	/**
	 * Optimize by adding URLs to the prefetch DNS list.
	 *
	 * @param array $urls Array of resources and their attributes, or URLs to print for resource hints.
	 * @param string $relation_type The relation type the URLs are printed for,  e.g. 'preconnect' or 'prerender'.
	 *
	 * @return array
	 * @since 2.0.2
	 * @access public
	 */
	public function breeze_dns_prefetch( $urls, $relation_type ) {

		$prefetch_url_list = Breeze_Options_Reader::get_option_value( 'breeze-prefetch-urls' );
		if ( ! is_array( $prefetch_url_list ) ) {
			$prefetch_url_list = array();
		}

		if ( ! empty( $prefetch_url_list ) ) {
			$prefetch_url_list = array_map( 'breeze_rtrim_urls', $prefetch_url_list );
			$prefetch_url_list = array_map( array( $this, 'clean_schema' ), $prefetch_url_list );

			foreach ( $prefetch_url_list as $url_domain ) {

				if ( 'dns-prefetch' === $relation_type ) {
					$urls[] = $url_domain;
				}
			}
		}

		return $urls;
	}

	/**
	 * Remove link schema.
	 *
	 * @param string $current_url Given url string.
	 *
	 * @return string
	 * @since 2.0.2
	 * @access public
	 */
	private function clean_schema( $current_url ) {
		return ltrim( $current_url, 'https:' );
	}
}

new Breeze_DNS_Prefetch();