|
@@ 74-86 (lines=13) @@
|
| 71 |
|
$asset_hashes = self::get_plugin_checksums( $current_version, $plugin_slug ); |
| 72 |
|
$plugin_directory_url = plugins_url() . '/' . $plugin_slug . '/'; |
| 73 |
|
|
| 74 |
|
foreach ( $wp_scripts->registered as $handle => $thing ) { |
| 75 |
|
if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
| 76 |
|
continue; |
| 77 |
|
} |
| 78 |
|
if ( wp_startswith( $thing->src, $plugin_directory_url ) ) { |
| 79 |
|
$local_path = substr( $thing->src, strlen( $plugin_directory_url ) ); |
| 80 |
|
if ( isset( $asset_hashes[ $local_path ] ) ) { |
| 81 |
|
$wp_scripts->registered[ $handle ]->src = sprintf('https://c0.wp.com/p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path ); |
| 82 |
|
$wp_scripts->registered[ $handle ]->ver = null; |
| 83 |
|
wp_script_add_data( $handle, 'integrity', 'sha256-' . base64_encode( $asset_hashes[ $local_path ] ) ); |
| 84 |
|
} |
| 85 |
|
} |
| 86 |
|
} |
| 87 |
|
foreach ( $wp_styles->registered as $handle => $thing ) { |
| 88 |
|
if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
| 89 |
|
continue; |
|
@@ 87-99 (lines=13) @@
|
| 84 |
|
} |
| 85 |
|
} |
| 86 |
|
} |
| 87 |
|
foreach ( $wp_styles->registered as $handle => $thing ) { |
| 88 |
|
if ( wp_startswith( $thing->src, 'https://c0.wp.com/' ) ) { |
| 89 |
|
continue; |
| 90 |
|
} |
| 91 |
|
if ( wp_startswith( $thing->src, $plugin_directory_url ) ) { |
| 92 |
|
$local_path = substr( $thing->src, strlen( $plugin_directory_url ) ); |
| 93 |
|
if ( isset( $asset_hashes[ $local_path ] ) ) { |
| 94 |
|
$wp_styles->registered[ $handle ]->src = sprintf('https://c0.wp.com/p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path ); |
| 95 |
|
$wp_styles->registered[ $handle ]->ver = null; |
| 96 |
|
wp_style_add_data( $handle, 'integrity', 'sha256-' . base64_encode( $asset_hashes[ $local_path ] ) ); |
| 97 |
|
} |
| 98 |
|
} |
| 99 |
|
} |
| 100 |
|
} |
| 101 |
|
|
| 102 |
|
/** |