Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

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