Code Duplication    Length = 10-10 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 56-65 (lines=10) @@
53
54
		if ( self::is_public_version( $version ) ) {
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 ( self::is_js_or_css_file( $src ) && in_array( substr( $src, 0, 9 ), array( 'wp-admin/', 'wp-includ' ) ) ) {
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 ( self::is_js_or_css_file( $src ) && in_array( substr( $src, 0, 9 ), array( 'wp-admin/', 'wp-includ' ) ) ) {
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 );