| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: Ultimate Post Kit |
| 5 | 5 | * Plugin URI: https://postkit.pro/ |
| 6 | 6 | * Description: <a href="https://postkit.pro/">Ultimate Post Kit</a> is a packed of post related elementor widgets. This plugin gives you post related widget features for elementor page builder plugin. |
| 7 | - * Version: 4.5.2 | |
| 7 | + * Version: 4.5.6 | |
| 8 | 8 | * Author: BdThemes |
| 9 | 9 | * Author URI: https://bdthemes.com/ |
| 10 | 10 | * Text Domain: ultimate-post-kit |
| 11 | 11 | * Domain Path: /languages |
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | * Text Domain: ultimate-post-kit |
| 11 | 11 | * Domain Path: /languages |
| 12 | 12 | * License: GPL3 |
| 13 | 13 | * Elementor requires at least: 4.0.0 |
| 14 | - * Elementor tested up to: 4.2.2 | |
| 14 | + * Elementor tested up to: 4.3.4 | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | if ( ! defined( 'ABSPATH' ) ) { |
| 18 | 18 | exit; |
| @@ -18,9 +18,21 @@ | ||
| 18 | 18 | exit; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | // Some pre define value for easy use |
| 22 | -define( 'BDTUPK_VER', '4.5.2' ); | |
| 22 | +define( 'BDTUPK_VER', '4.5.6' ); | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * Minimum Pro version this Free/Core release is API compatible with. | |
| 26 | + * | |
| 27 | + * Required on Core/Base file changes. The Pro add-on extends base classes and | |
| 28 | + * calls helpers that live here, so whenever those signatures change a matching | |
| 29 | + * Pro must be released and this constant bumped to it. An older Pro is only | |
| 30 | + * warned about, never blocked, so the Free plugin stays fully functional on | |
| 31 | + * its own. | |
| 32 | + */ | |
| 33 | +define( 'BDTUPK_PRO_REQUIRED_VERSION', '4.5.2' ); | |
| 34 | + | |
| 23 | 35 | define( 'BDTUPK__FILE__', __FILE__ ); |
| 24 | 36 | |
| 25 | 37 | /** |
| 26 | 38 | * Loads translations |
| @@ -65,8 +77,22 @@ | ||
| 65 | 77 | return false; |
| 66 | 78 | } |
| 67 | 79 | } |
| 68 | 80 | |
| 81 | +if ( ! function_exists( '_is_upk_pro_version_sufficient' ) ) { | |
| 82 | + | |
| 83 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- matches the established _is_upk_* helper naming used across the plugin family. | |
| 84 | + function _is_upk_pro_version_sufficient() { | |
| 85 | + | |
| 86 | + // Pro is not loaded, so there is nothing to be incompatible with. | |
| 87 | + if ( ! defined( 'BDTUPK_PRO_VER' ) ) { | |
| 88 | + return true; | |
| 89 | + } | |
| 90 | + | |
| 91 | + return version_compare( BDTUPK_PRO_VER, BDTUPK_PRO_REQUIRED_VERSION, '>=' ); | |
| 92 | + } | |
| 93 | +} | |
| 94 | + | |
| 69 | 95 | // Helper function here |
| 70 | 96 | require_once ( dirname( __FILE__ ) . '/includes/helper.php' ); |
| 71 | 97 | |
| 72 | 98 | if ( ! _is_upk_pro_activated() ) { |
| @@ -94,8 +120,13 @@ | ||
| 94 | 120 | |
| 95 | 121 | return; |
| 96 | 122 | } |
| 97 | 123 | |
| 124 | + // An outdated Pro is warned about but never blocked; Free must keep working. | |
| 125 | + if ( ! _is_upk_pro_version_sufficient() ) { | |
| 126 | + add_action( 'admin_notices', 'ultimate_post_kit_pro_version_not_sufficient' ); | |
| 127 | + } | |
| 128 | + | |
| 98 | 129 | require_once( dirname( __FILE__ ) . '/includes/setup-wizard/init.php' ); |
| 99 | 130 | |
| 100 | 131 | // Element pack widget and assets loader |
| 101 | 132 | require_once ( BDTUPK_PATH . 'loader.php' ); |
| @@ -102,8 +133,27 @@ | ||
| 102 | 133 | } |
| 103 | 134 | |
| 104 | 135 | add_action( 'plugins_loaded', 'ultimate_post_kit_load_plugin' ); |
| 105 | 136 | |
| 137 | + | |
| 138 | +/** | |
| 139 | + * Warn when the installed Pro add-on is older than this Free/Core release | |
| 140 | + * expects. Pro is still loaded, so nothing breaks silently on the front end. | |
| 141 | + */ | |
| 142 | +function ultimate_post_kit_pro_version_not_sufficient() { | |
| 143 | + if ( ! current_user_can( 'update_plugins' ) ) { | |
| 144 | + return; | |
| 145 | + } | |
| 146 | + | |
| 147 | + $admin_message = '<p>' . sprintf( | |
| 148 | + /* translators: 1: installed Ultimate Post Kit Pro version, 2: minimum required Ultimate Post Kit Pro version */ | |
| 149 | + esc_html__( 'Ops! Ultimate Post Kit Pro %1$s is older than this version of the Free/Core plugin supports. Please update Ultimate Post Kit Pro to at least version %2$s.', 'ultimate-post-kit' ), | |
| 150 | + esc_html( BDTUPK_PRO_VER ), | |
| 151 | + esc_html( BDTUPK_PRO_REQUIRED_VERSION ) | |
| 152 | + ) . '</p>'; | |
| 153 | + | |
| 154 | + echo '<div class="error">' . wp_kses_post( $admin_message ) . '</div>'; | |
| 155 | +} | |
| 106 | 156 | |
| 107 | 157 | /** |
| 108 | 158 | * Check Elementor installed and activated correctly |
| 109 | 159 | */ |