Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 56-65 (lines=10) @@
53
54
		if ( ! empty( $known_core_files ) && is_array( $known_core_files ) ) {
55
			$site_url = trailingslashit( site_url() );
56
			foreach ( $wp_scripts->registered as $handle => $thing ) {
57
				if ( wp_startswith( $thing->src, self::CDN ) ) {
58
					continue;
59
				}
60
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
61
				if ( in_array( $src, $known_core_files, true ) ) {
62
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'c/%1$s/%2$s', $version, $src );
63
					$wp_scripts->registered[ $handle ]->ver = null;
64
				}
65
			}
66
			foreach ( $wp_styles->registered as $handle => $thing ) {
67
				if ( wp_startswith( $thing->src, self::CDN ) ) {
68
					continue;
@@ 66-75 (lines=10) @@
63
					$wp_scripts->registered[ $handle ]->ver = null;
64
				}
65
			}
66
			foreach ( $wp_styles->registered as $handle => $thing ) {
67
				if ( wp_startswith( $thing->src, self::CDN ) ) {
68
					continue;
69
				}
70
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
71
				if ( in_array( $src, $known_core_files, true ) ) {
72
					$wp_styles->registered[ $handle ]->src = sprintf( self::CDN . 'c/%1$s/%2$s', $version, $src );
73
					$wp_styles->registered[ $handle ]->ver = null;
74
				}
75
			}
76
		}
77
78
		self::cdnize_plugin_assets( 'jetpack', JETPACK__VERSION );