PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 260917
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v260917
260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 All 189 releases
← All changes | s2member.php +193 -137 120213260917 View file →
@@ -1,169 +1,224 @@
1 1 <?php
2 +// @codingStandardsIgnoreFile
2 3 /**
3 -* The main plugin file.
4 -*
5 -* This file loads the plugin after checking
6 -* PHP, WordPress® and other compatibility requirements.
7 -*
8 -* Copyright: © 2009-2011
9 -* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
10 -* ( coded in the USA )
11 -*
12 -* Released under the terms of the GNU General Public License.
13 -* You should have received a copy of the GNU General Public License,
14 -* along with this software. In the main directory, see: /licensing/
15 -* If not, see: {@link http://www.gnu.org/licenses/}.
16 -*
17 -* @package s2Member
18 -* @since 1.0
19 -*/
20 -/* -- This section for WordPress® parsing. ------------------------------------------------------------------------------
4 + * The main plugin file.
5 + *
6 + * This file loads the plugin after checking
7 + * PHP, WordPress and other compatibility requirements.
8 + *
9 + * Copyright: © 2009-2011
10 + * {@link http://wpsharks.com/ WP Sharks}
11 + * (coded in the USA)
12 + *
13 + * Released under the terms of the GNU General Public License.
14 + * You should have received a copy of the GNU General Public License,
15 + * along with this software. In the main directory, see: /licensing/
16 + * If not, see: {@link http://www.gnu.org/licenses/}.
17 + *
18 + * @package s2Member
19 + * @since 1.0
20 + */
21 +/* -- This section for WordPress parsing. ------------------------------------------------------------------------------
21 22
22 -Version: 120213
23 -Stable tag: 120213
23 +Version: 260917
24 +Stable tag: 260917
24 25
25 26 SSL Compatible: yes
26 -bbPress® Compatible: yes
27 -WordPress® Compatible: yes
28 -BuddyPress® Compatible: yes
29 -WP® Multisite Compatible: yes
27 +bbPress Compatible: yes
28 +WordPress Compatible: yes
29 +BuddyPress Compatible: yes
30 +WP Multisite Compatible: yes
30 31 Multisite Blog Farm Compatible: yes
31 32
32 -PayPal® Standard Compatible: yes
33 -PayPal® Pro Compatible: yes w/s2Member® Pro
34 -Authorize.Net® Compatible: yes w/s2Member® Pro
35 -Google® Checkout Compatible: yes w/s2Member® Pro
36 -ClickBank® Compatible: yes w/s2Member® Pro
33 +PayPal Standard Compatible: yes
34 +Stripe Compatible: yes w/s2Member Pro
35 +PayPal Pro Compatible: yes w/s2Member Pro
36 +Authorize.Net Compatible: yes w/s2Member Pro
37 +ClickBank Compatible: yes w/s2Member Pro
37 38
38 -Tested up to: 3.3.1
39 -Requires at least: 3.2
39 +Tested up to: 7.2-alpha-63608
40 +Requires at least: 4.2
40 41
41 -Copyright: © 2009 WebSharks, Inc.
42 +Requires PHP: 5.6.2
43 +Tested up to PHP: 8.5.9
44 +
45 +Copyright: © 2009 WP Sharks
42 46 License: GNU General Public License
43 -Contributors: WebSharks
47 +Contributors: WebSharks, JasWSInc, anguz, raamdev, bruce-caldwell, clavaque
44 48
45 -Author: s2Member® / WebSharks, Inc.
46 -Author URI: http://www.s2member.com/
47 -Donate link: http://www.s2member.com/donate/
49 +Author: WP Sharks
50 +Author URI: http://s2member.com/
51 +Donate link: http://s2member.com/r/donate
48 52
49 53 Text Domain: s2member
50 -Domain Path: /includes/translations
54 +Domain Path: /languages
51 55
52 -Plugin Name: s2Member® Framework
53 -Forum URI: http://www.s2member.com/forums/
54 -Plugin URI: http://www.s2member.com/framework/
55 -Privacy URI: http://www.s2member.com/privacy/
56 -Video Tutorials: http://www.s2member.com/videos/
57 -Pro Module / Home Page: http://www.s2member.com/
58 -Pro Module / Prices: http://www.s2member.com/prices/
59 -Pro Module / Auto-Update URL: http://www.s2member.com/
60 -PayPal Pro Integration: http://www.s2member.com/videos/ED70D90C6749DA3D/
61 -Professional Installation URI: http://www.s2member.com/professional-installation/
56 +Plugin Name: s2Member Framework
57 +Forum URI: http://s2member.com/r/forum/
58 +Plugin URI: http://s2member.com/
59 +Privacy URI: http://s2member.com/privacy-policy/
60 +Changelog URI: http://s2member.com/changelog/
61 +Video Tutorials: http://s2member.com/r/s2member-videos/
62 +Knowledge Base: http://s2member.com/kb/
63 +Newsletter: http://s2member.com/r/subscribe/
64 +PayPal Pro Integration: http://s2member.com/r/pp-account-types/
62 65
63 -Description: s2Member®, a powerful (free) membership plugin for WordPress®. Protect/secure members only content with roles/capabilities.
64 -Tags: s2, s2member, s2 member, membership, users, user, members, member, subscribers, subscriber, members only, roles, capabilities, capability, register, signup, paypal, paypal pro, pay pal, authorize, authorize.net, google checkout, clickbank, click bank, buddypress, buddy press, bbpress, bb press, shopping cart, cart, checkout, ecommerce
66 +Description: s2Member, a powerful (free) membership plugin for WordPress. Protect/secure members only content with roles/capabilities.
67 +Tags: s2, s2member, s2 member, membership, users, user, members, member, subscribers, subscriber, members only, roles, capabilities, capability, register, signup, paypal, paypal pro, pay pal, authorize, authorize.net, google wallet, clickbank, click bank, buddypress, buddy press, bbpress, bb press, shopping cart, cart, checkout, ecommerce
65 68
66 -if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
67 - exit("Do not access this file directly.");
69 +-- end section for WordPress parsing. ------------------------------------------------------------------------------- */
70 +if(!defined('WPINC')) // MUST have WordPress.
71 + exit('Do not access this file directly.');
68 72 /**
69 -* The installed version of s2Member.
70 -*
71 -* @package s2Member
72 -* @since 3.0
73 -*
74 -* @var str
75 -*/
76 -if(!defined("WS_PLUGIN__S2MEMBER_VERSION"))
77 - define("WS_PLUGIN__S2MEMBER_VERSION", "120213" /* !#distro-version#! */);
73 + * The installed version of s2Member.
74 + *
75 + * @package s2Member
76 + * @since 3.0
77 + *
78 + * @var string
79 + */
80 +${__FILE__}['tmp'] = '260917'; //version//
81 +if(!defined('WS_PLUGIN__S2MEMBER_VERSION'))
82 + define('WS_PLUGIN__S2MEMBER_VERSION', ${__FILE__}['tmp']);
78 83 /**
79 -* Minimum PHP version required to run s2Member.
80 -*
81 -* @package s2Member
82 -* @since 3.0
83 -*
84 -* @var str
85 -*/
86 -if(!defined("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION"))
87 - define("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2.3" /* !#php-requires-at-least-version#! */);
84 + * Minimum PHP version required to run s2Member.
85 + *
86 + * @package s2Member
87 + * @since 3.0
88 + *
89 + * @var string
90 + */
91 +${__FILE__}['tmp'] = '5.6.2'; //php-required-version//
92 +if(!defined('WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION'))
93 + define('WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION', ${__FILE__}['tmp']);
88 94 /**
89 -* Minimum WordPress® version required to run s2Member.
90 -*
91 -* @package s2Member
92 -* @since 3.0
93 -*
94 -* @var str
95 -*/
96 -if(!defined("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION"))
97 - define("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.2" /* !#wp-requires-at-least-version#! */);
95 + * Minimum WordPress version required to run s2Member.
96 + *
97 + * @package s2Member
98 + * @since 3.0
99 + *
100 + * @var string
101 + */
102 +${__FILE__}['tmp'] = '4.2'; //wp-required-version//
103 +if(!defined('WS_PLUGIN__S2MEMBER_MIN_WP_VERSION'))
104 + define('WS_PLUGIN__S2MEMBER_MIN_WP_VERSION', ${__FILE__}['tmp']);
98 105 /**
99 -* Minimum Pro version required by the Framework.
100 -*
101 -* @package s2Member
102 -* @since 3.0
103 -*
104 -* @var str
105 -*/
106 -if(!defined("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION"))
107 - define("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "120213" /* !#distro-version#! */);
106 + * Minimum Pro version required by the Framework.
107 + *
108 + * @package s2Member
109 + * @since 3.0
110 + *
111 + * @var string
112 + */
113 +${__FILE__}['tmp'] = '210526'; //!!!version//
114 +if(!defined('WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION'))
115 + define('WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION', ${__FILE__}['tmp']);
108 116 /*
109 117 Several compatibility checks.
110 118 If all pass, load the s2Member plugin.
111 119 */
112 -if(version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">=") && version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">=") && !isset($GLOBALS["WS_PLUGIN__"]["s2member"]))
120 +if(version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, '>=') && version_compare(get_bloginfo('version'), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, '>=') && !isset($GLOBALS['WS_PLUGIN__']['s2member']))
121 +{
122 + $GLOBALS['WS_PLUGIN__']['s2member']['l'] = __FILE__;
123 + /*
124 + Hook before loaded.
125 + */
126 + do_action('ws_plugin__s2member_before_loaded');
127 + /*
128 + System configuraton.
129 + */
130 + include_once dirname(__FILE__).'/src/includes/syscon.inc.php';
131 + /*
132 + Hooks and Filters.
133 + */
134 + include_once dirname(__FILE__).'/src/includes/hooks.inc.php';
135 + /*
136 + Hook after system config & Hooks are loaded.
137 + */
138 + do_action('ws_plugin__s2member_config_hooks_loaded');
139 + /*
140 + Load a possible Pro module, if/when available.
141 + */
142 + if(apply_filters('ws_plugin__s2member_load_pro', TRUE))
113 143 {
114 - $GLOBALS["WS_PLUGIN__"]["s2member"]["l"] = __FILE__;
115 - /*
116 - Hook before loaded.
117 - */
118 - do_action("ws_plugin__s2member_before_loaded");
119 - /*
120 - System configuraton.
121 - */
122 - include_once dirname(__FILE__)."/includes/syscon.inc.php";
123 - /*
124 - Hooks and Filters.
125 - */
126 - include_once dirname(__FILE__)."/includes/hooks.inc.php";
127 - /*
128 - Hook after system config & Hooks are loaded.
129 - */
130 - do_action("ws_plugin__s2member_config_hooks_loaded");
131 - /*
132 - Load a possible Pro module, if/when available.
133 - */
134 - if(apply_filters("ws_plugin__s2member_load_pro", true) && file_exists(dirname(__FILE__)."-pro/pro-module.php"))
135 - include_once dirname(__FILE__)."-pro/pro-module.php";
136 - /*
137 - Configure options and their defaults.
138 - */
139 - ws_plugin__s2member_configure_options_and_their_defaults();
140 - /*
141 - Function includes.
142 - */
143 - include_once dirname(__FILE__)."/includes/funcs.inc.php";
144 - /*
145 - Include Shortcodes.
146 - */
147 - include_once dirname(__FILE__)."/includes/codes.inc.php";
148 - /*
149 - Hooks after loaded.
150 - */
151 - do_action("ws_plugin__s2member_loaded");
152 - do_action("ws_plugin__s2member_after_loaded");
144 + if(is_file($_s2member_pro = dirname(__FILE__).'-pro/pro-module.php'))
145 + include_once $_s2member_pro;
146 +
147 + else if(is_file($_s2member_pro = WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'-pro/pro-module.php'))
148 + include_once $_s2member_pro;
149 +
150 + unset($_s2member_pro); // Housekeeping.
153 151 }
152 + /*
153 + Configure options and their defaults.
154 + */
155 + ws_plugin__s2member_configure_options_and_their_defaults();
156 + /*
157 + Function includes.
158 + */
159 + include_once dirname(__FILE__).'/src/includes/funcs.inc.php';
160 + /*
161 + Include Shortcodes.
162 + */
163 + include_once dirname(__FILE__).'/src/includes/codes.inc.php';
164 + /*
165 + Hooks after loaded.
166 + */
167 + do_action('ws_plugin__s2member_loaded');
168 + do_action('ws_plugin__s2member_after_loaded');
169 +}
154 170 /*
155 171 Else NOT compatible. Do we need admin compatibility errors now?
156 172 */
157 -else if(is_admin()) /* Admin compatibility errors. */
173 +else if(is_admin()) // Admin compatibility errors.
174 +{
175 + if(!version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, '>='))
158 176 {
159 - if(!version_compare(PHP_VERSION, WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION, ">="))
160 - {
161 - add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need PHP v\' . WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
162 - }
163 - else if(!version_compare(get_bloginfo("version"), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, ">="))
164 - {
165 - add_action("all_admin_notices", create_function('', 'echo \'<div class="error fade"><p>You need WordPress® v\' . WS_PLUGIN__S2MEMBER_MIN_WP_VERSION . \'+ to use the s2Member plugin.</p></div>\';'));
166 - }
177 + add_action('all_admin_notices', function(){
178 + echo '<div class="error fade"><p>You need PHP v' . WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION . '+ to use the s2Member plugin.</p></div>';
179 + });
167 180 }
168 -?>
181 + else if(!version_compare(get_bloginfo('version'), WS_PLUGIN__S2MEMBER_MIN_WP_VERSION, '>='))
182 + {
183 + add_action('all_admin_notices', function(){
184 + echo '<div class="error fade"><p>You need WordPress v' . WS_PLUGIN__S2MEMBER_MIN_WP_VERSION . '+ to use the s2Member plugin.</p></div>';
185 + });
186 + }
187 +}
188 +unset(${__FILE__}); // Housekeeping.
189 +
190 +//2300808 PayPal button encryption notice if they're using it
191 +if (is_admin() && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"])) {
192 + // Dismiss.
193 + add_action('admin_init', function(){
194 + //260303 Show only to administrators.
195 + if (!current_user_can('manage_options'))
196 + return;
197 +
198 + $user_id = get_current_user_id();
199 + if (isset($_GET['s2-dismiss-2300808']))
200 + add_user_meta($user_id, 's2_notice_dismissed_2300808', 'true', true);
201 + });
202 +
203 + // Notice.
204 + add_action('admin_notices', function(){
205 + //260303 Show only to administrators.
206 + if (!current_user_can('manage_options'))
207 + return;
208 +
209 + $user_id = get_current_user_id();
210 + $logo_url = $GLOBALS['WS_PLUGIN__']['s2member']['c']['dir_url'].'/src/images/logo-square-big.png';
211 + $dismiss_url = esc_url(add_query_arg('s2-dismiss-2300808', '', $_SERVER['REQUEST_URI']));
212 +
213 + if (!get_user_meta($user_id, 's2_notice_dismissed_2300808')) {
214 + echo '
215 + <div class="notice notice-warning" style="position:relative; margin: 0 0 15px 2px !important; padding: 0 40px 0 0 !important">
216 + <table cellspacing="11" cellpadding="0"><tr>
217 + <td><img src="'.$logo_url.'" height="40" width="40" align="top" /></td>
218 + <td><span>⚠️ PayPal has given some trouble recently with encrypted buttons, so for the time being it\'s recommended to leave encryption disabled and allow non-encrypted payments. See: <em>s2Member > PayPal Options > Account Details > Button Encryption</em></span></td>
219 + </tr></table>
220 + <a href="'.$dismiss_url.'" class="notice-dismiss" style="text-decoration:none;"><span class="screen-reader-text">Dismiss this notice.</span></a>
221 + </div>';
222 + }
223 + });
224 +}