Plugin Directory

Changeset 3376745


Ignore:
Timestamp:
10/11/2025 05:18:11 PM (5 months ago)
Author:
nico23
Message:

Update plugin to version 1.3.0 with NextgenThemes WordPress Plugin Deploy

Location:
nextgenthemes-jsdelivr-this
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nextgenthemes-jsdelivr-this/tags/1.3.0/nextgenthemes-jsdelivr-this.php

    r3362648 r3376745  
    55 * Plugin URI:        https://nextgenthemes.com
    66 * Description:       Serves all available assets from free jsDelivr CDN
    7  * Version:           1.2.6
     7 * Version:           1.3.0
    88 * Requres PHP:       7.4
    99 * Author:            Nicolas Jonas
     
    1919use WP_HTML_Tag_Processor;
    2020
    21 const VERSION = '1.2.6';
     21const VERSION = '1.3.0';
     22
     23add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme', 11 );
     24
     25function 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}
    2233
    2334add_action( 'init', __NAMESPACE__ . '\init', 9 );
     
    2839
    2940    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 );
    3142
    3243    add_action( 'admin_bar_menu', __NAMESPACE__ . '\add_item_to_admin_bar', 33 );
     
    6576            return $links;
    6677        }
     78    );
     79}
     80
     81function 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
     90function 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        )
    67119    );
    68120}
     
    105157}
    106158
    107 function arve_links(): string {
     159function arve_links() {
    108160    return wp_kses(
    109161        sprintf(
     
    183235}
    184236
    185 function filter_style_loader_tag( string $html ): string {
     237function filter_link_tags( string $html ) {
    186238
    187239    $p = new WP_HTML_Tag_Processor( $html );
     
    450502 *
    451503 * @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.
    453505 */
    454506function path_from_url( string $url ): ?string {
     
    471523}
    472524
    473 function get_plugin_version( string $plugin_file ): string {
     525function get_plugin_version( string $plugin_file ) {
    474526    $plugin_data = get_file_data( WP_PLUGIN_DIR . "/$plugin_file", array( 'Version' => 'Version' ), 'plugin' );
    475527    return $plugin_data['Version'] ?? '';
  • nextgenthemes-jsdelivr-this/tags/1.3.0/readme.txt

    r3362648 r3376745  
    44Donate link: https://nextgenthemes.com/donate
    55Requires at least: 6.2.0
    6 Requires PHP: 7.4
     6Requires PHP: 8.0
    77Tested up to: 6.8.2
    8 Stable tag: 1.2.6
     8Stable tag: 1.3.0
    99License: GPL 3.0
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1313
    1414== Changelog ==
     15
     16= 2025-10-11 1.3.0 =
     17* New: Full support for script modules, including import map and `<link rel="modulepreload" `
    1518
    1619= 2025-09-16 1.2.6 =
  • nextgenthemes-jsdelivr-this/trunk/nextgenthemes-jsdelivr-this.php

    r3362648 r3376745  
    55 * Plugin URI:        https://nextgenthemes.com
    66 * Description:       Serves all available assets from free jsDelivr CDN
    7  * Version:           1.2.6
     7 * Version:           1.3.0
    88 * Requres PHP:       7.4
    99 * Author:            Nicolas Jonas
     
    1919use WP_HTML_Tag_Processor;
    2020
    21 const VERSION = '1.2.6';
     21const VERSION = '1.3.0';
     22
     23add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme', 11 );
     24
     25function 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}
    2233
    2334add_action( 'init', __NAMESPACE__ . '\init', 9 );
     
    2839
    2940    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 );
    3142
    3243    add_action( 'admin_bar_menu', __NAMESPACE__ . '\add_item_to_admin_bar', 33 );
     
    6576            return $links;
    6677        }
     78    );
     79}
     80
     81function 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
     90function 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        )
    67119    );
    68120}
     
    105157}
    106158
    107 function arve_links(): string {
     159function arve_links() {
    108160    return wp_kses(
    109161        sprintf(
     
    183235}
    184236
    185 function filter_style_loader_tag( string $html ): string {
     237function filter_link_tags( string $html ) {
    186238
    187239    $p = new WP_HTML_Tag_Processor( $html );
     
    450502 *
    451503 * @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.
    453505 */
    454506function path_from_url( string $url ): ?string {
     
    471523}
    472524
    473 function get_plugin_version( string $plugin_file ): string {
     525function get_plugin_version( string $plugin_file ) {
    474526    $plugin_data = get_file_data( WP_PLUGIN_DIR . "/$plugin_file", array( 'Version' => 'Version' ), 'plugin' );
    475527    return $plugin_data['Version'] ?? '';
  • nextgenthemes-jsdelivr-this/trunk/readme.txt

    r3362648 r3376745  
    44Donate link: https://nextgenthemes.com/donate
    55Requires at least: 6.2.0
    6 Requires PHP: 7.4
     6Requires PHP: 8.0
    77Tested up to: 6.8.2
    8 Stable tag: 1.2.6
     8Stable tag: 1.3.0
    99License: GPL 3.0
    1010License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1313
    1414== Changelog ==
     15
     16= 2025-10-11 1.3.0 =
     17* New: Full support for script modules, including import map and `<link rel="modulepreload" `
    1518
    1619= 2025-09-16 1.2.6 =
Note: See TracChangeset for help on using the changeset viewer.