PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / trunk
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar vtrunk
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 1.2.0 1.2.1 All 156 releases
← All changes | notificationx.php +86 -56 1.0.0trunk View file →
@@ -1,80 +1,110 @@
1 1 <?php
2 -
3 2 /**
4 - * @link https://wpdeveloper.net
5 - * @since 1.0.0
6 - * @package NotificationX
7 - *
8 - * @wordpress-plugin
9 3 * Plugin Name: NotificationX
10 - * Plugin URI: https://wpdeveloper.net/NotificationX
4 + * Plugin URI: https://notificationx.com
11 5 * Description: Social Proof & Recent Sales Popup, Comment Notification, Subscription Notification, Notification Bar and many more.
12 - * Version: 1.0.0
6 + * Version: 3.3.1
13 7 * Author: WPDeveloper
14 - * Author URI: https://wpdeveloper.net
15 - * License: GPL-2.0+
16 - * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
8 + * Author URI: https://wpdeveloper.com
9 + * License: GPL-3.0+
10 + * License URI: https://www.gnu.org/licenses/gpl-3.0.html
17 11 * Text Domain: notificationx
18 12 * Domain Path: /languages
13 + *
14 + * @package NotificationX
15 + * @link https://wpdeveloper.com
16 + * @since 1.0.0
19 17 */
20 18
21 -// If this file is called directly, abort.
19 +/**
20 + * If this file is called directly, abort.
21 + */
22 22 if ( ! defined( 'WPINC' ) ) {
23 - die;
23 + die;
24 24 }
25 +/**
26 + * Defines CONSTANTS for Whole plugins.
27 + */
28 +define( 'NOTIFICATIONX_FILE', __FILE__ );
29 +define( 'NOTIFICATIONX_VERSION', '3.3.1' );
30 +define( 'NOTIFICATIONX_URL', plugins_url( '/', __FILE__ ) );
31 +define( 'NOTIFICATIONX_PATH', plugin_dir_path( __FILE__ ) );
32 +define( 'NOTIFICATIONX_BASENAME', plugin_basename( __FILE__ ) );
25 33
26 -define( 'NOTIFICATIONX_VERSION', '1.0.0' );
27 -define( 'NOTIFICATIONX_PLUGIN_URL', 'https://notificationx.com' );
34 +define( 'NOTIFICATIONX_ASSETS', NOTIFICATIONX_URL . 'assets/' );
35 +define( 'NOTIFICATIONX_ASSETS_PATH', NOTIFICATIONX_PATH . 'assets/' );
36 +define( 'NOTIFICATIONX_DEV_ASSETS', NOTIFICATIONX_URL . 'nxbuild/' );
37 +define( 'NOTIFICATIONX_DEV_ASSETS_PATH', NOTIFICATIONX_PATH . 'nxbuild/' );
38 +define( 'NOTIFICATIONX_INCLUDES', NOTIFICATIONX_PATH . 'includes/' );
28 39
29 -define( 'NOTIFICATIONX_URL', plugins_url( '/', __FILE__ ) );
30 -define( 'NOTIFICATIONX_ADMIN_URL', NOTIFICATIONX_URL . 'admin/' );
31 -define( 'NOTIFICATIONX_PUBLIC_URL', NOTIFICATIONX_URL . 'public/' );
32 40
33 -define( 'NOTIFICATIONX_FILE', __FILE__ );
34 -define( 'NOTIFICATIONX_BASENAME', plugin_basename( __FILE__ ) );
35 -define( 'NOTIFICATIONX_ROOT_DIR_PATH', plugin_dir_path( __FILE__ ) );
36 -define( 'NOTIFICATIONX_ADMIN_DIR_PATH', NOTIFICATIONX_ROOT_DIR_PATH . 'admin/' );
37 -define( 'NOTIFICATIONX_PUBLIC_PATH', NOTIFICATIONX_ROOT_DIR_PATH . 'public/' );
38 -define( 'NOTIFICATIONX_EXT_DIR_PATH', NOTIFICATIONX_ROOT_DIR_PATH . 'extensions/' );
41 +define( 'NOTIFICATIONX_PLUGIN_URL', 'https://notificationx.com' );
42 +define( 'NOTIFICATIONX_ADMIN_URL', NOTIFICATIONX_ASSETS . 'admin/' );
43 +define( 'NOTIFICATIONX_PUBLIC_URL', NOTIFICATIONX_ASSETS . 'public/' );
44 +define( 'NOTIFICATIONX_COMMON_URL', NOTIFICATIONX_ASSETS . 'common/' );
39 45
40 46 /**
41 - * The code that runs during plugin activation.
42 - * This action is documented in includes/class-nx-activator.php
47 + * The Core Engine of the Plugin
43 48 */
44 -function activate_notificationx() {
45 - require_once NOTIFICATIONX_ROOT_DIR_PATH . 'includes/class-nx-activator.php';
46 - NotificationX_Activator::activate();
49 +if ( ! class_exists( '\NotificationX\NotificationX' ) ) {
50 + require_once NOTIFICATIONX_PATH . 'vendor/autoload.php';
51 + if ( notificationx_is_plugin_active( 'notificationx-pro/notificationx-pro.php' ) ) {
52 + add_action( 'admin_notices', 'notificationx_free_compatibility_notice' );
53 + if ( file_exists( dirname( NOTIFICATIONX_PATH ) . '/notificationx-pro/notificationx-pro.php' ) ) {
54 + require_once dirname( NOTIFICATIONX_PATH ) . '/notificationx-pro/notificationx-pro.php';
55 + } else {
56 + add_action('plugins_loaded', function() {
57 + remove_action( 'admin_notices', 'notificationx_install_core_notice' );
58 + \NotificationX\Core\Helper::remove_old_notice();
59 + });
60 + }
61 + }
62 +
63 + function notificationx_activate() {
64 + \NotificationX\NotificationX::get_instance()->activator();
65 + }
66 + /**
67 + * Plugin Activator
68 + */
69 + register_activation_hook( NOTIFICATIONX_FILE, 'notificationx_activate' );
70 + \NotificationX\NotificationX::get_instance();
47 71 }
48 72
49 -/**
50 - * The code that runs during plugin deactivation.
51 - * This action is documented in includes/class-nx-deactivator.php
52 - */
53 -function deactivate_notificationx() {
54 - require_once NOTIFICATIONX_ROOT_DIR_PATH . 'includes/class-nx-deactivator.php';
55 - NotificationX_Deactivator::deactivate();
73 +function notificationx_free_compatibility_notice() {
74 + if ( ! function_exists( 'get_plugins' ) ) {
75 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
76 + }
77 + $plugins = get_plugins();
78 + if ( isset( $plugins['notificationx-pro/notificationx-pro.php']['Version'] ) && version_compare( $plugins['notificationx-pro/notificationx-pro.php']['Version'], '2.5.0', '>=' ) ) {
79 + return;
80 + }
81 + ?>
82 + <div class="notice notice-warning is-dismissible">
83 + <p>
84 + <?php
85 + /* translators: %s: URL of the wp-admin plugins page */
86 + echo wp_kses_post( sprintf( __( "<strong>Recommended: </strong> Seems like you haven't updated the NotificationX Pro version. Please make sure to update NotificationX Pro plugin from <a href='%s'><strong>wp-admin -> Plugins</strong></a>.", 'notificationx' ), esc_url( admin_url( 'plugins.php' ) ) ) ); ?></p>
87 + </div>
88 + <?php
56 89 }
57 90
58 -register_activation_hook( __FILE__, 'activate_notificationx' );
59 -register_deactivation_hook( __FILE__, 'deactivate_notificationx' );
60 91
61 -/**
62 - * The core plugin class that is used to define internationalization,
63 - * admin-specific hooks, and public-facing site hooks.
64 - */
65 -require_once NOTIFICATIONX_ROOT_DIR_PATH . 'includes/class-nx.php';
92 +function notificationx_is_plugin_active( $plugin ) {
93 + return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || notificationx_is_plugin_active_for_network( $plugin );
94 +}
66 95
67 -/**
68 - * Begins execution of the plugin.
69 - *
70 - * Since everything within the plugin is registered via hooks,
71 - * then kicking off the plugin from this point in the file does
72 - * not affect the page life cycle.
73 - *
74 - * @since 1.0.0
75 - */
76 -function run_NotificationX() {
77 - $plugin = new NotificationX();
78 - $plugin->run();
96 +function notificationx_is_plugin_active_for_network( $plugin ) {
97 + if ( ! is_multisite() ) {
98 + return false;
99 + }
100 +
101 + $plugins = get_site_option( 'active_sitewide_plugins' );
102 + if ( isset( $plugins[ $plugin ] ) ) {
103 + return true;
104 + }
105 +
106 + return false;
79 107 }
80 -run_NotificationX();
108 +
109 +//declare compliance with WP Consent API
110 +add_filter( "wp_consent_api_registered_".NOTIFICATIONX_BASENAME, '__return_true' );