Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

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