PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
← All changes | includes/Admin/Admin.php +63 -0 3.2.10 → 3.3.3 View file →
@@ -43,8 +43,18 @@
43 43 const ASSET_URL = NOTIFICATIONX_ASSETS . 'admin/';
44 44 const ASSET_PATH = NOTIFICATIONX_ASSETS_PATH . 'admin/';
45 45 const VIEWS_PATH = NOTIFICATIONX_INCLUDES . 'Admin/views/';
46 46
47 + /**
48 + * Oldest NotificationX Pro that ships its own copy of the Pro features the
49 + * free plugin is removing (Flashing Tab, Cart Peek, Inline). Older Pro keeps
50 + * working with this release, but loses those features once the free copies
51 + * are deleted. See docs/api/frontend-js-hooks.md.
52 + *
53 + * @since 3.3.3
54 + */
55 + const MIN_PRO_VERSION = '3.2.3';
56 +
47 57 private $insights = null;
48 58
49 59 /**
50 60 * @var CacheBank
@@ -93,8 +103,12 @@
93 103 }
94 104 }
95 105 add_action('admin_init', [$this, 'admin_init']);
96 106 add_action('admin_menu', [$this, 'menu'], 10);
107 + // all_admin_notices, not admin_notices: hide_others_plugin_admin_notice()
108 + // clears admin_notices on NotificationX screens, and this notice must
109 + // show there too.
110 + add_action('all_admin_notices', [$this, 'pro_version_notice']);
97 111 Dashboard::get_instance();
98 112 SetupWizard::get_instance();
99 113 PostType::get_instance();
100 114 Settings::get_instance()->init();
@@ -205,8 +219,52 @@
205 219 NoticeRemover::get_instance( '1.0.0' );
206 220 }
207 221
208 222
223 + /**
224 + * Whether the active NotificationX Pro is older than MIN_PRO_VERSION.
225 + *
226 + * @since 3.3.3
227 + * @param string|null $pro_version Pro version; defaults to NOTIFICATIONX_PRO_VERSION.
228 + * @return bool False when Pro is not active or its version is unknown.
229 + */
230 + public static function pro_needs_update( $pro_version = null ) {
231 + if ( null === $pro_version ) {
232 + if ( ! NotificationX::is_pro() || ! defined( 'NOTIFICATIONX_PRO_VERSION' ) ) {
233 + return false;
234 + }
235 + $pro_version = NOTIFICATIONX_PRO_VERSION;
236 + }
237 + if ( ! is_string( $pro_version ) || '' === $pro_version ) {
238 + return false;
239 + }
240 + return version_compare( $pro_version, self::MIN_PRO_VERSION, '<' );
241 + }
242 +
243 + /**
244 + * Non-dismissible notice asking to update an outdated NotificationX Pro.
245 + *
246 + * @since 3.3.3
247 + * @return void
248 + */
249 + public function pro_version_notice() {
250 + if ( ! current_user_can( 'update_plugins' ) || ! self::pro_needs_update() ) {
251 + return;
252 + }
253 + $message = sprintf(
254 + /* translators: 1: installed NotificationX Pro version, 2: required NotificationX Pro version. */
255 + __( 'You are using NotificationX Pro %1$s. Please update NotificationX Pro to version %2$s or later. Upcoming NotificationX releases move Flashing Tab, Cart Peek and Inline notifications fully into NotificationX Pro, and older Pro versions will stop showing them.', 'notificationx' ),
256 + '<strong>' . esc_html( NOTIFICATIONX_PRO_VERSION ) . '</strong>',
257 + '<strong>' . esc_html( self::MIN_PRO_VERSION ) . '</strong>'
258 + );
259 + printf(
260 + '<div class="notice notice-warning nx-pro-version-notice"><p>%1$s <a href="%2$s">%3$s</a></p></div>',
261 + wp_kses_post( $message ),
262 + esc_url( self_admin_url( 'plugins.php?plugin_status=upgrade' ) ),
263 + esc_html__( 'Go to plugin updates', 'notificationx' )
264 + );
265 + }
266 +
209 267 public function hide_others_plugin_admin_notice()
210 268 {
211 269 $current_screen = get_current_screen();
212 270 $hide_on = ['toplevel_page_nx-admin', 'notificationx_page_nx-dashboard', 'notificationx_page_nx-edit','notificationx_page_nx-settings','notificationx_page_nx-analytics','notificationx_page_nx-builder', 'notificationx_page_nx-feedback-entries'];
@@ -419,8 +477,11 @@
419 477 self::$cache_bank->calculate_deposits( $notices );
420 478 }
421 479
422 480 public function plugin_usage_insights(){
481 + if ( null !== $this->insights ) {
482 + return $this->insights;
483 + }
423 484 $this->insights = PluginInsights::get_instance( NOTIFICATIONX_FILE, [
424 485 'opt_in' => true,
425 486 'goodbye_form' => true,
426 487 'item_id' => '6ba8d30bc0beaddb2540'
@@ -432,8 +493,10 @@
432 493 discount coupon. This data lets us make sure this plugin always stays compatible with the most
433 494 popular plugins and themes. No spam, I promise.', 'notificationx' ),
434 495 ));
435 496 $this->insights->init();
497 +
498 + return $this->insights;
436 499 }
437 500
438 501 /**
439 502 * Handle miscellaneous REST API actions