Changeset 3376745
- Timestamp:
- 10/11/2025 05:18:11 PM (5 months ago)
- Location:
- nextgenthemes-jsdelivr-this
- Files:
-
- 4 edited
- 1 copied
-
tags/1.3.0 (copied) (copied from nextgenthemes-jsdelivr-this/trunk)
-
tags/1.3.0/nextgenthemes-jsdelivr-this.php (modified) (8 diffs)
-
tags/1.3.0/readme.txt (modified) (2 diffs)
-
trunk/nextgenthemes-jsdelivr-this.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nextgenthemes-jsdelivr-this/tags/1.3.0/nextgenthemes-jsdelivr-this.php
r3362648 r3376745 5 5 * Plugin URI: https://nextgenthemes.com 6 6 * Description: Serves all available assets from free jsDelivr CDN 7 * Version: 1. 2.67 * Version: 1.3.0 8 8 * Requres PHP: 7.4 9 9 * Author: Nicolas Jonas … … 19 19 use WP_HTML_Tag_Processor; 20 20 21 const VERSION = '1.2.6'; 21 const VERSION = '1.3.0'; 22 23 add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme', 11 ); 24 25 function after_setup_theme(): void { 26 27 $position = wp_is_block_theme() ? 'wp_head' : 'wp_footer'; 28 remove_action( $position, array( wp_script_modules(), 'print_import_map' ) ); 29 remove_action( $position, array( wp_script_modules(), 'print_script_module_preloads' ) ); 30 add_action( $position, __NAMESPACE__ . '\print_import_map' ); 31 add_action( $position, __NAMESPACE__ . '\print_script_module_preloads' ); 32 } 22 33 23 34 add_action( 'init', __NAMESPACE__ . '\init', 9 ); … … 28 39 29 40 add_filter( 'wp_script_attributes', __NAMESPACE__ . '\filter_script_attributes', 10, 1 ); 30 add_filter( 'style_loader_tag', __NAMESPACE__ . '\filter_ style_loader_tag', 10, 1 );41 add_filter( 'style_loader_tag', __NAMESPACE__ . '\filter_link_tags', 10, 1 ); 31 42 32 43 add_action( 'admin_bar_menu', __NAMESPACE__ . '\add_item_to_admin_bar', 33 ); … … 65 76 return $links; 66 77 } 78 ); 79 } 80 81 function print_script_module_preloads(): void { 82 83 ob_start(); 84 85 wp_script_modules()->print_script_module_preloads(); 86 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 87 echo filter_link_tags( ob_get_clean() ); 88 } 89 90 function print_import_map(): void { 91 92 ob_start(); 93 94 wp_script_modules()->print_import_map(); 95 96 // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags 97 $import_map = json_decode( strip_tags( ob_get_clean() ), true ); 98 99 if ( empty( $import_map['imports'] ) ) { 100 return; 101 } 102 103 foreach ( $import_map['imports'] as $id => $src ) { 104 105 $attributes['src'] = $src; 106 $attributes = filter_script_attributes( $attributes ); 107 108 if ( ! empty( $attributes['integrity'] ) ) { 109 $import_map['integrity'][ $src ] = $attributes['integrity']; 110 } 111 } 112 113 wp_print_inline_script_tag( 114 wp_json_encode( $import_map, JSON_HEX_TAG | JSON_HEX_AMP ), 115 array( 116 'type' => 'importmap', 117 'id' => 'wp-importmap', 118 ) 67 119 ); 68 120 } … … 105 157 } 106 158 107 function arve_links() : string{159 function arve_links() { 108 160 return wp_kses( 109 161 sprintf( … … 183 235 } 184 236 185 function filter_ style_loader_tag( string $html ): string{237 function filter_link_tags( string $html ) { 186 238 187 239 $p = new WP_HTML_Tag_Processor( $html ); … … 450 502 * 451 503 * @param string $url The URL to retrieve the file path for. 452 * @return string|null The file path if it exists, or null otherwise.504 * return string|null The file path if it exists, or null otherwise. 453 505 */ 454 506 function path_from_url( string $url ): ?string { … … 471 523 } 472 524 473 function get_plugin_version( string $plugin_file ) : string{525 function get_plugin_version( string $plugin_file ) { 474 526 $plugin_data = get_file_data( WP_PLUGIN_DIR . "/$plugin_file", array( 'Version' => 'Version' ), 'plugin' ); 475 527 return $plugin_data['Version'] ?? ''; -
nextgenthemes-jsdelivr-this/tags/1.3.0/readme.txt
r3362648 r3376745 4 4 Donate link: https://nextgenthemes.com/donate 5 5 Requires at least: 6.2.0 6 Requires PHP: 7.46 Requires PHP: 8.0 7 7 Tested up to: 6.8.2 8 Stable tag: 1. 2.68 Stable tag: 1.3.0 9 9 License: GPL 3.0 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 13 13 14 14 == Changelog == 15 16 = 2025-10-11 1.3.0 = 17 * New: Full support for script modules, including import map and `<link rel="modulepreload" ` 15 18 16 19 = 2025-09-16 1.2.6 = -
nextgenthemes-jsdelivr-this/trunk/nextgenthemes-jsdelivr-this.php
r3362648 r3376745 5 5 * Plugin URI: https://nextgenthemes.com 6 6 * Description: Serves all available assets from free jsDelivr CDN 7 * Version: 1. 2.67 * Version: 1.3.0 8 8 * Requres PHP: 7.4 9 9 * Author: Nicolas Jonas … … 19 19 use WP_HTML_Tag_Processor; 20 20 21 const VERSION = '1.2.6'; 21 const VERSION = '1.3.0'; 22 23 add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme', 11 ); 24 25 function after_setup_theme(): void { 26 27 $position = wp_is_block_theme() ? 'wp_head' : 'wp_footer'; 28 remove_action( $position, array( wp_script_modules(), 'print_import_map' ) ); 29 remove_action( $position, array( wp_script_modules(), 'print_script_module_preloads' ) ); 30 add_action( $position, __NAMESPACE__ . '\print_import_map' ); 31 add_action( $position, __NAMESPACE__ . '\print_script_module_preloads' ); 32 } 22 33 23 34 add_action( 'init', __NAMESPACE__ . '\init', 9 ); … … 28 39 29 40 add_filter( 'wp_script_attributes', __NAMESPACE__ . '\filter_script_attributes', 10, 1 ); 30 add_filter( 'style_loader_tag', __NAMESPACE__ . '\filter_ style_loader_tag', 10, 1 );41 add_filter( 'style_loader_tag', __NAMESPACE__ . '\filter_link_tags', 10, 1 ); 31 42 32 43 add_action( 'admin_bar_menu', __NAMESPACE__ . '\add_item_to_admin_bar', 33 ); … … 65 76 return $links; 66 77 } 78 ); 79 } 80 81 function print_script_module_preloads(): void { 82 83 ob_start(); 84 85 wp_script_modules()->print_script_module_preloads(); 86 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 87 echo filter_link_tags( ob_get_clean() ); 88 } 89 90 function print_import_map(): void { 91 92 ob_start(); 93 94 wp_script_modules()->print_import_map(); 95 96 // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags 97 $import_map = json_decode( strip_tags( ob_get_clean() ), true ); 98 99 if ( empty( $import_map['imports'] ) ) { 100 return; 101 } 102 103 foreach ( $import_map['imports'] as $id => $src ) { 104 105 $attributes['src'] = $src; 106 $attributes = filter_script_attributes( $attributes ); 107 108 if ( ! empty( $attributes['integrity'] ) ) { 109 $import_map['integrity'][ $src ] = $attributes['integrity']; 110 } 111 } 112 113 wp_print_inline_script_tag( 114 wp_json_encode( $import_map, JSON_HEX_TAG | JSON_HEX_AMP ), 115 array( 116 'type' => 'importmap', 117 'id' => 'wp-importmap', 118 ) 67 119 ); 68 120 } … … 105 157 } 106 158 107 function arve_links() : string{159 function arve_links() { 108 160 return wp_kses( 109 161 sprintf( … … 183 235 } 184 236 185 function filter_ style_loader_tag( string $html ): string{237 function filter_link_tags( string $html ) { 186 238 187 239 $p = new WP_HTML_Tag_Processor( $html ); … … 450 502 * 451 503 * @param string $url The URL to retrieve the file path for. 452 * @return string|null The file path if it exists, or null otherwise.504 * return string|null The file path if it exists, or null otherwise. 453 505 */ 454 506 function path_from_url( string $url ): ?string { … … 471 523 } 472 524 473 function get_plugin_version( string $plugin_file ) : string{525 function get_plugin_version( string $plugin_file ) { 474 526 $plugin_data = get_file_data( WP_PLUGIN_DIR . "/$plugin_file", array( 'Version' => 'Version' ), 'plugin' ); 475 527 return $plugin_data['Version'] ?? ''; -
nextgenthemes-jsdelivr-this/trunk/readme.txt
r3362648 r3376745 4 4 Donate link: https://nextgenthemes.com/donate 5 5 Requires at least: 6.2.0 6 Requires PHP: 7.46 Requires PHP: 8.0 7 7 Tested up to: 6.8.2 8 Stable tag: 1. 2.68 Stable tag: 1.3.0 9 9 License: GPL 3.0 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 13 13 14 14 == Changelog == 15 16 = 2025-10-11 1.3.0 = 17 * New: Full support for script modules, including import map and `<link rel="modulepreload" ` 15 18 16 19 = 2025-09-16 1.2.6 =
Note: See TracChangeset
for help on using the changeset viewer.