Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 70-79 (lines=10) @@
67
68
		if ( self::is_public_version( $version ) ) {
69
			$site_url = trailingslashit( site_url() );
70
			foreach ( $wp_scripts->registered as $handle => $thing ) {
71
				if ( wp_startswith( $thing->src, self::CDN ) ) {
72
					continue;
73
				}
74
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
75
				if ( self::is_js_or_css_file( $src ) && in_array( substr( $src, 0, 9 ), array( 'wp-admin/', 'wp-includ' ) ) ) {
76
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'c/%1$s/%2$s', $version, $src );
77
					$wp_scripts->registered[ $handle ]->ver = null;
78
				}
79
			}
80
			foreach ( $wp_styles->registered as $handle => $thing ) {
81
				if ( wp_startswith( $thing->src, self::CDN ) ) {
82
					continue;
@@ 80-89 (lines=10) @@
77
					$wp_scripts->registered[ $handle ]->ver = null;
78
				}
79
			}
80
			foreach ( $wp_styles->registered as $handle => $thing ) {
81
				if ( wp_startswith( $thing->src, self::CDN ) ) {
82
					continue;
83
				}
84
				$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' );
85
				if ( self::is_js_or_css_file( $src ) && in_array( substr( $src, 0, 9 ), array( 'wp-admin/', 'wp-includ' ) ) ) {
86
					$wp_styles->registered[ $handle ]->src = sprintf( self::CDN . 'c/%1$s/%2$s', $version, $src );
87
					$wp_styles->registered[ $handle ]->ver = null;
88
				}
89
			}
90
		}
91
92
		self::cdnize_plugin_assets( 'jetpack', JETPACK__VERSION );