| @@ -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.1.15 | |
| 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.1.4 | |
| 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.1.15' ); | |
| 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 |
| @@ -27,18 +39,14 @@ | ||
| 27 | 39 | * |
| 28 | 40 | * @return void |
| 29 | 41 | */ |
| 30 | 42 | |
| 31 | -if ( ! function_exists( 'ultimate_post_kit_load_textdomain' ) ) { | |
| 32 | - function ultimate_post_kit_load_textdomain() { | |
| 33 | - load_plugin_textdomain( 'ultimate-post-kit', false, basename( dirname( __FILE__ ) ) . '/languages' ); | |
| 34 | - } | |
| 35 | - add_action( 'init', 'ultimate_post_kit_load_textdomain' ); | |
| 36 | -} | |
| 43 | +// Translations for plugins hosted on WordPress.org load automatically since WP 4.6. | |
| 37 | 44 | |
| 38 | 45 | |
| 39 | 46 | if ( ! function_exists( '_is_upk_pro_installed' ) ) { |
| 40 | 47 | |
| 48 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration. | |
| 41 | 49 | function _is_upk_pro_installed() { |
| 42 | 50 | |
| 43 | 51 | if ( ! function_exists( 'get_plugins' ) ) { |
| 44 | 52 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| @@ -52,8 +60,9 @@ | ||
| 52 | 60 | } |
| 53 | 61 | |
| 54 | 62 | if ( ! function_exists( '_is_upk_pro_activated' ) ) { |
| 55 | 63 | |
| 64 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration. | |
| 56 | 65 | function _is_upk_pro_activated() { |
| 57 | 66 | |
| 58 | 67 | if ( ! function_exists( 'get_plugins' ) ) { |
| 59 | 68 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| @@ -68,21 +77,22 @@ | ||
| 68 | 77 | return false; |
| 69 | 78 | } |
| 70 | 79 | } |
| 71 | 80 | |
| 72 | -// Load white label configuration if it exists (before defining BDTUPK_TITLE) | |
| 73 | -if ( ! defined( 'BDTUPK_WL' ) ) { | |
| 74 | - if ( get_option( 'upk_white_label_enabled' ) ) { | |
| 75 | - define( 'BDTUPK_WL', true ); | |
| 76 | - $white_label_config = dirname( __FILE__ ) . '/admin/white-label/white-label-config.php'; | |
| 77 | - if ( file_exists( $white_label_config ) ) { | |
| 78 | - require_once( $white_label_config ); | |
| 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; | |
| 79 | 89 | } |
| 90 | + | |
| 91 | + return version_compare( BDTUPK_PRO_VER, BDTUPK_PRO_REQUIRED_VERSION, '>=' ); | |
| 80 | 92 | } |
| 81 | 93 | } |
| 82 | 94 | |
| 83 | - | |
| 84 | - | |
| 85 | 95 | // Helper function here |
| 86 | 96 | require_once ( dirname( __FILE__ ) . '/includes/helper.php' ); |
| 87 | 97 | |
| 88 | 98 | if ( ! _is_upk_pro_activated() ) { |
| @@ -110,16 +120,17 @@ | ||
| 110 | 120 | |
| 111 | 121 | return; |
| 112 | 122 | } |
| 113 | 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 | + | |
| 114 | 129 | require_once( dirname( __FILE__ ) . '/includes/setup-wizard/init.php' ); |
| 115 | 130 | |
| 116 | 131 | // Element pack widget and assets loader |
| 117 | 132 | require_once ( BDTUPK_PATH . 'loader.php' ); |
| 118 | - | |
| 119 | - // Initialize custom CSS/JS injection on frontend | |
| 120 | - add_action( 'wp_head', 'upk_inject_header_custom_code', 999 ); | |
| 121 | - add_action( 'wp_footer', 'upk_inject_footer_custom_code', 999 ); | |
| 122 | 133 | } |
| 123 | 134 | |
| 124 | 135 | add_action( 'plugins_loaded', 'ultimate_post_kit_load_plugin' ); |
| 125 | 136 | |
| @@ -124,8 +135,27 @@ | ||
| 124 | 135 | add_action( 'plugins_loaded', 'ultimate_post_kit_load_plugin' ); |
| 125 | 136 | |
| 126 | 137 | |
| 127 | 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 | +} | |
| 156 | + | |
| 157 | +/** | |
| 128 | 158 | * Check Elementor installed and activated correctly |
| 129 | 159 | */ |
| 130 | 160 | function ultimate_post_kit_fail_load() { |
| 131 | 161 | $screen = get_current_screen(); |
| @@ -150,9 +180,9 @@ | ||
| 150 | 180 | $admin_message = '<p>' . esc_html__( 'Ops! Ultimate Post Kit not working because you need to install the Elementor plugin', 'ultimate-post-kit' ) . '</p>'; |
| 151 | 181 | $admin_message .= '<p>' . sprintf( '<a href="%s" class="button-primary">%s</a>', $install_url, esc_html__( 'Install Elementor Now', 'ultimate-post-kit' ) ) . '</p>'; |
| 152 | 182 | } |
| 153 | 183 | |
| 154 | - echo '<div class="error">' . $admin_message . '</div>'; | |
| 184 | + echo '<div class="error">' . wp_kses_post( $admin_message ) . '</div>'; | |
| 155 | 185 | } |
| 156 | 186 | |
| 157 | 187 | /** |
| 158 | 188 | * Check the elementor installed or not |
| @@ -158,8 +188,9 @@ | ||
| 158 | 188 | * Check the elementor installed or not |
| 159 | 189 | */ |
| 160 | 190 | if ( ! function_exists( '_is_elementor_installed' ) ) { |
| 161 | 191 | |
| 192 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- established function name relied on across the plugin family / feedback SDK; renaming would break integration. | |
| 162 | 193 | function _is_elementor_installed() { |
| 163 | 194 | $file_path = 'elementor/elementor.php'; |
| 164 | 195 | $installed_plugins = get_plugins(); |
| 165 | 196 | |
| @@ -172,14 +203,14 @@ | ||
| 172 | 203 | /** |
| 173 | 204 | * Review Automation Integration |
| 174 | 205 | */ |
| 175 | 206 | |
| 176 | -if ( ! function_exists( 'rc_upk_core_plugin' ) ) { | |
| 177 | - function rc_upk_core_plugin() { | |
| 207 | +if ( ! function_exists( 'ultimate_post_kit_reviews_bootstrap' ) ) { | |
| 208 | + function ultimate_post_kit_reviews_bootstrap() { | |
| 178 | 209 | |
| 179 | 210 | require_once BDTUPK_INC_PATH . 'feedback-hub/start.php'; |
| 180 | 211 | |
| 181 | - rc_dynamic_init( array( | |
| 212 | + ultimate_post_kit_reviews_init( array( | |
| 182 | 213 | 'sdk_version' => '1.0.0', |
| 183 | 214 | 'plugin_name' => 'Ultimate Post Kit', |
| 184 | 215 | 'plugin_icon' => BDTUPK_ASSETS_URL . 'images/logo.svg', |
| 185 | 216 | 'slug' => 'ultimate_post_kit_options', |
| @@ -191,6 +222,6 @@ | ||
| 191 | 222 | 'plugin_msg' => '<p>Loved using Ultimate Post Kit on your website? Share your experience in a review and help us spread the love to everyone right now. Good words will help the community.</p>', |
| 192 | 223 | ) ); |
| 193 | 224 | |
| 194 | 225 | } |
| 195 | - add_action( 'admin_init', 'rc_upk_core_plugin' ); | |
| 226 | + add_action( 'admin_init', 'ultimate_post_kit_reviews_bootstrap' ); | |
| 196 | 227 | } |