Plugin Directory

Changeset 3296607


Ignore:
Timestamp:
05/19/2025 03:33:56 PM (11 months ago)
Author:
aliakro
Message:

Update to version 5.0.1 from GitHub

Location:
shortcode-variables
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • shortcode-variables/tags/5.0.1/includes/marketing.php

    r3295323 r3296607  
    5151        return;
    5252    }
    53    
    54     if ( SH_CD_PREMIUM_PLUGIN_LATEST_VERSION === YK_SS_PLUGIN_VERSION ) {
     53
     54    $latest_version = sh_cd_get_latest_premium_version();
     55
     56    if ( true === empty( $latest_version ) ) {
     57        return;
     58    }
     59   
     60    if ( $latest_version === YK_SS_PLUGIN_VERSION ) {
    5561        return;
    5662    }
     
    6369    $version_dismissed = sh_cd_marketing_prompt_been_dismissed( '_yeken_shortcode_variables_upgrade_premium_has_been_dismissed' );
    6470
    65     if ( false !== empty( $version_dimissed ) && $version_dismissed === SH_CD_PREMIUM_PLUGIN_LATEST_VERSION ) {
    66         return;
    67     }
    68 
    69     $dismiss_url = add_query_arg( [ 'dismiss-premium-upgrade' => SH_CD_PREMIUM_PLUGIN_LATEST_VERSION ], sh_cd_get_current_url() );
     71    if ( false !== empty( $version_dimissed ) && $version_dismissed === $latest_version ) {
     72        return;
     73    }
     74
     75    $dismiss_url = add_query_arg( [ 'dismiss-premium-upgrade' => $latest_version ], sh_cd_get_current_url() );
    7076
    7177    printf('<div class="notice notice-warning">
     
    8288            $dismiss_url,
    8389            __( 'Dismiss', SH_CD_SLUG ),
    84             __( 'Update to ', SH_CD_SLUG ) . SH_CD_PREMIUM_PLUGIN_LATEST_VERSION,
     90            __( 'Update both plugins via plugin screen', SH_CD_SLUG ),
    8591            sh_cd_premium_shortcode_download( true ),
    8692    );
     
    324330
    325331/**
    326  * Display admin notice for notification from yeken.uk
    327  */
    328 function sh_cd_get_marketing_message() {
    329    
    330     if ( $cache = get_transient( '_yeken_shortcode_variables_update1' ) ) {
     332 * Fetch the latest version of the premium plugin
     333 */
     334function sh_cd_get_latest_premium_version() {
     335   
     336    if ( $cache = get_transient( '_yeken_shortcode_variables_latest_premium_version' ) ) {
    331337        return $cache;
    332338    }
    333339
    334     $response = wp_remote_get( SH_CD_YEKEN_UPDATES_URL );
     340    $response   = wp_remote_get( SH_CD_YEKEN_PREMIUM_RELEASE_MANIFEST );
     341    $version    = NULL;
    335342
    336343    // All ok?
     
    342349
    343350            $body = json_decode( $body, true );
     351
     352            $version = ( false === empty( $body[ 'version' ] ) ) ? $body[ 'version' ] : NULL;
    344353           
    345             set_transient( '_yeken_shortcode_variables_update', $body, HOUR_IN_SECONDS );
     354            set_transient( '_yeken_shortcode_variables_latest_premium_version', $version, DAY_IN_SECONDS );
     355        }
     356    }
     357
     358    return $version;
     359}
     360
     361/**
     362 * Display admin notice for notification from yeken.uk
     363 */
     364function sh_cd_get_marketing_message() {
     365   
     366    if ( $cache = get_transient( '_yeken_shortcode_variables_update' ) ) {
     367        return $cache;
     368    }
     369
     370    $response = wp_remote_get( SH_CD_YEKEN_UPDATES_URL );
     371
     372    // All ok?
     373    if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
     374
     375        $body = wp_remote_retrieve_body( $response );
     376
     377        if ( false === empty( $body ) ) {
     378            $body = json_decode( $body, true );
     379           
     380            set_transient( '_yeken_shortcode_variables_update', $body, DAY_IN_SECONDS );
    346381
    347382            return $body;
  • shortcode-variables/tags/5.0.1/readme.txt

    r3295323 r3296607  
    44Requires at least: 6.0
    55Tested up to: 6.8
    6 Stable tag: 5.0
     6Stable tag: 5.0.1
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    7878
    7979== Changelog ==
     80
     81= 5.0.1 =
     82
     83* Improvement: Latest version number of Premium plugin is now fetched from the release manifest rather than hardcoded into the plugin.
     84* Improvement: Only reach out to YeKen servers for update notices once a day, rather than hourly.
     85* Bug fix: Corrected issue where each page call would look for update message from Yeken.
    8086
    8187= 5.0 =
  • shortcode-variables/tags/5.0.1/shortcode-variables.php

    r3295323 r3296607  
    3535define( 'SH_CD_ABSPATH', plugin_dir_path( __FILE__ ) );
    3636define( 'SH_CD_PLUGIN_VERSION', '5.0' );
    37 define( 'SH_CD_PREMIUM_PLUGIN_LATEST_VERSION', '1.0.4' ); // Used to trigger "there is a newer version" message
    3837define( 'SH_CD_PLUGIN_NAME', 'Snippet Shortcodes' );
    3938define( 'SH_CD_TABLE', 'SH_CD_SHORTCODES' );
     
    4746define( 'SH_CD_GET_PREMIUM_LINK', 'https://snippetshortcodes.yeken.uk/download/' );   
    4847define( 'SH_CD_YEKEN_UPDATES_URL', 'https://yeken.uk/downloads/_updates/shortcode-variables.json' );
     48define( 'SH_CD_YEKEN_PREMIUM_RELEASE_MANIFEST', 'https://snippetshortcodes.yeken.uk/wp-content/plugins/snippet-shortcodes-premium/release.json' );
    4949
    5050add_action( 'plugins_loaded', function() {
     
    6767    include_once SH_CD_ABSPATH . 'includes/pages/page.import.php';
    6868    include_once SH_CD_ABSPATH . 'includes/tinymce.php';
    69 
    7069});
  • shortcode-variables/trunk/includes/marketing.php

    r3295323 r3296607  
    5151        return;
    5252    }
    53    
    54     if ( SH_CD_PREMIUM_PLUGIN_LATEST_VERSION === YK_SS_PLUGIN_VERSION ) {
     53
     54    $latest_version = sh_cd_get_latest_premium_version();
     55
     56    if ( true === empty( $latest_version ) ) {
     57        return;
     58    }
     59   
     60    if ( $latest_version === YK_SS_PLUGIN_VERSION ) {
    5561        return;
    5662    }
     
    6369    $version_dismissed = sh_cd_marketing_prompt_been_dismissed( '_yeken_shortcode_variables_upgrade_premium_has_been_dismissed' );
    6470
    65     if ( false !== empty( $version_dimissed ) && $version_dismissed === SH_CD_PREMIUM_PLUGIN_LATEST_VERSION ) {
    66         return;
    67     }
    68 
    69     $dismiss_url = add_query_arg( [ 'dismiss-premium-upgrade' => SH_CD_PREMIUM_PLUGIN_LATEST_VERSION ], sh_cd_get_current_url() );
     71    if ( false !== empty( $version_dimissed ) && $version_dismissed === $latest_version ) {
     72        return;
     73    }
     74
     75    $dismiss_url = add_query_arg( [ 'dismiss-premium-upgrade' => $latest_version ], sh_cd_get_current_url() );
    7076
    7177    printf('<div class="notice notice-warning">
     
    8288            $dismiss_url,
    8389            __( 'Dismiss', SH_CD_SLUG ),
    84             __( 'Update to ', SH_CD_SLUG ) . SH_CD_PREMIUM_PLUGIN_LATEST_VERSION,
     90            __( 'Update both plugins via plugin screen', SH_CD_SLUG ),
    8591            sh_cd_premium_shortcode_download( true ),
    8692    );
     
    324330
    325331/**
    326  * Display admin notice for notification from yeken.uk
    327  */
    328 function sh_cd_get_marketing_message() {
    329    
    330     if ( $cache = get_transient( '_yeken_shortcode_variables_update1' ) ) {
     332 * Fetch the latest version of the premium plugin
     333 */
     334function sh_cd_get_latest_premium_version() {
     335   
     336    if ( $cache = get_transient( '_yeken_shortcode_variables_latest_premium_version' ) ) {
    331337        return $cache;
    332338    }
    333339
    334     $response = wp_remote_get( SH_CD_YEKEN_UPDATES_URL );
     340    $response   = wp_remote_get( SH_CD_YEKEN_PREMIUM_RELEASE_MANIFEST );
     341    $version    = NULL;
    335342
    336343    // All ok?
     
    342349
    343350            $body = json_decode( $body, true );
     351
     352            $version = ( false === empty( $body[ 'version' ] ) ) ? $body[ 'version' ] : NULL;
    344353           
    345             set_transient( '_yeken_shortcode_variables_update', $body, HOUR_IN_SECONDS );
     354            set_transient( '_yeken_shortcode_variables_latest_premium_version', $version, DAY_IN_SECONDS );
     355        }
     356    }
     357
     358    return $version;
     359}
     360
     361/**
     362 * Display admin notice for notification from yeken.uk
     363 */
     364function sh_cd_get_marketing_message() {
     365   
     366    if ( $cache = get_transient( '_yeken_shortcode_variables_update' ) ) {
     367        return $cache;
     368    }
     369
     370    $response = wp_remote_get( SH_CD_YEKEN_UPDATES_URL );
     371
     372    // All ok?
     373    if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
     374
     375        $body = wp_remote_retrieve_body( $response );
     376
     377        if ( false === empty( $body ) ) {
     378            $body = json_decode( $body, true );
     379           
     380            set_transient( '_yeken_shortcode_variables_update', $body, DAY_IN_SECONDS );
    346381
    347382            return $body;
  • shortcode-variables/trunk/readme.txt

    r3295323 r3296607  
    44Requires at least: 6.0
    55Tested up to: 6.8
    6 Stable tag: 5.0
     6Stable tag: 5.0.1
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    7878
    7979== Changelog ==
     80
     81= 5.0.1 =
     82
     83* Improvement: Latest version number of Premium plugin is now fetched from the release manifest rather than hardcoded into the plugin.
     84* Improvement: Only reach out to YeKen servers for update notices once a day, rather than hourly.
     85* Bug fix: Corrected issue where each page call would look for update message from Yeken.
    8086
    8187= 5.0 =
  • shortcode-variables/trunk/shortcode-variables.php

    r3295323 r3296607  
    3535define( 'SH_CD_ABSPATH', plugin_dir_path( __FILE__ ) );
    3636define( 'SH_CD_PLUGIN_VERSION', '5.0' );
    37 define( 'SH_CD_PREMIUM_PLUGIN_LATEST_VERSION', '1.0.4' ); // Used to trigger "there is a newer version" message
    3837define( 'SH_CD_PLUGIN_NAME', 'Snippet Shortcodes' );
    3938define( 'SH_CD_TABLE', 'SH_CD_SHORTCODES' );
     
    4746define( 'SH_CD_GET_PREMIUM_LINK', 'https://snippetshortcodes.yeken.uk/download/' );   
    4847define( 'SH_CD_YEKEN_UPDATES_URL', 'https://yeken.uk/downloads/_updates/shortcode-variables.json' );
     48define( 'SH_CD_YEKEN_PREMIUM_RELEASE_MANIFEST', 'https://snippetshortcodes.yeken.uk/wp-content/plugins/snippet-shortcodes-premium/release.json' );
    4949
    5050add_action( 'plugins_loaded', function() {
     
    6767    include_once SH_CD_ABSPATH . 'includes/pages/page.import.php';
    6868    include_once SH_CD_ABSPATH . 'includes/tinymce.php';
    69 
    7069});
Note: See TracChangeset for help on using the changeset viewer.