Plugin Directory

Changeset 3373047


Ignore:
Timestamp:
10/05/2025 07:43:42 AM (6 months ago)
Author:
wingdevs
Message:

Fixed: minor issues

Location:
wing-popup
Files:
172 added
1 edited

Legend:

Unmodified
Added
Removed
  • wing-popup/trunk/wing-popup.php

    r3349192 r3373047  
    6060add_action('plugins_loaded', 'wdpop_load_core_framework');
    6161
     62
     63add_action( 'in_plugin_update_message-wing-popup/wing-popup.php', 'wing_popup_major_update_notice', 10, 2 );
     64
     65function wing_popup_major_update_notice( $plugin_data, $response ) {
     66    $current_version = isset( $plugin_data->Version ) ? $plugin_data->Version : '';
     67    $new_version     = isset( $response->new_version ) ? $response->new_version : '';
     68
     69    if ( $current_version && $new_version && wing_popup_is_major_update( $current_version, $new_version ) ) {
     70        echo '<div style="margin-top:8px; padding:10px; background:#fff3cd; border-left:4px solid #ff9800;">';
     71        echo '<strong>' . esc_html__( 'Heads up!', 'wing-popup' ) . '</strong> ';
     72        echo esc_html__( 'This is a major Wing Popup update — please back up your site before updating.', 'wing-popup' );
     73        echo '</div>';
     74    }
     75}
     76
     77function wing_popup_is_major_update( $current, $new ) {
     78    $current_parts = explode( '.', $current );
     79    $new_parts     = explode( '.', $new );
     80
     81    // Compare only the major version number (first digit)
     82    return isset( $current_parts[0], $new_parts[0] ) && ( (int) $new_parts[0] > (int) $current_parts[0] );
     83}
     84
    6285/**
    6386 * The core plugin class that is used to define internationalization,
Note: See TracChangeset for help on using the changeset viewer.