@@ 44-55 (lines=12) @@ | ||
41 | $jetpack_asset_hashes = self::get_plugin_checksums( $jetpack_version, 'jetpack' ); |
|
42 | $jetpack_directory_url = plugins_url( '/', JETPACK__PLUGIN_FILE ); |
|
43 | ||
44 | foreach ( $wp_scripts->registered as $handle => $thing ) { |
|
45 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
46 | continue; |
|
47 | } |
|
48 | if ( wp_startswith( $thing->src, $jetpack_directory_url ) ) { |
|
49 | $local_path = substr( $thing->src, strlen( $jetpack_directory_url ) ); |
|
50 | if ( isset( $jetpack_asset_hashes[ $local_path ] ) ) { |
|
51 | $wp_scripts->registered[ $handle ]->src = sprintf('https://c0.wp.com/p/jetpack/%1$s/%2$s', $jetpack_version, $local_path ); |
|
52 | wp_script_add_data( $handle, 'integrity', 'sha256-' . base64_encode( $jetpack_asset_hashes[ $local_path ] ) ); |
|
53 | } |
|
54 | } |
|
55 | } |
|
56 | foreach ( $wp_styles->registered as $handle => $thing ) { |
|
57 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
58 | continue; |
|
@@ 56-67 (lines=12) @@ | ||
53 | } |
|
54 | } |
|
55 | } |
|
56 | foreach ( $wp_styles->registered as $handle => $thing ) { |
|
57 | if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
|
58 | continue; |
|
59 | } |
|
60 | if ( wp_startswith( $thing->src, $jetpack_directory_url ) ) { |
|
61 | $local_path = substr( $thing->src, strlen( $jetpack_directory_url ) ); |
|
62 | if ( isset( $jetpack_asset_hashes[ $local_path ] ) ) { |
|
63 | $wp_styles->registered[ $handle ]->src = sprintf('https://c0.wp.com/p/jetpack/%1$s/%2$s', $jetpack_version, $local_path ); |
|
64 | wp_style_add_data( $handle, 'integrity', 'sha256-' . base64_encode( $jetpack_asset_hashes[ $local_path ] ) ); |
|
65 | } |
|
66 | } |
|
67 | } |
|
68 | } |
|
69 | } |
|
70 |