|
@@ 37-46 (lines=10) @@
|
| 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/core/%1$s/%2$s', $wp_version, $src ); |
| 44 |
|
wp_script_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
| 45 |
|
} |
| 46 |
|
} |
| 47 |
|
foreach ( $wp_styles->registered as $handle => $thing ) { |
| 48 |
|
if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
| 49 |
|
continue; |
|
@@ 47-56 (lines=10) @@
|
| 44 |
|
wp_script_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
| 45 |
|
} |
| 46 |
|
} |
| 47 |
|
foreach ( $wp_styles->registered as $handle => $thing ) { |
| 48 |
|
if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
| 49 |
|
continue; |
| 50 |
|
} |
| 51 |
|
$src = ltrim( str_replace( $site_url, '', $thing->src ), '/' ); |
| 52 |
|
if ( isset( $known_core_files[ $src ] ) ) { |
| 53 |
|
$wp_styles->registered[ $handle ]->src = sprintf('https://c0.wp.com/core/%1$s/%2$s', $wp_version, $src ); |
| 54 |
|
wp_style_add_data( $handle, 'integrity', 'md5-' . base64_encode( $known_core_files[ $src ] ) ); |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
$jetpack_version = JETPACK__VERSION; |
| 59 |
|
|