@@ 37-47 (lines=11) @@ | ||
34 | ||
35 | $known_core_files = self::get_core_checksums(); |
|
36 | $site_url = trailingslashit( site_url() ); |
|
37 | foreach ( $wp_scripts->registered as $handle => $thing ) { |
|
38 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
39 | continue; |
|
40 | } |
|
41 | $src = ltrim( str_replace( $site_url, '', $thing->src ), '/' ); |
|
42 | if ( isset( $known_core_files[ $src ] ) ) { |
|
43 | $wp_scripts->registered[ $handle ]->src = sprintf('https://c0.wp.com/c/%1$s/%2$s', $wp_version, $src ); |
|
44 | $wp_scripts->registered[ $handle ]->ver = null; |
|
45 | wp_script_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
|
46 | } |
|
47 | } |
|
48 | foreach ( $wp_styles->registered as $handle => $thing ) { |
|
49 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
50 | continue; |
|
@@ 48-58 (lines=11) @@ | ||
45 | wp_script_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
|
46 | } |
|
47 | } |
|
48 | foreach ( $wp_styles->registered as $handle => $thing ) { |
|
49 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
50 | continue; |
|
51 | } |
|
52 | $src = ltrim( str_replace( $site_url, '', $thing->src ), '/' ); |
|
53 | if ( isset( $known_core_files[ $src ] ) ) { |
|
54 | $wp_styles->registered[ $handle ]->src = sprintf('https://c0.wp.com/c/%1$s/%2$s', $wp_version, $src ); |
|
55 | $wp_styles->registered[ $handle ]->ver = null; |
|
56 | wp_style_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
|
57 | } |
|
58 | } |
|
59 | ||
60 | self::cdnize_plugin_assets( 'jetpack', JETPACK__VERSION ); |
|
61 | } |