s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) - Version 3.2.5

Version Description

  • IP Restrictions ( reset ). Several site owners have reported issues with s2Member's IP Restrictions. A full investigation has been performed. Although no bugs were found, we suspect that recent reports on this topic are related to a combination of a.) improvements in recent versions of s2Member, with respect to IP Restrictions ( adaptive concurrency limits ); and b.) lack of support ( on the part of s2Member ) for resetting IP Restriction Logs after changes in configuration. In this release of s2Member, we've introduced a new tool for site owners, which allows you to Reset IP Restriction Logs manually, at anytime you like. For further details, please see: s2Member -> General Options -> IP Restrictions ( look for the new button titled: Reset IP Restriction Logs. ).
  • Compatibility. s2Member's activation/deactivation routines have been updated to support installations of WordPress that may, or may not, already have the default WordPress Roles installed. For instance, some installations of WordPress are running with Role managing plugins. A site owner could have modified WordPress, and may no longer have one, or even all of these default Roles: administrator, editor, author, contributor, subscriber. s2Member is now capable of dealing with this scenario gracefully upon activation/deactivation.
Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 3.2.5
Comparing to
See all releases

Code changes from version 3.2.4 to 3.2.5

includes/functions/activate-deactivate.inc.php CHANGED
@@ -12,7 +12,7 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
/*
17
Check existing installations that have not been re-activated.
18
Attach to: add_action("admin_init");
@@ -22,20 +22,23 @@ if (!function_exists ("ws_plugin__s2member_check_activation"))
22
function ws_plugin__s2member_check_activation () /* Up-to-date? */
23
{
24
$v = get_option ("ws_plugin__s2member_activated_version");
25
- if (!$v || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
26
- ws_plugin__s2member_activate ();
27
/**/
28
- /* Be ABSOLUTELY sure to use "else if" here. Avoid doubles. */
29
/**/
30
else if (is_multisite () && is_main_site ())
31
- /* In case a Multisite Network is enabled later on. */
32
{
33
$mms_v = get_option ("ws_plugin__s2member_activated_mms_version");
34
if (!$mms_v || !version_compare ($mms_v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
35
- ws_plugin__s2member_activate ();
36
}
37
/**/
38
- return;
39
}
40
}
41
/*
@@ -57,71 +60,91 @@ if (!function_exists ("ws_plugin__s2member_activate"))
57
/**/
58
do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
59
/**/
60
- $role = &get_role ("subscriber");
61
- $role->add_cap ("access_s2member_level0");
62
- /**/
63
add_role ("s2member_level1", "s2Member Level 1");
64
add_role ("s2member_level2", "s2Member Level 2");
65
add_role ("s2member_level3", "s2Member Level 3");
66
add_role ("s2member_level4", "s2Member Level 4");
67
/**/
68
- $role = &get_role ("s2member_level1");
69
- $role->add_cap ("read");
70
- $role->add_cap ("level_0");
71
- $role->add_cap ("access_s2member_level0");
72
- $role->add_cap ("access_s2member_level1");
73
/**/
74
- $role = &get_role ("s2member_level2");
75
- $role->add_cap ("read");
76
- $role->add_cap ("level_0");
77
- $role->add_cap ("access_s2member_level0");
78
- $role->add_cap ("access_s2member_level1");
79
- $role->add_cap ("access_s2member_level2");
80
/**/
81
- $role = &get_role ("s2member_level3");
82
- $role->add_cap ("read");
83
- $role->add_cap ("level_0");
84
- $role->add_cap ("access_s2member_level0");
85
- $role->add_cap ("access_s2member_level1");
86
- $role->add_cap ("access_s2member_level2");
87
- $role->add_cap ("access_s2member_level3");
88
/**/
89
- $role = &get_role ("s2member_level4");
90
- $role->add_cap ("read");
91
- $role->add_cap ("level_0");
92
- $role->add_cap ("access_s2member_level0");
93
- $role->add_cap ("access_s2member_level1");
94
- $role->add_cap ("access_s2member_level2");
95
- $role->add_cap ("access_s2member_level3");
96
- $role->add_cap ("access_s2member_level4");
97
/**/
98
- $role = &get_role ("administrator");
99
- $role->add_cap ("access_s2member_level0");
100
- $role->add_cap ("access_s2member_level1");
101
- $role->add_cap ("access_s2member_level2");
102
- $role->add_cap ("access_s2member_level3");
103
- $role->add_cap ("access_s2member_level4");
104
/**/
105
- $role = &get_role ("editor");
106
- $role->add_cap ("access_s2member_level0");
107
- $role->add_cap ("access_s2member_level1");
108
- $role->add_cap ("access_s2member_level2");
109
- $role->add_cap ("access_s2member_level3");
110
- $role->add_cap ("access_s2member_level4");
111
/**/
112
- $role = &get_role ("author");
113
- $role->add_cap ("access_s2member_level0");
114
- $role->add_cap ("access_s2member_level1");
115
- $role->add_cap ("access_s2member_level2");
116
- $role->add_cap ("access_s2member_level3");
117
- $role->add_cap ("access_s2member_level4");
118
/**/
119
- $role = &get_role ("contributor");
120
- $role->add_cap ("access_s2member_level0");
121
- $role->add_cap ("access_s2member_level1");
122
- $role->add_cap ("access_s2member_level2");
123
- $role->add_cap ("access_s2member_level3");
124
- $role->add_cap ("access_s2member_level4");
125
/**/
126
if (!is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
127
if (is_writable (dirname ($files_dir)))
@@ -139,31 +162,41 @@ if (!function_exists ("ws_plugin__s2member_activate"))
139
if (!file_exists ($htaccess = $logs_dir . "/.htaccess"))
140
file_put_contents ($htaccess, "deny from all");
141
/**/
142
- (!is_numeric (get_option ("ws_plugin__s2member_configured"))) ? update_option ("ws_plugin__s2member_configured", "0") : null;
143
(!is_array (get_option ("ws_plugin__s2member_cache"))) ? update_option ("ws_plugin__s2member_cache", array ()) : null;
144
(!is_array (get_option ("ws_plugin__s2member_notices"))) ? update_option ("ws_plugin__s2member_notices", array ()) : null;
145
(!is_array (get_option ("ws_plugin__s2member_options"))) ? update_option ("ws_plugin__s2member_options", array ()) : null;
146
/**/
147
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"]) /* If already configured, we are re-activating. */
148
{
149
$v = get_option ("ws_plugin__s2member_activated_version");
150
if (!$v || !version_compare ($v, "3.2", ">=")) /* Needs to be upgraded? */
151
- /* Version 3.2 is where the `meta_key` names were changed. They're prefixed now. */
152
{
153
$like = "`meta_key` LIKE 's2member\_%' AND `meta_key` NOT LIKE '%s2member\_originating\_blog%'";
154
$wpdb->query ("UPDATE `" . $wpdb->usermeta . "` SET `meta_key` = CONCAT('" . $wpdb->prefix . "', `meta_key`) WHERE " . $like);
155
}
156
/**/
157
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
158
$notice .= 'You now have version ' . WS_PLUGIN__S2MEMBER_VERSION . '. Your existing configuration remains.';
159
if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) /* No Changelog on a Multisite Farm. */
160
$notice .= '<br />Have fun, <a href="admin.php?page=ws-plugin--s2member-info#rm-changelog">read the Changelog</a>, and make some money! :-)';
161
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
162
}
163
else /* Otherwise, (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide. */
164
{
165
$notice = '<strong>s2Member</strong> v' . WS_PLUGIN__S2MEMBER_VERSION . ' has been <strong>activated</strong>. Nice work!<br />';
166
$notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-start">read the Quick Start Guide</a>, and make some money! :-)';
167
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
168
}
169
/**/
@@ -171,17 +204,18 @@ if (!function_exists ("ws_plugin__s2member_activate"))
171
/**/
172
if (is_multisite () && is_main_site ()) /* Network activation routines. A few quick adjustments. */
173
{
174
- foreach ((array)($users = $wpdb->get_results ("SELECT `ID` FROM `" . $wpdb->users . "`")) as $user)
175
{
176
/* Here we convert everyone already in the system; without a point of origin.
177
This will set their point of origin to the Main Site ( Dashboard Blog ). */
178
- if (!($originating_blog = get_user_meta ($user->ID, "s2member_originating_blog", true)))
179
update_user_meta ($user->ID, "s2member_originating_blog", $current_site->blog_id);
180
}
181
/**/
182
$notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v' . WS_PLUGIN__S2MEMBER_VERSION . '.<br />';
183
$notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
184
$notice .= 'In the Dashboard for your Main Site, see:<br /><code>s2Member -> Multisite ( Config )</code>.';
185
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
186
/**/
187
update_option ("ws_plugin__s2member_activated_mms_version", WS_PLUGIN__S2MEMBER_VERSION);
@@ -189,7 +223,7 @@ if (!function_exists ("ws_plugin__s2member_activate"))
189
/**/
190
do_action ("ws_plugin__s2member_after_activation", get_defined_vars ());
191
/**/
192
- return;
193
}
194
}
195
/*
@@ -208,41 +242,51 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
208
/**/
209
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
210
{
211
- $role = &get_role ("subscriber");
212
- $role->remove_cap ("access_s2member_level0");
213
/**/
214
- remove_role("s2member_level1");
215
- remove_role("s2member_level2");
216
- remove_role("s2member_level3");
217
- remove_role("s2member_level4");
218
/**/
219
- $role = &get_role ("administrator");
220
- $role->remove_cap ("access_s2member_level0");
221
- $role->remove_cap ("access_s2member_level1");
222
- $role->remove_cap ("access_s2member_level2");
223
- $role->remove_cap ("access_s2member_level3");
224
- $role->remove_cap ("access_s2member_level4");
225
/**/
226
- $role = &get_role ("editor");
227
- $role->remove_cap ("access_s2member_level0");
228
- $role->remove_cap ("access_s2member_level1");
229
- $role->remove_cap ("access_s2member_level2");
230
- $role->remove_cap ("access_s2member_level3");
231
- $role->remove_cap ("access_s2member_level4");
232
/**/
233
- $role = &get_role ("author");
234
- $role->remove_cap ("access_s2member_level0");
235
- $role->remove_cap ("access_s2member_level1");
236
- $role->remove_cap ("access_s2member_level2");
237
- $role->remove_cap ("access_s2member_level3");
238
- $role->remove_cap ("access_s2member_level4");
239
/**/
240
- $role = &get_role ("contributor");
241
- $role->remove_cap ("access_s2member_level0");
242
- $role->remove_cap ("access_s2member_level1");
243
- $role->remove_cap ("access_s2member_level2");
244
- $role->remove_cap ("access_s2member_level3");
245
- $role->remove_cap ("access_s2member_level4");
246
/**/
247
if (is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
248
{
@@ -262,23 +306,25 @@ if (!function_exists ("ws_plugin__s2member_deactivate"))
262
@rmdir($logs_dir);
263
}
264
/**/
265
- delete_option("ws_plugin__s2member_activated_mms_version");
266
- delete_option("ws_plugin__s2member_activated_version");
267
- delete_option("ws_plugin__s2member_configured");
268
- delete_option("ws_plugin__s2member_cache");
269
- delete_option("ws_plugin__s2member_notices");
270
- delete_option("ws_plugin__s2member_options");
271
/**/
272
- $like = "`meta_key` LIKE '%s2member\_%'";
273
- $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE " . $like);
274
- $wpdb->query ("DELETE FROM `" . $wpdb->usermeta . "` WHERE " . $like);
275
/**/
276
do_action ("ws_plugin__s2member_during_deactivation", get_defined_vars ());
277
}
278
/**/
279
do_action ("ws_plugin__s2member_after_deactivation", get_defined_vars ());
280
/**/
281
- return;
282
}
283
}
284
?>
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Check existing installations that have not been re-activated.
18
Attach to: add_action("admin_init");
22
function ws_plugin__s2member_check_activation () /* Up-to-date? */
23
{
24
$v = get_option ("ws_plugin__s2member_activated_version");
25
/**/
26
+ if (!$v || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
27
+ {
28
+ ws_plugin__s2member_activate ();
29
+ }
30
/**/
31
else if (is_multisite () && is_main_site ())
32
{
33
$mms_v = get_option ("ws_plugin__s2member_activated_mms_version");
34
+ /**/
35
if (!$mms_v || !version_compare ($mms_v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
36
+ {
37
+ ws_plugin__s2member_activate ();
38
+ }
39
}
40
/**/
41
+ return; /* Return for uniformity. */
42
}
43
}
44
/*
60
/**/
61
do_action ("ws_plugin__s2member_before_activation", get_defined_vars ());
62
/**/
63
+ add_role ("subscriber", "Subscriber");
64
add_role ("s2member_level1", "s2Member Level 1");
65
add_role ("s2member_level2", "s2Member Level 2");
66
add_role ("s2member_level3", "s2Member Level 3");
67
add_role ("s2member_level4", "s2Member Level 4");
68
/**/
69
+ if ($role = &get_role ("subscriber"))
70
+ {
71
+ $role->add_cap ("read");
72
+ $role->add_cap ("access_s2member_level0");
73
+ }
74
/**/
75
+ if ($role = &get_role ("s2member_level1"))
76
+ {
77
+ $role->add_cap ("read");
78
+ $role->add_cap ("level_0");
79
+ $role->add_cap ("access_s2member_level0");
80
+ $role->add_cap ("access_s2member_level1");
81
+ }
82
/**/
83
+ if ($role = &get_role ("s2member_level2"))
84
+ {
85
+ $role->add_cap ("read");
86
+ $role->add_cap ("level_0");
87
+ $role->add_cap ("access_s2member_level0");
88
+ $role->add_cap ("access_s2member_level1");
89
+ $role->add_cap ("access_s2member_level2");
90
+ }
91
/**/
92
+ if ($role = &get_role ("s2member_level3"))
93
+ {
94
+ $role->add_cap ("read");
95
+ $role->add_cap ("level_0");
96
+ $role->add_cap ("access_s2member_level0");
97
+ $role->add_cap ("access_s2member_level1");
98
+ $role->add_cap ("access_s2member_level2");
99
+ $role->add_cap ("access_s2member_level3");
100
+ }
101
/**/
102
+ if ($role = &get_role ("s2member_level4"))
103
+ {
104
+ $role->add_cap ("read");
105
+ $role->add_cap ("level_0");
106
+ $role->add_cap ("access_s2member_level0");
107
+ $role->add_cap ("access_s2member_level1");
108
+ $role->add_cap ("access_s2member_level2");
109
+ $role->add_cap ("access_s2member_level3");
110
+ $role->add_cap ("access_s2member_level4");
111
+ }
112
/**/
113
+ if ($role = &get_role ("administrator"))
114
+ {
115
+ $role->add_cap ("access_s2member_level0");
116
+ $role->add_cap ("access_s2member_level1");
117
+ $role->add_cap ("access_s2member_level2");
118
+ $role->add_cap ("access_s2member_level3");
119
+ $role->add_cap ("access_s2member_level4");
120
+ }
121
/**/
122
+ if ($role = &get_role ("editor"))
123
+ {
124
+ $role->add_cap ("access_s2member_level0");
125
+ $role->add_cap ("access_s2member_level1");
126
+ $role->add_cap ("access_s2member_level2");
127
+ $role->add_cap ("access_s2member_level3");
128
+ $role->add_cap ("access_s2member_level4");
129
+ }
130
/**/
131
+ if ($role = &get_role ("author"))
132
+ {
133
+ $role->add_cap ("access_s2member_level0");
134
+ $role->add_cap ("access_s2member_level1");
135
+ $role->add_cap ("access_s2member_level2");
136
+ $role->add_cap ("access_s2member_level3");
137
+ $role->add_cap ("access_s2member_level4");
138
+ }
139
+ /**/
140
+ if ($role = &get_role ("contributor"))
141
+ {
142
+ $role->add_cap ("access_s2member_level0");
143
+ $role->add_cap ("access_s2member_level1");
144
+ $role->add_cap ("access_s2member_level2");
145
+ $role->add_cap ("access_s2member_level3");
146
+ $role->add_cap ("access_s2member_level4");
147
+ }
148
/**/
149
if (!is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
150
if (is_writable (dirname ($files_dir)))
162
if (!file_exists ($htaccess = $logs_dir . "/.htaccess"))
163
file_put_contents ($htaccess, "deny from all");
164
/**/
165
(!is_array (get_option ("ws_plugin__s2member_cache"))) ? update_option ("ws_plugin__s2member_cache", array ()) : null;
166
(!is_array (get_option ("ws_plugin__s2member_notices"))) ? update_option ("ws_plugin__s2member_notices", array ()) : null;
167
(!is_array (get_option ("ws_plugin__s2member_options"))) ? update_option ("ws_plugin__s2member_options", array ()) : null;
168
+ (!is_numeric (get_option ("ws_plugin__s2member_configured"))) ? update_option ("ws_plugin__s2member_configured", "0") : null;
169
/**/
170
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"]) /* If already configured, we are re-activating. */
171
{
172
$v = get_option ("ws_plugin__s2member_activated_version");
173
+ /**/
174
if (!$v || !version_compare ($v, "3.2", ">=")) /* Needs to be upgraded? */
175
+ /* Version 3.2 is where `meta_key` names were changed. They're prefixed now. */
176
{
177
$like = "`meta_key` LIKE 's2member\_%' AND `meta_key` NOT LIKE '%s2member\_originating\_blog%'";
178
$wpdb->query ("UPDATE `" . $wpdb->usermeta . "` SET `meta_key` = CONCAT('" . $wpdb->prefix . "', `meta_key`) WHERE " . $like);
179
}
180
/**/
181
+ if (!$v || !version_compare ($v, "3.2.5", ">=")) /* Needs to be upgraded? */
182
+ /* Version 3.2.5 is where transient names were changed. They're prefixed now. */
183
+ {
184
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_%'");
185
+ }
186
+ /**/
187
$notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
188
$notice .= 'You now have version ' . WS_PLUGIN__S2MEMBER_VERSION . '. Your existing configuration remains.';
189
+ /**/
190
if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) /* No Changelog on a Multisite Farm. */
191
$notice .= '<br />Have fun, <a href="admin.php?page=ws-plugin--s2member-info#rm-changelog">read the Changelog</a>, and make some money! :-)';
192
+ /**/
193
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
194
}
195
else /* Otherwise, (initial activation); we'll help the Site Owner out by giving them a link to the Quick Start Guide. */
196
{
197
$notice = '<strong>s2Member</strong> v' . WS_PLUGIN__S2MEMBER_VERSION . ' has been <strong>activated</strong>. Nice work!<br />';
198
$notice .= 'Have fun, <a href="admin.php?page=ws-plugin--s2member-start">read the Quick Start Guide</a>, and make some money! :-)';
199
+ /**/
200
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
201
}
202
/**/
204
/**/
205
if (is_multisite () && is_main_site ()) /* Network activation routines. A few quick adjustments. */
206
{
207
+ foreach ((array) ($users = $wpdb->get_results ("SELECT `ID` FROM `" . $wpdb->users . "`")) as $user)
208
{
209
/* Here we convert everyone already in the system; without a point of origin.
210
This will set their point of origin to the Main Site ( Dashboard Blog ). */
211
+ if (! ($originating_blog = get_user_meta ($user->ID, "s2member_originating_blog", true)))
212
update_user_meta ($user->ID, "s2member_originating_blog", $current_site->blog_id);
213
}
214
/**/
215
$notice = '<strong>Multisite Network</strong> updated automatically by <strong>s2Member</strong> v' . WS_PLUGIN__S2MEMBER_VERSION . '.<br />';
216
$notice .= 'You\'ll want to configure s2Member\'s Multisite options now.<br />';
217
$notice .= 'In the Dashboard for your Main Site, see:<br /><code>s2Member -> Multisite ( Config )</code>.';
218
+ /**/
219
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
220
/**/
221
update_option ("ws_plugin__s2member_activated_mms_version", WS_PLUGIN__S2MEMBER_VERSION);
223
/**/
224
do_action ("ws_plugin__s2member_after_activation", get_defined_vars ());
225
/**/
226
+ return; /* Return for uniformity. */
227
}
228
}
229
/*
242
/**/
243
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
244
{
245
+ remove_role ("s2member_level1");
246
+ remove_role ("s2member_level2");
247
+ remove_role ("s2member_level3");
248
+ remove_role ("s2member_level4");
249
/**/
250
+ if ($role = &get_role ("subscriber"))
251
+ {
252
+ $role->remove_cap ("access_s2member_level0");
253
+ }
254
/**/
255
+ if ($role = &get_role ("administrator"))
256
+ {
257
+ $role->remove_cap ("access_s2member_level0");
258
+ $role->remove_cap ("access_s2member_level1");
259
+ $role->remove_cap ("access_s2member_level2");
260
+ $role->remove_cap ("access_s2member_level3");
261
+ $role->remove_cap ("access_s2member_level4");
262
+ }
263
/**/
264
+ if ($role = &get_role ("editor"))
265
+ {
266
+ $role->remove_cap ("access_s2member_level0");
267
+ $role->remove_cap ("access_s2member_level1");
268
+ $role->remove_cap ("access_s2member_level2");
269
+ $role->remove_cap ("access_s2member_level3");
270
+ $role->remove_cap ("access_s2member_level4");
271
+ }
272
/**/
273
+ if ($role = &get_role ("author"))
274
+ {
275
+ $role->remove_cap ("access_s2member_level0");
276
+ $role->remove_cap ("access_s2member_level1");
277
+ $role->remove_cap ("access_s2member_level2");
278
+ $role->remove_cap ("access_s2member_level3");
279
+ $role->remove_cap ("access_s2member_level4");
280
+ }
281
/**/
282
+ if ($role = &get_role ("contributor"))
283
+ {
284
+ $role->remove_cap ("access_s2member_level0");
285
+ $role->remove_cap ("access_s2member_level1");
286
+ $role->remove_cap ("access_s2member_level2");
287
+ $role->remove_cap ("access_s2member_level3");
288
+ $role->remove_cap ("access_s2member_level4");
289
+ }
290
/**/
291
if (is_dir ($files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"]))
292
{
306
@rmdir($logs_dir);
307
}
308
/**/
309
+ delete_option ("ws_plugin__s2member_cache");
310
+ delete_option ("ws_plugin__s2member_notices");
311
+ delete_option ("ws_plugin__s2member_options");
312
+ delete_option ("ws_plugin__s2member_configured");
313
+ delete_option ("ws_plugin__s2member_activated_version");
314
+ delete_option ("ws_plugin__s2member_activated_mms_version");
315
/**/
316
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '%s2member\_%'");
317
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_s2m\_%'");
318
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_timeout\_s2m\_%'");
319
+ $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` LIKE '%s2member\_%'");
320
+ $wpdb->query ("DELETE FROM `" . $wpdb->usermeta . "` WHERE `meta_key` LIKE '%s2member\_%'");
321
/**/
322
do_action ("ws_plugin__s2member_during_deactivation", get_defined_vars ());
323
}
324
/**/
325
do_action ("ws_plugin__s2member_after_deactivation", get_defined_vars ());
326
/**/
327
+ return; /* Return for uniformity. */
328
}
329
}
330
?>
includes/functions/ip-restrictions.inc.php CHANGED
@@ -12,44 +12,46 @@ If not, see: <http://www.gnu.org/licenses/>.
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit("Do not access this file directly.");
16
/*
17
Function for handling IP Restrictions.
18
- IP addresses are stored in a Transient field.
19
*/
20
if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
21
{
22
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
23
{
24
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
25
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
- if ($restriction) /* There MUST be a restriction. However, the IP *could* be empty. */
29
{
30
- $ip = ($ip) ? $ip : "empty"; /* Allow empty IPs; we need to track them too. */
31
/**/
32
- $entries = (array)get_transient ($transient = md5 ("s2member_ip_restrictions_" . $restriction));
33
/**/
34
$conc_filter = "ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip";
35
$concurrency = apply_filters ($conc_filter, "30 days");
36
/**/
37
foreach ($entries as $_entry => $_time) /* Auto-expire entries. */
38
if ($_time < strtotime ("-" . $concurrency))
39
- unset($entries[$_entry]);
40
/**/
41
$entries[$ip] = strtotime ("now"); /* Log this entry. */
42
- set_transient ($transient, $entries, 2 * (strtotime ("+" . $concurrency) - strtotime ("now")));
43
- /*
44
- Now check to see if this is a security breach; or if it has too many IP addresses.
45
- */
46
- if (get_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached")))
47
{
48
ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
49
/**/
50
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
51
/**/
52
- header("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
53
/**/
54
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
55
echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
@@ -61,12 +63,11 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
61
{
62
ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
63
/**/
64
- $p = $punish = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"];
65
- set_transient (md5 ("s2member_ip_restrictions_" . $restriction . "_breached"), "1", $p);
66
/**/
67
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
68
/**/
69
- header("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
70
/**/
71
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
72
echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
@@ -76,7 +77,7 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
76
}
77
else /* OK, this looks legitimate. Continue updating the Transient array of IP addresses. */
78
{
79
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
80
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
81
unset ($__refs, $__v); /* Unset defined __refs, __v. */
82
/**/
@@ -87,4 +88,41 @@ if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
87
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
88
}
89
}
90
?>
12
Direct access denial.
13
*/
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
/*
17
Function for handling IP Restrictions.
18
+ IP address details are stored in Transient fields.
19
*/
20
if (!function_exists ("ws_plugin__s2member_ip_restrictions_ok"))
21
{
22
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
23
{
24
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
25
do_action ("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars ());
26
unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
/**/
28
+ if ($restriction) /* There MUST be a restriction. However, the IP * could * be empty. */
29
{
30
+ $prefix = "s2m_ipr_"; /* s2Member Transient prefix for all IP Restrictions. */
31
/**/
32
+ $transient_entries = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_entries");
33
+ $transient_security_breach = $prefix . md5 ("s2member_ip_restrictions_" . $restriction . "_security_breach");
34
/**/
35
$conc_filter = "ws_plugin__s2member_ip_restrictions__concurrency_time_per_ip";
36
$concurrency = apply_filters ($conc_filter, "30 days");
37
/**/
38
+ $entries = (is_array ($entries = get_transient ($transient_entries))) ? $entries : array ();
39
+ /**/
40
foreach ($entries as $_entry => $_time) /* Auto-expire entries. */
41
if ($_time < strtotime ("-" . $concurrency))
42
+ unset ($entries[$_entry]);
43
/**/
44
+ $ip = ($ip) ? $ip : "empty"; /* Allow empty IPs. */
45
$entries[$ip] = strtotime ("now"); /* Log this entry. */
46
+ set_transient ($transient_entries, $entries, 2 * (strtotime ("+" . $concurrency) - strtotime ("now")));
47
+ /**/
48
+ if (get_transient ($transient_security_breach)) /* Has this restriction already been breached? */
49
{
50
ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
51
/**/
52
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
53
/**/
54
+ header ("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
55
/**/
56
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
57
echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
63
{
64
ws_plugin__s2member_nocache_constants(true) . wp_clear_auth_cookie ();
65
/**/
66
+ set_transient ($transient_security_breach, 1, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
67
/**/
68
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars ());
69
/**/
70
+ header ("HTTP/1.0 503 Service Temporarily Unavailable"); /* Sends a status header. */
71
/**/
72
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
73
echo 'Too many IP addresses accessing one secure area<em>!</em><br />' . "\n";
77
}
78
else /* OK, this looks legitimate. Continue updating the Transient array of IP addresses. */
79
{
80
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
81
do_action ("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars ());
82
unset ($__refs, $__v); /* Unset defined __refs, __v. */
83
/**/
88
return apply_filters ("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars ());
89
}
90
}
91
+ /*
92
+ Function resets/deletes all IP Restrictions.
93
+ */
94
+ if (!function_exists ("ws_plugin__s2member_delete_reset_all_ip_restrictions"))
95
+ {
96
+ function ws_plugin__s2member_delete_reset_all_ip_restrictions ()
97
+ {
98
+ global $wpdb; /* Need global database object. */
99
+ /**/
100
+ do_action ("ws_plugin__s2member_before_delete_reset_all_ip_restrictions", get_defined_vars ());
101
+ /**/
102
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_s2m\_ipr\_%'");
103
+ $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_timeout\_s2m\_ipr\_%'");
104
+ /**/
105
+ do_action ("ws_plugin__s2member_after_delete_reset_all_ip_restrictions", get_defined_vars ());
106
+ /**/
107
+ return; /* Return for uniformity. */
108
+ }
109
+ }
110
+ /*
111
+ Function resets/deletes all IP Restrictions.
112
+ Attach to: add_action("wp_ajax_ws_plugin__s2member_reset_ip_restrictions_via_ajax");
113
+ */
114
+ if (!function_exists ("ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax"))
115
+ {
116
+ function ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax ()
117
+ {
118
+ do_action ("ws_plugin__s2member_before_delete_reset_all_ip_restrictions_via_ajax", get_defined_vars ());
119
+ /**/
120
+ if (current_user_can ("create_users")) /* Check priveledges as well. */
121
+ if (($nonce = $_POST["ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax"))
122
+ if (ws_plugin__s2member_delete_reset_all_ip_restrictions () !== "nill") /* Delete/reset IP Restrictions, and return 1 ( success ). */
123
+ echo apply_filters ("ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax", 1, get_defined_vars ());
124
+ /**/
125
+ exit ();
126
+ }
127
+ }
128
?>
includes/functions/sp-access.inc.php CHANGED
@@ -41,17 +41,17 @@ if (!function_exists ("ws_plugin__s2member_sp_access_link_gen"))
41
}
42
/*
43
Generates Specific Post/Page Access links via ajax tools.
44
- Attach to: add_action("wp_ajax_s2member_sp_access_link");
45
*/
46
- if (!function_exists ("ws_plugin__s2member_sp_access_link"))
47
{
48
- function ws_plugin__s2member_sp_access_link ()
49
{
50
- do_action ("ws_plugin__s2member_before_sp_access_link", get_defined_vars ());
51
/**/
52
if (current_user_can ("create_users")) /* Check priveledges as well. */
53
- if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
54
- echo apply_filters ("ws_plugin__s2member_sp_access_link", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]), get_defined_vars ());
55
/**/
56
exit ();
57
}
41
}
42
/*
43
Generates Specific Post/Page Access links via ajax tools.
44
+ Attach to: add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax");
45
*/
46
+ if (!function_exists ("ws_plugin__s2member_sp_access_link_via_ajax"))
47
{
48
+ function ws_plugin__s2member_sp_access_link_via_ajax ()
49
{
50
+ do_action ("ws_plugin__s2member_before_sp_access_link_via_ajax", get_defined_vars ());
51
/**/
52
if (current_user_can ("create_users")) /* Check priveledges as well. */
53
+ if (($nonce = $_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link-via-ajax"))
54
+ echo apply_filters ("ws_plugin__s2member_sp_access_link_via_ajax", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]), get_defined_vars ());
55
/**/
56
exit ();
57
}
includes/hooks.inc.php CHANGED
@@ -91,7 +91,6 @@ add_action ("save_post", "ws_plugin__s2member_save_meta_boxes");
91
add_action ("admin_menu", "ws_plugin__s2member_add_admin_options");
92
add_action ("admin_print_scripts", "ws_plugin__s2member_add_admin_scripts");
93
add_action ("admin_print_styles", "ws_plugin__s2member_add_admin_styles");
94
- add_action ("wp_ajax_s2member_sp_access_link", "ws_plugin__s2member_sp_access_link");
95
/**/
96
add_filter ("manage_users_columns", "ws_plugin__s2member_users_list_cols");
97
add_filter ("manage_users_custom_column", "ws_plugin__s2member_users_list_display_cols", 10, 3);
@@ -103,6 +102,9 @@ add_filter ("show_password_fields", "ws_plugin__s2member_demo_hide_password_fiel
103
/**/
104
add_filter ("cron_schedules", "ws_plugin__s2member_extend_cron_schedules");
105
add_action ("ws_plugin__s2member_auto_eot_system__schedule", "ws_plugin__s2member_auto_eot_system");
106
/*
107
Register the activation | de-activation routines.
108
*/
91
add_action ("admin_menu", "ws_plugin__s2member_add_admin_options");
92
add_action ("admin_print_scripts", "ws_plugin__s2member_add_admin_scripts");
93
add_action ("admin_print_styles", "ws_plugin__s2member_add_admin_styles");
94
/**/
95
add_filter ("manage_users_columns", "ws_plugin__s2member_users_list_cols");
96
add_filter ("manage_users_custom_column", "ws_plugin__s2member_users_list_display_cols", 10, 3);
102
/**/
103
add_filter ("cron_schedules", "ws_plugin__s2member_extend_cron_schedules");
104
add_action ("ws_plugin__s2member_auto_eot_system__schedule", "ws_plugin__s2member_auto_eot_system");
105
+ /**/
106
+ add_action ("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax", "ws_plugin__s2member_sp_access_link_via_ajax");
107
+ add_action ("wp_ajax_ws_plugin__s2member_reset_ip_restrictions_via_ajax", "ws_plugin__s2member_reset_ip_restrictions_via_ajax");
108
/*
109
Register the activation | de-activation routines.
110
*/
includes/menu-pages/menu-pages-s-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(b){var a=esc_html=function(c){return String(c).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};if(location.href.match(/page\=ws-plugin--s2member-mms-options/)){b("select#ws-plugin--s2member-mms-registration-file").change(function(){if(b(this).val()==="wp-signup"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show()}else{if(b(this).val()==="wp-login"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide()}}b("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"show":"hide")](),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"1":"0"))}).trigger("change");b("select#ws-plugin--s2member-mms-registration-grants").change(function(){b("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}else{if(location.href.match(/page\=ws-plugin--s2member-options/)){ws_plugin__s2member_generateSecurityKey=function(){var f=function(h,g){h=(arguments.length<1)?0:h;g=(arguments.length<2)?2147483647:g;return Math.floor(Math.random()*(g-h+1))+h};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";for(var d=0,c="";d<56;d++){c+=e.substr(f(0,e.length-1),1)}b("input#ws-plugin--s2member-sec-encryption-key").val(c);return false};ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){b("input#ws-plugin--s2member-sec-encryption-key").attr("disabled",false)}return false};ws_plugin__s2member_securityKeyHistory=function(){b("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false}}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){b("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var d=b(this),e=d.val();var c=b("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(e==2){c.show()}else{c.hide()}})}else{if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){b("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var e=b(this),f=e.val();var d=b("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var c=b("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(f<=0){d.css("display","none"),c.attr("src",c.attr("src").replace(/\/checked\.png#x2F;,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png#x2F;,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png#x2F;,"/unchecked.png"))}}}})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){b("select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term").change(function(){var d=this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;g,"$1");var c=(b(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;b("p#ws-plugin--s2member-"+d+"-trial-line").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-trial-then").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-20p-rule").css("display",(c?"none":""));(c)?b("input#ws-plugin--s2member-"+form+"-trial-period").val(0):null});b("input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps").keyup(function(){if(this.value.match(/[^a-z_0-9,]/)){this.value=b.trim(b.trim(this.value).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(f){var c='[s2Member-PayPal-Button %%attrs%% image="default" /]',q="",t={};t.level0='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';t.level1='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';t.level2='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';t.level3='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';t.level4='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';var o=b("input#ws-plugin--s2member-"+f+"-shortcode");var g=b("textarea#ws-plugin--s2member-"+f+"-button");var k=b("select#ws-plugin--s2member-modification-level");var h=(f==="modification")?k.val().split(":",2)[1]:f.replace(/^level/,"");var l=t["level"+h].replace(/"/g,"");var d=b("input#ws-plugin--s2member-"+f+"-trial-period").val().replace(/[^0-9]/g,"");var j=b("select#ws-plugin--s2member-"+f+"-trial-term").val().replace(/[^A-Z]/g,"");var m=b("input#ws-plugin--s2member-"+f+"-amount").val().replace(/[^0-9\.]/g,"");var s=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var u=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var r=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var e=b.trim(b("input#ws-plugin--s2member-"+f+"-page-style").val().replace(/"/g,""));var i=b("select#ws-plugin--s2member-"+f+"-currency").val().replace(/[^A-Z]/g,"");var n=b.trim(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());d=(r==="BN")?"0":d;var p=(r==="BN"&&u!=="L")?h+":"+n+":"+s+" "+u:h+":"+n;p=p.replace(/\:+#x2F;g,"");if(j==="D"&&d>7){alert("Oops, a slight problem:\n\nMaximum Free Days is: 7.\nIf you want to offer more than 7 days free, please choose Weeks or Months from the drop-down.");return false}else{if(j==="W"&&d>52){alert("Oops, a slight problem:\n\nMaximum Free Weeks is: 52.\nIf you want to offer more than 52 weeks free, please choose Months from the drop-down.");return false}else{if(j==="M"&&d>12){alert("Oops, a slight problem:\n\nMaximum Free Months is: 12.\nIf you want to offer more than 12 months free, please choose Years from the drop-down.");return false}else{if(j==="Y"&&d>1){alert("Oops, a slight problem:\n\nMax Trial Period Years is: 1. *This is a PayPal® limitation.");return false}else{if(!m||isNaN(m)||m<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(m>10000){alert("Oops, a slight problem:\n\nMaximum amount is: 10000.00");return false}}}}}}g.val(g.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(d)<=0)?g.val(g.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(r==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(r==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(r!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(r!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;q+='level="'+a(h)+'" ccaps="'+a(n)+'" desc="'+a(l)+'" ps="'+a(e)+'" cc="'+a(i)+'" ns="1" custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"';q+=' tp="'+a(d)+'" tt="'+a(j)+'" ra="'+a(m)+'" rp="'+a(s)+'" rt="'+a(u)+'" rr="'+a(r)+'"';q+=(f==="modification")?' modify="1"':"";o.val(c.replace(/%%attrs%%/,q));g.val(g.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(l)+'"'));g.val(g.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(p)+'"'));g.val(g.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(e)+'"'));g.val(g.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(i)+'"'));g.val(g.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));g.val(g.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((f==="modification")?"1":"0")+'"'));g.val(g.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(m)+'"'));g.val(g.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+a(r)+'"'));g.val(g.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+a(d)+'"'));g.val(g.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+a(j)+'"'));g.val(g.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+a(m)+'"'));g.val(g.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+a(s)+'"'));g.val(g.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+a(u)+'"'));b("div#ws-plugin--s2member-"+f+"-button-prev").html(g.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g,""));(f==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");o.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var q='[s2Member-PayPal-Button %%attrs%% image="default" /]',p="";var n=b("input#ws-plugin--s2member-sp-shortcode");var e=b("textarea#ws-plugin--s2member-sp-button");var f=b("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-additional-ids").val()||[];var o=b("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var k=b("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var j=b.trim(b("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var m=b.trim(b("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var d=b("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!f){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}else{if(!k||isNaN(k)||k<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(k>10000){alert("Oops, a slight problem:\n\nMaximum amount is: 10000.00");return false}else{if(!j){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}for(var g=0,c=f;g<h.length;g++){if(h[g]&&h[g]!==f){c+=","+h[g]}}var l="sp:"+c+":"+o;p+='ids="'+a(c)+'" exp="'+a(o)+'" desc="'+a(j)+'" ps="'+a(m)+'" cc="'+a(d)+'" ns="1"';p+=' custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>" ra="'+a(k)+'" sp="1"';n.val(q.replace(/%%attrs%%/,p));e.val(e.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(j)+'"'));e.val(e.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(l)+'"'));e.val(e.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(m)+'"'));e.val(e.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(d)+'"'));e.val(e.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));e.val(e.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(k)+'"'));b("div#ws-plugin--s2member-sp-button-prev").html(e.val().replace(/\<form/,'<form target="_blank"'));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");n.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var j=b("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var c=b("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var d=b("p#ws-plugin--s2member-sp-link"),g=b("img#ws-plugin--s2member-sp-link-loading");if(!j){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}for(var e=0,f=j;e<h.length;e++){if(h[e]&&h[e]!==j){f+=","+h[e]}}d.hide(),g.show(),b.post(ajaxurl,{action:"s2member_sp_access_link",s2member_sp_access_link:'<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link")); ?>',s2member_sp_access_link_ids:f,s2member_sp_access_link_hours:c},function(i){d.show().html('<a href="'+a(i)+'" target="_blank" rel="external">'+esc_html(i)+"</a>"),g.hide()});return false}}}}}}});
1
+ jQuery(document).ready(function(b){var a=esc_html=function(c){return String(c).replace(/"/g,"&quot;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")};if(location.href.match(/page\=ws-plugin--s2member-mms-options/)){b("select#ws-plugin--s2member-mms-registration-file").change(function(){if(b(this).val()==="wp-signup"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").show(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").hide(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").show()}else{if(b(this).val()==="wp-login"){b("div#ws-plugin--s2member-mms-registration-support-package-details-wrapper").hide(),b("div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login").show(),b("div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup").hide()}}b("div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0")[((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"show":"hide")](),b("input#ws-plugin--s2member-mms-registration-blogs-level0").val(((b("select#ws-plugin--s2member-mms-registration-grants").val()==="all")?"1":"0"))}).trigger("change");b("select#ws-plugin--s2member-mms-registration-grants").change(function(){b("select#ws-plugin--s2member-mms-registration-file").trigger("change")})}else{if(location.href.match(/page\=ws-plugin--s2member-options/)){ws_plugin__s2member_generateSecurityKey=function(){var f=function(h,g){h=(arguments.length<1)?0:h;g=(arguments.length<2)?2147483647:g;return Math.floor(Math.random()*(g-h+1))+h};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";for(var d=0,c="";d<56;d++){c+=e.substr(f(0,e.length-1),1)}b("input#ws-plugin--s2member-sec-encryption-key").val(c);return false};ws_plugin__s2member_enableSecurityKey=function(){if(confirm("Edit Key? Are you sure?\nThis could break your installation!\n\n*Note* If you've been testing s2Member, feel free to change this Key before you go live. Just don't go live, and then change it. You'll have some very unhappy Customers. Data corruption WILL occur!\n\nFor your safety, s2Member keeps a history of the last 10 Keys that you've used. If you get yourself into a real situation, s2Member will let you revert back to a previous Key.")){b("input#ws-plugin--s2member-sec-encryption-key").attr("disabled",false)}return false};ws_plugin__s2member_securityKeyHistory=function(){b("div#ws-plugin--s2member-sec-encryption-key-history").toggle();return false};b("input#ws-plugin--s2member-ip-restrictions-reset-button").click(function(){var c=b(this);c.val("one moment please ...");b.post(ajaxurl,{action:"ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax",ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax:'<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'},function(d){alert("s2Member's IP Restriction Logs have all been reset."),c.val("Reset IP Restriction Logs")});return false})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-ops/)){b("select#ws-plugin--s2member-auto-eot-system-enabled").change(function(){var d=b(this),e=d.val();var c=b("p#ws-plugin--s2member-auto-eot-system-enabled-via-cron");if(e==2){c.show()}else{c.hide()}})}else{if(location.href.match(/page\=ws-plugin--s2member-els-ops/)){b("select#ws-plugin--s2member-custom-reg-opt-in").change(function(){var e=b(this),f=e.val();var d=b("tr.ws-plugin--s2member-custom-reg-opt-in-label-row");var c=b("img.ws-plugin--s2member-custom-reg-opt-in-label-prev-img");if(f<=0){d.css("display","none"),c.attr("src",c.attr("src").replace(/\/checked\.png#x2F;,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png#x2F;,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png#x2F;,"/unchecked.png"))}}}})}else{if(location.href.match(/page\=ws-plugin--s2member-paypal-buttons/)){b("select#ws-plugin--s2member-level1-term, select#ws-plugin--s2member-level2-term, select#ws-plugin--s2member-level3-term, select#ws-plugin--s2member-level4-term, select#ws-plugin--s2member-modification-term").change(function(){var d=this.id.replace(/^ws-plugin--s2member-(.+?)-term#x2F;g,"$1");var c=(b(this).val().split("-")[2].replace(/[^0-1BN]/g,"")==="BN")?1:0;b("p#ws-plugin--s2member-"+d+"-trial-line").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-trial-then").css("display",(c?"none":""));b("span#ws-plugin--s2member-"+d+"-20p-rule").css("display",(c?"none":""));(c)?b("input#ws-plugin--s2member-"+form+"-trial-period").val(0):null});b("input#ws-plugin--s2member-level1-ccaps, input#ws-plugin--s2member-level2-ccaps, input#ws-plugin--s2member-level3-ccaps, input#ws-plugin--s2member-level4-ccaps, input#ws-plugin--s2member-modification-ccaps").keyup(function(){if(this.value.match(/[^a-z_0-9,]/)){this.value=b.trim(b.trim(this.value).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase())}});ws_plugin__s2member_paypalButtonGenerate=function(f){var c='[s2Member-PayPal-Button %%attrs%% image="default" /]',q="",t={};t.level0='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';t.level1='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';t.level2='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';t.level3='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';t.level4='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"]); ?>';var o=b("input#ws-plugin--s2member-"+f+"-shortcode");var g=b("textarea#ws-plugin--s2member-"+f+"-button");var k=b("select#ws-plugin--s2member-modification-level");var h=(f==="modification")?k.val().split(":",2)[1]:f.replace(/^level/,"");var l=t["level"+h].replace(/"/g,"");var d=b("input#ws-plugin--s2member-"+f+"-trial-period").val().replace(/[^0-9]/g,"");var j=b("select#ws-plugin--s2member-"+f+"-trial-term").val().replace(/[^A-Z]/g,"");var m=b("input#ws-plugin--s2member-"+f+"-amount").val().replace(/[^0-9\.]/g,"");var s=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var u=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var r=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[2].replace(/[^0-1BN]/g,"");var e=b.trim(b("input#ws-plugin--s2member-"+f+"-page-style").val().replace(/"/g,""));var i=b("select#ws-plugin--s2member-"+f+"-currency").val().replace(/[^A-Z]/g,"");var n=b.trim(b.trim(b("input#ws-plugin--s2member-"+f+"-ccaps").val()).replace(/[ \-]/g,"_").replace(/[^A-Z_0-9,]/gi,"").toLowerCase());d=(r==="BN")?"0":d;var p=(r==="BN"&&u!=="L")?h+":"+n+":"+s+" "+u:h+":"+n;p=p.replace(/\:+#x2F;g,"");if(j==="D"&&d>7){alert("Oops, a slight problem:\n\nMaximum Free Days is: 7.\nIf you want to offer more than 7 days free, please choose Weeks or Months from the drop-down.");return false}else{if(j==="W"&&d>52){alert("Oops, a slight problem:\n\nMaximum Free Weeks is: 52.\nIf you want to offer more than 52 weeks free, please choose Months from the drop-down.");return false}else{if(j==="M"&&d>12){alert("Oops, a slight problem:\n\nMaximum Free Months is: 12.\nIf you want to offer more than 12 months free, please choose Years from the drop-down.");return false}else{if(j==="Y"&&d>1){alert("Oops, a slight problem:\n\nMax Trial Period Years is: 1. *This is a PayPal® limitation.");return false}else{if(!m||isNaN(m)||m<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(m>10000){alert("Oops, a slight problem:\n\nMaximum amount is: 10000.00");return false}}}}}}g.val(g.val().replace(/ \<\!--(\<input type\="hidden" name\="(amount|src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)--\>/g," $1"));(parseInt(d)<=0)?g.val(g.val().replace(/ (\<input type\="hidden" name\="(a1|p1|t1)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(r==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(r==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(r!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(r!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;q+='level="'+a(h)+'" ccaps="'+a(n)+'" desc="'+a(l)+'" ps="'+a(e)+'" cc="'+a(i)+'" ns="1" custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"';q+=' tp="'+a(d)+'" tt="'+a(j)+'" ra="'+a(m)+'" rp="'+a(s)+'" rt="'+a(u)+'" rr="'+a(r)+'"';q+=(f==="modification")?' modify="1"':"";o.val(c.replace(/%%attrs%%/,q));g.val(g.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(l)+'"'));g.val(g.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(p)+'"'));g.val(g.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(e)+'"'));g.val(g.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(i)+'"'));g.val(g.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));g.val(g.val().replace(/ name\="modify" value\="(.*?)"/,' name="modify" value="'+((f==="modification")?"1":"0")+'"'));g.val(g.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(m)+'"'));g.val(g.val().replace(/ name\="src" value\="(.*?)"/,' name="src" value="'+a(r)+'"'));g.val(g.val().replace(/ name\="p1" value\="(.*?)"/,' name="p1" value="'+a(d)+'"'));g.val(g.val().replace(/ name\="t1" value\="(.*?)"/,' name="t1" value="'+a(j)+'"'));g.val(g.val().replace(/ name\="a3" value\="(.*?)"/,' name="a3" value="'+a(m)+'"'));g.val(g.val().replace(/ name\="p3" value\="(.*?)"/,' name="p3" value="'+a(s)+'"'));g.val(g.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+a(u)+'"'));b("div#ws-plugin--s2member-"+f+"-button-prev").html(g.val().replace(/\<form/,'<form target="_blank"').replace(/\<\?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_(ON0|OS0); \?\>/g,""));(f==="modification")?alert("Your Modification Button has been generated.\nPlease copy/paste the Shortcode Format into your Login Welcome Page, or wherever you feel it would be most appropriate."):alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");o.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpButtonGenerate=function(){var q='[s2Member-PayPal-Button %%attrs%% image="default" /]',p="";var n=b("input#ws-plugin--s2member-sp-shortcode");var e=b("textarea#ws-plugin--s2member-sp-button");var f=b("select#ws-plugin--s2member-sp-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-additional-ids").val()||[];var o=b("select#ws-plugin--s2member-sp-hours").val().replace(/[^0-9]/g,"");var k=b("input#ws-plugin--s2member-sp-amount").val().replace(/[^0-9\.]/g,"");var j=b.trim(b("input#ws-plugin--s2member-sp-desc").val().replace(/"/g,""));var m=b.trim(b("input#ws-plugin--s2member-sp-page-style").val().replace(/"/g,""));var d=b("select#ws-plugin--s2member-sp-currency").val().replace(/[^A-Z]/g,"");if(!f){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}else{if(!k||isNaN(k)||k<0.01){alert("Oops, a slight problem:\n\nAmount must be >= 0.01");return false}else{if(k>10000){alert("Oops, a slight problem:\n\nMaximum amount is: 10000.00");return false}else{if(!j){alert("Oops, a slight problem:\n\nPlease type a Description for this Button.");return false}}}}for(var g=0,c=f;g<h.length;g++){if(h[g]&&h[g]!==f){c+=","+h[g]}}var l="sp:"+c+":"+o;p+='ids="'+a(c)+'" exp="'+a(o)+'" desc="'+a(j)+'" ps="'+a(m)+'" cc="'+a(d)+'" ns="1"';p+=' custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>" ra="'+a(k)+'" sp="1"';n.val(q.replace(/%%attrs%%/,p));e.val(e.val().replace(/ name\="item_name" value\="(.*?)"/,' name="item_name" value="'+a(j)+'"'));e.val(e.val().replace(/ name\="item_number" value\="(.*?)"/,' name="item_number" value="'+a(l)+'"'));e.val(e.val().replace(/ name\="page_style" value\="(.*?)"/,' name="page_style" value="'+a(m)+'"'));e.val(e.val().replace(/ name\="currency_code" value\="(.*?)"/,' name="currency_code" value="'+a(d)+'"'));e.val(e.val().replace(/ name\="custom" value\="(.*?)"/,' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));e.val(e.val().replace(/ name\="amount" value\="(.*?)"/,' name="amount" value="'+a(k)+'"'));b("div#ws-plugin--s2member-sp-button-prev").html(e.val().replace(/\<form/,'<form target="_blank"'));alert("Your Button has been generated.\nPlease copy/paste the Shortcode Format into your Membership Options Page.");n.each(function(){this.focus(),this.select()});return false};ws_plugin__s2member_paypalSpLinkGenerate=function(){var j=b("select#ws-plugin--s2member-sp-link-leading-id").val().replace(/[^0-9]/g,"");var h=b("select#ws-plugin--s2member-sp-link-additional-ids").val()||[];var c=b("select#ws-plugin--s2member-sp-link-hours").val().replace(/[^0-9]/g,"");var d=b("p#ws-plugin--s2member-sp-link"),g=b("img#ws-plugin--s2member-sp-link-loading");if(!j){alert("Oops, a slight problem:\n\nPlease select a Leading Post/Page.\n\n*Tip* If there are no Posts/Pages in the menu, it's because you've not configured s2Member for Specific Post/Page Access yet. See: s2Member -> General Options -> Specific Post/Page Access Restrictions.");return false}for(var e=0,f=j;e<h.length;e++){if(h[e]&&h[e]!==j){f+=","+h[e]}}d.hide(),g.show(),b.post(ajaxurl,{action:"ws_plugin__s2member_sp_access_link_via_ajax",ws_plugin__s2member_sp_access_link_via_ajax:'<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>',s2member_sp_access_link_ids:f,s2member_sp_access_link_hours:c},function(i){d.show().html('<a href="'+a(i)+'" target="_blank" rel="external">'+esc_html(i)+"</a>"),g.hide()});return false}}}}}}});
includes/menu-pages/menu-pages-s.js CHANGED
@@ -30,7 +30,7 @@ jQuery (document).ready (function($)
30
$ ('div#ws-plugin--s2member-mms-registration-support-package-details-wrapper').hide (), $ ('div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login').show (), $ ('div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup').hide ();
31
}
32
/**/
33
- $ ('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0')[(($ ('select#ws-plugin--s2member-mms-registration-grants').val () === 'all') ? 'show' : 'hide')] (), $ ('input#ws-plugin--s2member-mms-registration-blogs-level0').val ((($ ('select#ws-plugin--s2member-mms-registration-grants').val () === 'all') ? '1' : '0'));
34
/**/
35
}).trigger ('change'); /* Fire on ready too. */
36
/**/
@@ -74,6 +74,19 @@ jQuery (document).ready (function($)
74
/**/
75
return false;
76
};
77
}
78
/**/
79
else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
@@ -204,7 +217,7 @@ jQuery (document).ready (function($)
204
code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + esc_attr (pageStyle) + '"'));
205
code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + esc_attr (currencyCode) + '"'));
206
code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));
207
- code.val (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ((button === 'modification') ? '1' : '0') + '"'));
208
code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr (regAmount) + '"'));
209
code.val (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + esc_attr (regRecur) + '"'));
210
code.val (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + esc_attr (trialPeriod) + '"'));
@@ -307,7 +320,7 @@ jQuery (document).ready (function($)
307
if (additionals[i] && additionals[i] !== leading)
308
ids += ',' + additionals[i];
309
/**/
310
- $link.hide (), $loading.show (), $.post (ajaxurl, {action: 's2member_sp_access_link', s2member_sp_access_link: '<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link")); ?>', s2member_sp_access_link_ids: ids, s2member_sp_access_link_hours: hours}, function(response)
311
{
312
$link.show ().html ('<a href="' + esc_attr (response) + '" target="_blank" rel="external">' + esc_html (response) + '</a>'), $loading.hide ();
313
});
30
$ ('div#ws-plugin--s2member-mms-registration-support-package-details-wrapper').hide (), $ ('div.ws-plugin--s2member-mms-registration-wp-login, table.ws-plugin--s2member-mms-registration-wp-login').show (), $ ('div.ws-plugin--s2member-mms-registration-wp-signup, table.ws-plugin--s2member-mms-registration-wp-signup').hide ();
31
}
32
/**/
33
+ $ ('div.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0, table.ws-plugin--s2member-mms-registration-wp-signup-blogs-level0')[ ( ($ ('select#ws-plugin--s2member-mms-registration-grants').val () === 'all') ? 'show' : 'hide')] (), $ ('input#ws-plugin--s2member-mms-registration-blogs-level0').val ( ( ($ ('select#ws-plugin--s2member-mms-registration-grants').val () === 'all') ? '1' : '0'));
34
/**/
35
}).trigger ('change'); /* Fire on ready too. */
36
/**/
74
/**/
75
return false;
76
};
77
+ /**/
78
+ $ ('input#ws-plugin--s2member-ip-restrictions-reset-button').click (function()
79
+ {
80
+ var $this = $ (this); /* Save $(this) into $this. */
81
+ $this.val ('one moment please ...'); /* Indicate loading status ( please wait ). */
82
+ /**/
83
+ $.post (ajaxurl, {action: 'ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax', ws_plugin__s2member_delete_reset_all_ip_restrictions_via_ajax: '<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-delete-reset-all-ip-restrictions-via-ajax")); ?>'}, function(response)
84
+ {
85
+ alert ('s2Member\'s IP Restriction Logs have all been reset.'), $this.val ('Reset IP Restriction Logs');
86
+ });
87
+ /**/
88
+ return false;
89
+ });
90
}
91
/**/
92
else if (location.href.match (/page\=ws-plugin--s2member-paypal-ops/))
217
code.val (code.val ().replace (/ name\="page_style" value\="(.*?)"/, ' name="page_style" value="' + esc_attr (pageStyle) + '"'));
218
code.val (code.val ().replace (/ name\="currency_code" value\="(.*?)"/, ' name="currency_code" value="' + esc_attr (currencyCode) + '"'));
219
code.val (code.val ().replace (/ name\="custom" value\="(.*?)"/, ' name="custom" value="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"'));
220
+ code.val (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ( (button === 'modification') ? '1' : '0') + '"'));
221
code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr (regAmount) + '"'));
222
code.val (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + esc_attr (regRecur) + '"'));
223
code.val (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + esc_attr (trialPeriod) + '"'));
320
if (additionals[i] && additionals[i] !== leading)
321
ids += ',' + additionals[i];
322
/**/
323
+ $link.hide (), $loading.show (), $.post (ajaxurl, {action: 'ws_plugin__s2member_sp_access_link_via_ajax', ws_plugin__s2member_sp_access_link_via_ajax: '<?php echo ws_plugin__s2member_esc_sq (wp_create_nonce ("ws-plugin--s2member-sp-access-link-via-ajax")); ?>', s2member_sp_access_link_ids: ids, s2member_sp_access_link_hours: hours}, function(response)
324
{
325
$link.show ().html ('<a href="' + esc_attr (response) + '" target="_blank" rel="external">' + esc_html (response) + '</a>'), $loading.hide ();
326
});
includes/menu-pages/options.inc.php CHANGED
@@ -599,6 +599,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
599
echo '<div class="ws-menu-page-section ws-plugin--s2member-login-welcome-page-section">' . "\n";
600
echo '<h3>Login Welcome Page ( required, please customize this )</h3>' . "\n";
601
echo '<p>Please create and/or choose an existing Page to use as the first page Members will see after logging in.</p>' . "\n";
602
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_login_welcome_page", get_defined_vars ());
603
/**/
604
echo '<table class="form-table">' . "\n";
@@ -644,6 +645,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
644
echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-options-page-section">' . "\n";
645
echo '<h3>Membership Options Page ( required, please customize this )</h3>' . "\n";
646
echo '<p>Please create and/or choose an existing Page that showcases your Membership subscription options. This special Page is where you will insert the PayPal® Subscription Buttons generated for you by s2Member. This Page serves as your signup page. It should detail all of the features that come with Membership to your site, and provide a PayPal® Subscription Button for each Level of access you plan to offer. This is also the page that Users will be redirected to, should they attempt to access an area of your site that requires Membership.</p>' . "\n";
647
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_options_page", get_defined_vars ());
648
/**/
649
echo '<table class="form-table">' . "\n";
@@ -1317,8 +1319,8 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1317
/**/
1318
echo '<div class="ws-menu-page-section ws-plugin--s2member-ip-restrictions-section">' . "\n";
1319
echo '<h3>Unique IP Access Restrictions ( prevents username/link sharing )</h3>' . "\n";
1320
- echo '<p>As with any Membership system, it is possible for one Member to signup, and then share their Username with someone else; or even post it online for the whole world to see. This is known as Link Sharing ( aka: Username Sharing ). It is NOT likely that you\'ll be attacked in this way, but it\'s still a good idea to protect your system; just in case somebody tries this. s2Member\'s IP Restrictions work for Membership Level Access ( account logins ), Specific Post/Page Access, Registration Links, and other secure Entry Points.</p>' . "\n";
1321
- echo '<p>In all cases, the rules are simple. A single Username, Access Link, and/or Entry Point ... is only valid for a certain number of unique IP addresses. Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban ( preventing access ) to a Specific Post/Page, or to an account associated with a particular Username. This temporary ban, will ONLY affect the offending Link and/or Username associated with the security breach. You can fine-tune this behavior, using the options below.</p>' . "\n";
1322
echo '<p>This form of IP monitoring, is known as an (Adaptive Concurrency Restriction). We refer to this as "Adaptive", because the concurrency timeouts are increased automatically, based on the number of attempts that MAY take place over time. The default period of 30 days works on 99.9% of all installations. This period is renewed automatically, every time a new attempt is made. This allows s2Member to become more secure; with each attempt from a new location ( commonly associated with link sharing ). In other words, s2Member adapts itself to bad behavior, so it can ALSO crack-down on hacking attempts that may occur over a longer period of time. And without being SO paranoid that a legitimate Customer would have a problem.</p>' . "\n";
1323
echo '<p><em>*Note* an empty IP address ( associated with someone browsing anonymously ), is also considered a unique IP address, so it cannot circumvent s2Member\'s security.</em></p>' . "\n";
1324
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_ip_restrictions", get_defined_vars ());
@@ -1388,7 +1390,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1388
echo '<option value="15778463"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 15778463) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 6 months )</option>' . "\n";
1389
echo '<option value="31556926"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 31556926) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 1 year )</option>' . "\n";
1390
echo '</select><br />' . "\n";
1391
- echo 'When/if you change this, it will take X amount of time to update; based on your previous configuration.' . "\n";
1392
echo '</td>' . "\n";
1393
/**/
1394
echo '</tr>' . "\n";
599
echo '<div class="ws-menu-page-section ws-plugin--s2member-login-welcome-page-section">' . "\n";
600
echo '<h3>Login Welcome Page ( required, please customize this )</h3>' . "\n";
601
echo '<p>Please create and/or choose an existing Page to use as the first page Members will see after logging in.</p>' . "\n";
602
+ echo '<p><em><strong>*Tip*</strong> This special Page will be protected from public access ( automatically ) by s2Member.</em></p>' . "\n";
603
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_login_welcome_page", get_defined_vars ());
604
/**/
605
echo '<table class="form-table">' . "\n";
645
echo '<div class="ws-menu-page-section ws-plugin--s2member-membership-options-page-section">' . "\n";
646
echo '<h3>Membership Options Page ( required, please customize this )</h3>' . "\n";
647
echo '<p>Please create and/or choose an existing Page that showcases your Membership subscription options. This special Page is where you will insert the PayPal® Subscription Buttons generated for you by s2Member. This Page serves as your signup page. It should detail all of the features that come with Membership to your site, and provide a PayPal® Subscription Button for each Level of access you plan to offer. This is also the page that Users will be redirected to, should they attempt to access an area of your site that requires Membership.</p>' . "\n";
648
+ echo '<p><em><strong>*Tip*</strong> s2Member will NEVER allow this Page to be protected from public access.</em></p>' . "\n";
649
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_membership_options_page", get_defined_vars ());
650
/**/
651
echo '<table class="form-table">' . "\n";
1319
/**/
1320
echo '<div class="ws-menu-page-section ws-plugin--s2member-ip-restrictions-section">' . "\n";
1321
echo '<h3>Unique IP Access Restrictions ( prevents username/link sharing )</h3>' . "\n";
1322
+ echo '<input type="button" id="ws-plugin--s2member-ip-restrictions-reset-button" value="Reset IP Restriction Logs" class="ws-menu-page-right" style="min-width:175px;" />' . "\n";
1323
+ echo '<p>As with any Membership system, it is possible for one Member to signup, and then share their Username with someone else; or even post it online for the whole world to see. This is known as Link Sharing ( aka: Username Sharing ). It is NOT likely that you\'ll be attacked in this way, but it\'s still a good idea to protect your system; just in case somebody tries this. s2Member\'s IP Restrictions work for Membership Level Access ( account logins ), Specific Post/Page Access, Registration Links, and other secure Entry Points. In all cases, the rules are simple. A single Username, Access Link, and/or Entry Point ... is only valid for a certain number of unique IP addresses. Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban ( preventing access ) to a Specific Post/Page, or to an account associated with a particular Username. This temporary ban, will ONLY affect the offending Link and/or Username associated with the security breach. You can fine-tune this behavior, using the options below.</p>' . "\n";
1324
echo '<p>This form of IP monitoring, is known as an (Adaptive Concurrency Restriction). We refer to this as "Adaptive", because the concurrency timeouts are increased automatically, based on the number of attempts that MAY take place over time. The default period of 30 days works on 99.9% of all installations. This period is renewed automatically, every time a new attempt is made. This allows s2Member to become more secure; with each attempt from a new location ( commonly associated with link sharing ). In other words, s2Member adapts itself to bad behavior, so it can ALSO crack-down on hacking attempts that may occur over a longer period of time. And without being SO paranoid that a legitimate Customer would have a problem.</p>' . "\n";
1325
echo '<p><em>*Note* an empty IP address ( associated with someone browsing anonymously ), is also considered a unique IP address, so it cannot circumvent s2Member\'s security.</em></p>' . "\n";
1326
do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_ip_restrictions", get_defined_vars ());
1390
echo '<option value="15778463"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 15778463) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 6 months )</option>' . "\n";
1391
echo '<option value="31556926"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"] == 31556926) ? ' selected="selected"' : '') . '>If limit is exceeded ( punish for 1 year )</option>' . "\n";
1392
echo '</select><br />' . "\n";
1393
+ echo 'When/if you change this, you should also <strong>Reset IP Restriction Logs</strong> ( click button above ).' . "\n";
1394
echo '</td>' . "\n";
1395
/**/
1396
echo '</tr>' . "\n";
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
=== s2Member ( Membership w/ PayPal® Integration ) ~ now Multisite compatible! ===
2
3
- Version: 3.2.4
4
- Stable tag: 3.2.4
5
Framework: WS-P-3.0
6
7
SSL Compatible: yes
@@ -170,6 +170,10 @@ Not yet. This is coming soon though. It will be included in a future release of
170
171
== Changelog ==
172
173
= 3.2.4 =
174
* BuddyPress ( bug ). A bug that was first introduced in s2Member v3.2.3 with Hook priority on `template_redirect` was causing compatiblity issues with BuddyPress. This has been corrected in s2Member v3.2.4+.
175
* Bug fix. The s2Member Meta Box panel was not being displayed with Custom Post Types. This has been resolved in s2Member v3.2.4+.
1
=== s2Member ( Membership w/ PayPal® Integration ) ~ now Multisite compatible! ===
2
3
+ Version: 3.2.5
4
+ Stable tag: 3.2.5
5
Framework: WS-P-3.0
6
7
SSL Compatible: yes
170
171
== Changelog ==
172
173
+ = 3.2.5 =
174
+ * IP Restrictions ( reset ). Several site owners have reported issues with s2Member's IP Restrictions. A full investigation has been performed. Although no bugs were found, we suspect that recent reports on this topic are related to a combination of a.) improvements in recent versions of s2Member, with respect to IP Restrictions ( adaptive concurrency limits ); and b.) lack of support ( on the part of s2Member ) for resetting IP Restriction Logs after changes in configuration. In this release of s2Member, we've introduced a new tool for site owners, which allows you to Reset IP Restriction Logs manually, at anytime you like. For further details, please see: `s2Member -> General Options -> IP Restrictions` ( look for the new button titled: `Reset IP Restriction Logs`. ).
175
+ * Compatibility. s2Member's activation/deactivation routines have been updated to support installations of WordPress® that may, or may not, already have the default WordPress® Roles installed. For instance, some installations of WordPress® are running with Role managing plugins. A site owner could have modified WordPress®, and may no longer have one, or even all of these default Roles: `administrator, editor, author, contributor, subscriber`. s2Member is now capable of dealing with this scenario gracefully upon activation/deactivation.
176
+
177
= 3.2.4 =
178
* BuddyPress ( bug ). A bug that was first introduced in s2Member v3.2.3 with Hook priority on `template_redirect` was causing compatiblity issues with BuddyPress. This has been corrected in s2Member v3.2.4+.
179
* Bug fix. The s2Member Meta Box panel was not being displayed with Custom Post Types. This has been resolved in s2Member v3.2.4+.
s2member.php CHANGED
@@ -9,8 +9,8 @@ along with this software. In the main directory, see: /licensing/
9
If not, see: <http://www.gnu.org/licenses/>.
10
*/
11
/*
12
- Version: 3.2.4
13
- Stable tag: 3.2.4
14
Framework: WS-P-3.0
15
16
SSL Compatible: yes
@@ -48,10 +48,10 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
48
/*
49
Define versions.
50
*/
51
- define ("WS_PLUGIN__S2MEMBER_VERSION", "3.2.4");
52
define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
53
define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
54
- define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.2.3");
55
/*
56
Compatibility checks.
57
*/
9
If not, see: <http://www.gnu.org/licenses/>.
10
*/
11
/*
12
+ Version: 3.2.5
13
+ Stable tag: 3.2.5
14
Framework: WS-P-3.0
15
16
SSL Compatible: yes
48
/*
49
Define versions.
50
*/
51
+ define ("WS_PLUGIN__S2MEMBER_VERSION", "3.2.5");
52
define ("WS_PLUGIN__S2MEMBER_MIN_PHP_VERSION", "5.2");
53
define ("WS_PLUGIN__S2MEMBER_MIN_WP_VERSION", "3.0");
54
+ define ("WS_PLUGIN__S2MEMBER_MIN_PRO_VERSION", "1.2.5");
55
/*
56
Compatibility checks.
57
*/