-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathnotificationx.php
executable file
·104 lines (92 loc) · 3.83 KB
/
notificationx.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Plugin Name: NotificationX
* Plugin URI: https://notificationx.com
* Description: Social Proof & Recent Sales Popup, Comment Notification, Subscription Notification, Notification Bar and many more.
* Version: 2.9.5
* Author: WPDeveloper
* Author URI: https://wpdeveloper.com
* License: GPL-3.0+
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: notificationx
* Domain Path: /languages
*
* @package NotificationX
* @link https://wpdeveloper.com
* @since 1.0.0
*/
/**
* If this file is called directly, abort.
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Defines CONSTANTS for Whole plugins.
*/
define( 'NOTIFICATIONX_FILE', __FILE__ );
define( 'NOTIFICATIONX_VERSION', '2.9.5' );
define( 'NOTIFICATIONX_URL', plugins_url( '/', __FILE__ ) );
define( 'NOTIFICATIONX_PATH', plugin_dir_path( __FILE__ ) );
define( 'NOTIFICATIONX_BASENAME', plugin_basename( __FILE__ ) );
define( 'NOTIFICATIONX_ASSETS', NOTIFICATIONX_URL . 'assets/' );
define( 'NOTIFICATIONX_ASSETS_PATH', NOTIFICATIONX_PATH . 'assets/' );
define( 'NOTIFICATIONX_DEV_ASSETS', NOTIFICATIONX_URL . 'nxbuild/' );
define( 'NOTIFICATIONX_DEV_ASSETS_PATH', NOTIFICATIONX_PATH . 'nxbuild/' );
define( 'NOTIFICATIONX_INCLUDES', NOTIFICATIONX_PATH . 'includes/' );
define( 'NOTIFICATIONX_PLUGIN_URL', 'https://notificationx.com' );
define( 'NOTIFICATIONX_ADMIN_URL', NOTIFICATIONX_ASSETS . 'admin/' );
define( 'NOTIFICATIONX_PUBLIC_URL', NOTIFICATIONX_ASSETS . 'public/' );
/**
* The Core Engine of the Plugin
*/
if ( ! class_exists( '\NotificationX\NotificationX' ) ) {
require_once NOTIFICATIONX_PATH . 'vendor/autoload.php';
if ( nx_is_plugin_active( 'notificationx-pro/notificationx-pro.php' ) ) {
add_action( 'admin_notices', 'nx_free_compatibility_notice' );
if ( file_exists( dirname( NOTIFICATIONX_PATH ) . '/notificationx-pro/notificationx-pro.php' ) ) {
require_once dirname( NOTIFICATIONX_PATH ) . '/notificationx-pro/notificationx-pro.php';
} else {
add_action('plugins_loaded', function() {
remove_action( 'admin_notices', 'notificationx_install_core_notice' );
\NotificationX\Core\Helper::remove_old_notice();
});
}
}
function activate_notificationx() {
\NotificationX\NotificationX::get_instance()->activator();
}
/**
* Plugin Activator
*/
register_activation_hook( NOTIFICATIONX_FILE, 'activate_notificationx' );
\NotificationX\NotificationX::get_instance();
}
function nx_free_compatibility_notice() {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
if ( isset( $plugins['notificationx-pro/notificationx-pro.php']['Version'] ) && version_compare( $plugins['notificationx-pro/notificationx-pro.php']['Version'], '2.5.0', '>=' ) ) {
return;
}
?>
<div class="notice notice-warning is-dismissible">
<p>
<?php echo 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>
</div>
<?php
}
function nx_is_plugin_active( $plugin ) {
return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) || nx_is_plugin_active_for_network( $plugin );
}
function nx_is_plugin_active_for_network( $plugin ) {
if ( ! is_multisite() ) {
return false;
}
$plugins = get_site_option( 'active_sitewide_plugins' );
if ( isset( $plugins[ $plugin ] ) ) {
return true;
}
return false;
}