forked from wpsharks/s2member-pro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpro-module.php
143 lines (143 loc) · 5.75 KB
/
pro-module.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
// @codingStandardsIgnoreFile
/**
* The main plugin file.
*
* This file loads the plugin after checking
* PHP, WordPress and other compatibility requirements.
*
* Copyright: © 2009-2011
* {@link http://wpsharks.com/ WP Sharks}
* (coded in the USA)
*
* This WordPress plugin (s2Member Pro) is comprised of two parts:
*
* o (1) Its PHP code is licensed under the GPL license, as is WordPress.
* You should have received a copy of the GNU General Public License,
* along with this software. In the main directory, see: /licensing/
* If not, see: {@link http://www.gnu.org/licenses/}.
*
* o (2) All other parts of (s2Member Pro); including, but not limited to:
* the CSS code, some JavaScript code, images, and design;
* are licensed according to the license purchased.
* See: {@link http://s2member.com/prices/}
*
* Unless you have our prior written consent, you must NOT directly or indirectly license,
* sub-license, sell, resell, or provide for free; part (2) of the s2Member Pro Add-on;
* or make an offer to do any of these things. All of these things are strictly
* prohibited with part (2) of the s2Member Pro Add-on.
*
* Your purchase of s2Member Pro includes free lifetime upgrades via s2Member.com
* (i.e., new features, bug fixes, updates, improvements); along with full access
* to our video tutorial library: {@link http://s2member.com/videos/}
*
* @package s2Member
* @since 1.0
*/
if(!defined('WPINC')) // MUST have WordPress.
exit('Do not access this file directly.');
/**
* The installed version of s2Member Pro.
*
* @package s2Member
* @since 1.0
*
* @var string
*/
${__FILE__}['tmp'] = '191022'; //version//
if(!defined('WS_PLUGIN__S2MEMBER_PRO_VERSION'))
define('WS_PLUGIN__S2MEMBER_PRO_VERSION', ${__FILE__}['tmp']);
/**
* Minimum PHP version required to run s2Member Pro.
*
* @package s2Member
* @since 1.0
*
* @var string
*/
${__FILE__}['tmp'] = '5.6.2'; //php-required-version//
if(!defined('WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION'))
define('WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION', ${__FILE__}['tmp']);
/**
* Minimum WordPress version required to run s2Member Pro.
*
* @package s2Member
* @since 1.0
*
* @var string
*/
${__FILE__}['tmp'] = '4.2'; //wp-required-version//
if(!defined('WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION'))
define('WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION', ${__FILE__}['tmp']);
/**
* Minimum Framework version required by s2Member Pro.
*
* @package s2Member
* @since 1.0
*
* @var string
*/
${__FILE__}['tmp'] = '191022'; //version//
if(!defined('WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION'))
define('WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION', ${__FILE__}['tmp']);
/*
Several compatibility checks.
If all pass, load the s2Member plugin.
*/
if(version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION, '>=') && version_compare(get_bloginfo('version'), WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION, '>=') && defined('WS_PLUGIN__S2MEMBER_VERSION') && defined('WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION') && version_compare(WS_PLUGIN__S2MEMBER_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION, '>=') && version_compare(WS_PLUGIN__S2MEMBER_PRO_VERSION, WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION, '>=') && !isset($GLOBALS['WS_PLUGIN__']['s2member_pro']))
{
$GLOBALS['WS_PLUGIN__']['s2member_pro']['l'] = __FILE__;
/*
Hook before loaded.
*/
do_action('ws_plugin__s2member_pro_before_loaded');
/*
System configuration.
*/
include_once dirname(__FILE__).'/src/includes/syscon.inc.php';
/*
Hooks and Filters.
*/
include_once dirname(__FILE__).'/src/includes/hooks.inc.php';
/*
Hook after system config & Hooks are loaded.
*/
do_action('ws_plugin__s2member_pro_config_hooks_loaded');
/*
Function includes.
*/
include_once dirname(__FILE__).'/src/includes/funcs.inc.php';
/*
Include Shortcodes.
*/
include_once dirname(__FILE__).'/src/includes/codes.inc.php';
/*
Hooks after loaded.
*/
do_action('ws_plugin__s2member_pro_loaded');
do_action('ws_plugin__s2member_pro_after_loaded');
}
/*
Else NOT compatible. Do we need admin compatibility errors now?
*/
else if(is_admin()) // Admin compatibility errors.
{
if(!version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION, '>='))
{
add_action('all_admin_notices', create_function('', 'echo \'<div class="error fade"><p>You need PHP v\'.WS_PLUGIN__S2MEMBER_PRO_MIN_PHP_VERSION.\'+ to use the s2Member Pro Add-on.</p></div>\';'));
}
else if(!version_compare(get_bloginfo('version'), WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION, '>='))
{
add_action('all_admin_notices', create_function('', 'echo \'<div class="error fade"><p>You need WordPress v\'.WS_PLUGIN__S2MEMBER_PRO_MIN_WP_VERSION.\'+ to use the s2Member Pro Add-on.</p></div>\';'));
}
else if(!defined('WS_PLUGIN__S2MEMBER_VERSION') || !defined('WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION') || !version_compare(WS_PLUGIN__S2MEMBER_VERSION, WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION, '>='))
{
add_action('all_admin_notices', create_function('', 'echo \'<div class="error fade"><p>In order to load the s2Member Pro Add-on, you need the <a href="http://s2member.com/release-archive/" target="_blank">s2Member Framework</a>, v\'.WS_PLUGIN__S2MEMBER_PRO_MIN_FRAMEWORK_VERSION.\'+. It\\\'s free.</p></div>\';'));
}
else if(!version_compare(WS_PLUGIN__S2MEMBER_PRO_VERSION, WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION, '>=') && file_exists(dirname(__FILE__).'/src/includes/classes/upgrader.inc.php'))
{
include_once dirname(__FILE__).'/src/includes/classes/upgrader.inc.php'; // Include upgrader class. s2Member Pro autoload functionality will NOT be available in this scenario. Using ``include_once()``.
add_action('admin_init', 'c_ws_plugin__s2member_pro_upgrader::upgrade').add_action('all_admin_notices', create_function('', 'echo c_ws_plugin__s2member_pro_upgrader::wizard();'));
}
}
unset(${__FILE__}); // Housekeeping.