Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 35-44 (lines=10) @@
32
33
		if ( ! empty( $known_core_files ) && is_array( $known_core_files ) ) {
34
			$site_url = trailingslashit( site_url() );
35
			foreach ( $wp_scripts->registered as $handle => $thing ) {
36
				if ( wp_startswith( $thing->src, self::CDN ) ) {
37
					continue;
38
				}
39
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
40
				if ( in_array( $src, $known_core_files ) ) {
41
					$wp_scripts->registered[ $handle ]->src = sprintf(self::CDN . 'c/%1$s/%2$s', $wp_version, $src );
42
					$wp_scripts->registered[ $handle ]->ver = null;
43
				}
44
			}
45
			foreach ( $wp_styles->registered as $handle => $thing ) {
46
				if ( wp_startswith( $thing->src, self::CDN ) ) {
47
					continue;
@@ 45-54 (lines=10) @@
42
					$wp_scripts->registered[ $handle ]->ver = null;
43
				}
44
			}
45
			foreach ( $wp_styles->registered as $handle => $thing ) {
46
				if ( wp_startswith( $thing->src, self::CDN ) ) {
47
					continue;
48
				}
49
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
50
				if ( in_array( $src, $known_core_files ) ) {
51
					$wp_styles->registered[ $handle ]->src = sprintf(self::CDN . 'c/%1$s/%2$s', $wp_version, $src );
52
					$wp_styles->registered[ $handle ]->ver = null;
53
				}
54
			}
55
		}
56
57
		self::cdnize_plugin_assets( 'jetpack', JETPACK__VERSION );