diff --git a/bin/phpcs-requirelist.js b/bin/phpcs-requirelist.js
index 2d9aa99b2b57d..8e922cabb5f5e 100644
--- a/bin/phpcs-requirelist.js
+++ b/bin/phpcs-requirelist.js
@@ -38,10 +38,12 @@ module.exports = [
'json-endpoints/jetpack/class-jetpack-json-api-delete-backup-helper-script-endpoint.php',
'json-endpoints/jetpack/class-jetpack-json-api-install-backup-helper-script-endpoint.php',
'load-jetpack.php',
+ 'modules/comments.php',
'modules/masterbar/',
'modules/memberships/',
'modules/module-extras.php',
'modules/module-info.php',
+ 'modules/photon.php',
'modules/post-by-email.php',
'modules/post-by-email/',
'modules/publicize.php',
diff --git a/class.jetpack.php b/class.jetpack.php
index 205d4293d86d9..e1459726fd903 100644
--- a/class.jetpack.php
+++ b/class.jetpack.php
@@ -6900,23 +6900,14 @@ public static function build_raw_urls( $url ) {
/**
* Stores and prints out domains to prefetch for page speed optimization.
*
- * @param mixed $new_urls
- */
- public static function dns_prefetch( $new_urls = null ) {
- static $prefetch_urls = array();
- if ( empty( $new_urls ) && ! empty( $prefetch_urls ) ) {
- echo "\r\n";
- foreach ( $prefetch_urls as $this_prefetch_url ) {
- printf( "\r\n", esc_attr( $this_prefetch_url ) );
- }
- } elseif ( ! empty( $new_urls ) ) {
- if ( ! has_action( 'wp_head', array( __CLASS__, __FUNCTION__ ) ) ) {
- add_action( 'wp_head', array( __CLASS__, __FUNCTION__ ) );
- }
- foreach ( (array) $new_urls as $this_new_url ) {
- $prefetch_urls[] = strtolower( untrailingslashit( preg_replace( '#^https?://#i', '//', $this_new_url ) ) );
- }
- $prefetch_urls = array_unique( $prefetch_urls );
+ * @deprecated 8.8.0 Use Jetpack::add_resource_hints.
+ *
+ * @param string|array $urls URLs to hint.
+ */
+ public static function dns_prefetch( $urls = null ) {
+ _deprecated_function( __FUNCTION__, 'jetpack-8.8.0', 'Automattic\Jetpack\Assets::add_resource_hint' );
+ if ( $urls ) {
+ Assets::add_resource_hint( $urls );
}
}
diff --git a/modules/comment-likes.php b/modules/comment-likes.php
index 8868f2688b5f8..aa7f2cb2e4402 100644
--- a/modules/comment-likes.php
+++ b/modules/comment-likes.php
@@ -13,11 +13,7 @@
use Automattic\Jetpack\Assets;
-Jetpack::dns_prefetch(
- array(
- '//widgets.wp.com',
- )
-);
+Assets::add_resource_hint( '//widgets.wp.com', 'dns-prefetch' );
require_once dirname( __FILE__ ) . '/likes/jetpack-likes-master-iframe.php';
require_once dirname( __FILE__ ) . '/likes/jetpack-likes-settings.php';
diff --git a/modules/comments.php b/modules/comments.php
index 4e607b86bdb2b..785ac4aeffa71 100644
--- a/modules/comments.php
+++ b/modules/comments.php
@@ -1,5 +1,4 @@
assertTrue( $seen_orig );
}
- /**
- * @author georgestephanis
- * @covers Jetpack::dns_prefetch
- * @since 3.3.0
- */
- public function test_dns_prefetch() {
- // Save URLs that are already in to remove them later and perform a clean test.
- ob_start();
- Jetpack::dns_prefetch();
- $remove_this = ob_get_clean();
-
- Jetpack::dns_prefetch( 'http://example1.com/' );
- Jetpack::dns_prefetch( array(
- 'http://example2.com/',
- 'https://example3.com',
- ) );
- Jetpack::dns_prefetch( 'https://example2.com' );
-
- $expected = "\r\n" .
- "\r\n" .
- "\r\n" .
- "\r\n";
-
- $this->assertEquals( $expected, str_replace( $remove_this, "\r\n", get_echo( array( 'Jetpack', 'dns_prefetch' ) ) ) );
- }
-
public function test_activating_deactivating_modules_fires_actions() {
self::reset_tracking_of_module_activation();