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

Version Description

  • Custom Fields ( new features ). s2Member is now equipped with a VERY powerful set of features; designed to extend the functionality of Custom Fields. s2Member now supports Text Fields ( single/multi-line ), Checkboxes ( single/multi-option ), Radio Buttons ( single/multi-option ), and Dropdowns ( single/multi-option ). In addition, with s2Member it is now possible to configure Custom Fields differently for each Membership Level. Other tools: including Validation Formats and Visibility are also available. For full details, check your Dashboard under: s2Member -> General Options -> Custom Fields.
  • Attn Developers ( before upgrading ). Hooks/Filters ( e.g. those related to Custom Fields ) have been modified in ways that may break custom scripts you've created to work with previous versions of s2Member. We suggest dropping all of your Hooks/Filters related to Custom Fields. Instead, use the NEW improved tools w/s2Member v3.2.7+. Please see: s2Member -> General Options -> Custom Fields.
  • BuddyPress/Multisite. A plugin conflict was resolved between BuddyPress/s2Member when both of these plugins were installed on a Multisite Network together. BuddyPress bypasses the default Filter ( pre_site_option_registration ) and instead, it uses: bp_core_get_site_options(). This has been resolved in s2Member v3.2.6+.
  • Bug fix. A bug was found in s2Member's handling of Custom Fields columns. This minor bug was conflicting with other plugins that attempt to create User-based columns. This was been resolved in s2Member v3.2.7+.
  • New Shortcode attribute. s2Member's PayPal Button Shortcode now accepts a new attribute ( ta="0.00", Trial Amount ). In the past, if you intended to offer a "paid" initial period at a different price, you had to use the Full Button Code. Now you can just change the ta="0.00" attribute ( which is easier ).
  • More informative. s2Member now generates warnings for newbies that create conflicts between their Membership Options Page and Login Welcome Page. s2Member is now capable of detecting the most common conflicts, in order to produce informative messages that assist site owners.
  • Login/Registration Design. s2Member v3.2.7+ includes additional customization tools that allow font sizes and font families to be configured for the Login/Registration system. In your Dashboard, go to: s2Member -> General Options -> Login/Registration Design.
  • Bug fix. The Default Profile Editing Panel ( e.g. /wp-admin/profile.php ) was NOT validating Custom Fields. s2Member v3.2.7 resolves this for Users/Members. Administrators are exempt ( the intended functionality ).
  • Better instructions inside in the General Options panel for s2Member. Just a few subtle improvements based on User feedback. Hopefully these will make life a little easier for newbies.
Download this release

Release Info

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

Code changes from version 3.2.5 to 3.2.7

Files changed (52) hide show
  1. images/add-icon.fla +0 -0
  2. images/add-icon.png +0 -0
  3. images/arrow-down-icon.fla +0 -0
  4. images/arrow-down-icon.png +0 -0
  5. images/arrow-up-icon.fla +0 -0
  6. images/arrow-up-icon.png +0 -0
  7. images/delete-icon.png +0 -0
  8. images/edit-icon.png +0 -0
  9. includes/dropins/bridges/_s2member-bbpress-bridge.php +1 -1
  10. includes/functions/activate-deactivate.inc.php +6 -0
  11. includes/functions/api-functions.inc.php +12 -0
  12. includes/functions/config-user-registration.inc.php +598 -0
  13. includes/functions/css-js-w-globals.inc.php +8 -8
  14. includes/functions/custom-reg-fields.inc.php +453 -0
  15. includes/functions/demo-users.inc.php +39 -0
  16. includes/functions/demotions.inc.php +0 -29
  17. includes/functions/email-configs.inc.php +19 -1
  18. includes/functions/force-options.inc.php +271 -0
  19. includes/functions/list-servers.inc.php +21 -21
  20. includes/functions/login-customizations.inc.php +32 -15
  21. includes/functions/menu-pages.inc.php +72 -74
  22. includes/functions/meta-boxes.inc.php +5 -7
  23. includes/functions/page-level-access.inc.php +2 -2
  24. includes/functions/passwords.inc.php +47 -0
  25. includes/functions/paypal-button.inc.php +4 -8
  26. includes/functions/post-level-access.inc.php +2 -2
  27. includes/functions/profile-modifications.inc.php +23 -24
  28. includes/functions/register-access.inc.php +0 -1387
  29. includes/functions/sc-get-details.inc.php +8 -30
  30. includes/functions/separates/paypal-notify.inc.php +2 -0
  31. includes/functions/separates/paypal-return.inc.php +1 -0
  32. includes/functions/user-new.inc.php +249 -0
  33. includes/functions/users-list.inc.php +209 -209
  34. includes/functions/utilities.inc.php +44 -10
  35. includes/hooks.inc.php +1 -0
  36. includes/menu-pages/code-samples/sc-s2-conditional-supplements-1.php +3 -0
  37. includes/menu-pages/info.inc.php +1 -1
  38. includes/menu-pages/jquery-ui-effects.js +220 -0
  39. includes/menu-pages/json-functions.js +1 -0
  40. includes/menu-pages/menu-pages-s-min.js +1 -1
  41. includes/menu-pages/menu-pages-s.css +110 -0
  42. includes/menu-pages/menu-pages-s.js +652 -3
  43. includes/menu-pages/options.inc.php +72 -14
  44. includes/menu-pages/paypal-buttons.inc.php +17 -17
  45. includes/profile.inc.php +67 -66
  46. includes/s2member-min.js +1 -1
  47. includes/s2member.css +13 -3
  48. includes/s2member.js +211 -35
  49. includes/syscon.inc.php +388 -379
  50. includes/templates/shortcodes/paypal-checkout-button-shortcode.html +1 -1
  51. readme.txt +20 -9
  52. s2member.php +6 -6
images/add-icon.fla ADDED
Binary file
images/add-icon.png ADDED
Binary file
images/arrow-down-icon.fla ADDED
Binary file
images/arrow-down-icon.png ADDED
Binary file
images/arrow-up-icon.fla ADDED
Binary file
images/arrow-up-icon.png ADDED
Binary file
images/delete-icon.png ADDED
Binary file
images/edit-icon.png ADDED
Binary file
includes/dropins/bridges/_s2member-bbpress-bridge.php CHANGED
@@ -18,8 +18,8 @@ Donate link: http://www.primothemes.com/donate/
18
  Plugin Name: s2Member Bridge
19
  Pro Module / Prices: http://www.s2member.com/prices/
20
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
21
- Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
22
  Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
 
23
  Description: Blocks all non-Member access to bbPress® forums. Only the login-page is available. Forum registration is redirected to your Membership Options Page for s2Member ( on your main WordPress® installation ). This way, a visitor can signup on your site, and gain Membership Access to your forums. This plugin will NOT work, until you've successfully integrated WordPress® into bbPress®. See: `bbPress® -> Settings -> WordPress® Integration`.
24
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, bbpress, bb press, forums, forum, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
25
  */
18
  Plugin Name: s2Member Bridge
19
  Pro Module / Prices: http://www.s2member.com/prices/
20
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
 
21
  Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
22
+ Plugin URI: http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/
23
  Description: Blocks all non-Member access to bbPress® forums. Only the login-page is available. Forum registration is redirected to your Membership Options Page for s2Member ( on your main WordPress® installation ). This way, a visitor can signup on your site, and gain Membership Access to your forums. This plugin will NOT work, until you've successfully integrated WordPress® into bbPress®. See: `bbPress® -> Settings -> WordPress® Integration`.
24
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, bbpress, bb press, forums, forum, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, multi widget support, includes extensive documentation, highly extensible
25
  */
includes/functions/activate-deactivate.inc.php CHANGED
@@ -184,6 +184,12 @@ if (!function_exists ("ws_plugin__s2member_activate"))
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
  /**/
184
  $wpdb->query ("DELETE FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '\_transient\_%'");
185
  }
186
  /**/
187
+ if (!$v || !version_compare ($v, "3.2.6", ">=")) /* Needs to be upgraded? */
188
+ /* Version 3.2.6 fixed `s2member_ccaps_req` being stored empty and/or w/ one empty element in the array. */
189
+ {
190
+ $wpdb->query ("DELETE FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` IN('','a:0:{}','a:1:{i:0;s:0:\"\";}')");
191
+ }
192
+ /**/
193
  $notice = '<strong>s2Member</strong> has been <strong>re-activated</strong>, with the latest version.<br />';
194
  $notice .= 'You now have version ' . WS_PLUGIN__S2MEMBER_VERSION . '. Your existing configuration remains.';
195
  /**/
includes/functions/api-functions.inc.php CHANGED
@@ -429,4 +429,16 @@ if (!function_exists ("s2member_file_download_key"))
429
  return ws_plugin__s2member_file_download_key ($file, $cache_compatible);
430
  }
431
  }
 
 
 
 
 
 
 
 
 
 
 
 
432
  ?>
429
  return ws_plugin__s2member_file_download_key ($file, $cache_compatible);
430
  }
431
  }
432
+ /*
433
+ Retrieves a Custom Field value.
434
+ $field_id - required argument.
435
+ $user_id - defaults to current user.
436
+ */
437
+ if (!function_exists ("get_user_field"))
438
+ {
439
+ function get_user_field ($field_id = FALSE, $user_id = FALSE)
440
+ {
441
+ return ws_plugin__s2member_get_user_field ($field_id, $user_id);
442
+ }
443
+ }
444
  ?>
includes/functions/config-user-registration.inc.php ADDED
@@ -0,0 +1,598 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that adds hidden fields to POST vars on signup.
18
+ Attach to: add_filter("signup_hidden_fields");
19
+
20
+ This can ONLY be fired through wp-signup.php on the front-side.
21
+ */
22
+ if (!function_exists ("ws_plugin__s2member_ms_process_signup_hidden_fields"))
23
+ {
24
+ function ws_plugin__s2member_ms_process_signup_hidden_fields ()
25
+ {
26
+ do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
27
+ /**/
28
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking, on a Blog Farm. */
29
+ if (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && $_POST["stage"] === "validate-user-signup")
30
+ {
31
+ foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
32
+ if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
33
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
34
+ echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
35
+ /**/
36
+ do_action ("ws_plugin__s2member_during_ms_process_signup_hidden_fields", get_defined_vars ());
37
+ }
38
+ /**/
39
+ do_action ("ws_plugin__s2member_after_ms_process_signup_hidden_fields", get_defined_vars ());
40
+ }
41
+ }
42
+ /*
43
+ Function that adds customs fields to $meta on signup.
44
+ Attach to: add_filter("add_signup_meta");
45
+
46
+ This can be fired through wp-signup.php on the front-side,
47
+ or possibly through user-new.php in the admin.
48
+ */
49
+ if (!function_exists ("ws_plugin__s2member_ms_process_signup_meta"))
50
+ {
51
+ function ws_plugin__s2member_ms_process_signup_meta ($meta = FALSE)
52
+ {
53
+ global $pagenow; /* Need this to detect the current admin page. */
54
+ /**/
55
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
56
+ do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
57
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
58
+ /**/
59
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. Either in the admin, or on a Blog Farm through wp-signup.php. */
60
+ if ((is_admin () && $pagenow === "user-new.php") || (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])))
61
+ {
62
+ ws_plugin__s2member_email_config (); /* Configures From: header that will be used in notifications. */
63
+ /**/
64
+ foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
65
+ if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
66
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
67
+ $meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
68
+ }
69
+ /**/
70
+ return apply_filters ("ws_plugin__s2member_ms_process_signup_meta", $meta, get_defined_vars ());
71
+ }
72
+ }
73
+ /*
74
+ Function for configuring new users.
75
+ Attach to: add_action("wpmu_activate_user");
76
+
77
+ This does NOT fire for a Super Admin managing Network Users.
78
+ Which is good. A Super Admin will NOT trigger this event.
79
+ ~ They fire wpmu_create_user(), bypassing activation.
80
+ - through ms-edit.php.
81
+
82
+ However, a Super Admin CAN trigger this event by adding a new User through the Users -> Add New menu.
83
+ ~ If they choose to bypass activation; an activation IS fired immediately. Otherwise, it's delayed.
84
+ - via user-new.php.
85
+
86
+ So this function may get fired inside the admin panel ( user-new.php ).
87
+ Or also during an actual activation; through wp-activate.php.
88
+ */
89
+ if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_user_activation"))
90
+ {
91
+ function ws_plugin__s2member_configure_user_on_ms_user_activation ($user_id = FALSE, $password = FALSE, $meta = FALSE)
92
+ {
93
+ global $pagenow; /* Need this to detect the current admin page. */
94
+ /**/
95
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
96
+ do_action ("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
97
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
98
+ /**/
99
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
100
+ if ((is_admin () && $pagenow === "user-new.php") || (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])))
101
+ {
102
+ ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
103
+ delete_user_meta ($user_id, "s2member_ms_signup_meta");
104
+ }
105
+ /**/
106
+ do_action ("ws_plugin__s2member_after_configure_user_on_ms_user_activation", get_defined_vars ());
107
+ /**/
108
+ return;
109
+ }
110
+ }
111
+ /*
112
+ Function for configuring new users.
113
+ Attach to: add_action("wpmu_activate_blog");
114
+
115
+ This does NOT fire for a Super Admin managing Network Blogs.
116
+ ~ Actually they do; BUT it's blocked by the routine below.
117
+ Which is good. A Super Admin should NOT trigger this event.
118
+
119
+ This function should ONLY be fired through wp-activate.php.
120
+ */
121
+ if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_blog_activation"))
122
+ {
123
+ function ws_plugin__s2member_configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
124
+ {
125
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
126
+ do_action ("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
127
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
128
+ /**/
129
+ if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
130
+ if (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) /* ONLY `wp-activate.php`. */
131
+ {
132
+ ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
133
+ delete_user_meta ($user_id, "s2member_ms_signup_meta");
134
+ }
135
+ /**/
136
+ do_action ("ws_plugin__s2member_after_configure_user_on_ms_blog_activation", get_defined_vars ());
137
+ /**/
138
+ return;
139
+ }
140
+ }
141
+ /*
142
+ Function for configuring new users.
143
+ Attach to: add_action("user_register");
144
+
145
+ This also receives Multisite events.
146
+ Attach to: add_action("wpmu_activate_user");
147
+ Attach to: add_action("wpmu_activate_blog");
148
+
149
+ The Hook `user_register` is also fired by calling:
150
+ wpmu_create_user()
151
+
152
+ This function also receives simulated events from s2Member Pro.
153
+ */
154
+ if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
155
+ {
156
+ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE, $password = FALSE, $meta = FALSE)
157
+ {
158
+ global $wpdb; /* Global database object may be required for this routine. */
159
+ global $pagenow; /* Need this to detect the current admin page. */
160
+ global $current_site, $current_blog; /* Multisite Networking. */
161
+ static $email_config, $processed; /* No duplicate processing. */
162
+ /**/
163
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
164
+ do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
165
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
166
+ /**/
167
+ /* With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_user|blog`. */
168
+ if (!$email_config && ($email_config = true)) /* Anytime this routine is fired; we config email; no exceptions. */
169
+ ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
170
+ /**/
171
+ if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
172
+ && (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) || is_array (ws_plugin__s2member_trim_deep (stripslashes_deep ($meta))))/**/
173
+ /**/
174
+ /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog` instead. */
175
+ && ! (is_admin () && is_multisite () && $pagenow === "user-new.php" && isset ($_POST["noconfirmation"]) && is_super_admin () && empty ($meta))/**/
176
+ && ! (preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && empty ($meta)) /* If activating; we MUST have a meta array. */
177
+ /* The $meta array is ONLY filled by hand-offs from `wpmu_activate_user|blog`. So this is how we check for these events. */
178
+ /**/
179
+ && $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true)) /* Process only once. */
180
+ {
181
+ foreach ((array)$_POST as $key => $value) /* Scan $_POST vars; adding `custom_reg_field` uniformity keys. */
182
+ if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Looking for `user_new` keys here. */
183
+ if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
184
+ $_POST[$key] = $value; /* Add these keys for uniformity. */
185
+ unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
186
+ /**/
187
+ if (!is_admin () && ($_POST["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
188
+ exit ("s2Member security violation. You attempted to POST variables that will NOT be trusted!");
189
+ /**/
190
+ $_pm = array_merge ((array)$_POST, (array)$meta); /* Merge these two data sources together now. However, ALWAYS after the security routine above ^. */
191
+ /**/
192
+ if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
193
+ && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"])))/**/
194
+ && (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1")))
195
+ /* ^ This is for security ^ It checks the database to make sure the User/Member has not already registered in the past, with the same Paid Subscr. ID. */
196
+ { /*
197
+ This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
198
+ If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
199
+ This may also be processed through BuddyPress, or another plugin calling `user_register`.
200
+ */
201
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
202
+ /**/
203
+ list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
204
+ $role = "s2member_level" . $level; /* Level 1-4. */
205
+ /**/
206
+ $email = $user->user_email;
207
+ $login = $user->user_login;
208
+ $ip = $_SERVER["REMOTE_ADDR"];
209
+ $cv = preg_split ("/\|/", $custom);
210
+ /**/
211
+ if ($eotper) /* If a specific EOT Period has been attached; we need to calculate that now. */
212
+ $auto_eot_time = ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $eotper);
213
+ /**/
214
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
215
+ /**/
216
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
217
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
218
+ /**/
219
+ if (! ($fname = $user->first_name))
220
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
221
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
222
+ /**/
223
+ if (!$fname) /* Also try BuddyPress. */
224
+ if ($_pm["field_1"]) /* BuddyPress. */
225
+ $fname = trim (preg_replace ("/ (.*)$/", "", $_pm["field_1"]));
226
+ /**/
227
+ if (! ($lname = $user->last_name))
228
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
229
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
230
+ /**/
231
+ if (!$lname) /* Also try BuddyPress. */
232
+ if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pm["field_1"]))
233
+ $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pm["field_1"]));
234
+ /**/
235
+ $name = trim ($fname . " " . $lname); /* Both names. */
236
+ /**/
237
+ if (! ($pass = $password)) /* Try s2Member's generator. */
238
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
239
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
240
+ /**/
241
+ if (!$pass) /* Also try BuddyPress password. */
242
+ if ($_pm["signup_password"]) /* BuddyPress. */
243
+ $pass = $_pm["signup_password"];
244
+ /**/
245
+ if ($pass) /* No password nag. Update this globally. */
246
+ {
247
+ delete_user_setting ("default_password_nag"); /* setcookie() */
248
+ update_user_option ($user_id, "default_password_nag", false, true);
249
+ }
250
+ /**/
251
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
252
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
253
+ update_user_option ($user_id, "s2member_custom", $custom);
254
+ update_user_option ($user_id, "s2member_notes", $notes);
255
+ /**/
256
+ if (!$user->first_name && $fname)
257
+ update_user_meta ($user_id, "first_name", $fname) ./**/
258
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
259
+ /**/
260
+ if (!$user->last_name && $lname)
261
+ update_user_meta ($user_id, "last_name", $lname);
262
+ /**/
263
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
264
+ {
265
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
266
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
267
+ }
268
+ /**/
269
+ $user->set_role ($role); /* s2Member. */
270
+ /**/
271
+ if ($ccaps) /* Add Custom Capabilities. */
272
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
273
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
274
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
275
+ /**/
276
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
277
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
278
+ {
279
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
280
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
281
+ /**/
282
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
283
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
284
+ }
285
+ /**/
286
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
287
+ /**/
288
+ if (($transient = md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
289
+ {
290
+ $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
291
+ ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("wpurl")), stripslashes_deep ($subscr_payment), array ("timeout" => 20));
292
+ delete_transient($transient);
293
+ }
294
+ /**/
295
+ setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
296
+ /**/
297
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
298
+ do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
299
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
300
+ }
301
+ /**/
302
+ else if (!is_admin ()) /* Otherwise, if we are NOT inside the Dashboard during the creation of this account. */
303
+ { /*
304
+ This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
305
+ If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
306
+ This may also be processed through BuddyPress, or another plugin calling `user_register`.
307
+ */
308
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
309
+ /**/
310
+ $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
311
+ $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
312
+ $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
313
+ /**/
314
+ $level = (preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
315
+ $level = (!$level && preg_match ("/^s2member_level[1-4]$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
316
+ $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
317
+ $level = (!$level) ? "0" : $level;
318
+ /**/
319
+ $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
320
+ /**/
321
+ $email = $user->user_email;
322
+ $login = $user->user_login;
323
+ $ip = $_SERVER["REMOTE_ADDR"];
324
+ $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
325
+ $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
326
+ $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
327
+ /**/
328
+ $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
329
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
330
+ /**/
331
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
332
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
333
+ /**/
334
+ if (! ($fname = $user->first_name))
335
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
336
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
337
+ /**/
338
+ if (!$fname) /* Also try BuddyPress. */
339
+ if ($_pm["field_1"]) /* BuddyPress. */
340
+ $fname = trim (preg_replace ("/ (.*)$/", "", $_pm["field_1"]));
341
+ /**/
342
+ if (! ($lname = $user->last_name))
343
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
344
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
345
+ /**/
346
+ if (!$lname) /* Also try BuddyPress. */
347
+ if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pm["field_1"]))
348
+ $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pm["field_1"]));
349
+ /**/
350
+ $name = trim ($fname . " " . $lname); /* Both names. */
351
+ /**/
352
+ if (! ($pass = $password)) /* Try s2Member's generator. */
353
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
354
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
355
+ /**/
356
+ if (!$pass) /* Also try BuddyPress password. */
357
+ if ($_pm["signup_password"]) /* BuddyPress. */
358
+ $pass = $_pm["signup_password"];
359
+ /**/
360
+ if ($pass) /* No password nag. Update this globally. */
361
+ {
362
+ delete_user_setting ("default_password_nag"); /* setcookie() */
363
+ update_user_option ($user_id, "default_password_nag", false, true);
364
+ }
365
+ /**/
366
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
367
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
368
+ update_user_option ($user_id, "s2member_custom", $custom);
369
+ update_user_option ($user_id, "s2member_notes", $notes);
370
+ /**/
371
+ if (!$user->first_name && $fname)
372
+ update_user_meta ($user_id, "first_name", $fname) ./**/
373
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
374
+ /**/
375
+ if (!$user->last_name && $lname)
376
+ update_user_meta ($user_id, "last_name", $lname);
377
+ /**/
378
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
379
+ {
380
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
381
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
382
+ }
383
+ /**/
384
+ $user->set_role ($role); /* s2Member. */
385
+ /**/
386
+ if ($ccaps) /* Add Custom Capabilities. */
387
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
388
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
389
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
390
+ /**/
391
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
392
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
393
+ {
394
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
395
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
396
+ /**/
397
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
398
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
399
+ }
400
+ /**/
401
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
402
+ /**/
403
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
404
+ do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
405
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
406
+ }
407
+ /**/
408
+ else if (is_admin () && $pagenow === "user-new.php") /* Else, if we're on this page. */
409
+ { /*
410
+ This routine can ONLY be processed through `user-new.php` inside the Dashboard.
411
+ */
412
+ $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
413
+ /**/
414
+ $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
415
+ $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
416
+ $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
417
+ /**/
418
+ $level = (preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
419
+ $level = (!$level && preg_match ("/^s2member_level[1-4]$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
420
+ $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
421
+ $level = (!$level) ? "0" : $level;
422
+ /**/
423
+ $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
424
+ /**/
425
+ $email = $user->user_email;
426
+ $login = $user->user_login;
427
+ $ip = ""; /* N/Applicable. */
428
+ $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
429
+ $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
430
+ $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
431
+ /**/
432
+ $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
433
+ $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
434
+ /**/
435
+ $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
436
+ $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
437
+ /**/
438
+ if (! ($fname = $user->first_name)) /* `Users -> Add New`. */
439
+ if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
440
+ $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
441
+ /**/
442
+ if (! ($lname = $user->last_name)) /* `Users -> Add New`. */
443
+ if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
444
+ $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
445
+ /**/
446
+ $name = trim ($fname . " " . $lname); /* Both names. */
447
+ /**/
448
+ if (! ($pass = $password)) /* Try s2Member's generator. */
449
+ if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
450
+ $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
451
+ /**/
452
+ if (!$pass) /* Also try the `Users -> Add New` form. */
453
+ if ($_pm["pass1"]) /* Field in user-new.php. */
454
+ $pass = $_pm["pass1"];
455
+ /**/
456
+ if ($pass) /* No password nag. Update this globally. */
457
+ {
458
+ delete_user_setting ("default_password_nag"); /* setcookie() */
459
+ update_user_option ($user_id, "default_password_nag", false, true);
460
+ }
461
+ /**/
462
+ update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
463
+ update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
464
+ update_user_option ($user_id, "s2member_custom", $custom);
465
+ update_user_option ($user_id, "s2member_notes", $notes);
466
+ /**/
467
+ if (!$user->first_name && $fname)
468
+ update_user_meta ($user_id, "first_name", $fname) ./**/
469
+ wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
470
+ /**/
471
+ if (!$user->last_name && $lname)
472
+ update_user_meta ($user_id, "last_name", $lname);
473
+ /**/
474
+ if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
475
+ {
476
+ (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
477
+ update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
478
+ }
479
+ /**/
480
+ $user->set_role ($role); /* s2Member. */
481
+ /**/
482
+ foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
483
+ if (strlen ($ccap)) /* Don't add empty capabilities. */
484
+ $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
485
+ /**/
486
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
487
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
488
+ {
489
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
490
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
491
+ /**/
492
+ if (isset ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
493
+ $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
494
+ }
495
+ /**/
496
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
497
+ /**/
498
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
499
+ do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
500
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
501
+ }
502
+ /**/
503
+ if ($processed === "yes") /* If registration was processed by one of the routines above. */
504
+ {
505
+ ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
506
+ /**/
507
+ if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
508
+ /**/
509
+ foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
510
+ /**/
511
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
512
+ if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
513
+ if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
514
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
515
+ if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
516
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
517
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
518
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
519
+ if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
520
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
521
+ /**/
522
+ if (($url = trim ($url))) /* Empty? */
523
+ ws_plugin__s2member_remote($url);
524
+ /**/
525
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
526
+ {
527
+ $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
528
+ $msg .= "\n\n"; /* Spacing in the message body. */
529
+ $msg .= "role: %%role%%\n";
530
+ $msg .= "level: %%level%%\n";
531
+ $msg .= "user_first_name: %%user_first_name%%\n";
532
+ $msg .= "user_last_name: %%user_last_name%%\n";
533
+ $msg .= "user_full_name: %%user_full_name%%\n";
534
+ $msg .= "user_email: %%user_email%%\n";
535
+ $msg .= "user_login: %%user_login%%\n";
536
+ $msg .= "user_pass: %%user_pass%%\n";
537
+ $msg .= "user_id: %%user_id%%\n";
538
+ $msg .= "cv0: %%cv0%%\n";
539
+ $msg .= "cv1: %%cv1%%\n";
540
+ $msg .= "cv2: %%cv2%%\n";
541
+ $msg .= "cv3: %%cv3%%\n";
542
+ $msg .= "cv4: %%cv4%%\n";
543
+ $msg .= "cv5: %%cv5%%\n";
544
+ $msg .= "cv6: %%cv6%%\n";
545
+ $msg .= "cv7: %%cv7%%\n";
546
+ $msg .= "cv8: %%cv8%%\n";
547
+ $msg .= "cv9: %%cv9%%";
548
+ /**/
549
+ if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
550
+ if (($msg = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds ($role), $msg)))
551
+ if (($msg = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds ($level), $msg)))
552
+ if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($fname), $msg)))
553
+ if (($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($lname), $msg)))
554
+ if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds ($name), $msg)))
555
+ if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($email), $msg)))
556
+ if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($login), $msg)))
557
+ if (($msg = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds ($pass), $msg)))
558
+ if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
559
+ /**/
560
+ foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
561
+ /**/
562
+ ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
563
+ }
564
+ /**/
565
+ if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
566
+ /**/
567
+ if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
568
+ if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
569
+ if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
570
+ if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
571
+ if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
572
+ if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
573
+ if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
574
+ if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
575
+ if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
576
+ if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
577
+ /**/
578
+ if (($url = trim ($url))) /* Empty? ... Otherwise, re-fill. */
579
+ $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
580
+ /**/
581
+ setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
582
+ setcookie ("s2member_custom", "", time () + 31556926, "/");
583
+ setcookie ("s2member_level", "", time () + 31556926, "/");
584
+ /**/
585
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
586
+ do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
587
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
588
+ }
589
+ }
590
+ /**/
591
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
592
+ do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
593
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
594
+ /**/
595
+ return;
596
+ }
597
+ }
598
+ ?>
includes/functions/css-js-w-globals.inc.php CHANGED
@@ -14,8 +14,7 @@ Direct access denial.
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /*
17
- Function adds styles to the header.
18
- Do NOT enqueue styles in the admin area.
19
  Attach to: add_action("wp_print_styles");
20
  */
21
  if (!function_exists ("ws_plugin__s2member_add_css"))
@@ -37,7 +36,7 @@ if (!function_exists ("ws_plugin__s2member_add_css"))
37
  }
38
  }
39
  /*
40
- Function for adding s2member.css.
41
  Attach to: add_action("init");
42
  */
43
  if (!function_exists ("ws_plugin__s2member_css"))
@@ -70,19 +69,20 @@ if (!function_exists ("ws_plugin__s2member_css"))
70
  }
71
  }
72
  /*
73
- Function for adding scripts to the header.
74
- Do NOT enqueue scripts in the admin area.
75
  Attach to: add_action("wp_print_scripts");
76
  */
77
  if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
78
  {
79
  function ws_plugin__s2member_add_js_w_globals ()
80
  {
 
 
81
  do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
  /**/
83
- if (!is_admin ()) /* Not in the admin. */
84
  {
85
- if (is_user_logged_in ())
86
  {
87
  $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
88
  /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
@@ -103,7 +103,7 @@ if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
103
  }
104
  }
105
  /*
106
- Function for adding s2member.js with globals.
107
  Attach to: add_action("init");
108
  */
109
  if (!function_exists ("ws_plugin__s2member_js_w_globals"))
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /*
17
+ Adds CSS files.
 
18
  Attach to: add_action("wp_print_styles");
19
  */
20
  if (!function_exists ("ws_plugin__s2member_add_css"))
36
  }
37
  }
38
  /*
39
+ Builds CSS files.
40
  Attach to: add_action("init");
41
  */
42
  if (!function_exists ("ws_plugin__s2member_css"))
69
  }
70
  }
71
  /*
72
+ Adds JavaScript files.
 
73
  Attach to: add_action("wp_print_scripts");
74
  */
75
  if (!function_exists ("ws_plugin__s2member_add_js_w_globals"))
76
  {
77
  function ws_plugin__s2member_add_js_w_globals ()
78
  {
79
+ global $pagenow; /* Need this for comparisons. */
80
+ /**/
81
  do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
82
  /**/
83
+ if (!is_admin () || ($pagenow === "profile.php" && !current_user_can ("edit_users")))
84
  {
85
+ if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
86
  {
87
  $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
88
  /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
103
  }
104
  }
105
  /*
106
+ Builds JavaScript files.
107
  Attach to: add_action("init");
108
  */
109
  if (!function_exists ("ws_plugin__s2member_js_w_globals"))
includes/functions/custom-reg-fields.inc.php ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Handles the creation of Custom Fields.
18
+ */
19
+ if (!function_exists ("ws_plugin__s2member_custom_field_gen"))
20
+ {
21
+ function ws_plugin__s2member_custom_field_gen ($_function = FALSE, $_field = FALSE, $_name_prefix = FALSE, $_id_prefix = FALSE, $_classes = FALSE, $_styles = FALSE, $_tabindex = FALSE, $_attrs = FALSE, $_submission = FALSE, $_value = FALSE, $_lock_uneditables = FALSE)
22
+ {
23
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
+ do_action ("ws_plugin__s2member_before_custom_field_gen", get_defined_vars ());
25
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
+ /**/
27
+ if ($_function && is_array ($field = $_field) && $field["type"] && $field["id"] && $_name_prefix && $_id_prefix)
28
+ {
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
30
+ do_action ("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars ());
31
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
32
+ /**/
33
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
34
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
35
+ /**/
36
+ $name_suffix = (preg_match ("/\[$/", $_name_prefix)) ? ']' : '';
37
+ $field_name = trim ($_name_prefix . $field_var . $name_suffix);
38
+ /**/
39
+ $common = ''; /* Common attribute configuration. */
40
+ $common .= ' name="' . esc_attr ($field_name) . '"';
41
+ $common .= ' id="' . esc_attr ($_id_prefix . $field_id_class) . '"';
42
+ $common .= ( ($field["required"] === "yes") ? ' aria-required="true"' : '');
43
+ $common .= ( (strlen ($_tabindex)) ? ' tabindex="' . esc_attr ($_tabindex) . '"' : '');
44
+ $common .= ( ($field["expected"]) ? ' data-expected="' . esc_attr ($field["expected"]) . '"' : '');
45
+ $common .= ( (preg_match ("/^no/", $field["editable"]) && $_lock_uneditables) ? ' disabled="disabled"' : '');
46
+ $common .= ( ($_classes || $field["classes"]) ? ' class="' . esc_attr (trim ($_classes . ( ($field["classes"]) ? ' ' . $field["classes"] : ''))) . '"' : '');
47
+ $common .= ( ($_styles || $field["styles"]) ? ' style="' . esc_attr (trim ($_styles . ( ($field["styles"]) ? ' ' . $field["styles"] : ''))) . '"' : '');
48
+ $common .= ( ($_attrs || $field["attrs"]) ? ' ' . trim ($_attrs . ( ($field["attrs"]) ? ' ' . $field["attrs"] : '')) : '');
49
+ /**/
50
+ if ($field["type"] === "text")
51
+ {
52
+ $gen = '<input type="text" maxlength="100"';
53
+ $gen .= ' value="' . format_to_edit ((string)$_value) . '"';
54
+ $gen .= $common . ' />';
55
+ }
56
+ /**/
57
+ else if ($field["type"] === "textarea")
58
+ {
59
+ $gen = '<textarea rows="3"' . $common . '>';
60
+ $gen .= format_to_edit ((string)$_value);
61
+ $gen .= '</textarea>';
62
+ }
63
+ /**/
64
+ else if ($field["type"] === "select" && $field["options"])
65
+ {
66
+ $gen = '<select' . $common . '>';
67
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $option_line)
68
+ {
69
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
70
+ $gen .= '<option value="' . esc_attr ($option_value) . '"' . ( ( ($option_default && !$_submission) || $option_value === (string)$_value) ? ' selected="selected"' : '') . '>' . $option_label . '</option>';
71
+ }
72
+ $gen .= '</select>';
73
+ }
74
+ /**/
75
+ else if ($field["type"] === "selects" && $field["options"])
76
+ {
77
+ $common = preg_replace ('/ name\="(.+?)"/', ' name="$1[]"', $common);
78
+ $common = preg_replace ('/ style\="(.+?)"/', ' style="height:auto; $1"', $common);
79
+ /**/
80
+ $gen = '<select multiple="multiple" size="3"' . $common . '>';
81
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $option_line)
82
+ {
83
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
84
+ $gen .= '<option value="' . esc_attr ($option_value) . '"' . ( ( ($option_default && !$_submission) || in_array ($option_value, (array)$_value)) ? ' selected="selected"' : '') . '>' . $option_label . '</option>';
85
+ }
86
+ $gen .= '</select>';
87
+ }
88
+ /**/
89
+ else if ($field["type"] === "checkbox")
90
+ {
91
+ $gen = '<input type="checkbox" value="1"';
92
+ $gen .= ( ((string)$_value) ? ' checked="checked"' : '');
93
+ $gen .= $common . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class) . '" style="display:inline;">' . $field["label"] . '</label>';
94
+ }
95
+ /**/
96
+ else if ($field["type"] === "pre_checkbox")
97
+ {
98
+ $gen = '<input type="checkbox" value="1"';
99
+ $gen .= ( (!$_submission || (string)$_value) ? ' checked="checked"' : '');
100
+ $gen .= $common . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class) . '" style="display:inline;">' . $field["label"] . '</label>';
101
+ }
102
+ /**/
103
+ else if ($field["type"] === "checkboxes" && $field["options"])
104
+ {
105
+ $gen = ""; /* Initialize generated field. */
106
+ /**/
107
+ $common = preg_replace ('/ name\="(.+?)"/', ' name="$1[]"', $common);
108
+ /**/
109
+ $sep = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_sep", "&nbsp;&nbsp;", get_defined_vars ());
110
+ $opl = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_opl", "ws-plugin--s2member-custom-reg-field-op-l", get_defined_vars ());
111
+ /**/
112
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $i => $option_line)
113
+ {
114
+ $common_i = preg_replace ('/ id\="(.+?)"/', ' id="$1-' . ($i) . '"', $common);
115
+ /**/
116
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
117
+ /**/
118
+ $gen .= ($i > 0) ? $sep : ''; /* Separators can be filtered above. */
119
+ $gen .= '<input type="checkbox" value="' . esc_attr ($option_value) . '"';
120
+ $gen .= ( ( ($option_default && !$_submission) || in_array ($option_value, (array)$_value)) ? ' checked="checked"' : '');
121
+ $gen .= $common_i . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class . "-" . $i) . '" class="' . esc_attr ($opl) . '" style="display:inline;">' . $option_label . '</label>';
122
+ }
123
+ }
124
+ /**/
125
+ else if ($field["type"] === "radios" && $field["options"])
126
+ {
127
+ $gen = ""; /* Initialize generated field. */
128
+ /**/
129
+ $sep = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_sep", "&nbsp;&nbsp;", get_defined_vars ());
130
+ $opl = apply_filters ("ws_plugin__s2member_custom_field_gen_" . $field["type"] . "_opl", "ws-plugin--s2member-custom-reg-field-op-l", get_defined_vars ());
131
+ /**/
132
+ foreach (preg_split ("/[\r\n\t]+/", $field["options"]) as $i => $option_line)
133
+ {
134
+ $common_i = preg_replace ('/ id\="(.+?)"/', ' id="$1-' . ($i) . '"', $common);
135
+ /**/
136
+ list ($option_value, $option_label, $option_default) = ws_plugin__s2member_trim_deep (preg_split ("/\|/", trim ($option_line)));
137
+ /**/
138
+ $gen .= ($i > 0) ? $sep : ''; /* Separators can be filtered above. */
139
+ $gen .= '<input type="radio" value="' . esc_attr ($option_value) . '"';
140
+ $gen .= ( ( ($option_default && !$_submission) || $option_value === (string)$_value) ? ' checked="checked"' : '');
141
+ $gen .= $common_i . ' /><label for="' . esc_attr ($_id_prefix . $field_id_class . "-" . $i) . '" class="' . esc_attr ($opl) . '" style="display:inline;">' . $option_label . '</label>';
142
+ }
143
+ }
144
+ else /* Otherwise, we use a default text field. */
145
+ {
146
+ $gen = '<input type="text" maxlength="100"';
147
+ $gen .= ' value="' . format_to_edit ((string)$_value) . '"';
148
+ $gen .= $common . ' />';
149
+ }
150
+ /**/
151
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
152
+ do_action ("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars ());
153
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
154
+ }
155
+ /**/
156
+ return apply_filters ("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars ());
157
+ }
158
+ }
159
+ /*
160
+ Function determines whether or not Custom Fields apply to a specific Level.
161
+ The $level parameter defaults to the current User's Access Level number.
162
+ $level MUST be numeric >= 0.
163
+ */
164
+ if (!function_exists ("ws_plugin__s2member_custom_fields_configured_at_level"))
165
+ {
166
+ function ws_plugin__s2member_custom_fields_configured_at_level ($_level = "auto-detection")
167
+ {
168
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
169
+ do_action ("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars ());
170
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
171
+ /**/
172
+ $level = ($_level === "auto-detection") ? ws_plugin__s2member_user_access_level () : $_level;
173
+ if ($_level === "auto-detection" && $level < 0 && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($cookie = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
174
+ list ($level) = preg_split ("/\:/", $cookie, 3);
175
+ /**/
176
+ $level = (!is_numeric ($level) || $level < 0) ? 0 : $level; /* Always default to Level #0. */
177
+ /**/
178
+ if (is_numeric ($level) && $level >= 0 && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
179
+ {
180
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
181
+ if ($field["levels"] === "all" || in_array ($level, preg_split ("/[;,]+/", preg_replace ("/[^0-9,]/", "", $field["levels"]))))
182
+ $configured[] = $field["id"]; /* Add this to the array. */
183
+ }
184
+ /**/
185
+ return apply_filters ("ws_plugin__s2member_custom_fields_configured_at_level", $configured, get_defined_vars ());
186
+ }
187
+ }
188
+ /*
189
+ This adds custom fields to `wp-signup.php`.
190
+ Attach to: add_action("signup_extra_fields");
191
+ ~ For Multisite Blog Farms.
192
+ */
193
+ if (!function_exists ("ws_plugin__s2member_ms_custom_registration_fields"))
194
+ {
195
+ function ws_plugin__s2member_ms_custom_registration_fields ()
196
+ {
197
+ do_action ("ws_plugin__s2member_before_ms_custom_registration_fields", get_defined_vars ());
198
+ /**/
199
+ if (is_multisite () && is_main_site ()) /* Must be Multisite / Main Site. */
200
+ {
201
+ $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
202
+ /**/
203
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
204
+ /**/
205
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
206
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
207
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
208
+ /**/
209
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
210
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
211
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
212
+ /**/
213
+ echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">First Name *</label>' . "\n";
214
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
215
+ echo '<br />' . "\n";
216
+ /**/
217
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
218
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
219
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
220
+ /**/
221
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
222
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
223
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
224
+ /**/
225
+ echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">Last Name *</label>' . "\n";
226
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
227
+ echo '<br />' . "\n";
228
+ /**/
229
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
231
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
+ /**/
233
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
234
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
235
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
236
+ {
237
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
238
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
239
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
240
+ /**/
241
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
242
+ {
243
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
244
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
245
+ /**/
246
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
247
+ if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
248
+ {
249
+ echo '<label for="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '"' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</label>' . "\n";
250
+ echo ws_plugin__s2member_custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", "", "", $_POST, $_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]);
251
+ echo '<br />' . "\n";
252
+ }
253
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
254
+ }
255
+ /**/
256
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
257
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
258
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
259
+ }
260
+ /**/
261
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
262
+ {
263
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
264
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
265
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
266
+ /**/
267
+ echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">' . "\n";
268
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
269
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
270
+ echo '</label>' . "\n";
271
+ echo '<br />' . "\n";
272
+ /**/
273
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
274
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
275
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
+ }
277
+ /**/
278
+ echo '<br />' . "\n"; /* Toss in one extra line break ( extra margin ). */
279
+ /**/
280
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
281
+ do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
282
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
283
+ }
284
+ /**/
285
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
286
+ do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
287
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
288
+ /**/
289
+ return; /* Return for uniformity. */
290
+ }
291
+ }
292
+ /*
293
+ This adds custom fields to `wp-login.php?action=register`.
294
+ Attach to: add_action("register_form");
295
+ */
296
+ if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
297
+ {
298
+ function ws_plugin__s2member_custom_registration_fields ()
299
+ {
300
+ do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
301
+ /**/
302
+ $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
303
+ /**/
304
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
305
+ /**/
306
+ $tabindex = 20; /* Incremented tabindex starting with 20. */
307
+ /**/
308
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
309
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
310
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
311
+ /**/
312
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
313
+ {
314
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
315
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
316
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
317
+ /**/
318
+ echo '<p>' . "\n";
319
+ echo '<label>' . "\n";
320
+ echo '<span>Password *</span><br />' . "\n";
321
+ echo '<input aria-required="true" type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
322
+ echo '</label>' . "\n";
323
+ echo '</p>';
324
+ /**/
325
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
326
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
327
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
328
+ }
329
+ /**/
330
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
331
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
332
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
333
+ /**/
334
+ echo '<p>' . "\n";
335
+ echo '<label>' . "\n";
336
+ echo '<span>First Name *</span><br />' . "\n";
337
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
338
+ echo '</label>' . "\n";
339
+ echo '</p>';
340
+ /**/
341
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
342
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
343
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
+ /**/
345
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
346
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
347
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
348
+ /**/
349
+ echo '<p>' . "\n";
350
+ echo '<label>' . "\n";
351
+ echo '<span>Last Name *</span><br />' . "\n";
352
+ echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
353
+ echo '</label>' . "\n";
354
+ echo '</p>';
355
+ /**/
356
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
357
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
358
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
359
+ /**/
360
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
361
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
362
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
363
+ {
364
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
365
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
366
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
367
+ /**/
368
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
369
+ {
370
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
371
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
372
+ /**/
373
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
374
+ if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
375
+ {
376
+ echo '<p>' . "\n";
377
+ echo '<label>' . "\n";
378
+ echo '<span' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</span>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
379
+ echo ws_plugin__s2member_custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", ($tabindex = $tabindex + 10), "", $_POST, $_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]);
380
+ echo '</label>' . "\n";
381
+ echo '</p>';
382
+ }
383
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
384
+ }
385
+ /**/
386
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
387
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
388
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
389
+ }
390
+ /**/
391
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
392
+ {
393
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
394
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
395
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
396
+ /**/
397
+ echo '<p>' . "\n";
398
+ echo '<label>' . "\n";
399
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
400
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
401
+ echo '</label>' . "\n";
402
+ echo '</p>';
403
+ /**/
404
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
405
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
406
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
407
+ }
408
+ /**/
409
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
410
+ do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
411
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
412
+ /**/
413
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
414
+ do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
415
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
416
+ /**/
417
+ return;
418
+ }
419
+ }
420
+ /*
421
+ This adds an opt-in checkbox to the BuddyPress signup form.
422
+ Attach to: add_action("bp_before_registration_submit_buttons");
423
+ */
424
+ if (!function_exists ("ws_plugin__s2member_opt_in_4bp"))
425
+ {
426
+ function ws_plugin__s2member_opt_in_4bp ()
427
+ {
428
+ do_action ("ws_plugin__s2member_before_opt_in_4bp", get_defined_vars ());
429
+ /**/
430
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
431
+ {
432
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
433
+ /**/
434
+ echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("ws_plugin__s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
435
+ /**/
436
+ echo '<p>' . "\n";
437
+ echo '<label>' . "\n";
438
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" class="ws-plugin--s2member-custom-reg-field" value="1"' . ( ( (empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
439
+ echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
440
+ echo '</label>' . "\n";
441
+ echo '</p>';
442
+ /**/
443
+ echo '</div>' . "\n";
444
+ /**/
445
+ do_action ("ws_plugin__s2member_during_opt_in_4bp_after", get_defined_vars ());
446
+ }
447
+ /**/
448
+ do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
449
+ /**/
450
+ return;
451
+ }
452
+ }
453
+ ?>
includes/functions/demo-users.inc.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function hides password fields for demo users.
18
+
19
+ Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
20
+ Any other restrictions you need to impose must be done through custom programming, using s2Member's Conditionals.
21
+ See `s2Member -> API Scripting`.
22
+
23
+ Attach to: add_filter("show_password_fields");
24
+ */
25
+ if (!function_exists ("ws_plugin__s2member_demo_hide_password_fields"))
26
+ {
27
+ function ws_plugin__s2member_demo_hide_password_fields ($show = TRUE, $profileuser = FALSE)
28
+ {
29
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
30
+ do_action ("ws_plugin__s2member_before_demo_hide_password_fields", get_defined_vars ());
31
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
32
+ /**/
33
+ if ($profileuser->user_login === "demo")
34
+ return ($show = false);
35
+ /**/
36
+ return $show;
37
+ }
38
+ }
39
+ ?>
includes/functions/demotions.inc.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
- /*
3
- Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
- <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
-
6
- Released under the terms of the GNU General Public License.
7
- You should have received a copy of the GNU General Public License,
8
- along with this software. In the main directory, see: /licensing/
9
- If not, see: <http://www.gnu.org/licenses/>.
10
- */
11
- /*
12
- Direct access denial.
13
- */
14
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
- exit ("Do not access this file directly.");
16
- /*
17
- Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
18
- Use by PayPal® IPN routines, and also by the Auto-EOT system.
19
- */
20
- if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
21
- {
22
- function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
23
- {
24
- do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
25
- /**/
26
- return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
27
- }
28
- }
29
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/functions/email-configs.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
  Functions that modify the email From: name/address.
18
  */
@@ -50,4 +50,22 @@ if (!function_exists ("_ws_plugin__s2member_email_config_name"))
50
  return apply_filters ("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
51
  }
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Functions that modify the email From: name/address.
18
  */
50
  return apply_filters ("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
51
  }
52
  }
53
+ /*
54
+ Convert primitive Role names in emails sent by WordPress®.
55
+ Attach to: add_filter("wpmu_signup_user_notification_email");
56
+ ~ Only necessary with this particular email.
57
+ */
58
+ if (!function_exists ("ws_plugin__s2member_ms_nice_email_roles"))
59
+ {
60
+ function ws_plugin__s2member_ms_nice_email_roles ($message = FALSE)
61
+ {
62
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
63
+ do_action ("ws_plugin__s2member_before_ms_nice_email_roles", get_defined_vars ());
64
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
65
+ /**/
66
+ $message = preg_replace ("/ as a (subscriber|s2member_level[1-4])/i", " as a Member", $message);
67
+ /**/
68
+ return apply_filters ("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
69
+ }
70
+ }
71
  ?>
includes/functions/force-options.inc.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Forces a default Role for new registrations, NOT tied to an incoming payment.
18
+ Attach to: add_filter("pre_option_default_role");
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_force_default_role"))
21
+ {
22
+ function ws_plugin__s2member_force_default_role ($default_role = FALSE)
23
+ {
24
+ do_action ("ws_plugin__s2member_before_force_default_role", get_defined_vars ());
25
+ /**/
26
+ return apply_filters ("ws_plugin__s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
27
+ }
28
+ }
29
+ /*
30
+ Forces a default Role for new Multisite registrations ( on the Main Site ) NOT tied to an incoming payment.
31
+ Attach to: add_filter("pre_site_option_default_user_role");
32
+ */
33
+ if (!function_exists ("ws_plugin__s2member_force_mms_default_role"))
34
+ {
35
+ function ws_plugin__s2member_force_mms_default_role ($default_role = FALSE)
36
+ {
37
+ do_action ("ws_plugin__s2member_before_force_mms_default_role", get_defined_vars ());
38
+ /**/
39
+ return apply_filters ("ws_plugin__s2member_force_mms_default_role", ($default_role = "subscriber"), get_defined_vars ());
40
+ }
41
+ }
42
+ /*
43
+ Forces a specific Role to demote to; whenever a Member is demoted in one way or another.
44
+ Use by PayPal® IPN routines, and also by the Auto-EOT system.
45
+ */
46
+ if (!function_exists ("ws_plugin__s2member_force_demotion_role"))
47
+ {
48
+ function ws_plugin__s2member_force_demotion_role ($demotion_role = FALSE)
49
+ {
50
+ do_action ("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
51
+ /**/
52
+ return apply_filters ("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
53
+ }
54
+ }
55
+ /*
56
+ Allows new Users to be created on a Multisite Network.
57
+ Attach to: add_filter("pre_site_option_add_new_users");
58
+ */
59
+ if (!function_exists ("ws_plugin__s2member_mms_allow_new_users"))
60
+ {
61
+ function ws_plugin__s2member_mms_allow_new_users ($allow = FALSE)
62
+ {
63
+ do_action ("ws_plugin__s2member_before_mms_allow_new_users", get_defined_vars ());
64
+ /**/
65
+ return apply_filters ("ws_plugin__s2member_mms_allow_new_users", ($allow = "1"), get_defined_vars ());
66
+ }
67
+ }
68
+ /*
69
+ Forces a Multisite Dashboard Blog to be the Main Site.
70
+ Attach to: add_filter("pre_site_option_dashboard_blog");
71
+ */
72
+ if (!function_exists ("ws_plugin__s2member_mms_dashboard_blog"))
73
+ {
74
+ function ws_plugin__s2member_mms_dashboard_blog ($dashboard_blog = FALSE)
75
+ {
76
+ global $current_site, $current_blog; /* For Multisite support. */
77
+ /**/
78
+ do_action ("ws_plugin__s2member_before_mms_dashboard_blog", get_defined_vars ());
79
+ /**/
80
+ $main_site = ( (is_multisite ()) ? $current_site->blog_id : "1"); /* Forces the Main Site. */
81
+ /**/
82
+ return apply_filters ("ws_plugin__s2member_mms_dashboard_blog", ($dashboard_blog = $main_site), get_defined_vars ());
83
+ }
84
+ }
85
+ /*
86
+ Function for allowing access to the Registration Form.
87
+ This function has been further optimized to reduce DB queries.
88
+ Attach to: add_filter("pre_option_users_can_register");
89
+ */
90
+ if (!function_exists ("ws_plugin__s2member_check_register_access"))
91
+ {
92
+ function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
93
+ {
94
+ global $wpdb; /* Global database object reference */
95
+ /**/
96
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
97
+ do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
98
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
99
+ /**/
100
+ $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];
101
+ /**/
102
+ if (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ())
103
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
104
+ /**/
105
+ else if (!is_admin () && !$users_can_register) /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
106
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site () || is_super_admin () || current_user_can ("create_users"))
107
+ {
108
+ if ((is_multisite () && is_super_admin ()) || current_user_can ("create_users") || ( ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
109
+ {
110
+ return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
111
+ }
112
+ }
113
+ /**/
114
+ return apply_filters ("ws_plugin__s2member_check_register_access", $users_can_register, get_defined_vars ());
115
+ }
116
+ }
117
+ /*
118
+ Function for allowing access to the main Multisite Registration Form.
119
+ This function has been further optimized to reduce DB queries.
120
+ Attach to: add_filter("pre_site_option_registration");
121
+ */
122
+ if (!function_exists ("ws_plugin__s2member_check_mms_register_access"))
123
+ {
124
+ function ws_plugin__s2member_check_mms_register_access ($users_can_register = FALSE)
125
+ {
126
+ global $wpdb; /* Global database object reference */
127
+ global $current_site, $current_blog; /* For Multisite support. */
128
+ /**/
129
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
130
+ do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
131
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
132
+ /**/
133
+ $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
134
+ /**/
135
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site ()) /* NOT a Blog Farm. */
136
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
137
+ /**/
138
+ else if (!is_admin () && $users_can_register !== "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
139
+ {
140
+ if (is_super_admin () || current_user_can ("create_users") || ( ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && ! ($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
141
+ {
142
+ if (is_super_admin () || current_user_can ("create_users"))
143
+ {
144
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
145
+ }
146
+ else if ($subscr_id && $custom && $level) /* A paying Customer? Cookies have already been authenticated above. */
147
+ {
148
+ list ($level) = preg_split ("/\:/", $level, 1); /* Parse out the level now. */
149
+ /**/
150
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])
151
+ {
152
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
153
+ }
154
+ else /* Otherwise, we MUST allow them to create an account; they paid for it! */
155
+ {
156
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
157
+ }
158
+ }
159
+ }
160
+ /* --------------------> $users_can_register !== "all", so exclude Level #0. */
161
+ else if (is_user_logged_in () && current_user_can ("access_s2member_level1") && is_object ($current_user = wp_get_current_user ()))
162
+ {
163
+ $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
164
+ $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
165
+ $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
166
+ $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
167
+ /**/
168
+ if ($current_user_blogs < $blogs_allowed) /* Are they within their limit? */
169
+ {
170
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
171
+ }
172
+ }
173
+ }
174
+ /**/
175
+ else if (!is_admin () && $users_can_register === "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
176
+ {
177
+ if (is_user_logged_in () && is_object ($current_user = wp_get_current_user ()))
178
+ {
179
+ $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
180
+ $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
181
+ $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
182
+ $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
183
+ /**/
184
+ if ($current_user_blogs >= $blogs_allowed) /* Are they at their limit? */
185
+ {
186
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
187
+ }
188
+ }
189
+ }
190
+ /**/
191
+ return apply_filters ("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars ());
192
+ }
193
+ }
194
+ /*
195
+ This handles register access in BuddyPress - for Multisite compatibility.
196
+ Attach to: add_filter("bp_core_get_site_options");
197
+
198
+ BuddyPress bypasses the default Filter ( `pre_site_option_registration` )
199
+ and instead, it uses: bp_core_get_site_options()
200
+ */
201
+ if (!function_exists ("ws_plugin__s2member_check_bp_mms_register_access"))
202
+ {
203
+ function ws_plugin__s2member_check_bp_mms_register_access ($site_options = FALSE)
204
+ {
205
+ if (is_multisite ()) /* Only if Multisite Networking is enabled. Pointless otherwise. */
206
+ $site_options["registration"] = ws_plugin__s2member_check_mms_register_access ($site_options["registration"]);
207
+ /**/
208
+ return apply_filters ("ws_plugin__s2member_check_bp_mms_register_access", $site_options, get_defined_vars ());
209
+ }
210
+ }
211
+ /*
212
+ Function that describes the General Option overrides for clarity.
213
+ Attach to: add_action("admin_init");
214
+ */
215
+ if (!function_exists ("ws_plugin__s2member_general_ops_notice"))
216
+ {
217
+ function ws_plugin__s2member_general_ops_notice ()
218
+ {
219
+ global $pagenow; /* Need this. */
220
+ /**/
221
+ do_action ("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
222
+ /**/
223
+ if (is_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) /* Multisite does NOT provide these options. */
224
+ {
225
+ $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>.<br />For further details, see: <code>s2Member -> General Options -> Open Registration</code>.";
226
+ /**/
227
+ $js = '<script type="text/javascript">';
228
+ $js .= "jQuery('input#users_can_register, select#default_role').attr('disabled', 'disabled');";
229
+ $js .= '</script>';
230
+ /**/
231
+ do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
232
+ /**/
233
+ ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
234
+ }
235
+ /**/
236
+ do_action ("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
237
+ /**/
238
+ return;
239
+ }
240
+ }
241
+ /*
242
+ Function that describes the Multisite Option overrides for clarity.
243
+ Attach to: add_action("admin_init");
244
+ */
245
+ if (!function_exists ("ws_plugin__s2member_multisite_ops_notice"))
246
+ {
247
+ function ws_plugin__s2member_multisite_ops_notice ()
248
+ {
249
+ global $pagenow; /* Need this. */
250
+ /**/
251
+ do_action ("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
252
+ /**/
253
+ if (is_admin () && $pagenow === "ms-options.php" && !isset ($_GET["page"]) && is_multisite ()) /* Only with Multisite Networking enabled. */
254
+ {
255
+ $notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
256
+ /**/
257
+ $js = '<script type="text/javascript">';
258
+ $js .= "jQuery('input#dashboard_blog, select#default_user_role, input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
259
+ $js .= '</script>';
260
+ /**/
261
+ do_action ("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
262
+ /**/
263
+ ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
264
+ }
265
+ /**/
266
+ do_action ("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
267
+ /**/
268
+ return;
269
+ }
270
+ }
271
+ ?>
includes/functions/list-servers.inc.php CHANGED
@@ -12,7 +12,24 @@ 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 that process list server integrations for s2Member.
18
  */
@@ -20,7 +37,7 @@ if (!function_exists ("ws_plugin__s2member_process_list_servers"))
20
  {
21
  function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
22
  {
23
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
24
  do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
25
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
26
  /**/
@@ -46,33 +63,16 @@ if (!function_exists ("ws_plugin__s2member_process_list_servers"))
46
  "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
47
  }
48
  /**/
49
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
50
  do_action ("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
51
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
52
  }
53
  /**/
54
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
  do_action ("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
56
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
  /**/
58
  return;
59
  }
60
  }
61
- /*
62
- Function that determines whether or not any list
63
- servers have been integrated into the s2Member options.
64
- */
65
- if (!function_exists ("ws_plugin__s2member_list_servers_integrated"))
66
- {
67
- function ws_plugin__s2member_list_servers_integrated ()
68
- {
69
- do_action ("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
70
- /**/
71
- for ($i = 0; $i <= 4; $i++)
72
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
73
- return apply_filters ("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
74
- /**/
75
- return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
76
- }
77
- }
78
  ?>
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that determines whether or not any list
18
+ servers have been integrated into the s2Member options.
19
+ */
20
+ if (!function_exists ("ws_plugin__s2member_list_servers_integrated"))
21
+ {
22
+ function ws_plugin__s2member_list_servers_integrated ()
23
+ {
24
+ do_action ("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
25
+ /**/
26
+ for ($i = 0; $i <= 4; $i++)
27
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"] || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
28
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
29
+ /**/
30
+ return apply_filters ("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
31
+ }
32
+ }
33
  /*
34
  Function that process list server integrations for s2Member.
35
  */
37
  {
38
  function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
39
  {
40
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
41
  do_action ("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
42
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
43
  /**/
63
  "From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
64
  }
65
  /**/
66
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
67
  do_action ("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
68
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
69
  }
70
  /**/
71
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
72
  do_action ("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
73
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
74
  /**/
75
  return;
76
  }
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ?>
includes/functions/login-customizations.inc.php CHANGED
@@ -57,31 +57,48 @@ if (!function_exists ("ws_plugin__s2member_login_header_styles"))
57
  do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
  /**/
 
 
 
60
  $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
61
  $s .= '<script type="text/javascript" src="' . get_bloginfo ("wpurl") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
62
  /**/
63
  $s .= "\n" . '<style type="text/css">' . "\n";
64
  /**/
65
- $s .= 'html, body { border: 0 !important; background: none !important; }' . "\n"; /* Clear borders & existing background. */
66
- $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; }' . "\n";
67
- $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ') !important; }' . "\n";
68
- $s .= 'html { background-repeat: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image_repeat"] . ' !important; }' . "\n";
 
 
 
 
 
 
 
 
 
 
 
69
  /**/
70
- $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; top: 15px !important; left: 15px !important; padding: 10px !important; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; -moz-border-radius:3px !important; -webkit-border-radius:3px !important; border-radius:3px !important; }' . "\n";
71
  /**/
72
- $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px !important; }' . "\n";
73
- $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center !important; }' . "\n";
74
- $s .= 'div#login h1 a { display: block !important; width: 100% !important; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px !important; }' . "\n";
75
- $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; }' . "\n";
76
- $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -khtml-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; }' . "\n";
77
- $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #333333 !important; border: 1px solid #666666 !important; background: #CCCCCC !important; padding: 5px !important; -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; -khtml-border-radius: 3px !important; border-radius: 3px !important; }' . "\n";
78
- $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000 !important; border: 1px solid #000000 !important; }' . "\n";
79
  /**/
80
- $s .= 'div#login form input.ws-plugin--s2member-custom-reg-field, div#login form select.ws-plugin--s2member-custom-reg-field { background:none repeat scroll 0 0 #FBFBFB; border:1px solid #E5E5E5; font-size:24px; margin-bottom:16px; margin-right:6px; margin-top:2px; padding:3px; width:97%; }' . "\n";
81
- $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field { width:99%; }' . "\n"; /* Adjust select fields. */
 
 
 
82
  /**/
 
83
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
84
- $s .= 'p#reg_passmail { display: none; }' . "\n";
85
  /**/
86
  $s .= '</style>' . "\n\n";
87
  /**/
57
  do_action ("ws_plugin__s2member_before_login_header_styles", get_defined_vars ());
58
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
59
  /**/
60
+ /* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
61
+ $important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
62
+ /**/
63
  $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
64
  $s .= '<script type="text/javascript" src="' . get_bloginfo ("wpurl") . '/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
65
  /**/
66
  $s .= "\n" . '<style type="text/css">' . "\n";
67
  /**/
68
+ $s .= 'html, body { border: 0' . $i . '; background: none' . $i . '; }' . "\n"; /* Clear existing. */
69
+ $s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . $i . '; }' . "\n";
70
+ $s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ')' . $i . '; }' . "\n";
71
+ $s .= 'html { background-repeat: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image_repeat"] . $i . '; }' . "\n";
72
+ /**/
73
+ $s .= 'body, body * { font-size: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_size"] . $i . '; }' . "\n";
74
+ $s .= 'body, body * { font-family: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_family"] . $i . '; }' . "\n";
75
+ /**/
76
+ $s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; top: 15px' . $i . '; left: 15px' . $i . '; padding: 10px' . $i . '; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . $i . '; -moz-border-radius:3px' . $i . '; -webkit-border-radius:3px' . $i . '; border-radius:3px' . $i . '; }' . "\n";
77
+ /**/
78
+ $s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px' . $i . '; }' . "\n";
79
+ $s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center' . $i . '; }' . "\n";
80
+ $s .= 'div#login h1 a { display: block' . $i . '; width: 100%' . $i . '; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px' . $i . '; }' . "\n";
81
+ /**/
82
+ $s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . $i . '; }' . "\n";
83
  /**/
84
+ $s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . $i . '; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . $i . '; }' . "\n";
85
  /**/
86
+ $s .= 'div#login form p { margin: 2px 0 16px 0' . $i . '; }' . "\n"; /* Handle margins. */
87
+ $s .= 'div#login form input[type="text"].input, div#login form input[type="password"].input, div#login form input[type="text"].ws-plugin--s2member-custom-reg-field, div#login form input[type="password"].ws-plugin--s2member-custom-reg-field, div#login form textarea.ws-plugin--s2member-custom-reg-field, div#login form select.ws-plugin--s2member-custom-reg-field { font-weight:normal' . $i . '; color:#333333' . $i . '; background:none repeat scroll 0 0 #FBFBFB' . $i . '; border:1px solid #E5E5E5' . $i . '; font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; margin: 0 2% 0 0' . $i . '; padding:3px' . $i . '; width:98%' . $i . '; }' . "\n";
88
+ $s .= 'div#login form input[type="checkbox"].ws-plugin--s2member-custom-reg-field, div#login form input[type="radio"].ws-plugin--s2member-custom-reg-field { vertical-align:middle' . $i . '; }' . "\n";
89
+ $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field > option { font-size:' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"] . $i . '; }' . "\n";
90
+ $s .= 'div#login form label.ws-plugin--s2member-custom-reg-field-op-l { vertical-align:middle' . $i . '; font-size:90%' . $i . '; }' . "\n";
91
+ $s .= 'div#login form select.ws-plugin--s2member-custom-reg-field { width:100%' . $i . '; }' . "\n";
 
92
  /**/
93
+ $s .= 'div#login form p.submit { margin-bottom: 0' . $i . '; }' . "\n";
94
+ $s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #666666' . $i . '; text-shadow: 2px 2px 5px #EEEEEE' . $i . '; border: 1px solid #999999' . $i . '; background: #FBFBFB' . $i . '; padding: 5px' . $i . '; -moz-border-radius: 3px' . $i . '; -webkit-border-radius: 3px' . $i . '; border-radius: 3px' . $i . '; }' . "\n";
95
+ $s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000' . $i . '; text-shadow: 2px 2px 5px #CCCCCC' . $i . '; border-color: #000000' . $i . '; }' . "\n";
96
+ $s .= 'div#login form#lostpasswordform { padding-bottom: 16px' . $i . '; } div#login form#lostpasswordform p.submit { float: none' . $i . '; } div#login form#lostpasswordform input[type="submit"] { width: 100%' . $i . '; }' . "\n";
97
+ $s .= 'div#login form#registerform { padding-bottom: 16px' . $i . '; } div#login form#registerform p.submit { float: none' . $i . '; margin-top: -10px' . $i . '; } div#login form#registerform input[type="submit"] { width: 100%' . $i . '; }' . "\n";
98
  /**/
99
+ $s .= 'div#login form#registerform p#reg_passmail { font-style: italic' . $i . '; }' . "\n";
100
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
101
+ $s .= 'p#reg_passmail { display: none' . $i . '; }' . "\n";
102
  /**/
103
  $s .= '</style>' . "\n\n";
104
  /**/
includes/functions/menu-pages.inc.php CHANGED
@@ -12,74 +12,67 @@ 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 saving all options from any page.
 
 
18
  */
19
  if (!function_exists ("ws_plugin__s2member_update_all_options"))
20
  {
21
  function ws_plugin__s2member_update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE)
22
  {
23
- do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ());
24
  /**/
25
- if ($verified || (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
26
  {
27
- unset($_POST["ws_plugin__s2member_options_save"]); /* Unset this key before we begin. */
 
 
28
  /**/
29
- $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
30
- $new_options = (is_array ($new_options)) ? $new_options : $_POST; /* New! */
31
- /**/
32
- foreach ($new_options as $key => $value) /* Go through each POST variable and look for s2member. */
33
- {
34
- if (preg_match ("/^" . preg_quote ("ws_plugin__s2member", "/") . "/", $key)) /* Look for keys. */
35
  {
36
- if ($key === "ws_plugin__s2member_configured") /* This is a special configuration option. */
37
- {
38
- update_option ("ws_plugin__s2member_configured", trim (stripslashes ($value))); /* Update this option separately. */
39
- /**/
40
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = trim (stripslashes ($value)); /* Update on-the-fly. */
41
- }
42
- else /* We need to place this option into the array. Here we remove the ws_plugin__s2member_ portion on the beginning. */
43
- {
44
- (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded, 1st key is removed. */
45
- $options[preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key)] = $value;
46
- }
47
  }
48
- }
49
- /**/
50
- $options["options_version"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] + 0.001; /* Increment options version. */
51
  /**/
52
- $options = ws_plugin__s2member_configure_options_and_their_defaults ($options); /* Also updates the global options array. */
 
53
  /**/
54
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
  do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
56
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
  /**/
58
  update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
59
  /**/
60
- if ($update_other === true || (is_array ($update_other) && in_array ("auto_eot_system", $update_other)))
61
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"] == 1)
62
- ws_plugin__s2member_add_auto_eot_system (); /* 1 == WP-Cron. */
63
- else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
64
- ws_plugin__s2member_delete_auto_eot_system ();
65
- /**/
66
- if ($display_notices === true || (is_array ($display_notices) && in_array ("options_saved", $display_notices)))
67
- if ($enqueue_notices === true || (is_array ($enqueue_notices) && in_array ("options_saved", $enqueue_notices)))
68
- ws_plugin__s2member_enqueue_admin_notice('<strong>Options saved.</strong>');
69
- else /* Otherwise, we can go ahead and display the notice immediately. Not queuing. */
70
- ws_plugin__s2member_display_admin_notice('<strong>Options saved.</strong>');
71
- /**/
72
- if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
73
- if ($display_notices === true || (is_array ($display_notices) && in_array ("membership_options_page_warning", $display_notices)))
74
- if ($enqueue_notices === true || (is_array ($enqueue_notices) && in_array ("membership_options_page_warning", $enqueue_notices)))
75
- ws_plugin__s2member_enqueue_admin_notice ('<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.', false, true);
76
- else /* Otherwise, we can go ahead and display the notice immediately. Not queuing. */
77
- ws_plugin__s2member_display_admin_notice ('<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.', true);
78
  }
79
  /**/
80
  do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ());
81
  /**/
82
- return;
83
  }
84
  }
85
  /*
@@ -164,7 +157,7 @@ if (!function_exists ("_ws_plugin__s2member_add_settings_link"))
164
  {
165
  function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
166
  {
167
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
168
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
169
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
170
  /**/
@@ -173,7 +166,7 @@ if (!function_exists ("_ws_plugin__s2member_add_settings_link"))
173
  $settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
174
  array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
175
  /**/
176
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
177
  do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
178
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
179
  }
@@ -193,10 +186,13 @@ if (!function_exists ("ws_plugin__s2member_add_admin_scripts"))
193
  /**/
194
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
195
  {
196
- wp_enqueue_script("jquery");
197
- wp_enqueue_script("thickbox");
198
- wp_enqueue_script("media-upload");
199
- wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
 
 
 
200
  /**/
201
  do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
202
  }
@@ -218,7 +214,7 @@ if (!function_exists ("ws_plugin__s2member_add_admin_styles"))
218
  /**/
219
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
220
  {
221
- wp_enqueue_style("thickbox");
222
  wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
223
  /**/
224
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
@@ -241,11 +237,11 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_js"))
241
  /**/
242
  if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
243
  {
244
- header("Content-Type: text/javascript; charset=utf-8");
245
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
246
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
247
- header("Cache-Control: no-cache, must-revalidate, max-age=0");
248
- header("Pragma: no-cache");
249
  /**/
250
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
251
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
@@ -276,16 +272,16 @@ if (!function_exists ("ws_plugin__s2member_menu_pages_css"))
276
  /**/
277
  if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
278
  {
279
- header("Content-Type: text/css; charset=utf-8");
280
- header("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
281
- header("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
282
- header("Cache-Control: no-cache, must-revalidate, max-age=0");
283
- header("Pragma: no-cache");
284
  /**/
285
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
286
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
287
  /**/
288
- ob_start("ws_plugin__s2member_compress_css"); /* Compress. */
289
  /**/
290
  include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
291
  /**/
@@ -321,7 +317,7 @@ if (!function_exists ("ws_plugin__s2member_mms_options_page"))
321
  $wp_login_replace = "\n\t\t// Modified for full plugin compatiblity.\n\t\t//wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );\n\t\t//exit;";
322
  /**/
323
  if (file_exists ($wp_login_file) && is_writable ($wp_login_file) && ($wp_login = file_get_contents ($wp_login_file)) && file_put_contents ($wp_login_file, preg_replace ($wp_login_section, $wp_login_replace, $wp_login)))
324
- ws_plugin__s2member_display_admin_notice('Your <code>/wp-login.php</code> file was patched successfully.');
325
  else /* Otherwise, we need to report that /wp-login.php could NOT be updated. Possibly a permissions error. */
326
  ws_plugin__s2member_display_admin_notice ('Your <code>wp-login.php</code> file could NOT be patched. File NOT writable.', true);
327
  /**/
@@ -330,7 +326,7 @@ if (!function_exists ("ws_plugin__s2member_mms_options_page"))
330
  $load_replace = "\n\n\t// Modified for full plugin compatiblity.\n\t//if ( empty( \$active_plugins ) || defined( 'WP_INSTALLING' ) )\n\tif ( empty( \$active_plugins ) || ( defined( 'WP_INSTALLING' ) && !preg_match(\"/\/wp-activate\.php/\", \$_SERVER[\"REQUEST_URI\"]) ) )";
331
  /**/
332
  if (file_exists ($load_file) && is_writable ($load_file) && ($load = file_get_contents ($load_file)) && file_put_contents ($load_file, preg_replace ($load_section, $load_replace, $load)))
333
- ws_plugin__s2member_display_admin_notice('Your <code>/wp-includes/load.php</code> file was patched successfully.');
334
  else /* Otherwise, we need to report that /wp-includes/load.php could NOT be updated. Possibly a permissions error. */
335
  ws_plugin__s2member_display_admin_notice ('Your <code>/wp-includes/load.php</code> file could NOT be patched. File NOT writable.', true);
336
  /**/
@@ -339,7 +335,7 @@ if (!function_exists ("ws_plugin__s2member_mms_options_page"))
339
  $user_new_replace = "\n\t\t\t\t// Modified for full plugin compatiblity.\n\t\t\t\t//wpmu_signup_user( \$new_user_login, \$_REQUEST[ 'email' ], array( 'add_to_blog' => \$wpdb->blogid, 'new_role' => \$_REQUEST[ 'role' ] ) );\n\t\t\t\twpmu_signup_user( \$new_user_login, \$_REQUEST[ 'email' ], apply_filters( 'add_signup_meta', array( 'add_to_blog' => \$wpdb->blogid, 'new_role' => \$_REQUEST[ 'role' ] ) ) );";
340
  /**/
341
  if (file_exists ($user_new_file) && is_writable ($user_new_file) && ($user_new = file_get_contents ($user_new_file)) && file_put_contents ($user_new_file, preg_replace ($user_new_section, $user_new_replace, $user_new)))
342
- ws_plugin__s2member_display_admin_notice('Your <code>/wp-admin/user-new.php</code> file was patched successfully.');
343
  else /* Otherwise, we need to report that /wp-admin/user-new.php could NOT be updated. Possibly a permissions error. */
344
  ws_plugin__s2member_display_admin_notice ('Your <code>/wp-admin/user-new.php</code> file could NOT be patched. File NOT writable.', true);
345
  }
@@ -567,22 +563,24 @@ if (!function_exists ("ws_plugin__s2member_bridges_page"))
567
  /**/
568
  if (($nonce = $_POST["ws_plugin__s2member_bridge_bbpress"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-bridge-bbpress"))
569
  {
570
- if (($plugins_dir = trim (rtrim (stripslashes ($_POST["ws_plugin__s2member_bridge_bbpress_plugins_dir"]), "/"))) && is_dir ($plugins_dir))
 
 
571
  {
572
- if (is_writable ($plugins_dir)) /* This directory MUST be writable. Otherwise, file_put_contents() will fail. */
573
  {
574
- if (preg_match ("/^Install/i", $_POST["ws_plugin__s2member_bridge_bbpress_action"]))
575
  {
576
- $min = (string)$_POST["ws_plugin__s2member_bridge_bbpress_min_level"];
577
  /**/
578
  if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", ws_plugin__s2member_esc_dq ($min), $file)) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
579
- ws_plugin__s2member_display_admin_notice("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
580
  /**/
581
  else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
582
  ws_plugin__s2member_display_admin_notice ("Unknown error. Please try again, or install manually.", true);
583
  }
584
  /**/
585
- else if (preg_match ("/^Un-Install/i", $_POST["ws_plugin__s2member_bridge_bbpress_action"]))
586
  {
587
  if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
588
  {
@@ -590,7 +588,7 @@ if (!function_exists ("ws_plugin__s2member_bridges_page"))
590
  ws_plugin__s2member_display_admin_notice ("Unknown error. Please try again, or un-install manually.", true);
591
  /**/
592
  else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
593
- ws_plugin__s2member_display_admin_notice("The bbPress® Bridge/plugin has been successfully <strong>un-installed</strong>.");
594
  }
595
  else
596
  ws_plugin__s2member_display_admin_notice ("The bbPress® Bridge/plugin is already un-installed.", true);
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
+ Function that saves all options from any page.
18
+ Options can also be passed in directly.
19
+ Can also be self-verified.
20
  */
21
  if (!function_exists ("ws_plugin__s2member_update_all_options"))
22
  {
23
  function ws_plugin__s2member_update_all_options ($new_options = FALSE, $verified = FALSE, $update_other = TRUE, $display_notices = TRUE, $enqueue_notices = FALSE)
24
  {
25
+ do_action ("ws_plugin__s2member_before_update_all_options", get_defined_vars ()); /* If you use this Hook, be sure to use `wp_verify_nonce()`. */
26
  /**/
27
+ if ($verified || ( ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save")))
28
  {
29
+ $options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Here we get all of the existing options. */
30
+ $new_options = (is_array ($new_options)) ? $new_options : (array)$_POST; /* Force array. */
31
+ $new_options = ws_plugin__s2member_trim_deep (stripslashes_deep ($new_options));
32
  /**/
33
+ foreach ((array)$new_options as $key => $value) /* Looking for relevant keys. */
34
+ if (preg_match ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", $key))
35
+ /**/
36
+ if ($key === "ws_plugin__s2member_configured") /* Configured. */
 
 
37
  {
38
+ update_option ("ws_plugin__s2member_configured", $value);
39
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = $value;
40
+ }
41
+ else /* Place this option into the array. Remove ws_plugin__s2member_. */
42
+ {
43
+ (is_array ($value)) ? array_shift ($value) : null; /* Arrays should be padded. */
44
+ $key = preg_replace ("/^" . preg_quote ("ws_plugin__s2member_", "/") . "/", "", $key);
45
+ $options[$key] = $value; /* Overriding a possible existing option. */
 
 
 
46
  }
 
 
 
47
  /**/
48
+ $options["options_version"] = $options["options_version"] + 0.001;
49
+ $options = ws_plugin__s2member_configure_options_and_their_defaults ($options);
50
  /**/
51
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
  do_action ("ws_plugin__s2member_during_update_all_options", get_defined_vars ());
53
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
54
  /**/
55
  update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
56
  /**/
57
+ if ($update_other === true || in_array ("auto_eot_system", (array)$update_other)) /* Handle the Auto-EOT System now ( enable/disable ). */
58
+ ($options["auto_eot_system_enabled"] == 1) ? ws_plugin__s2member_add_auto_eot_system () : ws_plugin__s2member_delete_auto_eot_system ();
59
+ /**/
60
+ if (($display_notices === true || in_array ("success", (array)$display_notices)) && ($notice = '<strong>Options saved.</strong>'))
61
+ ($enqueue_notices === true || in_array ("success", (array)$enqueue_notices)) ? ws_plugin__s2member_enqueue_admin_notice ($notice) : ws_plugin__s2member_display_admin_notice ($notice);
62
+ /**/
63
+ if (!$options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> s2Member security restrictions will NOT be enforced until you\'ve configured a Membership Options Page. See: <code>s2Member -> General Options -> Membership Options Page</code>.'))
64
+ ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? ws_plugin__s2member_enqueue_admin_notice ($notice, false, true) : ws_plugin__s2member_display_admin_notice ($notice, true);
65
+ /**/
66
+ if ($options["login_welcome_page"] && $options["login_welcome_page"] === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> Your Login Welcome Page is the same as your Membership Options Page. Please correct this. See: <code>s2Member -> General Options -> Login Welcome Page</code>.'))
67
+ ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? ws_plugin__s2member_enqueue_admin_notice ($notice, false, true) : ws_plugin__s2member_display_admin_notice ($notice, true);
68
+ /**/
69
+ if ($options["file_download_limit_exceeded_page"] && $options["file_download_limit_exceeded_page"] === $options["membership_options_page"] && ($display_notices === true || in_array ("page-conflict-warnings", (array)$display_notices)) && ($notice = '<strong>NOTE:</strong> Your Download Limit Exceeded Page is the same as your Membership Options Page. Please correct this. See: <code>s2Member -> Download Options</code>.'))
70
+ ($enqueue_notices === true || in_array ("page-conflict-warnings", (array)$enqueue_notices)) ? ws_plugin__s2member_enqueue_admin_notice ($notice, false, true) : ws_plugin__s2member_display_admin_notice ($notice, true);
 
 
 
 
71
  }
72
  /**/
73
  do_action ("ws_plugin__s2member_after_update_all_options", get_defined_vars ());
74
  /**/
75
+ return; /* Return for uniformity. */
76
  }
77
  }
78
  /*
157
  {
158
  function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
159
  {
160
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
161
  do_action ("_ws_plugin__s2member_before_add_settings_link", get_defined_vars ());
162
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
163
  /**/
166
  $settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
167
  array_unshift ($links, apply_filters ("ws_plugin__s2member_add_settings_link", $settings, get_defined_vars ()));
168
  /**/
169
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
170
  do_action ("_ws_plugin__s2member_during_add_settings_link", get_defined_vars ());
171
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
172
  }
186
  /**/
187
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
188
  {
189
+ wp_enqueue_script ("jquery");
190
+ wp_enqueue_script ("thickbox");
191
+ wp_enqueue_script ("media-upload");
192
+ wp_enqueue_script ("jquery-ui-core");
193
+ wp_enqueue_script ("json-functions", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/json-functions.js", array (), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
194
+ wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
195
+ wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload", "json-functions", "jquery-ui-core", "jquery-ui-effects"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
196
  /**/
197
  do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
198
  }
214
  /**/
215
  if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
216
  {
217
+ wp_enqueue_style ("thickbox");
218
  wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("wpurl") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
219
  /**/
220
  do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
237
  /**/
238
  if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
239
  {
240
+ header ("Content-Type: text/javascript; charset=utf-8");
241
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
242
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
243
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
244
+ header ("Pragma: no-cache");
245
  /**/
246
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
247
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
272
  /**/
273
  if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
274
  {
275
+ header ("Content-Type: text/css; charset=utf-8");
276
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
277
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
278
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
279
+ header ("Pragma: no-cache");
280
  /**/
281
  $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
282
  $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
283
  /**/
284
+ ob_start ("ws_plugin__s2member_compress_css"); /* Compress. */
285
  /**/
286
  include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
287
  /**/
317
  $wp_login_replace = "\n\t\t// Modified for full plugin compatiblity.\n\t\t//wp_redirect( apply_filters( 'wp_signup_location', get_bloginfo('wpurl') . '/wp-signup.php' ) );\n\t\t//exit;";
318
  /**/
319
  if (file_exists ($wp_login_file) && is_writable ($wp_login_file) && ($wp_login = file_get_contents ($wp_login_file)) && file_put_contents ($wp_login_file, preg_replace ($wp_login_section, $wp_login_replace, $wp_login)))
320
+ ws_plugin__s2member_display_admin_notice ('Your <code>/wp-login.php</code> file was patched successfully.');
321
  else /* Otherwise, we need to report that /wp-login.php could NOT be updated. Possibly a permissions error. */
322
  ws_plugin__s2member_display_admin_notice ('Your <code>wp-login.php</code> file could NOT be patched. File NOT writable.', true);
323
  /**/
326
  $load_replace = "\n\n\t// Modified for full plugin compatiblity.\n\t//if ( empty( \$active_plugins ) || defined( 'WP_INSTALLING' ) )\n\tif ( empty( \$active_plugins ) || ( defined( 'WP_INSTALLING' ) && !preg_match(\"/\/wp-activate\.php/\", \$_SERVER[\"REQUEST_URI\"]) ) )";
327
  /**/
328
  if (file_exists ($load_file) && is_writable ($load_file) && ($load = file_get_contents ($load_file)) && file_put_contents ($load_file, preg_replace ($load_section, $load_replace, $load)))
329
+ ws_plugin__s2member_display_admin_notice ('Your <code>/wp-includes/load.php</code> file was patched successfully.');
330
  else /* Otherwise, we need to report that /wp-includes/load.php could NOT be updated. Possibly a permissions error. */
331
  ws_plugin__s2member_display_admin_notice ('Your <code>/wp-includes/load.php</code> file could NOT be patched. File NOT writable.', true);
332
  /**/
335
  $user_new_replace = "\n\t\t\t\t// Modified for full plugin compatiblity.\n\t\t\t\t//wpmu_signup_user( \$new_user_login, \$_REQUEST[ 'email' ], array( 'add_to_blog' => \$wpdb->blogid, 'new_role' => \$_REQUEST[ 'role' ] ) );\n\t\t\t\twpmu_signup_user( \$new_user_login, \$_REQUEST[ 'email' ], apply_filters( 'add_signup_meta', array( 'add_to_blog' => \$wpdb->blogid, 'new_role' => \$_REQUEST[ 'role' ] ) ) );";
336
  /**/
337
  if (file_exists ($user_new_file) && is_writable ($user_new_file) && ($user_new = file_get_contents ($user_new_file)) && file_put_contents ($user_new_file, preg_replace ($user_new_section, $user_new_replace, $user_new)))
338
+ ws_plugin__s2member_display_admin_notice ('Your <code>/wp-admin/user-new.php</code> file was patched successfully.');
339
  else /* Otherwise, we need to report that /wp-admin/user-new.php could NOT be updated. Possibly a permissions error. */
340
  ws_plugin__s2member_display_admin_notice ('Your <code>/wp-admin/user-new.php</code> file could NOT be patched. File NOT writable.', true);
341
  }
563
  /**/
564
  if (($nonce = $_POST["ws_plugin__s2member_bridge_bbpress"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-bridge-bbpress"))
565
  {
566
+ $post = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)); /* Trim/stripslashes on all _POST vars. */
567
+ /**/
568
+ if (($plugins_dir = rtrim ($post["ws_plugin__s2member_bridge_bbpress_plugins_dir"], "/")) && is_dir ($plugins_dir))
569
  {
570
+ if (is_writable ($plugins_dir)) /* This directory MUST be writable. Otherwise, we cannot continue. */
571
  {
572
+ if (preg_match ("/^Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
573
  {
574
+ $min = (string)$post["ws_plugin__s2member_bridge_bbpress_min_level"];
575
  /**/
576
  if (($file = file_get_contents (dirname (dirname (__FILE__)) . "/dropins/bridges/_s2member-bbpress-bridge.php")) && ($file = preg_replace ("/%%min%%/i", ws_plugin__s2member_esc_dq ($min), $file)) && file_put_contents ($plugins_dir . "/_s2member-bbpress-bridge.php", $file))
577
+ ws_plugin__s2member_display_admin_notice ("The bbPress® Bridge/plugin has been <strong>installed successfully</strong>.");
578
  /**/
579
  else /* Otherwise, something unexpected. The site owner will need to install the bbPress® plugin manually. */
580
  ws_plugin__s2member_display_admin_notice ("Unknown error. Please try again, or install manually.", true);
581
  }
582
  /**/
583
+ else if (preg_match ("/^Un-Install/i", $post["ws_plugin__s2member_bridge_bbpress_action"]))
584
  {
585
  if (file_exists ($plugins_dir . "/_s2member-bbpress-bridge.php"))
586
  {
588
  ws_plugin__s2member_display_admin_notice ("Unknown error. Please try again, or un-install manually.", true);
589
  /**/
590
  else /* Otherwise, everything looks good. The plugin file has been removed successfully. */
591
+ ws_plugin__s2member_display_admin_notice ("The bbPress® Bridge/plugin has been successfully <strong>un-installed</strong>.");
592
  }
593
  else
594
  ws_plugin__s2member_display_admin_notice ("The bbPress® Bridge/plugin is already un-installed.", true);
includes/functions/meta-boxes.inc.php CHANGED
@@ -21,11 +21,9 @@ if (!function_exists ("ws_plugin__s2member_add_meta_boxes"))
21
  {
22
  function ws_plugin__s2member_add_meta_boxes ()
23
  {
24
- global $wp_post_types; /* Global reference. */
25
- /**/
26
  do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
27
  /**/
28
- foreach ($wp_post_types as $type => $post_type_object) /* Handles Custom Post Types as well. */
29
  if (!in_array ($type, array ("revision", "attachment", "nav_menu_item"))) /* But NOT on these Post Types. */
30
  add_meta_box ("ws-plugin--s2member-security", "s2Member", "ws_plugin__s2member_security_meta_box", $type, "side", "high");
31
  /**/
@@ -180,7 +178,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
180
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
181
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
182
  /**/
183
- ws_plugin__s2member_update_all_options ($new_options, true, false, array ("membership_options_page_warning"), true);
184
  }
185
  }
186
  /**/
@@ -215,7 +213,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
215
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
216
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
217
  /**/
218
- ws_plugin__s2member_update_all_options ($new_options, true, false, array ("membership_options_page_warning"), true);
219
  }
220
  }
221
  /**/
@@ -226,7 +224,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
226
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
227
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
228
  /**/
229
- if (($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
230
  update_post_meta ($page_id, "s2member_ccaps_req", $s2member_ccaps_req);
231
  /**/
232
  else /* Otherwise, the array is empty. Safe to delete. */
@@ -241,7 +239,7 @@ if (!function_exists ("ws_plugin__s2member_save_meta_boxes"))
241
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
242
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
243
  /**/
244
- if (($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
245
  update_post_meta ($post_id, "s2member_ccaps_req", $s2member_ccaps_req);
246
  /**/
247
  else /* Otherwise, the array is empty. Safe to delete. */
21
  {
22
  function ws_plugin__s2member_add_meta_boxes ()
23
  {
 
 
24
  do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
25
  /**/
26
+ foreach (get_post_types () as $type) /* Handles Custom Post Types as well. */
27
  if (!in_array ($type, array ("revision", "attachment", "nav_menu_item"))) /* But NOT on these Post Types. */
28
  add_meta_box ("ws-plugin--s2member-security", "s2Member", "ws_plugin__s2member_security_meta_box", $type, "side", "high");
29
  /**/
178
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
179
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
180
  /**/
181
+ ws_plugin__s2member_update_all_options ($new_options, true, false, array ("page-conflict-warnings"), true);
182
  }
183
  }
184
  /**/
213
  do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
214
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
215
  /**/
216
+ ws_plugin__s2member_update_all_options ($new_options, true, false, array ("page-conflict-warnings"), true);
217
  }
218
  }
219
  /**/
224
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
225
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
226
  /**/
227
+ if (strlen ($ccaps_req) && ($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
228
  update_post_meta ($page_id, "s2member_ccaps_req", $s2member_ccaps_req);
229
  /**/
230
  else /* Otherwise, the array is empty. Safe to delete. */
239
  $ccaps_req = trim (strtolower ($_p["ws_plugin__s2member_security_meta_box_ccaps"]), ",");
240
  $ccaps_req = trim (preg_replace ("/[^a-z_0-9,]/", "", $ccaps_req), ","); /* Now clean up. */
241
  /**/
242
+ if (strlen ($ccaps_req) && ($s2member_ccaps_req = preg_split ("/[\r\n\t\s;,]+/", $ccaps_req)))
243
  update_post_meta ($post_id, "s2member_ccaps_req", $s2member_ccaps_req);
244
  /**/
245
  else /* Otherwise, the array is empty. Safe to delete. */
includes/functions/page-level-access.inc.php CHANGED
@@ -103,7 +103,7 @@ if (!function_exists ("ws_plugin__s2member_check_page_level_access"))
103
  }
104
  }
105
  /**/
106
- if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && ws_plugin__s2member_nocache_constants (true) !== "nill")
107
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
108
  if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
109
  {
@@ -198,7 +198,7 @@ if (!function_exists ("ws_plugin__s2member_check_specific_page_level_access"))
198
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $i), get_defined_vars ());
199
  }
200
  /**/
201
- if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true))) /* Custom Capabilities. */
202
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capabilities. Serialized array. */
203
  if (strlen ($ccap) && (!$check_user || !$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
204
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
103
  }
104
  }
105
  /**/
106
+ if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && ws_plugin__s2member_nocache_constants (true) !== "nill")
107
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
108
  if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
109
  {
198
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_level_req" => $i), get_defined_vars ());
199
  }
200
  /**/
201
+ if (is_array ($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
202
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capabilities. Serialized array. */
203
  if (strlen ($ccap) && (!$check_user || !$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
204
  return apply_filters ("ws_plugin__s2member_check_specific_page_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
includes/functions/passwords.inc.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Pluggable function that handles password generation.
18
+ Taken from: /wp-includes/pluggable.php
19
+ */
20
+ if (!function_exists ("wp_generate_password"))
21
+ {
22
+ if (!function_exists ("ws_plugin__s2member_generate_password"))
23
+ {
24
+ function wp_generate_password ($length = 12, $special_chars = TRUE)
25
+ {
26
+ return ws_plugin__s2member_generate_password ($length, $special_chars);
27
+ }
28
+ /**/
29
+ function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
30
+ {
31
+ $password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
32
+ /**/
33
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
34
+ do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
35
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
36
+ /**/
37
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
38
+ if ($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"])))
39
+ {
40
+ $password = $custom; /* Use custom password. */
41
+ }
42
+ /**/
43
+ return ($GLOBALS["ws_plugin__s2member_generate_password_return"] = $password);
44
+ }
45
+ }
46
+ }
47
+ ?>
includes/functions/paypal-button.inc.php CHANGED
@@ -17,7 +17,7 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
17
  Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
  Attach to: add_shortcode("s2Member-PayPal-Button");
19
 
20
- [s2Member-PayPal-Button level="1" ccaps="" desc="" ps="paypal" cc="USD" ns="1" custom="www.domain.com" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
21
  [s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" ns="1" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
22
  The image="" attribute will be used as a custom image; when provided; and not equal to "default".
23
 
@@ -39,14 +39,9 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
39
  $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
40
  $attr["rr"] = strtoupper ($attr["rr"]); /* Must be provided in upper-case format. Numerical, or BN value. */
41
  $attr["ccaps"] = strtolower ($attr["ccaps"]); /* Custom Capabilities must be typed in lower-case format. */
 
42
  /**/
43
- $attr["rr"] = ($attr["rt"] === "L") ? "BN" : $attr["rr"]; /* Lifetime Subscriptions absolutely require Buy Now functionality in the (rr) attribute. */
44
- /**/
45
- $attr["modify"] = (!$attr["modify"] && $attr["mb"]) ? $attr["mb"] : $attr["modify"]; /* Backward compatibilty for "mb", which was renamed to "modify" in v3.0.5. */
46
- $attr["cancel"] = (!$attr["cancel"] && $attr["cb"]) ? $attr["cb"] : $attr["cancel"]; /* Backward compatibilty for "cb", which was renamed to "cancel" in v3.0.5. */
47
- $attr["ids"] = (!$attr["ids"] && $attr["page"]) ? $attr["page"] : $attr["ids"]; /* Backward compatibilty for "page", which was renamed to "ids" in s2Member v3.0. */
48
- /**/
49
- $attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "ns" => "1", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
50
  /**/
51
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
52
  do_action ("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
@@ -126,6 +121,7 @@ if (!function_exists ("ws_plugin__s2member_sc_paypal_button"))
126
  $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . ws_plugin__s2member_esc_ds (esc_attr (($attr["modify"]) ? "1" : "0")) . '"', $code);
127
  $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
128
  $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["rr"])) . '"', $code);
 
129
  $code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tp"])) . '"', $code);
130
  $code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tt"])) . '"', $code);
131
  $code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
17
  Function that handles the Shortcode for [s2Member-PayPal-Button /].
18
  Attach to: add_shortcode("s2Member-PayPal-Button");
19
 
20
+ [s2Member-PayPal-Button level="1" ccaps="" desc="" ps="paypal" cc="USD" ns="1" custom="www.domain.com" ta="0" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
21
  [s2Member-PayPal-Button page="0" exp="72" desc="Specific Post/Page Access" ps="paypal" cc="USD" ns="1" custom="www.domain.com" ra="0.01" sp="1" image="default" /]
22
  The image="" attribute will be used as a custom image; when provided; and not equal to "default".
23
 
39
  $attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
40
  $attr["rr"] = strtoupper ($attr["rr"]); /* Must be provided in upper-case format. Numerical, or BN value. */
41
  $attr["ccaps"] = strtolower ($attr["ccaps"]); /* Custom Capabilities must be typed in lower-case format. */
42
+ $attr["rr"] = ($attr["rt"] === "L") ? "BN" : $attr["rr"]; /* Lifetime Subscriptions require Buy Now. */
43
  /**/
44
+ $attr = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "ns" => "1", "custom" => $_SERVER["HTTP_HOST"], "ta" => "", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default"), $attr);
 
 
 
 
 
 
45
  /**/
46
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
47
  do_action ("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
121
  $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . ws_plugin__s2member_esc_ds (esc_attr (($attr["modify"]) ? "1" : "0")) . '"', $code);
122
  $code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
123
  $code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["rr"])) . '"', $code);
124
+ $code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ta"])) . '"', $code);
125
  $code = preg_replace ('/ name\="p1" value\="(.*?)"/', ' name="p1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tp"])) . '"', $code);
126
  $code = preg_replace ('/ name\="t1" value\="(.*?)"/', ' name="t1" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["tt"])) . '"', $code);
127
  $code = preg_replace ('/ name\="a3" value\="(.*?)"/', ' name="a3" value="' . ws_plugin__s2member_esc_ds (esc_attr ($attr["ra"])) . '"', $code);
includes/functions/post-level-access.inc.php CHANGED
@@ -108,7 +108,7 @@ if (!function_exists ("ws_plugin__s2member_check_post_level_access"))
108
  }
109
  }
110
  /**/
111
- if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && ws_plugin__s2member_nocache_constants (true) !== "nill")
112
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
113
  if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
114
  {
@@ -206,7 +206,7 @@ if (!function_exists ("ws_plugin__s2member_check_specific_post_level_access"))
206
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $i), get_defined_vars ());
207
  }
208
  /**/
209
- if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true))) /* Custom Capabilities. */
210
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capabilities. Serialized array. */
211
  if (strlen ($ccap) && (!$check_user || !$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
212
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
108
  }
109
  }
110
  /**/
111
+ if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req) && ws_plugin__s2member_nocache_constants (true) !== "nill")
112
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capability requirements. Stored as a serialized array. */
113
  if (strlen ($ccap) && (!$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
114
  {
206
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_level_req" => $i), get_defined_vars ());
207
  }
208
  /**/
209
+ if (is_array ($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty ($ccaps_req))
210
  foreach ($ccaps_req as $ccap) /* The $current_user MUST satisfy ALL Custom Capabilities. Serialized array. */
211
  if (strlen ($ccap) && (!$check_user || !$current_user || !$current_user->has_cap ("access_s2member_ccap_" . $ccap)))
212
  return apply_filters ("ws_plugin__s2member_check_specific_post_level_access", array ("s2member_ccap_req" => $ccap), get_defined_vars ());
includes/functions/profile-modifications.inc.php CHANGED
@@ -74,35 +74,34 @@ if (!function_exists ("ws_plugin__s2member_handle_profile_modifications"))
74
  /**/
75
  wp_update_user ($userdata); /* OK. Now send this array for an update. */
76
  /**/
77
- $_existing_fields = (array)get_user_option ("s2member_custom_fields", $user_id);
78
- /**/
79
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
80
- {
81
- $une = preg_match ("/\^/", $field); /* Uneditable fields should be wrapped inside carets. */
82
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
83
- /**/
84
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
85
- {
86
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
87
- $field_id_class = preg_replace ("/_/", "-", $field_var);
88
- /**/
89
- if ($une || !isset ($_POST["ws_plugin__s2member_profile_" . $field_var]))
90
- $fields[$field_var] = $_existing_fields[$field_var];
91
- /**/
92
- else if ($req && !strlen ($_POST["ws_plugin__s2member_profile_" . $field_var]))
93
- $fields[$field_var] = $_existing_fields[$field_var];
94
- /**/
95
- else /* Otherwise, we can use the new value. */
96
- $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
97
- }
98
- }
 
99
  /**/
100
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
101
  do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
102
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
103
  /**/
104
- update_user_option ($user_id, "s2member_custom_fields", $fields);
105
- /**/
106
  echo '<script type="text/javascript">' . "\n";
107
  echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
108
  echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
74
  /**/
75
  wp_update_user ($userdata); /* OK. Now send this array for an update. */
76
  /**/
77
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
78
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
79
+ {
80
+ $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
81
+ /**/
82
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
83
+ {
84
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
85
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
86
+ /**/
87
+ if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
88
+ $fields[$field_var] = $_existing_fields[$field_var];
89
+ /**/
90
+ else if ($field["required"] === "yes" && empty ($_POST["ws_plugin__s2member_profile_" . $field_var])/**/
91
+ && $_POST["ws_plugin__s2member_profile_" . $field_var] !== "0") /* Allow zeros. */
92
+ $fields[$field_var] = $_existing_fields[$field_var];
93
+ /**/
94
+ else /* Otherwise, we can use the newly updated value. */
95
+ $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
96
+ }
97
+ /**/
98
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
99
+ }
100
  /**/
101
  eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
102
  do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
103
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
104
  /**/
 
 
105
  echo '<script type="text/javascript">' . "\n";
106
  echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
107
  echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
includes/functions/register-access.inc.php CHANGED
@@ -14,734 +14,6 @@ Direct access denial.
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /*
17
- Forces a default Role for new registrations, NOT tied to an incoming payment.
18
- Attach to: add_filter("pre_option_default_role");
19
- */
20
- if (!function_exists ("ws_plugin__s2member_force_default_role"))
21
- {
22
- function ws_plugin__s2member_force_default_role ($default_role = FALSE)
23
- {
24
- do_action ("ws_plugin__s2member_before_force_default_role", get_defined_vars ());
25
- /**/
26
- return apply_filters ("ws_plugin__s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
27
- }
28
- }
29
- /*
30
- Forces a default Role for new Multisite registrations ( on the Main Site ) NOT tied to an incoming payment.
31
- Attach to: add_filter("pre_site_option_default_user_role");
32
- */
33
- if (!function_exists ("ws_plugin__s2member_force_mms_default_role"))
34
- {
35
- function ws_plugin__s2member_force_mms_default_role ($default_role = FALSE)
36
- {
37
- do_action ("ws_plugin__s2member_before_force_mms_default_role", get_defined_vars ());
38
- /**/
39
- return apply_filters ("ws_plugin__s2member_force_mms_default_role", ($default_role = "subscriber"), get_defined_vars ());
40
- }
41
- }
42
- /*
43
- Allows new Users to be created on a Multisite Network.
44
- Attach to: add_filter("pre_site_option_add_new_users");
45
- */
46
- if (!function_exists ("ws_plugin__s2member_mms_allow_new_users"))
47
- {
48
- function ws_plugin__s2member_mms_allow_new_users ($allow = FALSE)
49
- {
50
- do_action ("ws_plugin__s2member_before_mms_allow_new_users", get_defined_vars ());
51
- /**/
52
- return apply_filters ("ws_plugin__s2member_mms_allow_new_users", ($allow = "1"), get_defined_vars ());
53
- }
54
- }
55
- /*
56
- Forces a Multisite Dashboard Blog to be the Main Site.
57
- Attach to: add_filter("pre_site_option_dashboard_blog");
58
- */
59
- if (!function_exists ("ws_plugin__s2member_mms_dashboard_blog"))
60
- {
61
- function ws_plugin__s2member_mms_dashboard_blog ($dashboard_blog = FALSE)
62
- {
63
- global $current_site, $current_blog; /* For Multisite support. */
64
- /**/
65
- do_action ("ws_plugin__s2member_before_mms_dashboard_blog", get_defined_vars ());
66
- /**/
67
- $main_site = ((is_multisite ()) ? $current_site->blog_id : "1"); /* Forces the Main Site. */
68
- /**/
69
- return apply_filters ("ws_plugin__s2member_mms_dashboard_blog", ($dashboard_blog = $main_site), get_defined_vars ());
70
- }
71
- }
72
- /*
73
- Function for allowing access to the Registration Form.
74
- This function has been further optimized to reduce DB queries.
75
- Attach to: add_filter("pre_option_users_can_register");
76
- */
77
- if (!function_exists ("ws_plugin__s2member_check_register_access"))
78
- {
79
- function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
80
- {
81
- global $wpdb; /* Global database object reference */
82
- /**/
83
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
84
- do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
85
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
86
- /**/
87
- $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];
88
- /**/
89
- if (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ())
90
- return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
91
- /**/
92
- else if (!is_admin () && !$users_can_register) /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
93
- if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site () || is_super_admin () || current_user_can ("create_users"))
94
- {
95
- if ((is_multisite () && is_super_admin ()) || current_user_can ("create_users") || (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && !($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
96
- {
97
- return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
98
- }
99
- }
100
- /**/
101
- return apply_filters ("ws_plugin__s2member_check_register_access", $users_can_register, get_defined_vars ());
102
- }
103
- }
104
- /*
105
- Function for allowing access to the main Multisite Registration Form.
106
- This function has been further optimized to reduce DB queries.
107
- Attach to: add_filter("pre_site_option_registration");
108
- */
109
- if (!function_exists ("ws_plugin__s2member_check_mms_register_access"))
110
- {
111
- function ws_plugin__s2member_check_mms_register_access ($users_can_register = FALSE)
112
- {
113
- global $wpdb; /* Global database object reference */
114
- global $current_site, $current_blog; /* For Multisite support. */
115
- /**/
116
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
117
- do_action ("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
118
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
119
- /**/
120
- $by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
121
- /**/
122
- if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || !is_main_site ()) /* NOT a Blog Farm. */
123
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
124
- /**/
125
- else if (!is_admin () && $users_can_register !== "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
126
- {
127
- if (is_super_admin () || current_user_can ("create_users") || (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))) && !($exists = $wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))))
128
- {
129
- if (is_super_admin () || current_user_can ("create_users"))
130
- {
131
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
132
- }
133
- else if ($subscr_id && $custom && $level) /* A paying Customer? Cookies have already been authenticated above. */
134
- {
135
- list ($level) = preg_split ("/\:/", $level, 1); /* Parse out the level now. */
136
- /**/
137
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $level])
138
- {
139
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
140
- }
141
- else /* Otherwise, we MUST allow them to create an account; they paid for it! */
142
- {
143
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
144
- }
145
- }
146
- }
147
- /* --------------------> $users_can_register !== "all", so exclude Level #0. */
148
- else if (is_user_logged_in () && current_user_can ("access_s2member_level1") && is_object ($current_user = wp_get_current_user ()))
149
- {
150
- $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
151
- $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
152
- $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
153
- $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
154
- /**/
155
- if ($current_user_blogs < $blogs_allowed) /* Are they within their limit? */
156
- {
157
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
158
- }
159
- }
160
- }
161
- /**/
162
- else if (!is_admin () && $users_can_register === "all") /* Do NOT run these security checks on option pages; it's confusing to a site owner. */
163
- {
164
- if (is_user_logged_in () && is_object ($current_user = wp_get_current_user ()))
165
- {
166
- $blogs_allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . ws_plugin__s2member_user_access_level ()];
167
- $current_user_blogs = (is_array ($blogs = get_blogs_of_user ($current_user->ID))) ? count ($blogs) - 1 : 0;
168
- $current_user_blogs = ($current_user_blogs >= 0) ? $current_user_blogs : 0;
169
- $blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
170
- /**/
171
- if ($current_user_blogs >= $blogs_allowed) /* Are they at their limit? */
172
- {
173
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
174
- }
175
- }
176
- }
177
- /**/
178
- return apply_filters ("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars ());
179
- }
180
- }
181
- /*
182
- Function that describes the General Option overrides for clarity.
183
- Attach to: add_action("admin_init");
184
- */
185
- if (!function_exists ("ws_plugin__s2member_general_ops_notice"))
186
- {
187
- function ws_plugin__s2member_general_ops_notice ()
188
- {
189
- global $pagenow; /* Need this. */
190
- /**/
191
- do_action ("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
192
- /**/
193
- if (is_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) /* Multisite does NOT provide these options. */
194
- {
195
- $notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>.<br />For further details, see: <code>s2Member -> General Options -> Open Registration</code>.";
196
- /**/
197
- $js = '<script type="text/javascript">';
198
- $js .= "jQuery('input#users_can_register, select#default_role').attr('disabled', 'disabled');";
199
- $js .= '</script>';
200
- /**/
201
- do_action ("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
202
- /**/
203
- ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
204
- }
205
- /**/
206
- do_action ("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
207
- /**/
208
- return;
209
- }
210
- }
211
- /*
212
- Function that describes the Multisite Option overrides for clarity.
213
- Attach to: add_action("admin_init");
214
- */
215
- if (!function_exists ("ws_plugin__s2member_multisite_ops_notice"))
216
- {
217
- function ws_plugin__s2member_multisite_ops_notice ()
218
- {
219
- global $pagenow; /* Need this. */
220
- /**/
221
- do_action ("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
222
- /**/
223
- if (is_admin () && $pagenow === "ms-options.php" && !isset ($_GET["page"]) && is_multisite ()) /* Only with Multisite Networking enabled. */
224
- {
225
- $notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
226
- /**/
227
- $js = '<script type="text/javascript">';
228
- $js .= "jQuery('input#dashboard_blog, select#default_user_role, input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
229
- $js .= '</script>';
230
- /**/
231
- do_action ("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
232
- /**/
233
- ws_plugin__s2member_enqueue_admin_notice ($notice . $js, $pagenow);
234
- }
235
- /**/
236
- do_action ("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
237
- /**/
238
- return;
239
- }
240
- }
241
- /*
242
- Function that adds custom fields to `/wp-admin/user-new.php`.
243
- We have to buffer output because `/user-new.php` has NO Hooks.
244
- Attach to: add_action("admin_init");
245
- */
246
- if (!function_exists ("ws_plugin__s2member_admin_user_new_fields"))
247
- {
248
- function ws_plugin__s2member_admin_user_new_fields ()
249
- {
250
- global $pagenow; /* The current admin page file name. */
251
- /**/
252
- do_action ("ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
253
- /**/
254
- if (is_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
255
- {
256
- ob_start ("_ws_plugin__s2member_admin_user_new_fields"); /* No Hooks, so we buffer. */
257
- /**/
258
- do_action ("ws_plugin__s2member_during_admin_user_new_fields", get_defined_vars ());
259
- }
260
- /**/
261
- do_action ("ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
262
- /**/
263
- return;
264
- }
265
- }
266
- /*
267
- Callback that adds custom fields to `/wp-admin/user-new.php`.
268
- We have to buffer output because `/user-new.php` has NO Hooks.
269
- Attach to: ob_start("_ws_plugin__s2member_admin_user_new_fields");
270
- */
271
- if (!function_exists ("_ws_plugin__s2member_admin_user_new_fields"))
272
- {
273
- function _ws_plugin__s2member_admin_user_new_fields ($buffer = FALSE)
274
- {
275
- global $pagenow; /* The current admin page file name. */
276
- /**/
277
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
278
- do_action ("_ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
279
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
280
- /**/
281
- if (is_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
282
- {
283
- $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
284
- /**/
285
- $unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
286
- /**/
287
- $unfs .= '<h3 style="position:relative;"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/large-icon.png" title="s2Member ( a Membership management system for WordPress® )" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . ((is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
288
- /**/
289
- $unfs .= '<table class="form-table">' . "\n";
290
- /**/
291
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
292
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before", get_defined_vars ());
293
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
294
- /**/
295
- if (is_multisite ()) /* Multisite Networking is currently lacking these fields; we pop them in. */
296
- {
297
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
298
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_first_name", get_defined_vars ());
299
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
300
- /**/
301
- $unfs .= '<tr>' . "\n";
302
- $unfs .= '<th><label>First Name:</label></th>' . "\n";
303
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_first_name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
304
- $unfs .= '</tr>' . "\n";
305
- /**/
306
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
307
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_first_name", get_defined_vars ());
308
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
309
- /**/
310
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
311
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_last_name", get_defined_vars ());
312
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
313
- /**/
314
- $unfs .= '<tr>' . "\n";
315
- $unfs .= '<th><label>Last Name:</label></th>' . "\n";
316
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_last_name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
317
- $unfs .= '</tr>' . "\n";
318
- /**/
319
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
320
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_last_name", get_defined_vars ());
321
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
322
- }
323
- /**/
324
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
325
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_id", get_defined_vars ());
326
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
327
- /**/
328
- $unfs .= '<tr>' . "\n";
329
- $unfs .= '<th><label>Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscr. ID is only valid for paid Members. Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. ID manually.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
330
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_subscr_id" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
331
- $unfs .= '</tr>' . "\n";
332
- /**/
333
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
334
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_id", get_defined_vars ());
335
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
336
- /**/
337
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
338
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_custom", get_defined_vars ());
339
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
340
- /**/
341
- $unfs .= '<tr>' . "\n";
342
- $unfs .= '<th><label>Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
343
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_custom" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_custom"]) . '" class="regular-text" /></td>' . "\n";
344
- $unfs .= '</tr>' . "\n";
345
- /**/
346
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
347
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_custom", get_defined_vars ());
348
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
349
- /**/
350
- if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ())
351
- /* ^ Will change once Custom Capabilities are compatible with a Blog Farm. */
352
- {
353
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
354
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_ccaps", get_defined_vars ());
355
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
- /**/
357
- $unfs .= '<tr>' . "\n";
358
- $unfs .= '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.' . ((is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
359
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_ccaps" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_ccaps"]) . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());" /></td>' . "\n";
360
- $unfs .= '</tr>' . "\n";
361
- /**/
362
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
363
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_ccaps", get_defined_vars ());
364
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
365
- }
366
- /**/
367
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
368
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_auto_eot_time", get_defined_vars ());
369
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
370
- /**/
371
- $unfs .= '<tr>' . "\n";
372
- $unfs .= '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
373
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_auto_eot_time" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_auto_eot_time"]) . '" class="regular-text" /></td>' . "\n";
374
- $unfs .= '</tr>' . "\n";
375
- /**/
376
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
377
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_auto_eot_time", get_defined_vars ());
378
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
379
- /**/
380
- if (ws_plugin__s2member_list_servers_integrated ()) /* Only if integrated with s2Member. */
381
- {
382
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
383
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_opt_in", get_defined_vars ());
384
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
385
- /**/
386
- $unfs .= '<tr>' . "\n";
387
- $unfs .= '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
388
- $unfs .= '<td><label><input type="checkbox" name="ws_plugin__s2member_user_new_opt_in" value="1"' . (($_POST["ws_plugin__s2member_user_new_opt_in"]) ? ' checked="checked"' : '') . ' /> Yes, send a mailing list confirmation email to this new User.</label></td>' . "\n";
389
- $unfs .= '</tr>' . "\n";
390
- /**/
391
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
392
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_opt_in", get_defined_vars ());
393
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
394
- }
395
- /**/
396
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
397
- {
398
- $unfs .= '<tr>' . "\n";
399
- $unfs .= '<td colspan="2">' . "\n";
400
- $unfs .= '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
401
- $unfs .= '</td>' . "\n";
402
- $unfs .= '</tr>' . "\n";
403
- /**/
404
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
405
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_custom_fields", get_defined_vars ());
406
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
407
- /**/
408
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
409
- {
410
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
411
- {
412
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
413
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_before", get_defined_vars ());
414
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
415
- /**/
416
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
417
- $field_id_class = preg_replace ("/_/", "-", $field_var);
418
- /**/
419
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
420
- if (apply_filters ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_display", true, get_defined_vars ()))
421
- {
422
- $unfs .= '<tr>' . "\n";
423
- $unfs .= '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
424
- $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_' . $field_var . '" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_" . $field_var]) . '" class="regular-text" /></td>' . "\n";
425
- $unfs .= '</tr>' . "\n";
426
- }
427
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
428
- /**/
429
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
430
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_after", get_defined_vars ());
431
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
432
- }
433
- }
434
- /**/
435
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
436
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_custom_fields", get_defined_vars ());
437
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
438
- /**/
439
- $unfs .= '<tr>' . "\n";
440
- $unfs .= '<td colspan="2">' . "\n";
441
- $unfs .= '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
442
- $unfs .= '</td>' . "\n";
443
- $unfs .= '</tr>' . "\n";
444
- }
445
- /**/
446
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
447
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_notes", get_defined_vars ());
448
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
449
- /**/
450
- $unfs .= '<tr>' . "\n";
451
- $unfs .= '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
452
- $unfs .= '<td><textarea name="ws_plugin__s2member_user_new_s2member_notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_notes"]) . '</textarea></td>' . "\n";
453
- $unfs .= '</tr>' . "\n";
454
- /**/
455
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
456
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_notes", get_defined_vars ());
457
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
458
- /**/
459
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
460
- do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after", get_defined_vars ());
461
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
462
- /**/
463
- $unfs .= '</table>' . "\n";
464
- /**/
465
- $unfs .= '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
466
- /**/
467
- $buffer = preg_replace ("/(\<\/table\>)([\r\n\t\s ]*)(\<p class\=\"submit\"\>)/", "$1$2" . $unfs . "$3", $buffer);
468
- }
469
- /**/
470
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
471
- do_action ("_ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
472
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
473
- /**/
474
- return apply_filters ("_ws_plugin__s2member_admin_user_new_fields", $buffer, get_defined_vars ());
475
- }
476
- }
477
- /*
478
- This adds custom fields to `wp-signup.php`.
479
- Attach to: add_action("signup_extra_fields");
480
- ~ For Multisite Blog Farms.
481
- */
482
- if (!function_exists ("ws_plugin__s2member_ms_custom_registration_fields"))
483
- {
484
- function ws_plugin__s2member_ms_custom_registration_fields ()
485
- {
486
- do_action ("ws_plugin__s2member_before_ms_custom_registration_fields", get_defined_vars ());
487
- /**/
488
- if (is_multisite () && is_main_site ()) /* Must be Multisite / Main Site. */
489
- {
490
- $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
491
- /**/
492
- echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
493
- /**/
494
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
495
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars ());
496
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
497
- /**/
498
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
499
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars ());
500
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
501
- /**/
502
- echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">First Name *</label>' . "\n";
503
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" />' . "\n";
504
- echo '<br />' . "\n";
505
- /**/
506
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
507
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars ());
508
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
509
- /**/
510
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
511
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars ());
512
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
513
- /**/
514
- echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">Last Name *</label>' . "\n";
515
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" />' . "\n";
516
- echo '<br />' . "\n";
517
- /**/
518
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
519
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars ());
520
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
521
- /**/
522
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
523
- {
524
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
525
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
526
- /**/
527
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
528
- {
529
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
530
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars ());
531
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
532
- /**/
533
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
534
- $field_id_class = preg_replace ("/_/", "-", $field_var);
535
- /**/
536
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
537
- if (apply_filters ("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
538
- {
539
- echo '<label for="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '">' . esc_html ($field) . (($req) ? " *" : "") . '</label>' . "\n";
540
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" />' . "\n";
541
- echo '<br />' . "\n";
542
- }
543
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
544
- /**/
545
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
546
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars ());
547
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
548
- }
549
- }
550
- /**/
551
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
552
- {
553
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
554
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars ());
555
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
556
- /**/
557
- echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">' . "\n";
558
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" value="1"' . (((empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
559
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
560
- echo '</label>' . "\n";
561
- echo '<br />' . "\n";
562
- /**/
563
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
564
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars ());
565
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
566
- }
567
- /**/
568
- echo '<br />' . "\n"; /* Toss in one extra line break ( extra margin ). */
569
- /**/
570
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
571
- do_action ("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars ());
572
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
573
- }
574
- /**/
575
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
576
- do_action ("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars ());
577
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
578
- /**/
579
- return;
580
- }
581
- }
582
- /*
583
- This adds custom fields to `wp-login.php?action=register`.
584
- Attach to: add_action("register_form");
585
- */
586
- if (!function_exists ("ws_plugin__s2member_custom_registration_fields"))
587
- {
588
- function ws_plugin__s2member_custom_registration_fields ()
589
- {
590
- do_action ("ws_plugin__s2member_before_custom_registration_fields", get_defined_vars ());
591
- /**/
592
- $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
593
- /**/
594
- echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
595
- /**/
596
- $tabindex = 20; /* Incremented tabindex starting with 20. */
597
- /**/
598
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
599
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars ());
600
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
601
- /**/
602
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && function_exists ("ws_plugin__s2member_generate_password"))
603
- {
604
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
605
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars ());
606
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
607
- /**/
608
- echo '<p>' . "\n";
609
- echo '<label>' . "\n";
610
- echo 'Password *' . "\n";
611
- echo '<input aria-required="true" type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_custom_reg_field_user_pass" id="ws-plugin--s2member-custom-reg-field-user-pass" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
612
- echo '</label>' . "\n";
613
- echo '</p>';
614
- /**/
615
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
616
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars ());
617
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
618
- }
619
- /**/
620
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
621
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars ());
622
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
623
- /**/
624
- echo '<p>' . "\n";
625
- echo '<label>' . "\n";
626
- echo 'First Name *' . "\n";
627
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_first_name" id="ws-plugin--s2member-custom-reg-field-first-name" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_first_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
628
- echo '</label>' . "\n";
629
- echo '</p>';
630
- /**/
631
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
632
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars ());
633
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
634
- /**/
635
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
636
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars ());
637
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
638
- /**/
639
- echo '<p>' . "\n";
640
- echo '<label>' . "\n";
641
- echo 'Last Name *' . "\n";
642
- echo '<input aria-required="true" type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_last_name" id="ws-plugin--s2member-custom-reg-field-last-name" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_last_name"]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
643
- echo '</label>' . "\n";
644
- echo '</p>';
645
- /**/
646
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
647
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars ());
648
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
649
- /**/
650
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
651
- {
652
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
653
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
654
- /**/
655
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
656
- {
657
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
658
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars ());
659
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
660
- /**/
661
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
662
- $field_id_class = preg_replace ("/_/", "-", $field_var);
663
- /**/
664
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
665
- if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_during_custom_fields_display", true, get_defined_vars ()))
666
- {
667
- echo '<p>' . "\n";
668
- echo '<label>' . "\n";
669
- echo esc_html ($field) . (($req) ? " *" : "") . "\n";
670
- echo '<input' . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_custom_reg_field_' . $field_var . '" id="ws-plugin--s2member-custom-reg-field-' . $field_id_class . '" class="ws-plugin--s2member-custom-reg-field input" size="25" value="' . format_to_edit ($_POST["ws_plugin__s2member_custom_reg_field_" . $field_var]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
671
- echo '</label>' . "\n";
672
- echo '</p>';
673
- }
674
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
675
- /**/
676
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
677
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars ());
678
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
679
- }
680
- }
681
- /**/
682
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
683
- {
684
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
685
- do_action ("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars ());
686
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
687
- /**/
688
- echo '<p>' . "\n";
689
- echo '<label>' . "\n";
690
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" value="1"' . (((empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
691
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
692
- echo '</label>' . "\n";
693
- echo '</p>';
694
- /**/
695
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
696
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars ());
697
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
698
- }
699
- /**/
700
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
701
- do_action ("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars ());
702
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
703
- /**/
704
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
705
- do_action ("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars ());
706
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
707
- /**/
708
- return;
709
- }
710
- }
711
- /*
712
- This adds an opt-in checkbox to the BuddyPress signup form.
713
- Attach to: add_action("bp_before_registration_submit_buttons");
714
- */
715
- if (!function_exists ("ws_plugin__s2member_opt_in_4bp"))
716
- {
717
- function ws_plugin__s2member_opt_in_4bp ()
718
- {
719
- do_action ("ws_plugin__s2member_before_opt_in_4bp", get_defined_vars ());
720
- /**/
721
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
722
- {
723
- do_action ("ws_plugin__s2member_during_opt_in_4bp_before", get_defined_vars ());
724
- /**/
725
- echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("ws_plugin__s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
726
- /**/
727
- echo '<p>' . "\n";
728
- echo '<label>' . "\n";
729
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-opt-in" value="1"' . (((empty ($_POST) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
730
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
731
- echo '</label>' . "\n";
732
- echo '</p>';
733
- /**/
734
- echo '</div>' . "\n";
735
- /**/
736
- do_action ("ws_plugin__s2member_during_opt_in_4bp_after", get_defined_vars ());
737
- }
738
- /**/
739
- do_action ("ws_plugin__s2member_after_opt_in_4bp", get_defined_vars ());
740
- /**/
741
- return;
742
- }
743
- }
744
- /*
745
  Generates registration links.
746
  */
747
  if (!function_exists ("ws_plugin__s2member_register_link_gen"))
@@ -814,663 +86,4 @@ if (!function_exists ("ws_plugin__s2member_register"))
814
  do_action ("ws_plugin__s2member_after_register", get_defined_vars ());
815
  }
816
  }
817
- /*
818
- Function that adds hidden fields to POST vars on signup.
819
- Attach to: add_filter("signup_hidden_fields");
820
-
821
- This can ONLY be fired through wp-signup.php on the front-side.
822
- */
823
- if (!function_exists ("ws_plugin__s2member_ms_process_signup_hidden_fields"))
824
- {
825
- function ws_plugin__s2member_ms_process_signup_hidden_fields ()
826
- {
827
- do_action ("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
828
- /**/
829
- if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking, on a Blog Farm. */
830
- if (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && $_POST["stage"] === "validate-user-signup")
831
- {
832
- foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
833
- if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
834
- if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
835
- echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr ($value) . '" />' . "\n";
836
- /**/
837
- do_action ("ws_plugin__s2member_during_ms_process_signup_hidden_fields", get_defined_vars ());
838
- }
839
- /**/
840
- do_action ("ws_plugin__s2member_after_ms_process_signup_hidden_fields", get_defined_vars ());
841
- }
842
- }
843
- /*
844
- Function that adds customs fields to $meta on signup.
845
- Attach to: add_filter("add_signup_meta");
846
-
847
- This can be fired through wp-signup.php on the front-side,
848
- or possibly through user-new.php in the admin.
849
- */
850
- if (!function_exists ("ws_plugin__s2member_ms_process_signup_meta"))
851
- {
852
- function ws_plugin__s2member_ms_process_signup_meta ($meta = FALSE)
853
- {
854
- global $pagenow; /* Need this to detect the current admin page. */
855
- /**/
856
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
857
- do_action ("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
858
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
859
- /**/
860
- if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. Either in the admin, or on a Blog Farm through wp-signup.php. */
861
- if ((is_admin () && $pagenow === "user-new.php") || (ws_plugin__s2member_is_multisite_farm () && is_main_site () && preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && preg_match ("/^validate-(user|blog)-signup$/", $_POST["stage"])))
862
- {
863
- ws_plugin__s2member_email_config (); /* Configures From: header that will be used in notifications. */
864
- /**/
865
- foreach ((array)ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST)) as $key => $value)
866
- if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
867
- if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
868
- $meta["s2member_ms_signup_meta"][$key] = $value;
869
- }
870
- /**/
871
- return apply_filters ("ws_plugin__s2member_ms_process_signup_meta", $meta, get_defined_vars ());
872
- }
873
- }
874
- /*
875
- Function for configuring new users.
876
- Attach to: add_action("wpmu_activate_user");
877
-
878
- This does NOT fire for a Super Admin managing Network Users.
879
- Which is good. A Super Admin will NOT trigger this event.
880
- ~ They fire wpmu_create_user(), bypassing activation.
881
- - through ms-edit.php.
882
-
883
- However, a Super Admin CAN trigger this event by adding a new User through the Users -> Add New menu.
884
- ~ If they choose to bypass activation; an activation IS fired immediately. Otherwise, it's delayed.
885
- - via user-new.php.
886
-
887
- So this function may get fired inside the admin panel ( user-new.php ).
888
- Or also during an actual activation; through wp-activate.php.
889
- */
890
- if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_user_activation"))
891
- {
892
- function ws_plugin__s2member_configure_user_on_ms_user_activation ($user_id = FALSE, $password = FALSE, $meta = FALSE)
893
- {
894
- global $pagenow; /* Need this to detect the current admin page. */
895
- /**/
896
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
897
- do_action ("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
898
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
899
- /**/
900
- if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
901
- if ((is_admin () && $pagenow === "user-new.php") || (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])))
902
- {
903
- ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
904
- delete_user_meta ($user_id, "s2member_ms_signup_meta");
905
- }
906
- /**/
907
- do_action ("ws_plugin__s2member_after_configure_user_on_ms_user_activation", get_defined_vars ());
908
- /**/
909
- return;
910
- }
911
- }
912
- /*
913
- Function for configuring new users.
914
- Attach to: add_action("wpmu_activate_blog");
915
-
916
- This does NOT fire for a Super Admin managing Network Blogs.
917
- ~ Actually they do; BUT it's blocked by the routine below.
918
- Which is good. A Super Admin should NOT trigger this event.
919
-
920
- This function should ONLY be fired through wp-activate.php.
921
- */
922
- if (!function_exists ("ws_plugin__s2member_configure_user_on_ms_blog_activation"))
923
- {
924
- function ws_plugin__s2member_configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
925
- {
926
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
927
- do_action ("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
928
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
929
- /**/
930
- if (is_multisite ()) /* This event should ONLY be processed with Multisite Networking. */
931
- if (!is_admin () && preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) /* ONLY `wp-activate.php`. */
932
- {
933
- ws_plugin__s2member_configure_user_registration ($user_id, $password, $meta["s2member_ms_signup_meta"]);
934
- delete_user_meta ($user_id, "s2member_ms_signup_meta");
935
- }
936
- /**/
937
- do_action ("ws_plugin__s2member_after_configure_user_on_ms_blog_activation", get_defined_vars ());
938
- /**/
939
- return;
940
- }
941
- }
942
- /*
943
- Function for configuring new users.
944
- Attach to: add_action("user_register");
945
-
946
- This also receives Multisite events.
947
- Attach to: add_action("wpmu_activate_user");
948
- Attach to: add_action("wpmu_activate_blog");
949
-
950
- The Hook `user_register` is also fired by calling:
951
- wpmu_create_user()
952
-
953
- This function also receives simulated events from s2Member Pro.
954
- */
955
- if (!function_exists ("ws_plugin__s2member_configure_user_registration"))
956
- {
957
- function ws_plugin__s2member_configure_user_registration ($user_id = FALSE, $password = FALSE, $meta = FALSE)
958
- {
959
- global $wpdb; /* Global database object may be required for this routine. */
960
- global $pagenow; /* Need this to detect the current admin page. */
961
- global $current_site, $current_blog; /* Multisite Networking. */
962
- static $email_config, $processed; /* No duplicate processing. */
963
- /**/
964
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
965
- do_action ("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
966
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
967
- /**/
968
- /* With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_user|blog`. */
969
- if (!$email_config && ($email_config = true)) /* Anytime this routine is fired; we config email; no exceptions. */
970
- ws_plugin__s2member_email_config (); /* Configures From: header that will be used in new user notifications. */
971
- /**/
972
- if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins ( or even WordPress® itself ). */
973
- && (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) || is_array (ws_plugin__s2member_trim_deep (stripslashes_deep ($meta))))/**/
974
- /**/
975
- /* These negative matches are designed to prevent this routine from running under certain conditions; where we need to wait for `wpmu_activate_user|blog` instead. */
976
- && !(is_admin () && is_multisite () && $pagenow === "user-new.php" && isset ($_POST["noconfirmation"]) && is_super_admin () && empty ($meta))/**/
977
- && !(preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && empty ($meta)) /* If activating; we MUST have a meta array. */
978
- /* The $meta array is ONLY filled by hand-offs from `wpmu_activate_user|blog`. So this is how we check for these events. */
979
- /**/
980
- && $user_id && is_object ($user = new WP_User ($user_id)) && $user->ID && ($processed = true)) /* Process only once. */
981
- {
982
- foreach ((array)$_POST as $key => $value) /* Scan $_POST vars; adding `custom_reg_field` uniformity keys. */
983
- if (preg_match ("/^ws_plugin__s2member_user_new_/", $key)) /* Looking for `user_new` keys here. */
984
- if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
985
- $_POST[$key] = $value; /* Add these keys for uniformity. */
986
- unset ($key, $value); /* Prevents bleeding vars into Hooks/Filters. */
987
- /**/
988
- if (!is_admin () && ($_POST["ws_plugin__s2member_custom_reg_field_s2member_custom"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_ccaps"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"] || $_POST["ws_plugin__s2member_custom_reg_field_s2member_notes"]))
989
- exit ("s2Member security violation. You attempted to POST variables that will NOT be trusted!");
990
- /**/
991
- $_pm = array_merge ((array)$_POST, (array)$meta); /* Merge these two data sources together now. However, ALWAYS after the security routine above ^. */
992
- /**/
993
- if (!is_admin () /* Only run this particular routine whenever a Member [1-4] is registering themselves with cookies. */
994
- && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"]))) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"])))/**/
995
- && (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1")))
996
- /* ^ This is for security ^ It checks the database to make sure the User/Member has not already registered in the past, with the same Paid Subscr. ID. */
997
- { /*
998
- This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
999
- If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
1000
- This may also be processed through BuddyPress, or another plugin calling `user_register`.
1001
- */
1002
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
1003
- /**/
1004
- list ($level, $ccaps, $eotper) = preg_split ("/\:/", $level, 3);
1005
- $role = "s2member_level" . $level; /* Level 1-4. */
1006
- /**/
1007
- $email = $user->user_email;
1008
- $login = $user->user_login;
1009
- $ip = $_SERVER["REMOTE_ADDR"];
1010
- $cv = preg_split ("/\|/", $custom);
1011
- /**/
1012
- if ($eotper) /* If a specific EOT Period has been attached; we need to calculate that now. */
1013
- $auto_eot_time = ws_plugin__s2member_paypal_auto_eot_time (0, 0, 0, $eotper);
1014
- /**/
1015
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
1016
- /**/
1017
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
1018
- $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
1019
- /**/
1020
- if (!($fname = $user->first_name))
1021
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
1022
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
1023
- /**/
1024
- if (!$fname) /* Also try BuddyPress. */
1025
- if ($_pm["field_1"]) /* BuddyPress. */
1026
- $fname = trim (preg_replace ("/ (.*)$/", "", $_pm["field_1"]));
1027
- /**/
1028
- if (!($lname = $user->last_name))
1029
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
1030
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
1031
- /**/
1032
- if (!$lname) /* Also try BuddyPress. */
1033
- if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pm["field_1"]))
1034
- $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pm["field_1"]));
1035
- /**/
1036
- $name = trim ($fname . " " . $lname); /* Both names. */
1037
- /**/
1038
- if (!($pass = $password)) /* Try s2Member's generator. */
1039
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
1040
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
1041
- /**/
1042
- if (!$pass) /* Also try BuddyPress password. */
1043
- if ($_pm["signup_password"]) /* BuddyPress. */
1044
- $pass = $_pm["signup_password"];
1045
- /**/
1046
- if ($pass) /* No password nag. Update this globally. */
1047
- {
1048
- delete_user_setting ("default_password_nag"); /* setcookie() */
1049
- update_user_option ($user_id, "default_password_nag", false, true);
1050
- }
1051
- /**/
1052
- update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
1053
- update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
1054
- update_user_option ($user_id, "s2member_custom", $custom);
1055
- update_user_option ($user_id, "s2member_notes", $notes);
1056
- /**/
1057
- if (!$user->first_name && $fname)
1058
- update_user_meta ($user_id, "first_name", $fname) ./**/
1059
- wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
1060
- /**/
1061
- if (!$user->last_name && $lname)
1062
- update_user_meta ($user_id, "last_name", $lname);
1063
- /**/
1064
- if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
1065
- {
1066
- (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
1067
- update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
1068
- }
1069
- /**/
1070
- $user->set_role ($role); /* s2Member. */
1071
- /**/
1072
- if ($ccaps) /* Add Custom Capabilities. */
1073
- foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
1074
- if (strlen ($ccap)) /* Don't add empty capabilities. */
1075
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
1076
- /**/
1077
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
1078
- {
1079
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
1080
- {
1081
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
1082
- $field_id_class = preg_replace ("/_/", "-", $field_var);
1083
- /**/
1084
- if (strlen ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
1085
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
1086
- }
1087
- }
1088
- /**/
1089
- update_user_option ($user_id, "s2member_custom_fields", $fields);
1090
- /**/
1091
- if (($transient = md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array ($subscr_payment = get_transient ($transient)))
1092
- {
1093
- $proxy = array ("s2member_paypal_notify" => "1", "s2member_paypal_proxy" => "s2member_transient_ipn_subscr_payment");
1094
- ws_plugin__s2member_remote (add_query_arg ($proxy, get_bloginfo ("wpurl")), stripslashes_deep ($subscr_payment), array ("timeout" => 20));
1095
- delete_transient ($transient);
1096
- }
1097
- /**/
1098
- setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
1099
- /**/
1100
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1101
- do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
1102
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1103
- }
1104
- /**/
1105
- else if (!is_admin ()) /* Otherwise, if we are NOT inside the Dashboard during the creation of this account. */
1106
- { /*
1107
- This routine could be processed through `wp-login.php?action=register` - OR - through `wp-activate.php`.
1108
- If processed through `wp-activate.php`, it could've originated inside the admin, via `user-new.php`.
1109
- This may also be processed through BuddyPress, or another plugin calling `user_register`.
1110
- */
1111
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
1112
- /**/
1113
- $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
1114
- $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
1115
- $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
1116
- /**/
1117
- $level = (preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
1118
- $level = (!$level && preg_match ("/^s2member_level[1-4]$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
1119
- $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
1120
- $level = (!$level) ? "0" : $level;
1121
- /**/
1122
- $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
1123
- /**/
1124
- $email = $user->user_email;
1125
- $login = $user->user_login;
1126
- $ip = $_SERVER["REMOTE_ADDR"];
1127
- $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
1128
- $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
1129
- $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
1130
- /**/
1131
- $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
1132
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
1133
- /**/
1134
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
1135
- $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
1136
- /**/
1137
- if (!($fname = $user->first_name))
1138
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
1139
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
1140
- /**/
1141
- if (!$fname) /* Also try BuddyPress. */
1142
- if ($_pm["field_1"]) /* BuddyPress. */
1143
- $fname = trim (preg_replace ("/ (.*)$/", "", $_pm["field_1"]));
1144
- /**/
1145
- if (!($lname = $user->last_name))
1146
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
1147
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
1148
- /**/
1149
- if (!$lname) /* Also try BuddyPress. */
1150
- if ($_pm["field_1"] && preg_match ("/^(.+?) (.+)$/", $_pm["field_1"]))
1151
- $lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", $_pm["field_1"]));
1152
- /**/
1153
- $name = trim ($fname . " " . $lname); /* Both names. */
1154
- /**/
1155
- if (!($pass = $password)) /* Try s2Member's generator. */
1156
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
1157
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
1158
- /**/
1159
- if (!$pass) /* Also try BuddyPress password. */
1160
- if ($_pm["signup_password"]) /* BuddyPress. */
1161
- $pass = $_pm["signup_password"];
1162
- /**/
1163
- if ($pass) /* No password nag. Update this globally. */
1164
- {
1165
- delete_user_setting ("default_password_nag"); /* setcookie() */
1166
- update_user_option ($user_id, "default_password_nag", false, true);
1167
- }
1168
- /**/
1169
- update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
1170
- update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
1171
- update_user_option ($user_id, "s2member_custom", $custom);
1172
- update_user_option ($user_id, "s2member_notes", $notes);
1173
- /**/
1174
- if (!$user->first_name && $fname)
1175
- update_user_meta ($user_id, "first_name", $fname) ./**/
1176
- wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
1177
- /**/
1178
- if (!$user->last_name && $lname)
1179
- update_user_meta ($user_id, "last_name", $lname);
1180
- /**/
1181
- if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
1182
- {
1183
- (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
1184
- update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
1185
- }
1186
- /**/
1187
- $user->set_role ($role); /* s2Member. */
1188
- /**/
1189
- if ($ccaps) /* Add Custom Capabilities. */
1190
- foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
1191
- if (strlen ($ccap)) /* Don't add empty capabilities. */
1192
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
1193
- /**/
1194
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
1195
- {
1196
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
1197
- {
1198
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
1199
- $field_id_class = preg_replace ("/_/", "-", $field_var);
1200
- /**/
1201
- if (strlen ($_pm["ws_plugin__s2member_custom_reg_field_" . $field_var]))
1202
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
1203
- }
1204
- }
1205
- /**/
1206
- update_user_option ($user_id, "s2member_custom_fields", $fields);
1207
- /**/
1208
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1209
- do_action ("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
1210
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1211
- }
1212
- /**/
1213
- else if (is_admin () && $pagenow === "user-new.php") /* Else, if we're on this page. */
1214
- { /*
1215
- This routine can ONLY be processed through `user-new.php` inside the Dashboard.
1216
- */
1217
- $processed = "yes"; /* Mark this as yes, to indicate that a routine was processed. */
1218
- /**/
1219
- $role = $role = $user->roles[0]; /* If they already have a Role, we can use it. */
1220
- $role = (!$role && is_multisite () && is_main_site ()) ? get_site_option ("default_user_role") : $role;
1221
- $role = (!$role) ? get_option ("default_role") : $role; /* Otherwise, the default role. */
1222
- /**/
1223
- $level = (preg_match ("/^(administrator|editor|author|contributor)$/i", $role)) ? "4" : $level;
1224
- $level = (!$level && preg_match ("/^s2member_level[1-4]$/i", $role)) ? preg_replace ("/^s2member_level/", "", $role) : $level;
1225
- $level = (!$level && preg_match ("/^subscriber$/i", $role)) ? "0" : $level;
1226
- $level = (!$level) ? "0" : $level;
1227
- /**/
1228
- $ccaps = $_pm["ws_plugin__s2member_custom_reg_field_s2member_ccaps"];
1229
- /**/
1230
- $email = $user->user_email;
1231
- $login = $user->user_login;
1232
- $ip = ""; /* N/Applicable. */
1233
- $custom = $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"];
1234
- $subscr_id = $_pm["ws_plugin__s2member_custom_reg_field_s2member_subscr_id"];
1235
- $cv = preg_split ("/\|/", $_pm["ws_plugin__s2member_custom_reg_field_s2member_custom"]);
1236
- /**/
1237
- $auto_eot_time = ($eot = $_pm["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
1238
- $notes = $_pm["ws_plugin__s2member_custom_reg_field_s2member_notes"];
1239
- /**/
1240
- $opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
1241
- $opt_in = (!$opt_in && $_pm["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : $opt_in;
1242
- /**/
1243
- if (!($fname = $user->first_name)) /* `Users -> Add New`. */
1244
- if ($_pm["ws_plugin__s2member_custom_reg_field_first_name"])
1245
- $fname = $_pm["ws_plugin__s2member_custom_reg_field_first_name"];
1246
- /**/
1247
- if (!($lname = $user->last_name)) /* `Users -> Add New`. */
1248
- if ($_pm["ws_plugin__s2member_custom_reg_field_last_name"])
1249
- $lname = $_pm["ws_plugin__s2member_custom_reg_field_last_name"];
1250
- /**/
1251
- $name = trim ($fname . " " . $lname); /* Both names. */
1252
- /**/
1253
- if (!($pass = $password)) /* Try s2Member's generator. */
1254
- if ($GLOBALS["ws_plugin__s2member_generate_password_return"])
1255
- $pass = $GLOBALS["ws_plugin__s2member_generate_password_return"];
1256
- /**/
1257
- if (!$pass) /* Also try the `Users -> Add New` form. */
1258
- if ($_pm["pass1"]) /* Field in user-new.php. */
1259
- $pass = $_pm["pass1"];
1260
- /**/
1261
- if ($pass) /* No password nag. Update this globally. */
1262
- {
1263
- delete_user_setting ("default_password_nag"); /* setcookie() */
1264
- update_user_option ($user_id, "default_password_nag", false, true);
1265
- }
1266
- /**/
1267
- update_user_option ($user_id, "s2member_auto_eot_time", $auto_eot_time);
1268
- update_user_option ($user_id, "s2member_subscr_id", $subscr_id);
1269
- update_user_option ($user_id, "s2member_custom", $custom);
1270
- update_user_option ($user_id, "s2member_notes", $notes);
1271
- /**/
1272
- if (!$user->first_name && $fname)
1273
- update_user_meta ($user_id, "first_name", $fname) ./**/
1274
- wp_update_user (array ("ID" => $user_id, "display_name" => $fname));
1275
- /**/
1276
- if (!$user->last_name && $lname)
1277
- update_user_meta ($user_id, "last_name", $lname);
1278
- /**/
1279
- if (is_multisite ()) /* Originating Blog ID#, and adjust Main Site permissions. */
1280
- {
1281
- (!is_main_site ()) ? remove_user_from_blog ($user_id, $current_site->blog_id) : null;
1282
- update_user_meta ($user_id, "s2member_originating_blog", $current_blog->blog_id);
1283
- }
1284
- /**/
1285
- $user->set_role ($role); /* s2Member. */
1286
- /**/
1287
- foreach (preg_split ("/[\r\n\t\s;,]+/", $ccaps) as $ccap)
1288
- if (strlen ($ccap)) /* Don't add empty capabilities. */
1289
- $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
1290
- /**/
1291
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
1292
- {
1293
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
1294
- {
1295
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
1296
- $field_id_class = preg_replace ("/_/", "-", $field_var);
1297
- /**/
1298
- $fields[$field_var] = $_pm["ws_plugin__s2member_custom_reg_field_" . $field_var];
1299
- }
1300
- }
1301
- /**/
1302
- update_user_option ($user_id, "s2member_custom_fields", $fields);
1303
- /**/
1304
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1305
- do_action ("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
1306
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1307
- }
1308
- /**/
1309
- if ($processed === "yes") /* If registration was processed by one of the routines above. */
1310
- {
1311
- ws_plugin__s2member_process_list_servers ($level, $email, $fname, $lname, $ip, $opt_in);
1312
- /**/
1313
- if ($urls = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_urls"])
1314
- /**/
1315
- foreach (preg_split ("/[\r\n\t]+/", $urls) as $url) /* Notify each of the urls. */
1316
- /**/
1317
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1318
- if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1319
- if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
1320
- if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
1321
- if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
1322
- if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
1323
- if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
1324
- if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1325
- if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1326
- if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
1327
- /**/
1328
- if (($url = trim ($url))) /* Empty? */
1329
- ws_plugin__s2member_remote ($url);
1330
- /**/
1331
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])
1332
- {
1333
- $msg = $sbj = "( s2Member / API Notification Email ) - Registration";
1334
- $msg .= "\n\n"; /* Spacing in the message body. */
1335
- $msg .= "role: %%role%%\n";
1336
- $msg .= "level: %%level%%\n";
1337
- $msg .= "user_first_name: %%user_first_name%%\n";
1338
- $msg .= "user_last_name: %%user_last_name%%\n";
1339
- $msg .= "user_full_name: %%user_full_name%%\n";
1340
- $msg .= "user_email: %%user_email%%\n";
1341
- $msg .= "user_login: %%user_login%%\n";
1342
- $msg .= "user_pass: %%user_pass%%\n";
1343
- $msg .= "user_id: %%user_id%%\n";
1344
- $msg .= "cv0: %%cv0%%\n";
1345
- $msg .= "cv1: %%cv1%%\n";
1346
- $msg .= "cv2: %%cv2%%\n";
1347
- $msg .= "cv3: %%cv3%%\n";
1348
- $msg .= "cv4: %%cv4%%\n";
1349
- $msg .= "cv5: %%cv5%%\n";
1350
- $msg .= "cv6: %%cv6%%\n";
1351
- $msg .= "cv7: %%cv7%%\n";
1352
- $msg .= "cv8: %%cv8%%\n";
1353
- $msg .= "cv9: %%cv9%%";
1354
- /**/
1355
- if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)))
1356
- if (($msg = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds ($role), $msg)))
1357
- if (($msg = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds ($level), $msg)))
1358
- if (($msg = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds ($fname), $msg)))
1359
- if (($msg = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds ($lname), $msg)))
1360
- if (($msg = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds ($name), $msg)))
1361
- if (($msg = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds ($email), $msg)))
1362
- if (($msg = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds ($login), $msg)))
1363
- if (($msg = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds ($pass), $msg)))
1364
- if (($msg = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds ($user_id), $msg)))
1365
- /**/
1366
- foreach (ws_plugin__s2member_trim_deep (preg_split ("/;+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"])) as $recipient)
1367
- /**/
1368
- ($recipient) ? mail ($recipient, $sbj, apply_filters ("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=utf-8") : null;
1369
- }
1370
- /**/
1371
- if ($url = $GLOBALS["ws_plugin__s2member_registration_return_url"])
1372
- /**/
1373
- if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)))
1374
- if (($url = preg_replace ("/%%role%%/i", ws_plugin__s2member_esc_ds (urlencode ($role)), $url)))
1375
- if (($url = preg_replace ("/%%level%%/i", ws_plugin__s2member_esc_ds (urlencode ($level)), $url)))
1376
- if (($url = preg_replace ("/%%user_first_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($fname)), $url)))
1377
- if (($url = preg_replace ("/%%user_last_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($lname)), $url)))
1378
- if (($url = preg_replace ("/%%user_full_name%%/i", ws_plugin__s2member_esc_ds (urlencode ($name)), $url)))
1379
- if (($url = preg_replace ("/%%user_email%%/i", ws_plugin__s2member_esc_ds (urlencode ($email)), $url)))
1380
- if (($url = preg_replace ("/%%user_login%%/i", ws_plugin__s2member_esc_ds (urlencode ($login)), $url)))
1381
- if (($url = preg_replace ("/%%user_pass%%/i", ws_plugin__s2member_esc_ds (urlencode ($pass)), $url)))
1382
- if (($url = preg_replace ("/%%user_id%%/i", ws_plugin__s2member_esc_ds (urlencode ($user_id)), $url)))
1383
- /**/
1384
- if (($url = trim ($url))) /* Empty? ... Otherwise, re-fill. */
1385
- $GLOBALS["ws_plugin__s2member_registration_return_url"] = $url;
1386
- /**/
1387
- setcookie ("s2member_subscr_id", "", time () + 31556926, "/");
1388
- setcookie ("s2member_custom", "", time () + 31556926, "/");
1389
- setcookie ("s2member_level", "", time () + 31556926, "/");
1390
- /**/
1391
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1392
- do_action ("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
1393
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1394
- }
1395
- }
1396
- /**/
1397
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1398
- do_action ("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
1399
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1400
- /**/
1401
- return;
1402
- }
1403
- }
1404
- /*
1405
- Pluggable function that handles password generation.
1406
- Taken from: /wp-includes/pluggable.php
1407
- */
1408
- if (!function_exists ("wp_generate_password"))
1409
- {
1410
- if (!function_exists ("ws_plugin__s2member_generate_password"))
1411
- {
1412
- function wp_generate_password ($length = 12, $special_chars = TRUE)
1413
- {
1414
- return ws_plugin__s2member_generate_password ($length, $special_chars);
1415
- }
1416
- /**/
1417
- function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
1418
- {
1419
- $password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
1420
- /**/
1421
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1422
- do_action ("ws_plugin__s2member_before_generate_password", get_defined_vars ());
1423
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1424
- /**/
1425
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
1426
- if ($custom = trim (stripslashes ($_POST["ws_plugin__s2member_custom_reg_field_user_pass"])))
1427
- {
1428
- $password = $custom; /* Use custom password. */
1429
- }
1430
- /**/
1431
- return ($GLOBALS["ws_plugin__s2member_generate_password_return"] = $password);
1432
- }
1433
- }
1434
- }
1435
- /*
1436
- Function hides password fields for demo users.
1437
-
1438
- Demo accounts ( where the Username MUST be "demo" ), will NOT be allowed to change their password.
1439
- Any other restrictions you need to impose must be done through custom programming, using s2Member's Conditionals.
1440
- See `s2Member -> API Scripting`.
1441
-
1442
- Attach to: add_filter("show_password_fields");
1443
- */
1444
- if (!function_exists ("ws_plugin__s2member_demo_hide_password_fields"))
1445
- {
1446
- function ws_plugin__s2member_demo_hide_password_fields ($show = TRUE, $profileuser = FALSE)
1447
- {
1448
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1449
- do_action ("ws_plugin__s2member_before_demo_hide_password_fields", get_defined_vars ());
1450
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1451
- /**/
1452
- if ($profileuser->user_login === "demo")
1453
- return ($show = false);
1454
- /**/
1455
- return $show;
1456
- }
1457
- }
1458
- /*
1459
- Convert primitive Role names in emails sent by WordPress®.
1460
- Attach to: add_filter("wpmu_signup_user_notification_email");
1461
- ~ Only necessary with this particular email.
1462
- */
1463
- if (!function_exists ("ws_plugin__s2member_ms_nice_email_roles"))
1464
- {
1465
- function ws_plugin__s2member_ms_nice_email_roles ($message = FALSE)
1466
- {
1467
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
1468
- do_action ("ws_plugin__s2member_before_ms_nice_email_roles", get_defined_vars ());
1469
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
1470
- /**/
1471
- $message = preg_replace ("/ as a (subscriber|s2member_level[1-4])/i", " as a Member", $message);
1472
- /**/
1473
- return apply_filters ("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
1474
- }
1475
- }
1476
  ?>
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
  exit ("Do not access this file directly.");
16
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  Generates registration links.
18
  */
19
  if (!function_exists ("ws_plugin__s2member_register_link_gen"))
86
  do_action ("ws_plugin__s2member_after_register", get_defined_vars ());
87
  }
88
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  ?>
includes/functions/sc-get-details.inc.php CHANGED
@@ -12,11 +12,11 @@ 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 that handles the Shortcode for:
18
  [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
19
- [s2Get user_field="a_custom_registration_field" /]
20
  [s2Get user_option="s2member_subscr_id" /]
21
 
22
  Attach to: add_shortcode("s2Get");
@@ -28,15 +28,15 @@ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
28
  static $current_user; /* Optimizes this routine a bit. */
29
  $current_user = (!isset ($current_user)) ? wp_get_current_user () : $current_user;
30
  /**/
31
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
32
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
33
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
34
  /**/
35
- $attr = ws_plugin__s2member_trim_quot_deep ((array)$attr); /* Force array, and fix &quot; in attrs. */
36
  /**/
37
  $attr = shortcode_atts (array ("constant" => "", "user_field" => "", "user_option" => ""), $attr);
38
  /**/
39
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
40
  do_action ("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
41
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
42
  /**/
@@ -46,32 +46,10 @@ if (!function_exists ("ws_plugin__s2member_sc_get_details"))
46
  $get = constant ($attr["constant"]);
47
  }
48
  /**/
49
- else if ($attr["user_field"] && $current_user) /* Pull a particular field. */
50
- {
51
- if (preg_match ("/^(first_name|First Name)$/i", $attr["user_field"]))
52
- $get = $current_user->first_name;
53
- /**/
54
- else if (preg_match ("/^(last_name|Last Name)$/i", $attr["user_field"]))
55
- $get = $current_user->last_name;
56
- /**/
57
- else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $attr["user_field"]))
58
- $get = $current_user->user_email;
59
- /**/
60
- else if (isset ($current_user->$attr["user_field"]))
61
- $get = $current_user->$attr["user_field"];
62
- /**/
63
- else /* Otherwise, we assume it's an actual Custom Field. */
64
- {
65
- $field = trim ($attr["user_field"], "^* \t\n\r\0\x0B");
66
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
67
- /**/
68
- $fields = get_user_option ("s2member_custom_fields");
69
- /**/
70
- $get = $fields[$field_var];
71
- }
72
- }
73
  /**/
74
- else if ($attr["user_option"] && $current_user) /* Here we pull meta options. */
75
  $get = get_user_option ($attr["user_option"]);
76
  /**/
77
  return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that handles the Shortcode for:
18
  [s2Get constant="S2MEMBER_CURRENT_USER_DISPLAY_NAME" /]
19
+ [s2Get user_field="a_custom_registration_field_id" /]
20
  [s2Get user_option="s2member_subscr_id" /]
21
 
22
  Attach to: add_shortcode("s2Get");
28
  static $current_user; /* Optimizes this routine a bit. */
29
  $current_user = (!isset ($current_user)) ? wp_get_current_user () : $current_user;
30
  /**/
31
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
32
  do_action ("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
33
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
34
  /**/
35
+ $attr = ws_plugin__s2member_trim_quot_deep ((array)$attr); /* Force array, and fix &quot;. */
36
  /**/
37
  $attr = shortcode_atts (array ("constant" => "", "user_field" => "", "user_option" => ""), $attr);
38
  /**/
39
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
40
  do_action ("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
41
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
42
  /**/
46
  $get = constant ($attr["constant"]);
47
  }
48
  /**/
49
+ else if ($attr["user_field"] && $current_user)
50
+ $get = ws_plugin__s2member_get_user_field ($attr["user_field"]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**/
52
+ else if ($attr["user_option"] && $current_user)
53
  $get = get_user_option ($attr["user_option"]);
54
  /**/
55
  return apply_filters ("ws_plugin__s2member_sc_get_details", $get, get_defined_vars ());
includes/functions/separates/paypal-notify.inc.php CHANGED
@@ -24,6 +24,8 @@ Instead, use WordPress® Hooks/Filters.
24
 
25
  For example, if you'd like to add your own custom conditionals, use:
26
  add_filter ("ws_plugin__s2member_during_paypal_notify_conditionals", "your_function");
 
 
27
  */
28
  if (!function_exists ("s__ws_plugin__s2member_paypal_notify"))
29
  {
24
 
25
  For example, if you'd like to add your own custom conditionals, use:
26
  add_filter ("ws_plugin__s2member_during_paypal_notify_conditionals", "your_function");
27
+
28
+ Attach to: add_action("init");
29
  */
30
  if (!function_exists ("s__ws_plugin__s2member_paypal_notify"))
31
  {
includes/functions/separates/paypal-return.inc.php CHANGED
@@ -16,6 +16,7 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
16
  /*
17
  Handles PayPal® Return URL processing.
18
  This is used ONLY in PayPal® Standard Integration.
 
19
  */
20
  if (!function_exists ("s__ws_plugin__s2member_paypal_return"))
21
  {
16
  /*
17
  Handles PayPal® Return URL processing.
18
  This is used ONLY in PayPal® Standard Integration.
19
+ Attach to: add_action("init");
20
  */
21
  if (!function_exists ("s__ws_plugin__s2member_paypal_return"))
22
  {
includes/functions/user-new.inc.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /*
17
+ Function that adds custom fields to `/wp-admin/user-new.php`.
18
+ We have to buffer output because `/user-new.php` has NO Hooks.
19
+ Attach to: add_action("admin_init");
20
+ */
21
+ if (!function_exists ("ws_plugin__s2member_admin_user_new_fields"))
22
+ {
23
+ function ws_plugin__s2member_admin_user_new_fields ()
24
+ {
25
+ global $pagenow; /* The current admin page file name. */
26
+ /**/
27
+ do_action ("ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
28
+ /**/
29
+ if (is_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
30
+ {
31
+ ob_start ("_ws_plugin__s2member_admin_user_new_fields"); /* No Hooks, so we buffer. */
32
+ /**/
33
+ do_action ("ws_plugin__s2member_during_admin_user_new_fields", get_defined_vars ());
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
37
+ /**/
38
+ return;
39
+ }
40
+ }
41
+ /*
42
+ Callback that adds custom fields to `/wp-admin/user-new.php`.
43
+ We have to buffer output because `/user-new.php` has NO Hooks.
44
+ Attach to: ob_start("_ws_plugin__s2member_admin_user_new_fields");
45
+ */
46
+ if (!function_exists ("_ws_plugin__s2member_admin_user_new_fields"))
47
+ {
48
+ function _ws_plugin__s2member_admin_user_new_fields ($buffer = FALSE)
49
+ {
50
+ global $pagenow; /* The current admin page file name. */
51
+ /**/
52
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
53
+ do_action ("_ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
54
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
55
+ /**/
56
+ if (is_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
57
+ {
58
+ $_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST));
59
+ /**/
60
+ $unfs = '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
61
+ /**/
62
+ $unfs .= '<h3 style="position:relative;"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/large-icon.png" title="s2Member ( a Membership management system for WordPress® )" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . ( (is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
63
+ /**/
64
+ $unfs .= '<table class="form-table">' . "\n";
65
+ /**/
66
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
67
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before", get_defined_vars ());
68
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
69
+ /**/
70
+ if (is_multisite ()) /* Multisite Networking is currently lacking these fields; we pop them in. */
71
+ {
72
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
73
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_first_name", get_defined_vars ());
74
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
75
+ /**/
76
+ $unfs .= '<tr>' . "\n";
77
+ $unfs .= '<th><label>First Name:</label></th>' . "\n";
78
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_first_name" id="ws-plugin--s2member-user-new-first-name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_first_name"]) . '" class="regular-text" /></td>' . "\n";
79
+ $unfs .= '</tr>' . "\n";
80
+ /**/
81
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
82
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_first_name", get_defined_vars ());
83
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
84
+ /**/
85
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
86
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_last_name", get_defined_vars ());
87
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
88
+ /**/
89
+ $unfs .= '<tr>' . "\n";
90
+ $unfs .= '<th><label>Last Name:</label></th>' . "\n";
91
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_last_name" id="ws-plugin--s2member-user-new-last-name" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_last_name"]) . '" class="regular-text" /></td>' . "\n";
92
+ $unfs .= '</tr>' . "\n";
93
+ /**/
94
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
95
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_last_name", get_defined_vars ());
96
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
97
+ }
98
+ /**/
99
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
100
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_id", get_defined_vars ());
101
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
102
+ /**/
103
+ $unfs .= '<tr>' . "\n";
104
+ $unfs .= '<th><label>Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscr. ID is only valid for paid Members. Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. ID manually.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
105
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_subscr_id" id="ws-plugin--s2member-user-new-s2member-subscr-id" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_subscr_id"]) . '" class="regular-text" /></td>' . "\n";
106
+ $unfs .= '</tr>' . "\n";
107
+ /**/
108
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
109
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_id", get_defined_vars ());
110
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
111
+ /**/
112
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
113
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_custom", get_defined_vars ());
114
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
115
+ /**/
116
+ $unfs .= '<tr>' . "\n";
117
+ $unfs .= '<th><label>Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
118
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_custom" id="ws-plugin--s2member-user-new-s2member-custom" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_custom"]) . '" class="regular-text" /></td>' . "\n";
119
+ $unfs .= '</tr>' . "\n";
120
+ /**/
121
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
122
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_custom", get_defined_vars ());
123
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
124
+ /**/
125
+ if (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ())
126
+ /* ^ Will change once Custom Capabilities are compatible with a Blog Farm. */
127
+ {
128
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
129
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_ccaps", get_defined_vars ());
130
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
131
+ /**/
132
+ $unfs .= '<tr>' . "\n";
133
+ $unfs .= '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.' . ( (is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
134
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_ccaps" id="ws-plugin--s2member-user-new-s2member-ccaps" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_ccaps"]) . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());" /></td>' . "\n";
135
+ $unfs .= '</tr>' . "\n";
136
+ /**/
137
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
138
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_ccaps", get_defined_vars ());
139
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
140
+ }
141
+ /**/
142
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
143
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_auto_eot_time", get_defined_vars ());
144
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
145
+ /**/
146
+ $unfs .= '<tr>' . "\n";
147
+ $unfs .= '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
148
+ $unfs .= '<td><input type="text" name="ws_plugin__s2member_user_new_s2member_auto_eot_time" id="ws-plugin--s2member-user-new-auto-eot-time" value="' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_auto_eot_time"]) . '" class="regular-text" /></td>' . "\n";
149
+ $unfs .= '</tr>' . "\n";
150
+ /**/
151
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
152
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_auto_eot_time", get_defined_vars ());
153
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
154
+ /**/
155
+ if (ws_plugin__s2member_list_servers_integrated ()) /* Only if integrated with s2Member. */
156
+ {
157
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
158
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_opt_in", get_defined_vars ());
159
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
160
+ /**/
161
+ $unfs .= '<tr>' . "\n";
162
+ $unfs .= '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
163
+ $unfs .= '<td><label><input type="checkbox" name="ws_plugin__s2member_user_new_opt_in" id="ws-plugin--s2member-user-new-opt-in" value="1"' . ( ($_POST["ws_plugin__s2member_user_new_opt_in"]) ? ' checked="checked"' : '') . ' /> Yes, send a mailing list confirmation email to this new User.</label></td>' . "\n";
164
+ $unfs .= '</tr>' . "\n";
165
+ /**/
166
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
167
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_opt_in", get_defined_vars ());
168
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
169
+ }
170
+ /**/
171
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
172
+ {
173
+ $unfs .= '<tr>' . "\n";
174
+ $unfs .= '<td colspan="2">' . "\n";
175
+ $unfs .= '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
176
+ $unfs .= '</td>' . "\n";
177
+ $unfs .= '</tr>' . "\n";
178
+ /**/
179
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
180
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_custom_fields", get_defined_vars ());
181
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
182
+ /**/
183
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
184
+ {
185
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
186
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_before", get_defined_vars ());
187
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
188
+ /**/
189
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
190
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
191
+ /**/
192
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
193
+ if (apply_filters ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_display", true, get_defined_vars ()))
194
+ {
195
+ $unfs .= '<tr>' . "\n";
196
+ $unfs .= '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
197
+ $unfs .= '<td>' . ws_plugin__s2member_custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_user_new_", "ws-plugin--s2member-user-new-", "", ( (preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $_POST, $_POST["ws_plugin__s2member_user_new_" . $field_var]) . '</td>' . "\n";
198
+ $unfs .= '</tr>' . "\n";
199
+ }
200
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
201
+ /**/
202
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
203
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_after", get_defined_vars ());
204
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
205
+ }
206
+ /**/
207
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
208
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_custom_fields", get_defined_vars ());
209
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
210
+ /**/
211
+ $unfs .= '<tr>' . "\n";
212
+ $unfs .= '<td colspan="2">' . "\n";
213
+ $unfs .= '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
214
+ $unfs .= '</td>' . "\n";
215
+ $unfs .= '</tr>' . "\n";
216
+ }
217
+ /**/
218
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
219
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_before_notes", get_defined_vars ());
220
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
221
+ /**/
222
+ $unfs .= '<tr>' . "\n";
223
+ $unfs .= '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
224
+ $unfs .= '<td><textarea name="ws_plugin__s2member_user_new_s2member_notes" id="ws-plugin--s2member-user-new-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit ($_POST["ws_plugin__s2member_user_new_s2member_notes"]) . '</textarea></td>' . "\n";
225
+ $unfs .= '</tr>' . "\n";
226
+ /**/
227
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
228
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after_notes", get_defined_vars ());
229
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
230
+ /**/
231
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
232
+ do_action ("_ws_plugin__s2member_during_admin_user_new_fields_after", get_defined_vars ());
233
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
234
+ /**/
235
+ $unfs .= '</table>' . "\n";
236
+ /**/
237
+ $unfs .= '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
238
+ /**/
239
+ $buffer = preg_replace ("/(\<\/table\>)([\r\n\t\s ]*)(\<p class\=\"submit\"\>)/", "$1$2" . $unfs . "$3", $buffer);
240
+ }
241
+ /**/
242
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
243
+ do_action ("_ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
244
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
245
+ /**/
246
+ return apply_filters ("_ws_plugin__s2member_admin_user_new_fields", $buffer, get_defined_vars ());
247
+ }
248
+ }
249
+ ?>
includes/functions/users-list.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
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
@@ -21,7 +21,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_cols"))
21
  {
22
  function ws_plugin__s2member_users_list_cols ($cols = FALSE)
23
  {
24
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
  do_action ("ws_plugin__s2member_before_users_list_cols", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
@@ -32,18 +32,17 @@ if (!function_exists ("ws_plugin__s2member_users_list_cols"))
32
  /* ^ Will change once Custom Capabilities are compatible with a Blog Farm. */
33
  $cols["s2member_ccaps"] = "Custom Capabilities"; /* Custom Capabilities. */
34
  /**/
35
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
36
- {
37
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
38
- {
39
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
40
- $field_id_class = preg_replace ("/_/", "-", $field_var);
41
- /**/
42
- $cols[$field_var] = $field;
43
- }
44
- }
45
  /**/
46
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
47
  do_action ("ws_plugin__s2member_during_users_list_cols", get_defined_vars ());
48
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
49
  /**/
@@ -56,24 +55,21 @@ Attach to: add_filter ("manage_users_custom_column");
56
  */
57
  if (!function_exists ("ws_plugin__s2member_users_list_display_cols"))
58
  {
59
- function ws_plugin__s2member_users_list_display_cols ($_ = FALSE, $col = FALSE, $user_id = FALSE)
60
  {
61
  global $user_object; /* Already in global scope inside users.php. */
62
  $user = $user_object; /* Shorter reference to the $user_object var. */
63
  static $fields, $fields_4_user_id; /* Used for optimization. */
64
  /**/
65
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
66
  do_action ("ws_plugin__s2member_before_users_list_display_cols", get_defined_vars ());
67
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
68
  /**/
69
- if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
70
- $fields = get_user_option ("s2member_custom_fields", $user_id);
71
- /**/
72
  if ($col === "s2member_registration_time")
73
- $val = ($r = $user->user_registered) ? date ("D M j, Y", strtotime ($r)) . '<br />@exactly ' . date ("g:i a", strtotime ($r)) : "—";
74
  /**/
75
  else if ($col === "s2member_subscr_id")
76
- $val = ($r = get_user_option ("s2member_subscr_id", $user_id)) ? esc_html ($r) : "—";
77
  /**/
78
  else if ($col === "s2member_ccaps") /* Custom Capabilities. */
79
  {
@@ -84,13 +80,24 @@ if (!function_exists ("ws_plugin__s2member_users_list_display_cols"))
84
  $val = (!empty ($ccaps)) ? implode ("<br />", $ccaps) : "—";
85
  }
86
  /**/
87
- else if ($fields[$col] && preg_match ("/^http(s?)\:/i", $fields[$col]))
88
- $val = '<a href="' . esc_attr ($fields[$col]) . '" target="_blank">' . esc_html (substr ($fields[$col], strpos ($fields[$col], ":") + 3, 25) . "...") . '</a>';
89
- /**/
90
- else if ($fields[$col])
91
- $val = esc_html ($fields[$col]);
 
 
 
 
 
 
 
 
 
 
 
92
  /**/
93
- return apply_filters ("ws_plugin__s2member_users_list_display_cols", (($val) ? $val : "—"), get_defined_vars ());
94
  }
95
  }
96
  /*
@@ -110,7 +117,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
110
  {
111
  global $current_site, $current_blog; /* Multisite Networking. */
112
  /**/
113
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
114
  do_action ("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars ());
115
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
116
  /**/
@@ -118,60 +125,62 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
118
  /**/
119
  if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects beforehand. */
120
  {
121
- if (current_user_can ("edit_users") && (is_super_admin () || is_user_member_of_blog ($user->ID))) /* Security! */
122
  {
 
 
123
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
124
  /**/
125
- echo '<h3 style="position:relative;"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/large-icon.png" title="s2Member ( a Membership management system for WordPress® )" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . ((is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
126
  /**/
127
  echo '<table class="form-table">' . "\n";
128
  /**/
129
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
130
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
131
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
132
  /**/
133
  if (is_multisite () && is_super_admin ()) /* MUST be a Super Admin. */
134
  /* On a Multisite Network, the Super Administrator can ALWAYS edit this. */
135
  {
136
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
137
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog", get_defined_vars ());
138
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
139
  /**/
140
  echo '<tr>' . "\n";
141
  echo '<th><label>Originating Blog ID#:</label> <a href="#" onclick="alert(\'On a Multisite Network, this is how s2Member keeps track of which Blog each User/Member originated from. So this ID#, is automatically associated with a Blog in your Network, matching the User\\\'s point of origin. ~ ONLY a Super Admin can modify this.\\n\\nOn a Multisite Blog Farm, the Originating Blog ID# for your own Customers, will ALWAYS be associated with your ( Main Site ). It is NOT likely that you\\\'ll need to modify this manually, but s2Member makes it available; just in case.\\n\\n*Tip* - If you add Users ( and/or Blogs ) with the `Super Admin` panel inside WordPress® ( via: ms-users.php / ms-sites.php ), then you WILL need to set everything manually. s2Member does NOT tamper with any automation routines whenever YOU ( as a Super Administrator ) are working with that special panel in WordPress®.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
142
- echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_originating_blog" value="' . format_to_edit (get_user_meta ($user->ID, "s2member_originating_blog", true)) . '" class="regular-text" /></td>' . "\n";
143
  echo '</tr>' . "\n";
144
  /**/
145
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
146
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog", get_defined_vars ());
147
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
148
  }
149
  /**/
150
  if (!$user->has_cap ("administrator")) /* Do NOT present these details for Administrator accounts. */
151
  {
152
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
153
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars ());
154
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
155
  /**/
156
  echo '<tr>' . "\n";
157
  echo '<th><label>Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscr. ID is only valid for paid Members. This will be filled automatically by s2Member. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is ONLY editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. ID manually. You are not likely to need this, but s2Member makes it editable, just in case.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
158
- echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_subscr_id" value="' . format_to_edit (get_user_option ("s2member_subscr_id", $user->ID)) . '" class="regular-text" /></td>' . "\n";
159
  echo '</tr>' . "\n";
160
  /**/
161
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
162
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars ());
163
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
164
  /**/
165
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
166
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars ());
167
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
168
  /**/
169
  echo '<tr>' . "\n";
170
  echo '<th><label>Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
171
- echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_custom" value="' . format_to_edit (get_user_option ("s2member_custom", $user->ID)) . '" class="regular-text" /></td>' . "\n";
172
  echo '</tr>' . "\n";
173
  /**/
174
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
175
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom", get_defined_vars ());
176
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
177
  }
@@ -183,23 +192,23 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
183
  if (preg_match ("/^access_s2member_ccap_/", $cap))
184
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
185
  /**/
186
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
187
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars ());
188
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
189
  /**/
190
  echo '<tr>' . "\n";
191
- echo '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.' . ((is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a>' . ((is_multisite ()) ? '<br /><small>( for this Blog )</small>' : '') . '</th>' . "\n";
192
- echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_ccaps" value="' . format_to_edit (((!empty ($ccaps)) ? implode (",", $ccaps) : "")) . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());" /></td>' . "\n";
193
  echo '</tr>' . "\n";
194
  /**/
195
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
196
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars ());
197
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
  }
199
  /**/
200
  if (!$user->has_cap ("administrator")) /* Do NOT present these details for Administrator accounts. */
201
  {
202
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
203
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars ());
204
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
205
  /**/
@@ -207,94 +216,97 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
207
  $auto_eot_time = get_user_option ("s2member_auto_eot_time", $user->ID);
208
  $auto_eot_time = ($auto_eot_time) ? date ("D M j, Y g:i a T", $auto_eot_time) : "";
209
  echo '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
210
- echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_auto_eot_time" value="' . format_to_edit ($auto_eot_time) . '" class="regular-text" /></td>' . "\n";
211
  echo '</tr>' . "\n";
212
  /**/
213
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
214
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars ());
215
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
216
  }
217
  /**/
218
  if (ws_plugin__s2member_list_servers_integrated ()) /* Only if integrated with s2Member. */
219
  {
220
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
221
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_opt_in", get_defined_vars ());
222
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
223
  /**/
224
  echo '<tr>' . "\n";
225
  echo '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
226
- echo '<td><label><input type="checkbox" name="ws_plugin__s2member_profile_opt_in" value="1" /> Yes, send a mailing list confirmation email to this User.</label></td>' . "\n";
227
  echo '</tr>' . "\n";
228
  /**/
229
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_opt_in", get_defined_vars ());
231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
  }
233
  /**/
234
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
235
- {
236
- echo '<tr>' . "\n";
237
- echo '<td colspan="2">' . "\n";
238
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
239
- echo '</td>' . "\n";
240
- echo '</tr>' . "\n";
241
- /**/
242
- $fields = get_user_option ("s2member_custom_fields", $user->ID); /* Get existing field values. */
243
- /**/
244
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
245
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
246
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
247
- /**/
248
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
249
- {
250
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
251
- {
252
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
253
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
254
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
255
- /**/
256
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
257
- $field_id_class = preg_replace ("/_/", "-", $field_var);
258
- /**/
259
- if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
260
- {
261
- echo '<tr>' . "\n";
262
- echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
263
- echo '<td><input type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
264
- echo '</tr>' . "\n";
265
- }
266
- /**/
267
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
268
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
269
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
270
- }
271
- }
272
- /**/
273
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
274
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
275
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
276
- /**/
277
- echo '<tr>' . "\n";
278
- echo '<td colspan="2">' . "\n";
279
- echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
280
- echo '</td>' . "\n";
281
- echo '</tr>' . "\n";
282
- }
 
 
 
283
  /**/
284
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
285
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars ());
286
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
287
  /**/
288
  echo '<tr>' . "\n";
289
  echo '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
290
- echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit (get_user_option ("s2member_notes", $user->ID)) . '</textarea></td>' . "\n";
291
  echo '</tr>' . "\n";
292
  /**/
293
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
294
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars ());
295
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
296
  /**/
297
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
298
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
299
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
300
  /**/
@@ -306,72 +318,70 @@ if (!function_exists ("ws_plugin__s2member_users_list_edit_cols"))
306
  else if ($current_user->ID === $user->ID) /* Otherwise, a User can always edit their own Profile. */
307
  {
308
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
309
- {
310
- echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
311
- /**/
312
- echo '<h3>Additional Profile Fields' . ((is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
313
- /**/
314
- echo '<table class="form-table">' . "\n";
315
- /**/
316
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
317
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
318
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
319
- /**/
320
- $fields = get_user_option ("s2member_custom_fields", $user->ID); /* Get existing field values. */
321
- /**/
322
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
323
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
324
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
325
- /**/
326
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
327
- {
328
- $une = preg_match ("/\^/", $field); /* Preventing this field from being edited? */
329
- $une = ($une) ? ' disabled="disabled"' : ''; /* Prevent this field from being edited. */
330
- /**/
331
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
332
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
333
- /**/
334
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
335
- {
336
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
337
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
338
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
339
- /**/
340
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
341
- $field_id_class = preg_replace ("/_/", "-", $field_var);
342
- /**/
343
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
344
- if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
345
- {
346
- echo '<tr>' . "\n";
347
- echo '<th><label>' . esc_html ($field) . ':</label></th>' . "\n";
348
- echo '<td><input' . $une . $req . ' type="text" name="ws_plugin__s2member_profile_' . $field_var . '" value="' . format_to_edit ($fields[$field_var]) . '" class="regular-text" /></td>' . "\n";
349
- echo '</tr>' . "\n";
350
- }
351
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
352
- /**/
353
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
354
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
355
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
356
- }
357
- }
358
- /**/
359
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
360
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
361
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
362
- /**/
363
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
364
- do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
365
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
366
- /**/
367
- echo '</table>' . "\n";
368
- /**/
369
- echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
370
- }
371
  }
372
  }
373
  /**/
374
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
375
  do_action ("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars ());
376
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
377
  /**/
@@ -395,7 +405,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
395
  {
396
  global $current_site, $current_blog; /* Multisite Networking. */
397
  /**/
398
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
399
  do_action ("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars ());
400
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
401
  /**/
@@ -404,7 +414,7 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
404
  /**/
405
  if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects before we even begin. */
406
  {
407
- if (current_user_can ("edit_users") && (is_super_admin () || is_user_member_of_blog ($user->ID))) /* Security! */
408
  {
409
  if (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) && !empty ($_POST))
410
  {
@@ -438,28 +448,22 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
438
  $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
439
  }
440
  /**/
441
- $_existing_fields = (array)get_user_option ("s2member_custom_fields", $user_id);
442
- /**/
443
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
444
  {
445
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
446
  {
447
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
448
  $field_id_class = preg_replace ("/_/", "-", $field_var);
449
  /**/
450
- if (!isset ($_POST["ws_plugin__s2member_profile_" . $field_var]))
451
- $fields[$field_var] = $_existing_fields[$field_var];
452
- /**/
453
- else /* Otherwise, we can use the newly updated value. */
454
- $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
455
  }
456
  }
457
  /**/
458
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
 
 
459
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
460
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
461
- /**/
462
- update_user_option ($user_id, "s2member_custom_fields", $fields);
463
  }
464
  }
465
  /**/
@@ -467,42 +471,38 @@ if (!function_exists ("ws_plugin__s2member_users_list_update_cols"))
467
  {
468
  if (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) && !empty ($_POST))
469
  {
470
- if (isset ($_POST["ws_plugin__s2member_profile_s2member_originating_blog"]) && is_multisite () && is_super_admin ())
471
- update_user_meta ($user_id, "s2member_originating_blog", $_POST["ws_plugin__s2member_profile_s2member_originating_blog"]);
472
- /**/
473
- $_existing_fields = (array)get_user_option ("s2member_custom_fields", $user_id);
474
- /**/
475
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
476
- {
477
- $une = preg_match ("/\^/", $field); /* Uneditable fields should be wrapped inside carets. */
478
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
479
- /**/
480
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
481
- {
482
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
483
- $field_id_class = preg_replace ("/_/", "-", $field_var);
484
- /**/
485
- if ($une || !isset ($_POST["ws_plugin__s2member_profile_" . $field_var]))
486
- $fields[$field_var] = $_existing_fields[$field_var];
487
- /**/
488
- else if ($req && !strlen ($_POST["ws_plugin__s2member_profile_" . $field_var]))
489
- $fields[$field_var] = $_existing_fields[$field_var];
490
- /**/
491
- else /* Otherwise, we can use the newly updated value. */
492
- $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
493
- }
494
- }
495
- /**/
496
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
497
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
498
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
499
- /**/
500
- update_user_option ($user_id, "s2member_custom_fields", $fields);
501
  }
502
  }
503
  }
504
  /**/
505
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
506
  do_action ("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars ());
507
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
508
  }
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Function that adds columns to the list of Users.
18
  Attach to: add_filter ("manage_users_columns");
21
  {
22
  function ws_plugin__s2member_users_list_cols ($cols = FALSE)
23
  {
24
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
25
  do_action ("ws_plugin__s2member_before_users_list_cols", get_defined_vars ());
26
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
27
  /**/
32
  /* ^ Will change once Custom Capabilities are compatible with a Blog Farm. */
33
  $cols["s2member_ccaps"] = "Custom Capabilities"; /* Custom Capabilities. */
34
  /**/
35
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
36
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
37
+ {
38
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
39
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
40
+ /**/
41
+ $field_title = ucwords (preg_replace ("/_/", " ", $field_var));
42
+ $cols["s2member_custom_field_" . $field_var] = $field_title;
43
+ }
 
44
  /**/
45
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
46
  do_action ("ws_plugin__s2member_during_users_list_cols", get_defined_vars ());
47
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
  /**/
55
  */
56
  if (!function_exists ("ws_plugin__s2member_users_list_display_cols"))
57
  {
58
+ function ws_plugin__s2member_users_list_display_cols ($val = FALSE, $col = FALSE, $user_id = FALSE)
59
  {
60
  global $user_object; /* Already in global scope inside users.php. */
61
  $user = $user_object; /* Shorter reference to the $user_object var. */
62
  static $fields, $fields_4_user_id; /* Used for optimization. */
63
  /**/
64
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
65
  do_action ("ws_plugin__s2member_before_users_list_display_cols", get_defined_vars ());
66
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
67
  /**/
 
 
 
68
  if ($col === "s2member_registration_time")
69
+ $val = ($v = $user->user_registered) ? date ("D M j, Y", strtotime ($v)) . '<br />@exactly ' . date ("g:i a", strtotime ($v)) : "—";
70
  /**/
71
  else if ($col === "s2member_subscr_id")
72
+ $val = ($v = get_user_option ("s2member_subscr_id", $user_id)) ? esc_html ($v) : "—";
73
  /**/
74
  else if ($col === "s2member_ccaps") /* Custom Capabilities. */
75
  {
80
  $val = (!empty ($ccaps)) ? implode ("<br />", $ccaps) : "—";
81
  }
82
  /**/
83
+ else if (preg_match ("/^s2member_custom_field_/", $col)) /* Custom Fields. */
84
+ {
85
+ if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
86
+ $fields = get_user_option ("s2member_custom_fields", $user_id);
87
+ /**/
88
+ $field_var = preg_replace ("/^s2member_custom_field_/", "", $col);
89
+ /**/
90
+ if (is_string ($fields[$field_var]) && preg_match ("/^http(s?)\:/i", $fields[$field_var]))
91
+ $val = '<a href="' . esc_attr ($fields[$field_var]) . '" target="_blank">' . esc_html (substr ($fields[$field_var], strpos ($fields[$field_var], ":") + 3, 25) . "...") . '</a>';
92
+ /**/
93
+ else if (is_array ($fields[$field_var]) && !empty ($fields[$field_var]))
94
+ $val = preg_replace ("/-\|br\|-/", "<br />", esc_html (implode ("-|br|-", $fields[$field_var])));
95
+ /**/
96
+ else if (is_string ($fields[$field_var]) && strlen ($fields[$field_var]))
97
+ $val = esc_html ($fields[$field_var]);
98
+ }
99
  /**/
100
+ return apply_filters ("ws_plugin__s2member_users_list_display_cols", ( (strlen ($val)) ? $val : "—"), get_defined_vars ());
101
  }
102
  }
103
  /*
117
  {
118
  global $current_site, $current_blog; /* Multisite Networking. */
119
  /**/
120
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
  do_action ("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars ());
122
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
  /**/
125
  /**/
126
  if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects beforehand. */
127
  {
128
+ if (current_user_can ("edit_users") && (!is_multisite () || is_super_admin () || is_user_member_of_blog ($user->ID)))
129
  {
130
+ $level = ws_plugin__s2member_user_access_level ($user); /* This User's Access Level for s2Member. */
131
+ /**/
132
  echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
133
  /**/
134
+ echo '<h3 style="position:relative;"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/large-icon.png" title="s2Member ( a Membership management system for WordPress® )" alt="" style="position:absolute; top:-15px; right:0; border:0;" />s2Member Configuration &amp; Profile Fields' . ( (is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
135
  /**/
136
  echo '<table class="form-table">' . "\n";
137
  /**/
138
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
139
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
140
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
141
  /**/
142
  if (is_multisite () && is_super_admin ()) /* MUST be a Super Admin. */
143
  /* On a Multisite Network, the Super Administrator can ALWAYS edit this. */
144
  {
145
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
146
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog", get_defined_vars ());
147
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
148
  /**/
149
  echo '<tr>' . "\n";
150
  echo '<th><label>Originating Blog ID#:</label> <a href="#" onclick="alert(\'On a Multisite Network, this is how s2Member keeps track of which Blog each User/Member originated from. So this ID#, is automatically associated with a Blog in your Network, matching the User\\\'s point of origin. ~ ONLY a Super Admin can modify this.\\n\\nOn a Multisite Blog Farm, the Originating Blog ID# for your own Customers, will ALWAYS be associated with your ( Main Site ). It is NOT likely that you\\\'ll need to modify this manually, but s2Member makes it available; just in case.\\n\\n*Tip* - If you add Users ( and/or Blogs ) with the `Super Admin` panel inside WordPress® ( via: ms-users.php / ms-sites.php ), then you WILL need to set everything manually. s2Member does NOT tamper with any automation routines whenever YOU ( as a Super Administrator ) are working with that special panel in WordPress®.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
151
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_originating_blog" id="ws-plugin--s2member-profile-s2member-originating-blog" value="' . format_to_edit (get_user_meta ($user->ID, "s2member_originating_blog", true)) . '" class="regular-text" /></td>' . "\n";
152
  echo '</tr>' . "\n";
153
  /**/
154
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
155
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog", get_defined_vars ());
156
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
157
  }
158
  /**/
159
  if (!$user->has_cap ("administrator")) /* Do NOT present these details for Administrator accounts. */
160
  {
161
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
162
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars ());
163
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
164
  /**/
165
  echo '<tr>' . "\n";
166
  echo '<th><label>Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscr. ID is only valid for paid Members. This will be filled automatically by s2Member. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is ONLY editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. ID manually. You are not likely to need this, but s2Member makes it editable, just in case.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
167
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_subscr_id" id="ws-plugin--s2member-profile-s2member-subscr-id" value="' . format_to_edit (get_user_option ("s2member_subscr_id", $user->ID)) . '" class="regular-text" /></td>' . "\n";
168
  echo '</tr>' . "\n";
169
  /**/
170
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
171
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars ());
172
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
173
  /**/
174
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
175
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars ());
176
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
177
  /**/
178
  echo '<tr>' . "\n";
179
  echo '<th><label>Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . ws_plugin__s2member_esc_sq ($_SERVER["HTTP_HOST"]) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
180
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_custom" id="ws-plugin--s2member-profile-s2member-custom" value="' . format_to_edit (get_user_option ("s2member_custom", $user->ID)) . '" class="regular-text" /></td>' . "\n";
181
  echo '</tr>' . "\n";
182
  /**/
183
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
184
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom", get_defined_vars ());
185
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
186
  }
192
  if (preg_match ("/^access_s2member_ccap_/", $cap))
193
  $ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
194
  /**/
195
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
196
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars ());
197
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
198
  /**/
199
  echo '<tr>' . "\n";
200
+ echo '<th><label>Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.' . ( (is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a>' . ( (is_multisite ()) ? '<br /><small>( for this Blog )</small>' : '') . '</th>' . "\n";
201
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_ccaps" id="ws-plugin--s2member-profile-s2member-ccaps" value="' . format_to_edit (( (!empty ($ccaps)) ? implode (",", $ccaps) : "")) . '" class="regular-text" onkeyup="if(this.value.match(/[^a-z_0-9,]/)) this.value = jQuery.trim (jQuery.trim (this.value).replace (/[ \-]/g, \'_\').replace (/[^A-Z_0-9,]/gi, \'\').toLowerCase ());" /></td>' . "\n";
202
  echo '</tr>' . "\n";
203
  /**/
204
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
205
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars ());
206
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
207
  }
208
  /**/
209
  if (!$user->has_cap ("administrator")) /* Do NOT present these details for Administrator accounts. */
210
  {
211
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
212
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars ());
213
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
214
  /**/
216
  $auto_eot_time = get_user_option ("s2member_auto_eot_time", $user->ID);
217
  $auto_eot_time = ($auto_eot_time) ? date ("D M j, Y g:i a T", $auto_eot_time) : "";
218
  echo '<th><label>Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>( based on server time )</small>' : '') . '</th>' . "\n";
219
+ echo '<td><input type="text" name="ws_plugin__s2member_profile_s2member_auto_eot_time" id="ws-plugin--s2member-profile-s2member-auto-eot-time" value="' . format_to_edit ($auto_eot_time) . '" class="regular-text" /></td>' . "\n";
220
  echo '</tr>' . "\n";
221
  /**/
222
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
223
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars ());
224
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
225
  }
226
  /**/
227
  if (ws_plugin__s2member_list_servers_integrated ()) /* Only if integrated with s2Member. */
228
  {
229
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_opt_in", get_defined_vars ());
231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
  /**/
233
  echo '<tr>' . "\n";
234
  echo '<th><label>Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
235
+ echo '<td><label><input type="checkbox" name="ws_plugin__s2member_profile_opt_in" id="ws-plugin--s2member-profile-opt-in" value="1" /> Yes, send a mailing list confirmation email to this User.</label></td>' . "\n";
236
  echo '</tr>' . "\n";
237
  /**/
238
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
239
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_opt_in", get_defined_vars ());
240
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
241
  }
242
  /**/
243
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
244
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ($level))
245
+ {
246
+ echo '<tr>' . "\n";
247
+ echo '<td colspan="2">' . "\n";
248
+ echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
249
+ echo '</td>' . "\n";
250
+ echo '</tr>' . "\n";
251
+ /**/
252
+ $fields = get_user_option ("s2member_custom_fields", $user->ID); /* Existing fields. */
253
+ /**/
254
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
255
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
256
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
257
+ /**/
258
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
259
+ {
260
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
261
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
262
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
263
+ /**/
264
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
265
+ {
266
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
267
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
268
+ /**/
269
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
270
+ if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
271
+ {
272
+ echo '<tr>' . "\n";
273
+ echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
274
+ echo '<td>' . ws_plugin__s2member_custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var]) . '</td>' . "\n";
275
+ echo '</tr>' . "\n";
276
+ }
277
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
278
+ }
279
+ /**/
280
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
281
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
282
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
283
+ }
284
+ /**/
285
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
286
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
287
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
288
+ /**/
289
+ echo '<tr>' . "\n";
290
+ echo '<td colspan="2">' . "\n";
291
+ echo '<div style="height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
292
+ echo '</td>' . "\n";
293
+ echo '</tr>' . "\n";
294
+ }
295
  /**/
296
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
297
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars ());
298
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
299
  /**/
300
  echo '<tr>' . "\n";
301
  echo '<th><label>Administrative<br />Notations:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occassionaly, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
302
+ echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" id="ws-plugin--s2member-profile-s2member-notes" rows="5" wrap="off" spellcheck="false" style="width:99%;">' . format_to_edit (get_user_option ("s2member_notes", $user->ID)) . '</textarea></td>' . "\n";
303
  echo '</tr>' . "\n";
304
  /**/
305
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
306
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars ());
307
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
308
  /**/
309
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
310
  do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
311
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
312
  /**/
318
  else if ($current_user->ID === $user->ID) /* Otherwise, a User can always edit their own Profile. */
319
  {
320
  if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Only if configured. */
321
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
322
+ {
323
+ echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
324
+ /**/
325
+ echo '<h3>Additional Profile Fields' . ( (is_multisite ()) ? ' ( for this Blog )' : '') . '</h3>' . "\n";
326
+ /**/
327
+ echo '<table class="form-table">' . "\n";
328
+ /**/
329
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
330
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars ());
331
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
332
+ /**/
333
+ $fields = get_user_option ("s2member_custom_fields", $user->ID); /* Existing fields. */
334
+ /**/
335
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
336
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars ());
337
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
338
+ /**/
339
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
340
+ {
341
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
342
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars ());
343
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
344
+ /**/
345
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
346
+ {
347
+ if ($field["editable"] !== "no-invisible") /* Uneditable/invisible? */
348
+ {
349
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
350
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
351
+ /**/
352
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
353
+ if (apply_filters ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_display", true, get_defined_vars ()))
354
+ {
355
+ echo '<tr>' . "\n";
356
+ echo '<th><label>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
357
+ echo '<td>' . ws_plugin__s2member_custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var], true) . '</td>' . "\n";
358
+ echo '</tr>' . "\n";
359
+ }
360
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
361
+ }
362
+ }
363
+ /**/
364
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
365
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars ());
366
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
367
+ }
368
+ /**/
369
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
370
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars ());
371
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
372
+ /**/
373
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
374
+ do_action ("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars ());
375
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
376
+ /**/
377
+ echo '</table>' . "\n";
378
+ /**/
379
+ echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
380
+ }
 
 
381
  }
382
  }
383
  /**/
384
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
385
  do_action ("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars ());
386
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
387
  /**/
405
  {
406
  global $current_site, $current_blog; /* Multisite Networking. */
407
  /**/
408
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
409
  do_action ("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars ());
410
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
411
  /**/
414
  /**/
415
  if ($user && $user->ID && $current_user && $current_user->ID) /* Validate both of these User objects before we even begin. */
416
  {
417
+ if (current_user_can ("edit_users") && (!is_multisite () || is_super_admin () || is_user_member_of_blog ($user->ID)))
418
  {
419
  if (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) && !empty ($_POST))
420
  {
448
  $user->add_cap ("access_s2member_ccap_" . trim (strtolower ($ccap)));
449
  }
450
  /**/
451
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
 
 
452
  {
453
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
454
  {
455
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
456
  $field_id_class = preg_replace ("/_/", "-", $field_var);
457
  /**/
458
+ $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
 
 
 
 
459
  }
460
  }
461
  /**/
462
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
463
+ /**/
464
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
465
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
466
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
467
  }
468
  }
469
  /**/
471
  {
472
  if (is_array ($_POST = ws_plugin__s2member_trim_deep (stripslashes_deep ($_POST))) && !empty ($_POST))
473
  {
474
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
475
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
476
+ {
477
+ $_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
478
+ /**/
479
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
480
+ {
481
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
482
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
483
+ /**/
484
+ if (!in_array ($field["id"], $fields_applicable) || preg_match ("/^no/", $field["editable"]))
485
+ $fields[$field_var] = $_existing_fields[$field_var];
486
+ /**/
487
+ else if ($field["required"] === "yes" && empty ($_POST["ws_plugin__s2member_profile_" . $field_var])/**/
488
+ && $_POST["ws_plugin__s2member_profile_" . $field_var] !== "0") /* Allow zeros. */
489
+ $fields[$field_var] = $_existing_fields[$field_var];
490
+ /**/
491
+ else /* Otherwise, we can use the newly updated value. */
492
+ $fields[$field_var] = $_POST["ws_plugin__s2member_profile_" . $field_var];
493
+ }
494
+ /**/
495
+ update_user_option ($user_id, "s2member_custom_fields", $fields);
496
+ }
497
+ /**/
498
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
 
 
499
  do_action ("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars ());
500
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
 
501
  }
502
  }
503
  }
504
  /**/
505
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
506
  do_action ("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars ());
507
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
508
  }
includes/functions/utilities.inc.php CHANGED
@@ -166,9 +166,7 @@ if (!function_exists ("ws_plugin__s2member_get"))
166
  $return = call_user_func ($function);
167
  }
168
  /**/
169
- $echo = ob_get_contents ();
170
- /**/
171
- ob_end_clean ();
172
  /**/
173
  return (!strlen ($echo) && strlen ($return)) ? $return : $echo;
174
  }
@@ -177,6 +175,20 @@ if (!function_exists ("ws_plugin__s2member_get"))
177
  }
178
  }
179
  /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  Function escapes double quotes.
181
  */
182
  if (!function_exists ("ws_plugin__s2member_esc_dq"))
@@ -369,13 +381,7 @@ if (!function_exists ("ws_plugin__s2member_get_singular_ids_with_ccaps_req"))
369
  {
370
  foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
371
  {
372
- if (!$result->meta_value) /* Empty? */
373
- continue;
374
- /**/
375
- else if ($result->meta_value === 'a:1:{i:0;s:0:"";}')
376
- continue; /* An empty array? */
377
- /**/
378
- else if (!$user) /* Optimization. Saves time when NOT even logged into the site. */
379
  $ids[] = $result->post_id; /* There's no way to satisfy anything here. */
380
  /**/
381
  else if (is_array ($ccaps = @unserialize ($result->meta_value)))
@@ -713,4 +719,32 @@ if (!function_exists ("ws_plugin__s2member_highlight_php"))
713
  return '<span style="color:#164A61;">' . $m[0] . '</span>';
714
  }
715
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
716
  ?>
166
  $return = call_user_func ($function);
167
  }
168
  /**/
169
+ $echo = ob_get_clean ();
 
 
170
  /**/
171
  return (!strlen ($echo) && strlen ($return)) ? $return : $echo;
172
  }
175
  }
176
  }
177
  /*
178
+ Function evaluates PHP code, and returns the output afterward.
179
+ */
180
+ if (!function_exists ("ws_plugin__s2member_eval"))
181
+ {
182
+ function ws_plugin__s2member_eval ($code = FALSE)
183
+ {
184
+ ob_start (); /* Output buffer. */
185
+ /**/
186
+ eval ("?>" . trim ($code));
187
+ /**/
188
+ return ob_get_clean ();
189
+ }
190
+ }
191
+ /*
192
  Function escapes double quotes.
193
  */
194
  if (!function_exists ("ws_plugin__s2member_esc_dq"))
381
  {
382
  foreach ($results as $result) /* Now we need to check Custom Capabilities against $user. */
383
  {
384
+ if (!$user) /* Optimization. Saves time when NOT even logged into the site. */
 
 
 
 
 
 
385
  $ids[] = $result->post_id; /* There's no way to satisfy anything here. */
386
  /**/
387
  else if (is_array ($ccaps = @unserialize ($result->meta_value)))
719
  return '<span style="color:#164A61;">' . $m[0] . '</span>';
720
  }
721
  }
722
+ /*
723
+ Retrieves a field value. Also supports Custom Fields.
724
+ */
725
+ if (!function_exists ("ws_plugin__s2member_get_user_field"))
726
+ {
727
+ function ws_plugin__s2member_get_user_field ($field_id = FALSE, $user_id = FALSE)
728
+ {
729
+ if (is_object ($user = ($user_id) ? new WP_User ($user_id) : wp_get_current_user ()) && ($user_id = $user->ID))
730
+ {
731
+ if (preg_match ("/^(first_name|First Name)$/i", $field_id))
732
+ return $user->first_name;
733
+ /**/
734
+ else if (preg_match ("/^(last_name|Last Name)$/i", $field_id))
735
+ return $user->last_name;
736
+ /**/
737
+ else if (preg_match ("/^(email|E-mail|Email Address|E-mail Address)$/i", $field_id))
738
+ return $user->user_email;
739
+ /**/
740
+ else if (isset ($user->$field_id))
741
+ return $user->$field_id;
742
+ /**/
743
+ else if (is_array ($fields = get_user_option ("s2member_custom_fields", $user_id)))
744
+ return $fields[preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field_id))];
745
+ }
746
+ /**/
747
+ return false;
748
+ }
749
+ }
750
  ?>
includes/hooks.inc.php CHANGED
@@ -59,6 +59,7 @@ add_filter ("pre_site_option_add_new_users", "ws_plugin__s2member_mms_allow_new_
59
  add_filter ("pre_site_option_dashboard_blog", "ws_plugin__s2member_mms_dashboard_blog");
60
  add_filter ("pre_option_users_can_register", "ws_plugin__s2member_check_register_access");
61
  add_filter ("pre_site_option_registration", "ws_plugin__s2member_check_mms_register_access");
 
62
  /**/
63
  add_action ("user_register", "ws_plugin__s2member_configure_user_registration");
64
  add_action ("register_form", "ws_plugin__s2member_custom_registration_fields");
59
  add_filter ("pre_site_option_dashboard_blog", "ws_plugin__s2member_mms_dashboard_blog");
60
  add_filter ("pre_option_users_can_register", "ws_plugin__s2member_check_register_access");
61
  add_filter ("pre_site_option_registration", "ws_plugin__s2member_check_mms_register_access");
62
+ add_filter ("bp_core_get_site_options", "ws_plugin__s2member_check_bp_mms_register_access");
63
  /**/
64
  add_action ("user_register", "ws_plugin__s2member_configure_user_registration");
65
  add_action ("register_form", "ws_plugin__s2member_custom_registration_fields");
includes/menu-pages/code-samples/sc-s2-conditional-supplements-1.php CHANGED
@@ -25,4 +25,7 @@
25
  `Hi there John.
26
  You have a Gold Membership.`
27
 
 
 
 
28
  [/s2If]
25
  `Hi there John.
26
  You have a Gold Membership.`
27
 
28
+ Here is a Custom Field value:
29
+ [s2Get user_field="country_code" /]
30
+
31
  [/s2If]
includes/menu-pages/info.inc.php CHANGED
@@ -30,7 +30,7 @@ echo '<td class="ws-menu-page-table-l">' . "\n";
30
  /**/
31
  echo '<img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-icon.png" class="ws-menu-page-brand-icon" alt="." />' . "\n";
32
  /**/
33
- echo '<a href="' . ws_plugin__s2member_parse_readme_value ("Plugin URI") . '?check_ver=' . urlencode (ws_plugin__s2member_parse_readme_value ("Version")) . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-updates.png" class="ws-menu-page-brand-updates" alt="." /></a>' . "\n";
34
  /**/
35
  do_action ("ws_plugin__s2member_during_info_page_before_left_sections", get_defined_vars ());
36
  /**/
30
  /**/
31
  echo '<img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-icon.png" class="ws-menu-page-brand-icon" alt="." />' . "\n";
32
  /**/
33
+ echo '<a href="' . ws_plugin__s2member_parse_readme_value ("Plugin URI") . '?c_check_ver=' . urlencode (ws_plugin__s2member_parse_readme_value ("Version")) . '" target="_blank"><img src="' . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . '/images/brand-updates.png" class="ws-menu-page-brand-updates" alt="." /></a>' . "\n";
34
  /**/
35
  do_action ("ws_plugin__s2member_during_info_page_before_left_sections", get_defined_vars ());
36
  /**/
includes/menu-pages/jquery-ui-effects.js ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery UI Effects 1.8.5
3
+ *
4
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5
+ * Dual licensed under the MIT or GPL Version 2 licenses.
6
+ * http://jquery.org/license
7
+ *
8
+ * http://docs.jquery.com/UI/Effects/
9
+ */
10
+ jQuery.effects||function(f,j){function l(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
11
+ 16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return m.transparent;return m[f.trim(c).toLowerCase()]}function r(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return l(b)}function n(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
12
+ a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function o(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in s||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function t(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
13
+ a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=r(b.elem,a);b.end=l(b.end);b.colorInit=
14
+ true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var m={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,
15
+ 183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,
16
+ 165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},p=["add","remove","toggle"],s={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=o(n.call(this)),q,u=e.attr("className");f.each(p,function(v,
17
+ i){c[i]&&e[i+"Class"](c[i])});q=o(n.call(this));e.attr("className",u);e.animate(t(h,q),a,b,function(){f.each(p,function(v,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?
18
+ f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.5",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==
19
+ null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();
20
+ var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});
21
+ c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c||
22
+ typeof c=="number"||f.fx.speeds[c]||!f.effects[c])return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||!f.effects[c])return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||!f.effects[c]||typeof c==
23
+ "boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,
24
+ a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=
25
+ e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+
26
+ b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/
27
+ 2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*
28
+ a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;
29
+ return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,
30
+ a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
31
+ ;/*
32
+ * jQuery UI Effects Blind 1.8.5
33
+ *
34
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
35
+ * Dual licensed under the MIT or GPL Version 2 licenses.
36
+ * http://jquery.org/license
37
+ *
38
+ * http://docs.jquery.com/UI/Effects/Blind
39
+ *
40
+ * Depends:
41
+ * jquery.effects.core.js
42
+ */
43
+ (function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","left"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,g);b.effects.removeWrapper(a);
44
+ c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
45
+ ;/*
46
+ * jQuery UI Effects Bounce 1.8.5
47
+ *
48
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
49
+ * Dual licensed under the MIT or GPL Version 2 licenses.
50
+ * http://jquery.org/license
51
+ *
52
+ * http://docs.jquery.com/UI/Effects/Bounce
53
+ *
54
+ * Depends:
55
+ * jquery.effects.core.js
56
+ */
57
+ (function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","left"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
58
+ 3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
59
+ b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
60
+ ;/*
61
+ * jQuery UI Effects Clip 1.8.5
62
+ *
63
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
64
+ * Dual licensed under the MIT or GPL Version 2 licenses.
65
+ * http://jquery.org/license
66
+ *
67
+ * http://docs.jquery.com/UI/Effects/Clip
68
+ *
69
+ * Depends:
70
+ * jquery.effects.core.js
71
+ */
72
+ (function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","left","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,c/2)}var h={};h[g.size]=
73
+ f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
74
+ ;/*
75
+ * jQuery UI Effects Drop 1.8.5
76
+ *
77
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
78
+ * Dual licensed under the MIT or GPL Version 2 licenses.
79
+ * http://jquery.org/license
80
+ *
81
+ * http://docs.jquery.com/UI/Effects/Drop
82
+ *
83
+ * Depends:
84
+ * jquery.effects.core.js
85
+ */
86
+ (function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","left","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e=="show"?1:
87
+ 0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
88
+ ;/*
89
+ * jQuery UI Effects Explode 1.8.5
90
+ *
91
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
92
+ * Dual licensed under the MIT or GPL Version 2 licenses.
93
+ * http://jquery.org/license
94
+ *
95
+ * http://docs.jquery.com/UI/Effects/Explode
96
+ *
97
+ * Depends:
98
+ * jquery.effects.core.js
99
+ */
100
+ (function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
101
+ 0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
102
+ e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
103
+ ;/*
104
+ * jQuery UI Effects Fade 1.8.5
105
+ *
106
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
107
+ * Dual licensed under the MIT or GPL Version 2 licenses.
108
+ * http://jquery.org/license
109
+ *
110
+ * http://docs.jquery.com/UI/Effects/Fade
111
+ *
112
+ * Depends:
113
+ * jquery.effects.core.js
114
+ */
115
+ (function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
116
+ ;/*
117
+ * jQuery UI Effects Fold 1.8.5
118
+ *
119
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
120
+ * Dual licensed under the MIT or GPL Version 2 licenses.
121
+ * http://jquery.org/license
122
+ *
123
+ * http://docs.jquery.com/UI/Effects/Fold
124
+ *
125
+ * Depends:
126
+ * jquery.effects.core.js
127
+ */
128
+ (function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","left"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],10)/100*
129
+ f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
130
+ ;/*
131
+ * jQuery UI Effects Highlight 1.8.5
132
+ *
133
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
134
+ * Dual licensed under the MIT or GPL Version 2 licenses.
135
+ * http://jquery.org/license
136
+ *
137
+ * http://docs.jquery.com/UI/Effects/Highlight
138
+ *
139
+ * Depends:
140
+ * jquery.effects.core.js
141
+ */
142
+ (function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
143
+ this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
144
+ ;/*
145
+ * jQuery UI Effects Pulsate 1.8.5
146
+ *
147
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
148
+ * Dual licensed under the MIT or GPL Version 2 licenses.
149
+ * http://jquery.org/license
150
+ *
151
+ * http://docs.jquery.com/UI/Effects/Pulsate
152
+ *
153
+ * Depends:
154
+ * jquery.effects.core.js
155
+ */
156
+ (function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
157
+ a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
158
+ ;/*
159
+ * jQuery UI Effects Scale 1.8.5
160
+ *
161
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
162
+ * Dual licensed under the MIT or GPL Version 2 licenses.
163
+ * http://jquery.org/license
164
+ *
165
+ * http://docs.jquery.com/UI/Effects/Scale
166
+ *
167
+ * Depends:
168
+ * jquery.effects.core.js
169
+ */
170
+ (function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
171
+ b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
172
+ 1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","left","width","height","overflow","opacity"],g=["position","top","left","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=c.effects.setMode(a,
173
+ b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};if(m=="box"||m=="both"){if(d.from.y!=
174
+ d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);a.css("overflow","hidden").css(a.from);
175
+ if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);child.to=c.effects.setTransition(child,
176
+ f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,n?e:g);c.effects.removeWrapper(a);b.callback&&
177
+ b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
178
+ ;/*
179
+ * jQuery UI Effects Shake 1.8.5
180
+ *
181
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
182
+ * Dual licensed under the MIT or GPL Version 2 licenses.
183
+ * http://jquery.org/license
184
+ *
185
+ * http://docs.jquery.com/UI/Effects/Shake
186
+ *
187
+ * Depends:
188
+ * jquery.effects.core.js
189
+ */
190
+ (function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","left"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=(h=="pos"?"-=":"+=")+
191
+ e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
192
+ ;/*
193
+ * jQuery UI Effects Slide 1.8.5
194
+ *
195
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
196
+ * Dual licensed under the MIT or GPL Version 2 licenses.
197
+ * http://jquery.org/license
198
+ *
199
+ * http://docs.jquery.com/UI/Effects/Slide
200
+ *
201
+ * Depends:
202
+ * jquery.effects.core.js
203
+ */
204
+ (function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?
205
+ "+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
206
+ ;/*
207
+ * jQuery UI Effects Transfer 1.8.5
208
+ *
209
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
210
+ * Dual licensed under the MIT or GPL Version 2 licenses.
211
+ * http://jquery.org/license
212
+ *
213
+ * http://docs.jquery.com/UI/Effects/Transfer
214
+ *
215
+ * Depends:
216
+ * jquery.effects.core.js
217
+ */
218
+ (function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
219
+ b.dequeue()})})}})(jQuery);
220
+ ;
includes/menu-pages/json-functions.js ADDED
@@ -0,0 +1 @@
 
1
+ if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());
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};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$/,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/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$/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(/\:+$/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}}}}}}});
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};if(b("input#ws-plugin--s2member-custom-reg-fields").length&&b("div#ws-plugin--s2member-custom-reg-field-configuration").length){(function(){var c=b("input#ws-plugin--s2member-custom-reg-fields");var f=b("div#ws-plugin--s2member-custom-reg-field-configuration");var l=(c.val())?JSON.parse(c.val()):[];l=(l instanceof Array)?l:[];var k='<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>';var r='<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';f.html(k+r);var i=b("div#ws-plugin--s2member-custom-reg-field-configuration-tools");var o=b("table#ws-plugin--s2member-custom-reg-field-configuration-table");ws_plugin__s2member_customRegFieldTypeChange=function(t){var s,v,u=b(t).val();s="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options";v="tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected";if(u.match(/^(text|textarea|checkbox|pre_checkbox)$/)){b(s).css("display","none"),b(s).prev("tr").css("display","none")}else{b(s).css("display",""),b(s).prev("tr").css("display","")}if(u.match(/^(select|selects|checkboxes|radios)$/)){b(v).css("display","none"),b(v).prev("tr").css("display","none")}else{b(v).css("display",""),b(v).prev("tr").css("display","")}};ws_plugin__s2member_customRegFieldDelete=function(t){var s=new Array();for(var u=0;u<l.length;u++){if(u!==t){s.push(l[u])}}l=s,q(),p()};ws_plugin__s2member_customRegFieldMoveUp=function(u){if(typeof l[u]==="object"&&typeof l[u-1]==="object"){var t=l[u-1],s=l[u];l[u-1]=s,l[u]=t;q(),p()}};ws_plugin__s2member_customRegFieldMoveDown=function(u){if(typeof l[u]==="object"&&typeof l[u+1]==="object"){var s=l[u+1],t=l[u];l[u+1]=t,l[u]=s;q(),p()}};ws_plugin__s2member_customRegFieldCreate=function(){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),t={};b(':input[property!=""]',s).each(function(){var v=b(this),u=v.attr("property"),w=b.trim(v.val());t[u]=w});if((t=d(t))){l.push(t),q(),j(),p(),n();setTimeout(function(){var u="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+(l.length-1);alert('Field created successfully.\n* Remember to "Save Changes".');b(u).effect("highlight",1000)},500)}};ws_plugin__s2member_customRegFieldUpdate=function(t){var s=b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form"),u={};b(':input[property!=""]',s).each(function(){var x=b(this),w=x.attr("property"),y=b.trim(x.val());u[w]=y});if((u=d(u,t))){l[t]=u,q(),j(),p(),n();var v="tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-"+t;b(v).effect("highlight",1000)}};ws_plugin__s2member_customRegFieldAdd=function(){j(true)};ws_plugin__s2member_customRegFieldEdit=function(s){j(false,s),n()};ws_plugin__s2member_customRegFieldCancel=function(){j(),n()};var d=function(w,u){var s=(typeof u==="number"&&typeof l[u]==="object")?true:false,x=[],t,v;if(typeof w!=="object"){x.push("Invalid field object. Please try again.")}else{if(!w.id){x.push("Unique Field ID:\nThis is required. Please try again.")}else{if(h(w.id)&&(!s||w.id!==l[u].id)){x.push("Unique Field ID:\nThat Field ID already exists. Please try again.")}}if(!w.label){x.push("Field Label/Description:\nThis is required. Please try again.")}if(w.type.match(/^(select|selects|checkboxes|radios)$/)){w.expected="";if(!w.options){x.push("Option Configuration File:\nThis is required. Please try again.")}else{t=w.options.split(/[\r\n]+/);for(v=0;v<t.length;v++){t[v]=b.trim(t[v]);if(!t[v].match(/^([^\|]*)(\|)([^\|]*)(\|default)?$/)){x.push("Option Configuration File:\nInvalid configuration at line #"+(v+1)+".");break}}w.options=b.trim(t.join("\n"))}}else{w.options=""}if(!(w.levels=w.levels.replace(/ /g,""))){x.push("Applicable Levels:\nThis is required. Please try again.")}else{if(!w.levels.match(/^(all|[0-9,]+)$/)){x.push("Applicable Levels:\nShould be comma delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )")}}if(w.classes&&w.classes.match(/[^a-z 0-9 _ \-]/i)){x.push("CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )")}if(w.styles&&w.styles.match(/["\=\>\<]/)){x.push('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )')}if(w.attrs&&w.attrs.match(/[\>\<]/)){x.push("Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )")}}if(x.length>0){alert(x.join("\n\n"));return false}else{return w}};var q=function(){c.val(((l.length>0)?JSON.stringify(l):""))};var m=function(s){return(typeof s==="string")?b.trim(s).toLowerCase().replace(/[^a-z0-9]/g,"_"):""};var g=function(t){var s={text:"Text ( single line )",textarea:"Textarea ( multi-line )",select:"Select Menu ( drop-down )",selects:"Select Menu ( multi-option )",checkbox:"Checkbox ( single )",pre_checkbox:"Checkbox ( pre-checked )",checkboxes:"Checkboxes ( multi-option )",radios:"Radio Buttons ( multi-option )"};if(typeof s[t]==="string"){return s[t]}return""};var h=function(s){for(var t=0;t<l.length;t++){if(l[t].id===s){return true}}};var n=function(){scrollTo(0,b("div.ws-plugin--s2member-custom-reg-fields-section").offset()["top"]-100)};var j=function(s,A){var x=0,z="",t="",D=0,y=0,v={id:"",label:"",type:"text",options:"",expected:"",required:"yes",levels:"all",editable:"yes",classes:"",styles:"",attrs:""};var u=(typeof A==="number"&&typeof l[A]==="object")?true:false,C=(s||u)?true:false,B=(u)?l[A]:v;z+='<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>';tb_remove(),b("div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form").remove();if(C){t+='<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';t+='<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';t+="<tbody>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<td colspan="2">';t+='<select property="type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';t+='<option value="text"'+((B.type==="text")?' selected="selected"':"")+'">'+esc_html(g("text"))+"</option>";t+='<option value="textarea"'+((B.type==="textarea")?' selected="selected"':"")+'">'+esc_html(g("textarea"))+"</option>";t+='<option value="select"'+((B.type==="select")?' selected="selected"':"")+'">'+esc_html(g("select"))+"</option>";t+='<option value="selects"'+((B.type==="selects")?' selected="selected"':"")+'">'+esc_html(g("selects"))+"</option>";t+='<option value="checkbox"'+((B.type==="checkbox")?' selected="selected"':"")+'">'+esc_html(g("checkbox"))+"</option>";t+='<option value="pre_checkbox"'+((B.type==="pre_checkbox")?' selected="selected"':"")+'">'+esc_html(g("pre_checkbox"))+"</option>";t+='<option value="checkboxes"'+((B.type==="checkboxes")?' selected="selected"':"")+'">'+esc_html(g("checkboxes"))+"</option>";t+='<option value="radios"'+((B.type==="radios")?' selected="selected"':"")+'">'+esc_html(g("radios"))+"</option>";t+="</select>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';t+='<td colspan="2">';t+='<input type="text" property="label" value="'+a(B.label)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" /><br />';t+="<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';t+='<td colspan="2">';t+='<input type="text" property="id" value="'+a(B.id)+'" maxlength="25" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" /><br />';t+="<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />";t+='<small>e.g. <code>&lt;?php echo get_user_field("country_code"); ?&gt;</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<td colspan="2">';t+='<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';t+='<option value="yes"'+((B.required==="yes")?' selected="selected"':"")+'">Yes ( required )</option>';t+='<option value="no"'+((B.required==="no")?' selected="selected"':"")+'">No ( optional )</option>';t+="</select><br />";t+='<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';t+="<small>* Administrators are exempt from this requirement.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';t+="<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"'+((B.type.match(/^(text|textarea|checkbox|pre_checkbox)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<textarea property="options" rows="3" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">'+esc_html(B.options)+"</textarea><br />";t+="Here is a quick example:<br />";t+="<small>You can also specify a <em>default</em> option:</small><br />";t+="<code>US|United States|default</code><br />";t+="<code>CA|Canada</code><br />";t+="<code>VI|Virgin Islands (U.S.)</code>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+'><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"'+((B.type.match(/^(select|selects|checkboxes|radios)$/))?' style="display:none;"':"")+">";t+='<td colspan="2">';t+='<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';t+='<option value=""'+((B.expected==="")?' selected="selected"':"")+'">Anything Goes</option>';t+='<option disabled="disabled"></option>';t+='<optgroup label="Specific Input Types">';t+='<option value="numeric-wp-commas"'+((B.expected==="numeric-wp-commas")?' selected="selected"':"")+'">Numeric ( with or without decimals, commas allowed )</option>';t+='<option value="numeric"'+((B.expected==="numeric")?' selected="selected"':"")+'">Numeric ( with or without decimals, no commas )</option>';t+='<option value="integer"'+((B.expected==="integer")?' selected="selected"':"")+'">Integer ( whole number, without any decimals )</option>';t+='<option value="integer-gt-0"'+((B.expected==="integer-gt-0")?' selected="selected"':"")+'">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';t+='<option value="float"'+((B.expected==="float")?' selected="selected"':"")+'">Float ( floating point number, decimals required )</option>';t+='<option value="float-gt-0"'+((B.expected==="float-gt-0")?' selected="selected"':"")+'">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';t+='<option value="date"'+((B.expected==="date")?' selected="selected"':"")+'">Date ( required date format: dd/mm/yyyy )</option>';t+='<option value="email"'+((B.expected==="email")?' selected="selected"':"")+'">Email ( require valid email )</option>';t+='<option value="url"'+((B.expected==="url")?' selected="selected"':"")+'">Full URL ( starting with http or https )</option>';t+='<option value="domain"'+((B.expected==="domain")?' selected="selected"':"")+'">Domain Name ( domain name only, without http )</option>';t+='<option value="phone"'+((B.expected==="phone")?' selected="selected"':"")+'">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';t+='<option value="uszip"'+((B.expected==="uszip")?' selected="selected"':"")+'">US Zipcode ( 5-9 digits w/possible hyphen )</option>';t+='<option value="cazip"'+((B.expected==="cazip")?' selected="selected"':"")+'">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';t+='<option value="uczip"'+((B.expected==="uczip")?' selected="selected"':"")+'">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Any Character Combination">';for(x=1;x<=25;x++){t+='<option value="any-'+x+'"'+((B.expected==="any-"+x)?' selected="selected"':"")+'">Any Character Combination ( '+x+" character minimum )</option>";t+='<option value="any-'+x+'-e"'+((B.expected==="any-"+x+"-e")?' selected="selected"':"")+'">Any Character Combination ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-punctuation-'+x+'"'+((B.expected==="alphanumerics-spaces-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-spaces-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics, Spaces &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Spaces Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-spaces-'+x+'"'+((B.expected==="alphanumerics-spaces-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-spaces-'+x+'-e"'+((B.expected==="alphanumerics-spaces-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Spaces ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics &amp; Punctuation Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-punctuation-'+x+'"'+((B.expected==="alphanumerics-punctuation-"+x)?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-punctuation-'+x+'-e"'+((B.expected==="alphanumerics-punctuation-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics &amp; Punctuation ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphanumerics Only">';for(x=1;x<=25;x++){t+='<option value="alphanumerics-'+x+'"'+((B.expected==="alphanumerics-"+x)?' selected="selected"':"")+'">Alphanumerics ( '+x+" character minimum )</option>";t+='<option value="alphanumerics-'+x+'-e"'+((B.expected==="alphanumerics-"+x+"-e")?' selected="selected"':"")+'">Alphanumerics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Alphabetics Only">';for(x=1;x<=25;x++){t+='<option value="alphabetics-'+x+'"'+((B.expected==="alphabetics-"+x)?' selected="selected"':"")+'">Alphabetics ( '+x+" character minimum )</option>";t+='<option value="alphabetics-'+x+'-e"'+((B.expected==="alphabetics-"+x+"-e")?' selected="selected"':"")+'">Alphabetics ( exactly '+x+" character"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+='<option disabled="disabled"></option>';t+='<optgroup label="Numeric Digits Only">';for(x=1;x<=25;x++){t+='<option value="numerics-'+x+'"'+((B.expected==="numerics-"+x)?' selected="selected"':"")+'">Numeric Digits ( '+x+" digit minimum )</option>";t+='<option value="numerics-'+x+'-e"'+((B.expected==="numerics-"+x+"-e")?' selected="selected"':"")+'">Numeric Digits ( exactly '+x+" digit"+((x>1)?"s":"")+" )</option>"}t+="</optgroup>";t+="</select><br />";t+="<small>Only Users/Members will be required to meet this criteria.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';t+='<td colspan="2">';t+='<input type="text" property="levels" value="'+a(B.levels)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" /><br />';t+="<small>Please use comma-delimited Level #'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />";t+="<small>This allows you to enable this field - only at specific Membership Levels.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<td colspan="2">';t+='<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';t+='<option value="yes"'+((B.editable==="yes")?' selected="selected"':"")+'">Yes ( editable )</option>';t+='<option value="no"'+((B.editable==="no")?' selected="selected"':"")+'">No ( uneditable after registration )</option>';t+='<option value="no-invisible"'+((B.editable==="no-invisible")?' selected="selected"':"")+'">No ( uneditable &amp; totally invisible )</option>';t+="</select><br />";t+="<small>If <code>No</code>, this field will be un-editable after registration.</small><br />";t+="<small>* Administrators are exempt from this.</small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';t+='<td colspan="2">';t+='<input type="text" property="classes" value="'+a(B.classes)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" /><br />';t+="<small>Example: <code>my-style-1 my-style-2</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';t+='<td colspan="2">';t+='<input type="text" property="styles" value="'+a(B.styles)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" /><br />';t+="<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>";t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';t+='<td colspan="2">';t+='<input type="text" property="attrs" value="'+a(B.attrs)+'" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" /><br />';t+='<small>Example: <code>onkeyup="" onblur=""</code></small>';t+="</td>";t+="</tr>";t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';t+='<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';t+='<td align="left">';t+='<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';t+="</td>";t+='<td align="right">';t+='<input type="button" value="'+((u)?"Update This Field":"Create Registration Field")+'" onclick="'+((u)?"ws_plugin__s2member_customRegFieldUpdate("+A+");":"ws_plugin__s2member_customRegFieldCreate();")+'" />';t+="</td>";t+="</tr>";t+="</tbody>";t+="</table>";t+="<div>";b("body").append(t);tb_show(((u)?"Editing Registration Field":"New Custom Registration Field"),"#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form");b(window).trigger("resize"),b("table#ws-plugin--s2member-custom-reg-field-configuration-tools-form").show()}i.html(z)};var e=function(){b(window).resize(function(){var s,t;s=b(window).width(),t=b(window).height(),s=(s>720)?720:s;b("#TB_ajaxContent").css({width:s-50,height:t-75,margin:0,padding:0})})};var p=function(){var s=l.length,v=0,w,u="",t="o";u+="<tbody>";u+="<tr>";u+="<th>Order</th>";u+="<th>Field Type</th>";u+="<th>Unique ID</th>";u+="<th>Required</th>";u+="<th>Levels</th>";u+="<th>- Tools -</th>";u+="</tr>";if(l.length>0){for(v=0;v<l.length;v++){t=(t==="o")?"e":"o";w=l[v];u+='<tr class="'+a(t)+" ws-plugin--s2member-custom-reg-field-configuration-table-row-"+v+'">';u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown('+v+'); return false;"></a></td>';u+='<td nowrap="nowrap">'+esc_html(g(w.type))+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.id)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.required)+"</td>";u+='<td nowrap="nowrap">'+esc_html(w.levels)+"</td>";u+='<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit('+v+'); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete('+v+'); return false;"></a></td>';u+="</tr>"}}else{u+="<tr>";u+='<td colspan="6">No Custom Fields are configured.</td>';u+="</tr>"}u+="</tbody>";o.html(u)};j(),e(),p()})()}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$/,"/unchecked.png"))}else{if(f==1){d.css("display",""),c.attr("src",c.attr("src").replace(/\/unchecked\.png$/,"/checked.png"))}else{if(f==2){d.css("display",""),c.attr("src",c.attr("src").replace(/\/checked\.png$/,"/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$/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" /]',r="",u={};u.level0='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]); ?>';u.level1='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"]); ?>';u.level2='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"]); ?>';u.level3='<?php echo ws_plugin__s2member_esc_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"]); ?>';u.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=u["level"+h].replace(/"/g,"");var p=b("input#ws-plugin--s2member-"+f+"-trial-amount").val().replace(/[^0-9\.]/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 t=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[0].replace(/[^0-9]/g,"");var v=b("select#ws-plugin--s2member-"+f+"-term").val().split("-")[1].replace(/[^A-Z]/g,"");var s=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=(s==="BN")?"0":d;p=(!p||isNaN(p)||p<0.01||d<=0)?"0":p;var q=(s==="BN"&&v!=="L")?h+":"+n+":"+t+" "+v:h+":"+n;q=q.replace(/\:+$/g,"");if(p&&(isNaN(p)||p<0)){alert("Oops, a slight problem:\n\nWhen provided, Trial Amount must be >= 0.00");return false}else{if(p&&p>10000){alert("Oops, a slight problem:\n\nMaximum Trial Amount is: 10000.00");return false}else{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;(s==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick$3")):null;(s==="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="(src|sra|a1|p1|t1|a3|p3|t3)" value\="(.*?)" \/\>)/g," <!--$1-->")):null;(s!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="cmd" value\=")(.*?)(" \/\>)/g," $1_xclick-subscriptions$3")):null;(s!=="BN")?g.val(g.val().replace(/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g," <!--$1-->")):null;r+='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"]); ?>"';r+=' ta="'+a(p)+'" tp="'+a(d)+'" tt="'+a(j)+'" ra="'+a(m)+'" rp="'+a(t)+'" rt="'+a(v)+'" rr="'+a(s)+'"';r+=(f==="modification")?' modify="1"':"";o.val(c.replace(/%%attrs%%/,r));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(q)+'"'));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(s)+'"'));g.val(g.val().replace(/ name\="a1" value\="(.*?)"/,' name="a1" value="'+a(p)+'"'));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(t)+'"'));g.val(g.val().replace(/ name\="t3" value\="(.*?)"/,' name="t3" value="'+a(v)+'"'));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.css ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
3
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
4
+
5
+ Released under the terms of the GNU General Public License.
6
+ You should have received a copy of the GNU General Public License,
7
+ along with this software. In the main directory, see: /licensing/
8
+ If not, see: <http://www.gnu.org/licenses/>.
9
+ */
10
+ /*
11
+ These CSS selectors are all specific to this software.
12
+ These are for Custom Reg Field configuration.
13
+ -specifically for the tools.
14
+ */
15
+ div#ws-plugin--s2member-custom-reg-field-configuration-tools > a
16
+ {
17
+ display: block;
18
+ padding: 0 0 0 20px;
19
+ background: url('<?php echo $i; ?>/add-icon.png') no-repeat center left;
20
+ }
21
+ div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form > table
22
+ {
23
+ display: none; /* Hide until it's inside thickbox. */
24
+ }
25
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form
26
+ {
27
+ width: 95%;
28
+ margin: 2.5%;
29
+ }
30
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form label
31
+ {
32
+ color: #164A61;
33
+ }
34
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form input[type = "text"],
35
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form textarea,
36
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form select
37
+ {
38
+ font-size: 11px;
39
+ padding: 3px;
40
+ }
41
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form input[type = "text"],
42
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form select
43
+ {
44
+ height: 2em;
45
+ }
46
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form input[type = "text"],
47
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form textarea
48
+ {
49
+ width: 99%;
50
+ }
51
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form select
52
+ {
53
+ width: 100%;
54
+ }
55
+ table#ws-plugin--s2member-custom-reg-field-configuration-tools-form select option
56
+ {
57
+ padding: 1px;
58
+ }
59
+ tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer td
60
+ {
61
+ height: 1px;
62
+ padding: 2px 0 2px 0;
63
+ }
64
+ /*
65
+ These CSS selectors are all specific to this software.
66
+ These are for Custom Reg Field configuration.
67
+ -specifically for the table.
68
+ */
69
+ table#ws-plugin--s2member-custom-reg-field-configuration-table
70
+ {
71
+ width: 100%;
72
+ -moz-border-radius: 3px;
73
+ -webkit-border-radius: 3px;
74
+ border-radius: 3px;
75
+ border: 1px solid transparent;
76
+ }
77
+ table#ws-plugin--s2member-custom-reg-field-configuration-table th
78
+ {
79
+ font-weight: bold;
80
+ }
81
+ table#ws-plugin--s2member-custom-reg-field-configuration-table tr.e
82
+ {
83
+ background-color: #EEEEEE;
84
+ }
85
+ a.ws-plugin--s2member-custom-reg-field-configuration-move-up,
86
+ a.ws-plugin--s2member-custom-reg-field-configuration-move-down,
87
+ a.ws-plugin--s2member-custom-reg-field-configuration-edit,
88
+ a.ws-plugin--s2member-custom-reg-field-configuration-delete
89
+ {
90
+ width: 16px;
91
+ height: 16px;
92
+ margin: 0 5px 0 5px;
93
+ display: inline-block;
94
+ }
95
+ a.ws-plugin--s2member-custom-reg-field-configuration-move-up
96
+ {
97
+ background: url('<?php echo $i; ?>/arrow-up-icon.png') no-repeat;
98
+ }
99
+ a.ws-plugin--s2member-custom-reg-field-configuration-move-down
100
+ {
101
+ background: url('<?php echo $i; ?>/arrow-down-icon.png') no-repeat;
102
+ }
103
+ a.ws-plugin--s2member-custom-reg-field-configuration-edit
104
+ {
105
+ background: url('<?php echo $i; ?>/edit-icon.png') no-repeat;
106
+ }
107
+ a.ws-plugin--s2member-custom-reg-field-configuration-delete
108
+ {
109
+ background: url('<?php echo $i; ?>/delete-icon.png') no-repeat;
110
+ }
includes/menu-pages/menu-pages-s.js CHANGED
@@ -75,6 +75,637 @@ jQuery (document).ready (function($)
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. */
@@ -156,20 +787,37 @@ jQuery (document).ready (function($)
156
  /**/
157
  var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
158
  var label = labels['level' + level].replace (/"/g, ""); /* Labels may NOT contain any double-quotes. */
 
 
159
  var trialPeriod = $ ('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
160
  var trialTerm = $ ('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
 
161
  var regAmount = $ ('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
162
  var regPeriod = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
163
  var regTerm = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
164
  var regRecur = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
 
165
  var pageStyle = $.trim ($ ('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
166
  var currencyCode = $ ('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
167
  var cCaps = $.trim ($.trim ($ ('input#ws-plugin--s2member-' + button + '-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
168
- trialPeriod = (regRecur === 'BN') ? '0' : trialPeriod; /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is NOT compatible w/ free trials. */
 
 
 
169
  var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
170
  levelCcapsPer = levelCcapsPer.replace (/\:+$/g, ''); /* Clean any trailing separators from this string. */
171
  /**/
172
- if (trialTerm === 'D' && trialPeriod > 7) /* Some validation on the Trial Period. Max days: 7. */
 
 
 
 
 
 
 
 
 
 
173
  {
174
  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.');
175
  return false;
@@ -208,7 +856,7 @@ jQuery (document).ready (function($)
208
  (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
209
  /**/
210
  shortCodeTemplateAttrs += 'level="' + esc_attr (level) + '" ccaps="' + esc_attr (cCaps) + '" desc="' + esc_attr (label) + '" ps="' + esc_attr (pageStyle) + '" cc="' + esc_attr (currencyCode) + '" ns="1" custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"';
211
- shortCodeTemplateAttrs += ' tp="' + esc_attr (trialPeriod) + '" tt="' + esc_attr (trialTerm) + '" ra="' + esc_attr (regAmount) + '" rp="' + esc_attr (regPeriod) + '" rt="' + esc_attr (regTerm) + '" rr="' + esc_attr (regRecur) + '"';
212
  shortCodeTemplateAttrs += (button === 'modification') ? ' modify="1"' : ''; /* For Modification Buttons. */
213
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
214
  /**/
@@ -220,6 +868,7 @@ jQuery (document).ready (function($)
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) + '"'));
224
  code.val (code.val ().replace (/ name\="t1" value\="(.*?)"/, ' name="t1" value="' + esc_attr (trialTerm) + '"'));
225
  code.val (code.val ().replace (/ name\="a3" value\="(.*?)"/, ' name="a3" value="' + esc_attr (regAmount) + '"'));
75
  return false;
76
  };
77
  /**/
78
+ if ($ ('input#ws-plugin--s2member-custom-reg-fields').length && $ ('div#ws-plugin--s2member-custom-reg-field-configuration').length)
79
+ {
80
+ (function() /* Wrap these routines inside a function to keep variables within relative scope. */
81
+ {
82
+ var $fields = $ ('input#ws-plugin--s2member-custom-reg-fields');
83
+ var $configuration = $ ('div#ws-plugin--s2member-custom-reg-field-configuration');
84
+ var fields = ($fields.val ()) ? JSON.parse ($fields.val ()) : []; /* Parse. */
85
+ fields = (fields instanceof Array) ? fields : []; /* Force array. */
86
+ /**/
87
+ var tools = '<div id="ws-plugin--s2member-custom-reg-field-configuration-tools"></div>';
88
+ var table = '<table id="ws-plugin--s2member-custom-reg-field-configuration-table"></table>';
89
+ /**/
90
+ $configuration.html (tools + table); /* Add tools and table to configuration. */
91
+ /**/
92
+ var $tools = $ ('div#ws-plugin--s2member-custom-reg-field-configuration-tools');
93
+ var $table = $ ('table#ws-plugin--s2member-custom-reg-field-configuration-table');
94
+ /**/
95
+ ws_plugin__s2member_customRegFieldTypeChange = function(select)
96
+ {
97
+ var tr1, tr2, type = $ (select).val (); /* Current selection. */
98
+ /**/
99
+ tr1 = 'tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-options';
100
+ tr2 = 'tr.ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected';
101
+ /**/
102
+ if (type.match (/^(text|textarea|checkbox|pre_checkbox)$/))
103
+ $ (tr1).css ('display', 'none'), $ (tr1).prev ('tr').css ('display', 'none');
104
+ else /* Otherwise we display the table row by removing the display property. */
105
+ $ (tr1).css ('display', ''), $ (tr1).prev ('tr').css ('display', '');
106
+ /**/
107
+ /**/
108
+ if (type.match (/^(select|selects|checkboxes|radios)$/))
109
+ $ (tr2).css ('display', 'none'), $ (tr2).prev ('tr').css ('display', 'none');
110
+ else /* Otherwise we display the table row by removing the display property. */
111
+ $ (tr2).css ('display', ''), $ (tr2).prev ('tr').css ('display', '');
112
+ };
113
+ /**/
114
+ ws_plugin__s2member_customRegFieldDelete = function(index)
115
+ {
116
+ var newFields = new Array (); /* Build array. */
117
+ /**/
118
+ for (var i = 0; i < fields.length; i++)
119
+ if (i !== index) /* Omit index. */
120
+ newFields.push (fields[i]);
121
+ /**/
122
+ fields = newFields, updateFields (), buildTable ();
123
+ };
124
+ /**/
125
+ ws_plugin__s2member_customRegFieldMoveUp = function(index)
126
+ {
127
+ if (typeof fields[index] === 'object' && typeof fields[index - 1] === 'object')
128
+ {
129
+ var prevFieldObj = fields[index - 1], thisFieldObj = fields[index];
130
+ /**/
131
+ fields[index - 1] = thisFieldObj, fields[index] = prevFieldObj;
132
+ /**/
133
+ updateFields (), buildTable ();
134
+ }
135
+ };
136
+ /**/
137
+ ws_plugin__s2member_customRegFieldMoveDown = function(index)
138
+ {
139
+ if (typeof fields[index] === 'object' && typeof fields[index + 1] === 'object')
140
+ {
141
+ var nextFieldObj = fields[index + 1], thisFieldObj = fields[index];
142
+ /**/
143
+ fields[index + 1] = thisFieldObj, fields[index] = nextFieldObj;
144
+ /**/
145
+ updateFields (), buildTable ();
146
+ }
147
+ };
148
+ /**/
149
+ ws_plugin__s2member_customRegFieldCreate = function()
150
+ {
151
+ var $table = $ ('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {};
152
+ /**/
153
+ $ (':input[property!=""]', $table).each (function() /* Go through each property value. */
154
+ {
155
+ var $this = $ (this), property = $this.attr ('property'), val = $.trim ($this.val ());
156
+ /**/
157
+ field[property] = val;
158
+ });
159
+ /**/
160
+ if ((field = validateField (field))) /* If it can be validated. */
161
+ {
162
+ fields.push (field), updateFields (), buildTools (), buildTable (), scrollReset ();
163
+ /**/
164
+ setTimeout (function() /* A momentary delay here for usability. */
165
+ {
166
+ var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-' + (fields.length - 1);
167
+ alert ('Field created successfully.\n* Remember to "Save Changes".');
168
+ $ (row).effect ('highlight', 1000);
169
+ }, 500);
170
+ }
171
+ };
172
+ /**/
173
+ ws_plugin__s2member_customRegFieldUpdate = function(index)
174
+ {
175
+ var $table = $ ('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form'), field = {};
176
+ /**/
177
+ $ (':input[property!=""]', $table).each (function() /* Go through each property value. */
178
+ {
179
+ var $this = $ (this), property = $this.attr ('property'), val = $.trim ($this.val ());
180
+ /**/
181
+ field[property] = val;
182
+ });
183
+ /**/
184
+ if ((field = validateField (field, index))) /* If it validates. */
185
+ {
186
+ fields[index] = field, updateFields (), buildTools (), buildTable (), scrollReset ();
187
+ /**/
188
+ var row = 'tr.ws-plugin--s2member-custom-reg-field-configuration-table-row-' + index;
189
+ $ (row).effect ('highlight', 1000);
190
+ }
191
+ };
192
+ /**/
193
+ ws_plugin__s2member_customRegFieldAdd = function() /* Add new field links. */
194
+ {
195
+ buildTools (true); /* No need to reset scroll position. */
196
+ };
197
+ /**/
198
+ ws_plugin__s2member_customRegFieldEdit = function(index) /* Edit links. */
199
+ {
200
+ buildTools (false, index), scrollReset (); /* Reset scroll position. */
201
+ };
202
+ /**/
203
+ ws_plugin__s2member_customRegFieldCancel = function() /* Cancel form. */
204
+ {
205
+ buildTools (), scrollReset (); /* Re-build without the form. */
206
+ };
207
+ /**/
208
+ var validateField = function(field, index)
209
+ {
210
+ var editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, errors = [], options, i;
211
+ /**/
212
+ if (typeof field !== 'object') /* Must be an object. */
213
+ {
214
+ errors.push ('Invalid field object. Please try again.');
215
+ }
216
+ else /* We only proceed with these other checks if field is an object. */
217
+ {
218
+ if (!field.id)
219
+ {
220
+ errors.push ('Unique Field ID:\nThis is required. Please try again.');
221
+ }
222
+ else if (fieldIdExists (field.id) && (!editing || field.id !== fields[index].id))
223
+ {
224
+ errors.push ('Unique Field ID:\nThat Field ID already exists. Please try again.');
225
+ }
226
+ /**/
227
+ if (!field.label)
228
+ {
229
+ errors.push ('Field Label/Description:\nThis is required. Please try again.');
230
+ }
231
+ /**/
232
+ if (field.type.match (/^(select|selects|checkboxes|radios)$/))
233
+ {
234
+ field.expected = ''; /* Empty this ( n/a ). */
235
+ /**/
236
+ if (!field.options)
237
+ {
238
+ errors.push ('Option Configuration File:\nThis is required. Please try again.');
239
+ }
240
+ else /* Otherwise, we need to go through each lineof the option configuration. */
241
+ {
242
+ options = field.options.split (/[\r\n]+/);
243
+ /**/
244
+ for (i = 0; i < options.length; i++)
245
+ {
246
+ options[i] = $.trim (options[i]);
247
+ /**/
248
+ if (!options[i].match (/^([^\|]*)(\|)([^\|]*)(\|default)?$/))
249
+ {
250
+ errors.push ('Option Configuration File:\nInvalid configuration at line #' + (i + 1) + '.');
251
+ break; /* Break now. There could potentially be lots of lines with errors like this. */
252
+ }
253
+ }
254
+ /**/
255
+ field.options = $.trim (options.join ('\n')); /* Cleaned. */
256
+ }
257
+ }
258
+ else /* Else there should NOT be any options associated with this type. */
259
+ {
260
+ field.options = ''; /* Force empty options. */
261
+ }
262
+ /**/
263
+ if (! (field.levels = field.levels.replace (/ /g, '')))
264
+ {
265
+ errors.push ('Applicable Levels:\nThis is required. Please try again.');
266
+ }
267
+ else if (!field.levels.match (/^(all|[0-9,]+)$/))
268
+ {
269
+ errors.push ('Applicable Levels:\nShould be comma delimited Levels, or just type: all.\n( examples: 0,1,2,3,4 or type the word: all )');
270
+ }
271
+ /**/
272
+ if (field.classes && field.classes.match (/[^a-z 0-9 _ \-]/i))
273
+ {
274
+ errors.push ('CSS Classes:\nContains invalid characters. Please try again.\n( only: alphanumerics, underscores, hyphens, spaces )');
275
+ }
276
+ /**/
277
+ if (field.styles && field.styles.match (/["\=\>\<]/))
278
+ {
279
+ errors.push ('CSS Styles:\nContains invalid characters. Please try again.\n( do NOT use these characters: = " < > )');
280
+ }
281
+ /**/
282
+ if (field.attrs && field.attrs.match (/[\>\<]/))
283
+ {
284
+ errors.push ('Other Attributes:\nContains invalid characters. Please try again.\n( do NOT use these characters: < > )');
285
+ }
286
+ }
287
+ /**/
288
+ if (errors.length > 0) /* Errors? */
289
+ {
290
+ alert (errors.join ('\n\n'));
291
+ return false;
292
+ }
293
+ else /* Return. */
294
+ return field;
295
+ };
296
+ /**/
297
+ var updateFields = function() /* Update hidden input value. */
298
+ {
299
+ $fields.val ( ( (fields.length > 0) ? JSON.stringify (fields) : ''));
300
+ };
301
+ /**/
302
+ var fieldId2Var = function(fieldId) /* Convert ids to variables. */
303
+ {
304
+ return ( typeof fieldId === 'string') ? $.trim (fieldId).toLowerCase ().replace (/[^a-z0-9]/g, '_') : '';
305
+ };
306
+ /**/
307
+ var fieldTypeDesc = function(type)
308
+ {
309
+ var types = {text: 'Text ( single line )', textarea: 'Textarea ( multi-line )', select: 'Select Menu ( drop-down )', selects: 'Select Menu ( multi-option )', checkbox: 'Checkbox ( single )', pre_checkbox: 'Checkbox ( pre-checked )', checkboxes: 'Checkboxes ( multi-option )', radios: 'Radio Buttons ( multi-option )'};
310
+ /**/
311
+ if (typeof types[type] === 'string')
312
+ return types[type];
313
+ /**/
314
+ return ''; /* Default. */
315
+ };
316
+ /**/
317
+ var fieldIdExists = function(fieldId) /* Already exists? */
318
+ {
319
+ for (var i = 0; i < fields.length; i++)
320
+ if (fields[i].id === fieldId)
321
+ return true;
322
+ };
323
+ /**/
324
+ var scrollReset = function() /* Return to Custom Fields section. */
325
+ {
326
+ scrollTo (0, $ ('div.ws-plugin--s2member-custom-reg-fields-section').offset ()['top'] - 100);
327
+ };
328
+ /**/
329
+ var buildTools = function(adding, index) /* This builds tools into the configuration. */
330
+ {
331
+ var i = 0, html = '', form = '', w = 0, h = 0, defaults = {id: '', label: '', type: 'text', options: '', expected: '', required: 'yes', levels: 'all', editable: 'yes', classes: '', styles: '', attrs: ''};
332
+ var editing = ( typeof index === 'number' && typeof fields[index] === 'object') ? true : false, displayForm = (adding || editing) ? true : false, field = (editing) ? fields[index] : defaults;
333
+ /**/
334
+ html += '<a href="#" onclick="ws_plugin__s2member_customRegFieldAdd(); return false;">Add New Field</a>'; /* Click to add a new Custom Registration Field. */
335
+ /**/
336
+ tb_remove (), $ ('div#ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form').remove (); /* Remove an existing thickbox. */
337
+ /**/
338
+ if (displayForm) /* Do we need to display the adding/editing form at all?
339
+ *NOTE* This is NOT an actual <form>, because we're already inside another form tag. */
340
+ {
341
+ form += '<div id="ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form">';
342
+ /**/
343
+ form += '<table id="ws-plugin--s2member-custom-reg-field-configuration-tools-form">';
344
+ form += '<tbody>';
345
+ /**/
346
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';
347
+ form += '<td colspan="2">';
348
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">Form Field Type: *</label>';
349
+ form += '</td>';
350
+ form += '</tr>';
351
+ /**/
352
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';
353
+ form += '<td colspan="2">';
354
+ form += '<select property="type" onchange="ws_plugin__s2member_customRegFieldTypeChange(this);" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-type">';
355
+ form += '<option value="text"' + ( (field.type === 'text') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('text')) + '</option>';
356
+ form += '<option value="textarea"' + ( (field.type === 'textarea') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('textarea')) + '</option>';
357
+ form += '<option value="select"' + ( (field.type === 'select') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('select')) + '</option>';
358
+ form += '<option value="selects"' + ( (field.type === 'selects') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('selects')) + '</option>';
359
+ form += '<option value="checkbox"' + ( (field.type === 'checkbox') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('checkbox')) + '</option>';
360
+ form += '<option value="pre_checkbox"' + ( (field.type === 'pre_checkbox') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('pre_checkbox')) + '</option>';
361
+ form += '<option value="checkboxes"' + ( (field.type === 'checkboxes') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('checkboxes')) + '</option>';
362
+ form += '<option value="radios"' + ( (field.type === 'radios') ? ' selected="selected"' : '') + '">' + esc_html (fieldTypeDesc ('radios')) + '</option>';
363
+ form += '</select>';
364
+ form += '</td>';
365
+ form += '</tr>';
366
+ /**/
367
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
368
+ /**/
369
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';
370
+ form += '<td colspan="2">';
371
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">Field Label/Desc: *</label>';
372
+ form += '</td>';
373
+ form += '</tr>';
374
+ /**/
375
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label">';
376
+ form += '<td colspan="2">';
377
+ form += '<input type="text" property="label" value="' + esc_attr (field.label) + '" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-label" /><br />';
378
+ form += '<small>Examples: <code>Choose Country</code>, <code>Street Address</code></small>';
379
+ form += '</td>';
380
+ form += '</tr>';
381
+ /**/
382
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
383
+ /**/
384
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';
385
+ form += '<td colspan="2">';
386
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">Unique Field ID: *</label></label>';
387
+ form += '</td>';
388
+ form += '</tr>';
389
+ /**/
390
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id">';
391
+ form += '<td colspan="2">';
392
+ form += '<input type="text" property="id" value="' + esc_attr (field.id) + '" maxlength="25" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-id" /><br />';
393
+ form += '<small>Examples: <code>country_code</code>, <code>street_address</code></small><br />';
394
+ form += '<small>e.g. <code>&lt;?php echo get_user_field("country_code"); ?&gt;</code></small>';
395
+ form += '</td>';
396
+ form += '</tr>';
397
+ /**/
398
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
399
+ /**/
400
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
401
+ form += '<td colspan="2">';
402
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">Field Required: *</label>';
403
+ form += '</td>';
404
+ form += '</tr>';
405
+ /**/
406
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
407
+ form += '<td colspan="2">';
408
+ form += '<select property="required" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-required">';
409
+ form += '<option value="yes"' + ( (field.required === 'yes') ? ' selected="selected"' : '') + '">Yes ( required )</option>';
410
+ form += '<option value="no"' + ( (field.required === 'no') ? ' selected="selected"' : '') + '">No ( optional )</option>';
411
+ form += '</select><br />';
412
+ form += '<small>If <code>yes</code>, only Users/Members will be "required" to enter this field.</small><br />';
413
+ form += '<small>* Administrators are exempt from this requirement.</small>';
414
+ form += '</td>';
415
+ form += '</tr>';
416
+ /**/
417
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"' + ( (field.type.match (/^(text|textarea|checkbox|pre_checkbox)$/)) ? ' style="display:none;"' : '') + '><td colspan="2">&nbsp;</td></tr>';
418
+ /**/
419
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"' + ( (field.type.match (/^(text|textarea|checkbox|pre_checkbox)$/)) ? ' style="display:none;"' : '') + '>';
420
+ form += '<td colspan="2">';
421
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">Option Configuration File: * ( one option per line )</label><br />';
422
+ form += '<small>Use a pipe <code>|</code> delimited format: <code>option value|option label</code></small>';
423
+ form += '</td>';
424
+ form += '</tr>';
425
+ /**/
426
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options"' + ( (field.type.match (/^(text|textarea|checkbox|pre_checkbox)$/)) ? ' style="display:none;"' : '') + '>';
427
+ form += '<td colspan="2">';
428
+ form += '<textarea property="options" rows="3" wrap="off" spellcheck="false" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-options">' + esc_html (field.options) + '</textarea><br />';
429
+ form += 'Here is a quick example:<br />';
430
+ form += '<small>You can also specify a <em>default</em> option:</small><br />';
431
+ form += '<code>US|United States|default</code><br />';
432
+ form += '<code>CA|Canada</code><br />';
433
+ form += '<code>VI|Virgin Islands (U.S.)</code>';
434
+ form += '</td>';
435
+ form += '</tr>';
436
+ /**/
437
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"' + ( (field.type.match (/^(select|selects|checkboxes|radios)$/)) ? ' style="display:none;"' : '') + '><td colspan="2">&nbsp;</td></tr>';
438
+ /**/
439
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"' + ( (field.type.match (/^(select|selects|checkboxes|radios)$/)) ? ' style="display:none;"' : '') + '>';
440
+ form += '<td colspan="2">';
441
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">Expected Format: *</label>';
442
+ form += '</td>';
443
+ form += '</tr>';
444
+ /**/
445
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected"' + ( (field.type.match (/^(select|selects|checkboxes|radios)$/)) ? ' style="display:none;"' : '') + '>';
446
+ form += '<td colspan="2">';
447
+ form += '<select property="expected" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-expected">';
448
+ /**/
449
+ form += '<option value=""' + ( (field.expected === '') ? ' selected="selected"' : '') + '">Anything Goes</option>';
450
+ form += '<option disabled="disabled"></option>';
451
+ /**/
452
+ form += '<optgroup label="Specific Input Types">';
453
+ form += '<option value="numeric-wp-commas"' + ( (field.expected === 'numeric-wp-commas') ? ' selected="selected"' : '') + '">Numeric ( with or without decimals, commas allowed )</option>';
454
+ form += '<option value="numeric"' + ( (field.expected === 'numeric') ? ' selected="selected"' : '') + '">Numeric ( with or without decimals, no commas )</option>';
455
+ form += '<option value="integer"' + ( (field.expected === 'integer') ? ' selected="selected"' : '') + '">Integer ( whole number, without any decimals )</option>';
456
+ form += '<option value="integer-gt-0"' + ( (field.expected === 'integer-gt-0') ? ' selected="selected"' : '') + '">Integer > 0 ( whole number, no decimals, greater than 0 )</option>';
457
+ form += '<option value="float"' + ( (field.expected === 'float') ? ' selected="selected"' : '') + '">Float ( floating point number, decimals required )</option>';
458
+ form += '<option value="float-gt-0"' + ( (field.expected === 'float-gt-0') ? ' selected="selected"' : '') + '">Float > 0 ( floating point number, decimals required, greater than 0 )</option>';
459
+ form += '<option value="date"' + ( (field.expected === 'date') ? ' selected="selected"' : '') + '">Date ( required date format: dd/mm/yyyy )</option>';
460
+ form += '<option value="email"' + ( (field.expected === 'email') ? ' selected="selected"' : '') + '">Email ( require valid email )</option>';
461
+ form += '<option value="url"' + ( (field.expected === 'url') ? ' selected="selected"' : '') + '">Full URL ( starting with http or https )</option>';
462
+ form += '<option value="domain"' + ( (field.expected === 'domain') ? ' selected="selected"' : '') + '">Domain Name ( domain name only, without http )</option>';
463
+ form += '<option value="phone"' + ( (field.expected === 'phone') ? ' selected="selected"' : '') + '">Phone # ( 10 digits w/possible hyphens,spaces,brackets )</option>';
464
+ form += '<option value="uszip"' + ( (field.expected === 'uszip') ? ' selected="selected"' : '') + '">US Zipcode ( 5-9 digits w/possible hyphen )</option>';
465
+ form += '<option value="cazip"' + ( (field.expected === 'cazip') ? ' selected="selected"' : '') + '">Canadian Zipcode ( 6 alpha-numerics w/possible space )</option>';
466
+ form += '<option value="uczip"' + ( (field.expected === 'uczip') ? ' selected="selected"' : '') + '">US/Canadian Zipcode ( either a US or Canadian zipcode )</option>';
467
+ form += '</optgroup>';
468
+ /**/
469
+ form += '<option disabled="disabled"></option>';
470
+ /**/
471
+ form += '<optgroup label="Any Character Combination">';
472
+ for (i = 1; i <= 25; i++)
473
+ {
474
+ form += '<option value="any-' + i + '"' + ( (field.expected === 'any-' + i) ? ' selected="selected"' : '') + '">Any Character Combination ( ' + i + ' character minimum )</option>';
475
+ form += '<option value="any-' + i + '-e"' + ( (field.expected === 'any-' + i + '-e') ? ' selected="selected"' : '') + '">Any Character Combination ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
476
+ }
477
+ form += '</optgroup>';
478
+ /**/
479
+ form += '<option disabled="disabled"></option>';
480
+ /**/
481
+ form += '<optgroup label="Alphanumerics, Spaces &amp; Punctuation Only">';
482
+ for (i = 1; i <= 25; i++)
483
+ {
484
+ form += '<option value="alphanumerics-spaces-punctuation-' + i + '"' + ( (field.expected === 'alphanumerics-spaces-punctuation-' + i) ? ' selected="selected"' : '') + '">Alphanumerics, Spaces &amp; Punctuation ( ' + i + ' character minimum )</option>';
485
+ form += '<option value="alphanumerics-spaces-punctuation-' + i + '-e"' + ( (field.expected === 'alphanumerics-spaces-punctuation-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics, Spaces &amp; Punctuation ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
486
+ }
487
+ form += '</optgroup>';
488
+ /**/
489
+ form += '<option disabled="disabled"></option>';
490
+ /**/
491
+ form += '<optgroup label="Alphanumerics &amp; Spaces Only">';
492
+ for (i = 1; i <= 25; i++)
493
+ {
494
+ form += '<option value="alphanumerics-spaces-' + i + '"' + ( (field.expected === 'alphanumerics-spaces-' + i) ? ' selected="selected"' : '') + '">Alphanumerics &amp; Spaces ( ' + i + ' character minimum )</option>';
495
+ form += '<option value="alphanumerics-spaces-' + i + '-e"' + ( (field.expected === 'alphanumerics-spaces-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics &amp; Spaces ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
496
+ }
497
+ form += '</optgroup>';
498
+ /**/
499
+ form += '<option disabled="disabled"></option>';
500
+ /**/
501
+ form += '<optgroup label="Alphanumerics &amp; Punctuation Only">';
502
+ for (i = 1; i <= 25; i++)
503
+ {
504
+ form += '<option value="alphanumerics-punctuation-' + i + '"' + ( (field.expected === 'alphanumerics-punctuation-' + i) ? ' selected="selected"' : '') + '">Alphanumerics &amp; Punctuation ( ' + i + ' character minimum )</option>';
505
+ form += '<option value="alphanumerics-punctuation-' + i + '-e"' + ( (field.expected === 'alphanumerics-punctuation-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics &amp; Punctuation ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
506
+ }
507
+ form += '</optgroup>';
508
+ /**/
509
+ form += '<option disabled="disabled"></option>';
510
+ /**/
511
+ form += '<optgroup label="Alphanumerics Only">';
512
+ for (i = 1; i <= 25; i++)
513
+ {
514
+ form += '<option value="alphanumerics-' + i + '"' + ( (field.expected === 'alphanumerics-' + i) ? ' selected="selected"' : '') + '">Alphanumerics ( ' + i + ' character minimum )</option>';
515
+ form += '<option value="alphanumerics-' + i + '-e"' + ( (field.expected === 'alphanumerics-' + i + '-e') ? ' selected="selected"' : '') + '">Alphanumerics ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
516
+ }
517
+ form += '</optgroup>';
518
+ /**/
519
+ form += '<option disabled="disabled"></option>';
520
+ /**/
521
+ form += '<optgroup label="Alphabetics Only">';
522
+ for (i = 1; i <= 25; i++)
523
+ {
524
+ form += '<option value="alphabetics-' + i + '"' + ( (field.expected === 'alphabetics-' + i) ? ' selected="selected"' : '') + '">Alphabetics ( ' + i + ' character minimum )</option>';
525
+ form += '<option value="alphabetics-' + i + '-e"' + ( (field.expected === 'alphabetics-' + i + '-e') ? ' selected="selected"' : '') + '">Alphabetics ( exactly ' + i + ' character' + ( (i > 1) ? 's' : '') + ' )</option>';
526
+ }
527
+ form += '</optgroup>';
528
+ /**/
529
+ form += '<option disabled="disabled"></option>';
530
+ /**/
531
+ form += '<optgroup label="Numeric Digits Only">';
532
+ for (i = 1; i <= 25; i++)
533
+ {
534
+ form += '<option value="numerics-' + i + '"' + ( (field.expected === 'numerics-' + i) ? ' selected="selected"' : '') + '">Numeric Digits ( ' + i + ' digit minimum )</option>';
535
+ form += '<option value="numerics-' + i + '-e"' + ( (field.expected === 'numerics-' + i + '-e') ? ' selected="selected"' : '') + '">Numeric Digits ( exactly ' + i + ' digit' + ( (i > 1) ? 's' : '') + ' )</option>';
536
+ }
537
+ form += '</optgroup>';
538
+ /**/
539
+ form += '</select><br />';
540
+ form += '<small>Only Users/Members will be required to meet this criteria.</small><br />';
541
+ form += '<small>* Administrators are exempt from this.</small>';
542
+ form += '</td>';
543
+ form += '</tr>';
544
+ /**/
545
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
546
+ /**/
547
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';
548
+ form += '<td colspan="2">';
549
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">Applicable Membership Levels: *</label>';
550
+ form += '</td>';
551
+ form += '</tr>';
552
+ /**/
553
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels">';
554
+ form += '<td colspan="2">';
555
+ form += '<input type="text" property="levels" value="' + esc_attr (field.levels) + '" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-levels" /><br />';
556
+ form += '<small>Please use comma-delimited Level #\'s: <code>0,1,2,3,4</code> or type: <code>all</code>.</small><br />';
557
+ form += '<small>This allows you to enable this field - only at specific Membership Levels.</small>';
558
+ form += '</td>';
559
+ form += '</tr>';
560
+ /**/
561
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
562
+ /**/
563
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
564
+ form += '<td colspan="2">';
565
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">Allow Profile Edits: *</label>';
566
+ form += '</td>';
567
+ form += '</tr>';
568
+ /**/
569
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
570
+ form += '<td colspan="2">';
571
+ form += '<select property="editable" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-editable">';
572
+ form += '<option value="yes"' + ( (field.editable === 'yes') ? ' selected="selected"' : '') + '">Yes ( editable )</option>';
573
+ form += '<option value="no"' + ( (field.editable === 'no') ? ' selected="selected"' : '') + '">No ( uneditable after registration )</option>';
574
+ form += '<option value="no-invisible"' + ( (field.editable === 'no-invisible') ? ' selected="selected"' : '') + '">No ( uneditable &amp; totally invisible )</option>';
575
+ form += '</select><br />';
576
+ form += '<small>If <code>No</code>, this field will be un-editable after registration.</small><br />';
577
+ form += '<small>* Administrators are exempt from this.</small>';
578
+ form += '</td>';
579
+ form += '</tr>';
580
+ /**/
581
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
582
+ /**/
583
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';
584
+ form += '<td colspan="2">';
585
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">CSS Classes: ( optional )</label>';
586
+ form += '</td>';
587
+ form += '</tr>';
588
+ /**/
589
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes">';
590
+ form += '<td colspan="2">';
591
+ form += '<input type="text" property="classes" value="' + esc_attr (field.classes) + '" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-classes" /><br />';
592
+ form += '<small>Example: <code>my-style-1 my-style-2</code></small>';
593
+ form += '</td>';
594
+ form += '</tr>';
595
+ /**/
596
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
597
+ /**/
598
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';
599
+ form += '<td colspan="2">';
600
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">CSS Styles: ( optional )</label>';
601
+ form += '</td>';
602
+ form += '</tr>';
603
+ /**/
604
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles">';
605
+ form += '<td colspan="2">';
606
+ form += '<input type="text" property="styles" value="' + esc_attr (field.styles) + '" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-styles" /><br />';
607
+ form += '<small>Example: <code>color:#000000; background:#FFFFFF;</code></small>';
608
+ form += '</td>';
609
+ form += '</tr>';
610
+ /**/
611
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
612
+ /**/
613
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';
614
+ form += '<td colspan="2">';
615
+ form += '<label for="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">Other Attributes: ( optional )</label>';
616
+ form += '</td>';
617
+ form += '</tr>';
618
+ /**/
619
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs">';
620
+ form += '<td colspan="2">';
621
+ form += '<input type="text" property="attrs" value="' + esc_attr (field.attrs) + '" id="ws-plugin--s2member-custom-reg-field-configuration-tools-form-attrs" /><br />';
622
+ form += '<small>Example: <code>onkeyup="" onblur=""</code></small>';
623
+ form += '</td>';
624
+ form += '</tr>';
625
+ /**/
626
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-spacer"><td colspan="2">&nbsp;</td></tr>';
627
+ /**/
628
+ form += '<tr class="ws-plugin--s2member-custom-reg-field-configuration-tools-form-buttons">';
629
+ form += '<td align="left">';
630
+ form += '<input type="button" value="Cancel" onclick="ws_plugin__s2member_customRegFieldCancel();" />';
631
+ form += '</td>';
632
+ form += '<td align="right">';
633
+ form += '<input type="button" value="' + ( (editing) ? 'Update This Field' : 'Create Registration Field') + '" onclick="' + ( (editing) ? 'ws_plugin__s2member_customRegFieldUpdate(' + index + ');' : 'ws_plugin__s2member_customRegFieldCreate();') + '" />';
634
+ form += '</td>';
635
+ form += '</tr>';
636
+ /**/
637
+ form += '</tbody>';
638
+ form += '</table>';
639
+ /**/
640
+ form += '<div>';
641
+ /**/
642
+ $ ('body').append (form);
643
+ tb_show ( ( (editing) ? 'Editing Registration Field' : 'New Custom Registration Field'), '#TB_inline?inlineId=ws-plugin--s2member-custom-reg-field-configuration-thickbox-tools-form');
644
+ $ (window).trigger ('resize'), $ ('table#ws-plugin--s2member-custom-reg-field-configuration-tools-form').show ();
645
+ }
646
+ /**/
647
+ $tools.html (html);
648
+ };
649
+ /**/
650
+ var attachTBResizer = function() /* Resize inline #TB_ajaxContent. */
651
+ {
652
+ $ (window).resize (function()
653
+ {
654
+ var w, h; /* Initialize width/height vars. */
655
+ w = $ (window).width (), h = $ (window).height (), w = (w > 720) ? 720 : w;
656
+ $ ('#TB_ajaxContent').css ({'width': w - 50, 'height': h - 75, 'margin': 0, 'padding': 0});
657
+ });
658
+ };
659
+ /**/
660
+ var buildTable = function() /* This builds the table of existing fields. */
661
+ {
662
+ var l = fields.length, i = 0, field, html = '', eo = 'o';
663
+ /**/
664
+ html += '<tbody>';
665
+ /**/
666
+ html += '<tr>';
667
+ html += '<th>Order</th>';
668
+ html += '<th>Field Type</th>';
669
+ html += '<th>Unique ID</th>';
670
+ html += '<th>Required</th>';
671
+ html += '<th>Levels</th>';
672
+ html += '<th>- Tools -</th>';
673
+ html += '</tr>';
674
+ /**/
675
+ if (fields.length > 0)
676
+ {
677
+ for (i = 0; i < fields.length; i++)
678
+ {
679
+ eo = (eo === 'o') ? 'e' : 'o';
680
+ field = fields[i]; /* Obj. */
681
+ /**/
682
+ html += '<tr class="' + esc_attr (eo) + ' ws-plugin--s2member-custom-reg-field-configuration-table-row-' + i + '">'; /* Odd/even + row identifier. */
683
+ html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-move-up" href="#" onclick="ws_plugin__s2member_customRegFieldMoveUp(' + i + '); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-move-down" href="#" onclick="ws_plugin__s2member_customRegFieldMoveDown(' + i + '); return false;"></a></td>';
684
+ html += '<td nowrap="nowrap">' + esc_html (fieldTypeDesc (field.type)) + '</td>';
685
+ html += '<td nowrap="nowrap">' + esc_html (field.id) + '</td>';
686
+ html += '<td nowrap="nowrap">' + esc_html (field.required) + '</td>';
687
+ html += '<td nowrap="nowrap">' + esc_html (field.levels) + '</td>';
688
+ html += '<td nowrap="nowrap"><a class="ws-plugin--s2member-custom-reg-field-configuration-edit" href="#" onclick="ws_plugin__s2member_customRegFieldEdit(' + i + '); return false;"></a><a class="ws-plugin--s2member-custom-reg-field-configuration-delete" href="#" onclick="ws_plugin__s2member_customRegFieldDelete(' + i + '); return false;"></a></td>';
689
+ html += '</tr>';
690
+ }
691
+ }
692
+ else /* Otherwise, there are no fields configured yet. */
693
+ {
694
+ html += '<tr>'; /* There are no fields yet. */
695
+ html += '<td colspan="6">No Custom Fields are configured.</td>';
696
+ html += '</tr>';
697
+ }
698
+ /**/
699
+ html += '</tbody>';
700
+ /**/
701
+ $table.html (html);
702
+ };
703
+ /* Initialize configuration. */
704
+ buildTools (), attachTBResizer (), buildTable ();
705
+ /**/
706
+ }) ();
707
+ }
708
+ /**/
709
  $ ('input#ws-plugin--s2member-ip-restrictions-reset-button').click (function()
710
  {
711
  var $this = $ (this); /* Save $(this) into $this. */
787
  /**/
788
  var level = (button === 'modification') ? modLevel.val ().split (':', 2)[1] : button.replace (/^level/, '');
789
  var label = labels['level' + level].replace (/"/g, ""); /* Labels may NOT contain any double-quotes. */
790
+ /**/
791
+ var trialAmount = $ ('input#ws-plugin--s2member-' + button + '-trial-amount').val ().replace (/[^0-9\.]/g, '');
792
  var trialPeriod = $ ('input#ws-plugin--s2member-' + button + '-trial-period').val ().replace (/[^0-9]/g, '');
793
  var trialTerm = $ ('select#ws-plugin--s2member-' + button + '-trial-term').val ().replace (/[^A-Z]/g, '');
794
+ /**/
795
  var regAmount = $ ('input#ws-plugin--s2member-' + button + '-amount').val ().replace (/[^0-9\.]/g, '');
796
  var regPeriod = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[0].replace (/[^0-9]/g, '');
797
  var regTerm = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[1].replace (/[^A-Z]/g, '');
798
  var regRecur = $ ('select#ws-plugin--s2member-' + button + '-term').val ().split ('-')[2].replace (/[^0-1BN]/g, '');
799
+ /**/
800
  var pageStyle = $.trim ($ ('input#ws-plugin--s2member-' + button + '-page-style').val ().replace (/"/g, ''));
801
  var currencyCode = $ ('select#ws-plugin--s2member-' + button + '-currency').val ().replace (/[^A-Z]/g, '');
802
  var cCaps = $.trim ($.trim ($ ('input#ws-plugin--s2member-' + button + '-ccaps').val ()).replace (/[ \-]/g, '_').replace (/[^A-Z_0-9,]/gi, '').toLowerCase ());
803
+ /**/
804
+ trialPeriod = (regRecur === 'BN') ? '0' : trialPeriod; /* Lifetime ( 1-L-BN ) and Buy Now ( BN ) access is absolutely NOT compatible w/ free trials. */
805
+ trialAmount = (!trialAmount || isNaN (trialAmount) || trialAmount < 0.01 || trialPeriod <= 0) ? '0' : trialAmount; /* Validate trial amount. */
806
+ /**/
807
  var levelCcapsPer = (regRecur === 'BN' && regTerm !== 'L') ? level + ':' + cCaps + ':' + regPeriod + ' ' + regTerm : level + ':' + cCaps;
808
  levelCcapsPer = levelCcapsPer.replace (/\:+$/g, ''); /* Clean any trailing separators from this string. */
809
  /**/
810
+ if (trialAmount && (isNaN (trialAmount) || trialAmount < 0.00))
811
+ {
812
+ alert ('Oops, a slight problem:\n\nWhen provided, Trial Amount must be >= 0.00');
813
+ return false;
814
+ }
815
+ else if (trialAmount && trialAmount > 10000.00) /* $10,000.00 maximum. */
816
+ {
817
+ alert ('Oops, a slight problem:\n\nMaximum Trial Amount is: 10000.00');
818
+ return false;
819
+ }
820
+ else if (trialTerm === 'D' && trialPeriod > 7) /* Some validation on the Trial Period. Max days: 7. */
821
  {
822
  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.');
823
  return false;
856
  (regRecur !== 'BN') ? code.val (code.val ().replace (/ (\<input type\="hidden" name\="amount" value\="(.*?)" \/\>)/g, " <!--$1-->")) : null;
857
  /**/
858
  shortCodeTemplateAttrs += 'level="' + esc_attr (level) + '" ccaps="' + esc_attr (cCaps) + '" desc="' + esc_attr (label) + '" ps="' + esc_attr (pageStyle) + '" cc="' + esc_attr (currencyCode) + '" ns="1" custom="<?php echo esc_attr ($_SERVER["HTTP_HOST"]); ?>"';
859
+ shortCodeTemplateAttrs += ' ta="' + esc_attr (trialAmount) + '" tp="' + esc_attr (trialPeriod) + '" tt="' + esc_attr (trialTerm) + '" ra="' + esc_attr (regAmount) + '" rp="' + esc_attr (regPeriod) + '" rt="' + esc_attr (regTerm) + '" rr="' + esc_attr (regRecur) + '"';
860
  shortCodeTemplateAttrs += (button === 'modification') ? ' modify="1"' : ''; /* For Modification Buttons. */
861
  shortCode.val (shortCodeTemplate.replace (/%%attrs%%/, shortCodeTemplateAttrs));
862
  /**/
868
  code.val (code.val ().replace (/ name\="modify" value\="(.*?)"/, ' name="modify" value="' + ( (button === 'modification') ? '1' : '0') + '"'));
869
  code.val (code.val ().replace (/ name\="amount" value\="(.*?)"/, ' name="amount" value="' + esc_attr (regAmount) + '"'));
870
  code.val (code.val ().replace (/ name\="src" value\="(.*?)"/, ' name="src" value="' + esc_attr (regRecur) + '"'));
871
+ code.val (code.val ().replace (/ name\="a1" value\="(.*?)"/, ' name="a1" value="' + esc_attr (trialAmount) + '"'));
872
  code.val (code.val ().replace (/ name\="p1" value\="(.*?)"/, ' name="p1" value="' + esc_attr (trialPeriod) + '"'));
873
  code.val (code.val ().replace (/ name\="t1" value\="(.*?)"/, ' name="t1" value="' + esc_attr (trialTerm) + '"'));
874
  code.val (code.val ().replace (/ name\="a3" value\="(.*?)"/, ' name="a3" value="' + esc_attr (regAmount) + '"'));
includes/menu-pages/options.inc.php CHANGED
@@ -299,7 +299,66 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
299
  echo '<tr>' . "\n";
300
  /**/
301
  echo '<td>' . "\n";
302
- echo '<h3>Background Settings</h3>' . "\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  echo '<p>These settings are all focused on your Login/Registration Background.</p>' . "\n";
304
  echo '</td>' . "\n";
305
  /**/
@@ -416,7 +475,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
416
  echo '<tr>' . "\n";
417
  /**/
418
  echo '<td>' . "\n";
419
- echo '<h3>Logo Image Settings</h3>' . "\n";
420
  echo '<p>These settings are all focused on your Login/Registration Logo.</p>' . "\n";
421
  echo '</td>' . "\n";
422
  /**/
@@ -525,12 +584,11 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
525
  /**/
526
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-reg-fields-section">' . "\n";
527
  echo '<h3>Custom Registration Fields ( optional, for further customization )</h3>' . "\n";
 
528
  /**/
529
- echo '<p>This allows you to customize the Fields in your Standard Registration Form:<br />( <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">' . esc_html (add_query_arg ("action", "register", wp_login_url ())) . '</a> )</p>' . "\n";
530
  echo (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ()) ? '<p><em>A Multisite Blog Farm uses this Form instead. It supports Custom Fields too.<br />( <a href="' . apply_filters ("wp_signup_location", get_bloginfo ("wpurl") . "/wp-signup.php") . '" target="_blank" rel="external">' . esc_html (apply_filters ("wp_signup_location", get_bloginfo ("wpurl") . "/wp-signup.php")) . '</a> )</em></p>' . "\n" : '';
531
  /**/
532
- echo '<p>This is a comma delimited list of additional form fields to collect during registration. By default, all of your Custom Fields will remain optional to the User. That is, the User will NOT be required to enter any of these values. If you want specific fields to be *required*, wrap those Custom Fields inside *asterisks*. If you want specific fields to be ^uneditable^, you can wrap those Custom Fields inside ^carets^. Some fields are already built-in by default. The defaults are: <code>*Username*, *Email*, *First Name*, *Last Name*</code>. If you need to add other Custom Fields, in addition to these defaults, you can do that here.</p>' . "\n";
533
- /**/
534
  if (defined ("BP_VERSION"))
535
  echo '<p><em class="ws-menu-page-hilite">* With BuddyPress installed, Custom Registration Fields are NOT applicable. BuddyPress themes usually come with their own Registration Form ( i.e. BuddyPress redirects you away from the default Registration Form, over to a special <code>/register</code> page ); BuddyPress also has its own Profile Field Configuration Tool, under <code>BuddyPress -> Profile Field Setup</code>. When BuddyPress is installed, the use of s2Member\'s Custom Fields is not advised; that is... UNLESS you\'re using the s2Member Pro Module. With the s2Member Pro Module, Custom Fields <strong>will</strong> be included in all PayPal® Pro Forms, including even Free Registration Forms generated by the s2Member Pro Module.</em></p>' . "\n";
536
  /**/
@@ -547,7 +605,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
547
  echo '<tr>' . "\n";
548
  /**/
549
  echo '<th>' . "\n";
550
- echo '<label for="ws-plugin--s2member-custom-reg-fields">' . "\n";
551
  echo 'Custom Registration Fields:' . "\n";
552
  echo '</label>' . "\n";
553
  echo '</th>' . "\n";
@@ -556,8 +614,8 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
556
  echo '<tr>' . "\n";
557
  /**/
558
  echo '<td>' . "\n";
559
- echo '<input type="text" name="ws_plugin__s2member_custom_reg_fields" id="ws-plugin--s2member-custom-reg-fields" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) . '" /><br />' . "\n";
560
- echo 'Comma delimited please. <em>Ex:</em> <code>*Company*, ^*Primary Domain*^, Street Address, City, State, Zip Code, Phone</code>' . "\n";
561
  echo '</td>' . "\n";
562
  /**/
563
  echo '</tr>' . "\n";
@@ -690,7 +748,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
690
  echo '<h3>Post Level Access Restrictions ( optional )</h3>' . "\n";
691
  echo '<p>Here you can specify Posts that are restricted to certain Membership Access Levels. s2Member also supports Custom Post Types here, which were first introduced in WordPress® 3.0. If you have a theme or plugin installed, that has enabled Custom Post Types ( i.e. Music/Videos or something else ), you can put the IDs for those Posts here.</p>' . "\n";
692
  echo '<p><em><strong>*Note*</strong> Protecting individual Posts, ONLY protects the Permalinks for those Posts. It is still possible for excerpts of protected content to be seen in search results generated by WordPress®, feeds, and Archive views; such as your Home Page, inside a Category listing, or through other queries formulated by your theme. This is the intended functionality. Excerpts are a great way to "tease" public visitors. In other words, public visitors may have access to excerpts introduced by your theme, but any attempt to view the full Post ( i.e. the Permalink ) will result in an automatic redirect to your Membership Options Page; requiring registration. All of that being said, if you would like to protect many Posts at once ( including Archive views ), you can use Category Level Restrictions, Tag Level Restrictions, or have a look down below at s2Member\'s options for "Alternative View Protection", which deals with search results, as well as feeds.</em></p>' . "\n";
693
- echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Post IDs? Get <a href="http://www.primothemes.com/post/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
694
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_post_level_access", get_defined_vars ());
695
  /**/
696
  echo '<table class="form-table">' . "\n";
@@ -798,7 +856,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
798
  echo '<div class="ws-menu-page-section ws-plugin--s2member-page-level-access-section">' . "\n";
799
  echo '<h3>Page Level Access Restrictions ( optional )</h3>' . "\n";
800
  echo '<p>Here you can specify Pages that are restricted to certain Membership Access Levels.</p>' . "\n";
801
- echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Page IDs? Get <a href="http://www.primothemes.com/post/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
802
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_page_level_access", get_defined_vars ());
803
  /**/
804
  echo '<table class="form-table">' . "\n";
@@ -1014,7 +1072,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1014
  echo '<div class="ws-menu-page-section ws-plugin--s2member-category-level-access-section">' . "\n";
1015
  echo '<h3>Category Level Access Restrictions ( optional )</h3>' . "\n";
1016
  echo '<p>Here you can specify Categories that are restricted to certain Membership Access Levels. Category restrictions are a bit more complex. When you restrict access to a Category, it also restricts access to any child Categories it may have ( aka: sub-Categories ). In other words, restricting a Category protects a Category Archive, all of its child Category Archives, and any Posts contained within the Category, or its child Categories.</p>' . "\n";
1017
- echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Category IDs? Get <a href="http://www.primothemes.com/post/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
1018
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_category_level_access", get_defined_vars ());
1019
  /**/
1020
  echo '<table class="form-table">' . "\n";
@@ -1254,8 +1312,8 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1254
  echo '<option value="searches,feeds"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === "searches,feeds") ? ' selected="selected"' : '') . '>Searches &amp; Feeds Only ( hide protected content in search results &amp; feeds only )</option>' . "\n";
1255
  echo '<option value="all"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === "all") ? ' selected="selected"' : '') . '>Yes ( filter ALL WordPress® queries; protecting all Alternative Views )</option>' . "\n";
1256
  echo '</select><br />' . "\n";
1257
- echo 'Attn: Developers. This could also be disabled dynamically, using this technique:<br />' . "\n";
1258
- echo '<code>query_posts(" ... &suppress_filters=true");</code>' . "\n";
1259
  echo '</td>' . "\n";
1260
  /**/
1261
  echo '</tr>' . "\n";
@@ -1280,7 +1338,7 @@ if (apply_filters ("ws_plugin__s2member_during_options_page_during_left_sections
1280
  echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link ( see: <code>s2Member -> PayPal® Options -> Specific Post/Page Email</code> ). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
1281
  echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress®. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress® Post/Page that you\'ve created.</p>' . "\n";
1282
  echo '<p>Very simple. All you do is protect the Specific Post/Page IDs that are being sold on your site. Then, you can go to <code>s2Member -> PayPal® Buttons -> Specific Post/Page</code> to generate "Buy Now" Buttons that you can insert into your WordPress® Editor, and make available on your site. The Button Generator for s2Member, will even let you Package Additional Posts/Pages together into one transaction.</p>' . "\n";
1283
- echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Post/Page IDs? Get <a href="http://www.primothemes.com/post/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
1284
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_sp_access", get_defined_vars ());
1285
  /**/
1286
  echo '<table class="form-table">' . "\n";
299
  echo '<tr>' . "\n";
300
  /**/
301
  echo '<td>' . "\n";
302
+ echo '<h3>Overall Font/Size Configuration</h3>' . "\n";
303
+ echo '<p>These settings are all focused on your Login/Registration Fonts.</p>' . "\n";
304
+ echo '</td>' . "\n";
305
+ /**/
306
+ echo '</tr>' . "\n";
307
+ echo '<tr>' . "\n";
308
+ /**/
309
+ echo '<th>' . "\n";
310
+ echo '<label for="ws-plugin--s2member-login-reg-font-size">' . "\n";
311
+ echo 'Overall Font Size:' . "\n";
312
+ echo '</label>' . "\n";
313
+ echo '</th>' . "\n";
314
+ /**/
315
+ echo '</tr>' . "\n";
316
+ echo '<tr>' . "\n";
317
+ /**/
318
+ echo '<td>' . "\n";
319
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_font_size" id="ws-plugin--s2member-login-reg-font-size" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_size"]) . '" /><br />' . "\n";
320
+ echo 'Set this to a numeric value, calculated in pixels.' . "\n";
321
+ echo '</td>' . "\n";
322
+ /**/
323
+ echo '</tr>' . "\n";
324
+ echo '<tr>' . "\n";
325
+ /**/
326
+ echo '<th>' . "\n";
327
+ echo '<label for="ws-plugin--s2member-login-reg-font-family">' . "\n";
328
+ echo 'Overall Font Family:' . "\n";
329
+ echo '</label>' . "\n";
330
+ echo '</th>' . "\n";
331
+ /**/
332
+ echo '</tr>' . "\n";
333
+ echo '<tr>' . "\n";
334
+ /**/
335
+ echo '<td>' . "\n";
336
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_font_family" id="ws-plugin--s2member-login-reg-font-family" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_family"]) . '" /><br />' . "\n";
337
+ echo 'Set this to a web-safe font family.' . "\n";
338
+ echo '</td>' . "\n";
339
+ /**/
340
+ echo '</tr>' . "\n";
341
+ echo '<tr>' . "\n";
342
+ /**/
343
+ echo '<th>' . "\n";
344
+ echo '<label for="ws-plugin--s2member-login-reg-font-field-size">' . "\n";
345
+ echo 'Form Field Font Size:' . "\n";
346
+ echo '</label>' . "\n";
347
+ echo '</th>' . "\n";
348
+ /**/
349
+ echo '</tr>' . "\n";
350
+ echo '<tr>' . "\n";
351
+ /**/
352
+ echo '<td>' . "\n";
353
+ echo '<input type="text" name="ws_plugin__s2member_login_reg_font_field_size" id="ws-plugin--s2member-login-reg-font-field-size" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_font_field_size"]) . '" /><br />' . "\n";
354
+ echo 'Set this to a numeric value, calculated in pixels.' . "\n";
355
+ echo '</td>' . "\n";
356
+ /**/
357
+ echo '</tr>' . "\n";
358
+ echo '<tr>' . "\n";
359
+ /**/
360
+ echo '<td>' . "\n";
361
+ echo '<h3>Background Configuration</h3>' . "\n";
362
  echo '<p>These settings are all focused on your Login/Registration Background.</p>' . "\n";
363
  echo '</td>' . "\n";
364
  /**/
475
  echo '<tr>' . "\n";
476
  /**/
477
  echo '<td>' . "\n";
478
+ echo '<h3>Logo Image Configuration</h3>' . "\n";
479
  echo '<p>These settings are all focused on your Login/Registration Logo.</p>' . "\n";
480
  echo '</td>' . "\n";
481
  /**/
584
  /**/
585
  echo '<div class="ws-menu-page-section ws-plugin--s2member-custom-reg-fields-section">' . "\n";
586
  echo '<h3>Custom Registration Fields ( optional, for further customization )</h3>' . "\n";
587
+ echo '<p>Some fields are already built-in by default. The defaults are: <code>*Username*, *Email*, *First Name*, *Last Name*</code>.</p>' . "\n";
588
  /**/
589
+ echo '<p>Custom Fields will appear in your Standard Registration Form:<br />( <a href="' . add_query_arg ("action", "register", wp_login_url ()) . '" target="_blank" rel="external">' . esc_html (add_query_arg ("action", "register", wp_login_url ())) . '</a> )</p>' . "\n";
590
  echo (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ()) ? '<p><em>A Multisite Blog Farm uses this Form instead. It supports Custom Fields too.<br />( <a href="' . apply_filters ("wp_signup_location", get_bloginfo ("wpurl") . "/wp-signup.php") . '" target="_blank" rel="external">' . esc_html (apply_filters ("wp_signup_location", get_bloginfo ("wpurl") . "/wp-signup.php")) . '</a> )</em></p>' . "\n" : '';
591
  /**/
 
 
592
  if (defined ("BP_VERSION"))
593
  echo '<p><em class="ws-menu-page-hilite">* With BuddyPress installed, Custom Registration Fields are NOT applicable. BuddyPress themes usually come with their own Registration Form ( i.e. BuddyPress redirects you away from the default Registration Form, over to a special <code>/register</code> page ); BuddyPress also has its own Profile Field Configuration Tool, under <code>BuddyPress -> Profile Field Setup</code>. When BuddyPress is installed, the use of s2Member\'s Custom Fields is not advised; that is... UNLESS you\'re using the s2Member Pro Module. With the s2Member Pro Module, Custom Fields <strong>will</strong> be included in all PayPal® Pro Forms, including even Free Registration Forms generated by the s2Member Pro Module.</em></p>' . "\n";
594
  /**/
605
  echo '<tr>' . "\n";
606
  /**/
607
  echo '<th>' . "\n";
608
+ echo '<label>' . "\n";
609
  echo 'Custom Registration Fields:' . "\n";
610
  echo '</label>' . "\n";
611
  echo '</th>' . "\n";
614
  echo '<tr>' . "\n";
615
  /**/
616
  echo '<td>' . "\n";
617
+ echo '<input type="hidden" name="ws_plugin__s2member_custom_reg_fields" id="ws-plugin--s2member-custom-reg-fields" value="' . format_to_edit ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) . '" />' . "\n";
618
+ echo '<div id="ws-plugin--s2member-custom-reg-field-configuration"></div>' . "\n"; /* This is filled by JavaScript routines. */
619
  echo '</td>' . "\n";
620
  /**/
621
  echo '</tr>' . "\n";
748
  echo '<h3>Post Level Access Restrictions ( optional )</h3>' . "\n";
749
  echo '<p>Here you can specify Posts that are restricted to certain Membership Access Levels. s2Member also supports Custom Post Types here, which were first introduced in WordPress® 3.0. If you have a theme or plugin installed, that has enabled Custom Post Types ( i.e. Music/Videos or something else ), you can put the IDs for those Posts here.</p>' . "\n";
750
  echo '<p><em><strong>*Note*</strong> Protecting individual Posts, ONLY protects the Permalinks for those Posts. It is still possible for excerpts of protected content to be seen in search results generated by WordPress®, feeds, and Archive views; such as your Home Page, inside a Category listing, or through other queries formulated by your theme. This is the intended functionality. Excerpts are a great way to "tease" public visitors. In other words, public visitors may have access to excerpts introduced by your theme, but any attempt to view the full Post ( i.e. the Permalink ) will result in an automatic redirect to your Membership Options Page; requiring registration. All of that being said, if you would like to protect many Posts at once ( including Archive views ), you can use Category Level Restrictions, Tag Level Restrictions, or have a look down below at s2Member\'s options for "Alternative View Protection", which deals with search results, as well as feeds.</em></p>' . "\n";
751
+ echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Post IDs? Get <a href="http://www.primothemes.com/post/product/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
752
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_post_level_access", get_defined_vars ());
753
  /**/
754
  echo '<table class="form-table">' . "\n";
856
  echo '<div class="ws-menu-page-section ws-plugin--s2member-page-level-access-section">' . "\n";
857
  echo '<h3>Page Level Access Restrictions ( optional )</h3>' . "\n";
858
  echo '<p>Here you can specify Pages that are restricted to certain Membership Access Levels.</p>' . "\n";
859
+ echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Page IDs? Get <a href="http://www.primothemes.com/post/product/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
860
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_page_level_access", get_defined_vars ());
861
  /**/
862
  echo '<table class="form-table">' . "\n";
1072
  echo '<div class="ws-menu-page-section ws-plugin--s2member-category-level-access-section">' . "\n";
1073
  echo '<h3>Category Level Access Restrictions ( optional )</h3>' . "\n";
1074
  echo '<p>Here you can specify Categories that are restricted to certain Membership Access Levels. Category restrictions are a bit more complex. When you restrict access to a Category, it also restricts access to any child Categories it may have ( aka: sub-Categories ). In other words, restricting a Category protects a Category Archive, all of its child Category Archives, and any Posts contained within the Category, or its child Categories.</p>' . "\n";
1075
+ echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Category IDs? Get <a href="http://www.primothemes.com/post/product/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
1076
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_category_level_access", get_defined_vars ());
1077
  /**/
1078
  echo '<table class="form-table">' . "\n";
1312
  echo '<option value="searches,feeds"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === "searches,feeds") ? ' selected="selected"' : '') . '>Searches &amp; Feeds Only ( hide protected content in search results &amp; feeds only )</option>' . "\n";
1313
  echo '<option value="all"' . ( ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"] === "all") ? ' selected="selected"' : '') . '>Yes ( filter ALL WordPress® queries; protecting all Alternative Views )</option>' . "\n";
1314
  echo '</select><br />' . "\n";
1315
+ echo 'Attn Developers: Filters can be suppressed dynamically, using this technique:<br />' . "\n";
1316
+ echo '<code>query_posts(" ... &amp;suppress_filters=true");</code>' . "\n";
1317
  echo '</td>' . "\n";
1318
  /**/
1319
  echo '</tr>' . "\n";
1338
  echo '<p>In other words, Customers will NOT need to login, just to receive access to the Specific Post/Page they purchased access to. s2Member will immediately redirect the Customer to the Specific Post/Page after checkout is completed successfully. An email is also sent to the Customer with a link ( see: <code>s2Member -> PayPal® Options -> Specific Post/Page Email</code> ). Authentication is handled automatically through self-expiring links, good for 72 hours by default.</p>' . "\n";
1339
  echo '<p>Specific Post/Page Access, is sort of like selling a product. Only, instead of shipping anything to the Customer, you just give them access to a specific Post/Page on your site; one that you created in WordPress®. A Specific Post/Page that is protected by s2Member, might contain a download link for your eBook, access to file &amp; music downloads, access to additional support services, and the list goes on and on. The possibilities with this are endless; as long as your digital product can be delivered through access to a WordPress® Post/Page that you\'ve created.</p>' . "\n";
1340
  echo '<p>Very simple. All you do is protect the Specific Post/Page IDs that are being sold on your site. Then, you can go to <code>s2Member -> PayPal® Buttons -> Specific Post/Page</code> to generate "Buy Now" Buttons that you can insert into your WordPress® Editor, and make available on your site. The Button Generator for s2Member, will even let you Package Additional Posts/Pages together into one transaction.</p>' . "\n";
1341
+ echo ( (!is_multisite () || !ws_plugin__s2member_is_multisite_farm () || is_main_site ()) && !$GLOBALS["WS_PLUGIN__"]["wp_show_ids"]) ? '<p><em><strong>*Tip*</strong> Can\'t find your Post/Page IDs? Get <a href="http://www.primothemes.com/post/product/wp-show-ids-plugin/" target="_blank" rel="external">WP Show IDs</a>.</em></p>' . "\n" : '';
1342
  do_action ("ws_plugin__s2member_during_options_page_during_left_sections_during_sp_access", get_defined_vars ());
1343
  /**/
1344
  echo '<table class="form-table">' . "\n";
includes/menu-pages/paypal-buttons.inc.php CHANGED
@@ -55,10 +55,10 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
55
  /**/
56
  echo '<td>' . "\n";
57
  echo '<form onsubmit="return false;">' . "\n";
58
- echo '<p id="ws-plugin--s2member-level1-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level1-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level1-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
59
  echo '<p><span id="ws-plugin--s2member-level1-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level1-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level1-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
60
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level1-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level1-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level1\');" class="button-primary" /></p>' . "\n";
61
- echo '<p' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level1-ccaps" size="40" maxlength="125" /></p>' . "\n";
62
  echo '</form>' . "\n";
63
  echo '</td>' . "\n";
64
  /**/
@@ -75,7 +75,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
75
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"])), $ws_plugin__s2member_temp_s);
76
  echo '<input id="ws-plugin--s2member-level1-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
77
  /**/
78
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
79
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
80
  echo '<textarea id="ws-plugin--s2member-level1-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
81
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
@@ -130,10 +130,10 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
130
  /**/
131
  echo '<td>' . "\n";
132
  echo '<form onsubmit="return false;">' . "\n";
133
- echo '<p id="ws-plugin--s2member-level2-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level2-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level2-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
134
  echo '<p><span id="ws-plugin--s2member-level2-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level2-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level2-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
135
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level2-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level2-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level2\');" class="button-primary" /></p>' . "\n";
136
- echo '<p' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level2-ccaps" size="40" maxlength="125" /></p>' . "\n";
137
  echo '</form>' . "\n";
138
  echo '</td>' . "\n";
139
  /**/
@@ -150,7 +150,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
150
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"])), $ws_plugin__s2member_temp_s);
151
  echo '<input id="ws-plugin--s2member-level2-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
152
  /**/
153
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
154
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
155
  echo '<textarea id="ws-plugin--s2member-level2-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
156
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
@@ -205,10 +205,10 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
205
  /**/
206
  echo '<td>' . "\n";
207
  echo '<form onsubmit="return false;">' . "\n";
208
- echo '<p id="ws-plugin--s2member-level3-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level3-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level3-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
209
  echo '<p><span id="ws-plugin--s2member-level3-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level3-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level3-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
210
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level3-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level3-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level3\');" class="button-primary" /></p>' . "\n";
211
- echo '<p' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level3-ccaps" size="40" maxlength="125" /></p>' . "\n";
212
  echo '</form>' . "\n";
213
  echo '</td>' . "\n";
214
  /**/
@@ -225,7 +225,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
225
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"])), $ws_plugin__s2member_temp_s);
226
  echo '<input id="ws-plugin--s2member-level3-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
227
  /**/
228
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
229
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
230
  echo '<textarea id="ws-plugin--s2member-level3-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
231
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
@@ -280,10 +280,10 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
280
  /**/
281
  echo '<td>' . "\n";
282
  echo '<form onsubmit="return false;">' . "\n";
283
- echo '<p id="ws-plugin--s2member-level4-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level4-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level4-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
284
  echo '<p><span id="ws-plugin--s2member-level4-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level4-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level4-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
285
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level4-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level4-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level4\');" class="button-primary" /></p>' . "\n";
286
- echo '<p' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level4-ccaps" size="40" maxlength="125" /></p>' . "\n";
287
  echo '</form>' . "\n";
288
  echo '</td>' . "\n";
289
  /**/
@@ -300,7 +300,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
300
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"])), $ws_plugin__s2member_temp_s);
301
  echo '<input id="ws-plugin--s2member-level4-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
302
  /**/
303
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
304
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
305
  echo '<textarea id="ws-plugin--s2member-level4-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
306
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
@@ -359,10 +359,10 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
359
  echo '<td>' . "\n";
360
  echo '<form onsubmit="return false;">' . "\n";
361
  echo '<p>Modification: <select id="ws-plugin--s2member-modification-level">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-modification-levels.html") . '</select></p>' . "\n";
362
- echo '<p id="ws-plugin--s2member-modification-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-modification-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> free.</p>' . "\n";
363
  echo '<p><span id="ws-plugin--s2member-modification-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-modification-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select><span id="ws-plugin--s2member-modification-20p-rule"><br /><small>** Watch out for <a href="https://www.x.com/thread/41748" target="_blank" rel="external">the 20% rule</a>. Additional details on the 20% rule are <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments#id086530108PM__id08653060UE6" target="_blank" rel="external">documented here</a>.</small></span></p>' . "\n";
364
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-modification-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'modification\');" class="button-primary" /></p>' . "\n";
365
- echo '<p' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-modification-ccaps" size="40" maxlength="125" /></p>' . "\n";
366
  echo '</form>' . "\n";
367
  echo '</td>' . "\n";
368
  /**/
@@ -380,7 +380,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
380
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"])), $ws_plugin__s2member_temp_s);
381
  echo '<input id="ws-plugin--s2member-modification-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
382
  /**/
383
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
384
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
385
  echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
386
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
@@ -455,7 +455,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
455
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-cancellation-button-shortcode.html"));
456
  echo '<input id="ws-plugin--s2member-cancellation-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
457
  /**/
458
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
459
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
460
  echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
461
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.html"));
@@ -555,7 +555,7 @@ if (apply_filters ("ws_plugin__s2member_during_paypal_buttons_page_during_left_s
555
  $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (esc_attr ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
556
  echo '<input id="ws-plugin--s2member-sp-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
557
  /**/
558
- echo '<div' . ((is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
559
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
560
  echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
561
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.html"));
55
  /**/
56
  echo '<td>' . "\n";
57
  echo '<form onsubmit="return false;">' . "\n";
58
+ echo '<p id="ws-plugin--s2member-level1-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level1-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level1-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> <input type="hidden" id="ws-plugin--s2member-level1-trial-amount" value="0" />free.</p>' . "\n";
59
  echo '<p><span id="ws-plugin--s2member-level1-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level1-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level1-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
60
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level1-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level1-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level1\');" class="button-primary" /></p>' . "\n";
61
+ echo '<p' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level1-ccaps" size="40" maxlength="125" /></p>' . "\n";
62
  echo '</form>' . "\n";
63
  echo '</td>' . "\n";
64
  /**/
75
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_label"])), $ws_plugin__s2member_temp_s);
76
  echo '<input id="ws-plugin--s2member-level1-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
77
  /**/
78
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
79
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
80
  echo '<textarea id="ws-plugin--s2member-level1-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
81
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
130
  /**/
131
  echo '<td>' . "\n";
132
  echo '<form onsubmit="return false;">' . "\n";
133
+ echo '<p id="ws-plugin--s2member-level2-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level2-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level2-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> <input type="hidden" id="ws-plugin--s2member-level2-trial-amount" value="0" />free.</p>' . "\n";
134
  echo '<p><span id="ws-plugin--s2member-level2-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level2-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level2-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
135
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level2-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level2-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level2\');" class="button-primary" /></p>' . "\n";
136
+ echo '<p' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level2-ccaps" size="40" maxlength="125" /></p>' . "\n";
137
  echo '</form>' . "\n";
138
  echo '</td>' . "\n";
139
  /**/
150
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"])), $ws_plugin__s2member_temp_s);
151
  echo '<input id="ws-plugin--s2member-level2-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
152
  /**/
153
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
154
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
155
  echo '<textarea id="ws-plugin--s2member-level2-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
156
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
205
  /**/
206
  echo '<td>' . "\n";
207
  echo '<form onsubmit="return false;">' . "\n";
208
+ echo '<p id="ws-plugin--s2member-level3-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level3-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level3-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> <input type="hidden" id="ws-plugin--s2member-level3-trial-amount" value="0" />free.</p>' . "\n";
209
  echo '<p><span id="ws-plugin--s2member-level3-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level3-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level3-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
210
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level3-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level3-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level3\');" class="button-primary" /></p>' . "\n";
211
+ echo '<p' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level3-ccaps" size="40" maxlength="125" /></p>' . "\n";
212
  echo '</form>' . "\n";
213
  echo '</td>' . "\n";
214
  /**/
225
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_label"])), $ws_plugin__s2member_temp_s);
226
  echo '<input id="ws-plugin--s2member-level3-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
227
  /**/
228
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
229
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
230
  echo '<textarea id="ws-plugin--s2member-level3-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
231
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
280
  /**/
281
  echo '<td>' . "\n";
282
  echo '<form onsubmit="return false;">' . "\n";
283
+ echo '<p id="ws-plugin--s2member-level4-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-level4-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-level4-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> <input type="hidden" id="ws-plugin--s2member-level4-trial-amount" value="0" />free.</p>' . "\n";
284
  echo '<p><span id="ws-plugin--s2member-level4-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-level4-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-level4-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select></p>' . "\n";
285
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-level4-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-level4-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'level4\');" class="button-primary" /></p>' . "\n";
286
+ echo '<p' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-level4-ccaps" size="40" maxlength="125" /></p>' . "\n";
287
  echo '</form>' . "\n";
288
  echo '</td>' . "\n";
289
  /**/
300
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_label"])), $ws_plugin__s2member_temp_s);
301
  echo '<input id="ws-plugin--s2member-level4-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
302
  /**/
303
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
304
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
305
  echo '<textarea id="ws-plugin--s2member-level4-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
306
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
359
  echo '<td>' . "\n";
360
  echo '<form onsubmit="return false;">' . "\n";
361
  echo '<p>Modification: <select id="ws-plugin--s2member-modification-level">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-modification-levels.html") . '</select></p>' . "\n";
362
+ echo '<p id="ws-plugin--s2member-modification-trial-line">I\'ll offer the first <input type="text" id="ws-plugin--s2member-modification-trial-period" value="0" size="6" /> <select id="ws-plugin--s2member-modification-trial-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-trial-terms.html") . '</select> <input type="hidden" id="ws-plugin--s2member-modification-trial-amount" value="0" />free.</p>' . "\n";
363
  echo '<p><span id="ws-plugin--s2member-modification-trial-then">Then, </span>I want to charge: $<input type="text" id="ws-plugin--s2member-modification-amount" value="0.01" size="4" /> / <select id="ws-plugin--s2member-modification-term">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-membership-regular-terms.html") . '</select><span id="ws-plugin--s2member-modification-20p-rule"><br /><small>** Watch out for <a href="https://www.x.com/thread/41748" target="_blank" rel="external">the 20% rule</a>. Additional details on the 20% rule are <a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPRecurringPayments#id086530108PM__id08653060UE6" target="_blank" rel="external">documented here</a>.</small></span></p>' . "\n";
364
  echo '<p>Checkout Page Style <a href="#" onclick="alert(\'Optional. This can be configured inside your PayPal® account. PayPal® allows you to create Custom Page Styles, and assign a unique name to them. You can add your own header image and color selection to the checkout form. Once you\\\'ve created a Custom Page Style at PayPal®, you can enter that Page Style here.\\n\\nIn addition. The Shortcode below, provided by s2Member; supports an image attribute: image=\\\'\\\'default\\\'\\\'. This can be changed to a full URL, pointing to a custom image of your own; instead of the default PayPal® Button image.\'); return false;" tabindex="-1">[?]</a>: <input type="text" id="ws-plugin--s2member-modification-page-style" value="paypal" size="18" /> <select id="ws-plugin--s2member-modification-currency">' . file_get_contents (dirname (dirname (__FILE__)) . "/templates/options/paypal-currencies.html") . '</select> <input type="button" value="Generate Button Code" onclick="ws_plugin__s2member_paypalButtonGenerate(\'modification\');" class="button-primary" /></p>' . "\n";
365
+ echo '<p' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '>Custom Capabilities ( comma delimited ) <a href="#" onclick="alert(\'Optional. This is VERY advanced. For full details, see:\\ns2Member -> API Scripting -> Custom Capabilities.\'); return false;" tabindex="-1">[?]</a> <input type="text" id="ws-plugin--s2member-modification-ccaps" size="40" maxlength="125" /></p>' . "\n";
366
  echo '</form>' . "\n";
367
  echo '</td>' . "\n";
368
  /**/
380
  $ws_plugin__s2member_temp_s = preg_replace ("/%%level_label%%/", ws_plugin__s2member_esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_label"])), $ws_plugin__s2member_temp_s);
381
  echo '<input id="ws-plugin--s2member-modification-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
382
  /**/
383
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
384
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
385
  echo '<textarea id="ws-plugin--s2member-modification-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
386
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.html"));
455
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/shortcodes/paypal-cancellation-button-shortcode.html"));
456
  echo '<input id="ws-plugin--s2member-cancellation-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
457
  /**/
458
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
459
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
460
  echo '<textarea id="ws-plugin--s2member-cancellation-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
461
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-cancellation-button.html"));
555
  $ws_plugin__s2member_temp_s = preg_replace ("/%%domain%%/", ws_plugin__s2member_esc_ds (esc_attr ($_SERVER["HTTP_HOST"])), $ws_plugin__s2member_temp_s);
556
  echo '<input id="ws-plugin--s2member-sp-shortcode" type="text" value="' . format_to_edit ($ws_plugin__s2member_temp_s) . '" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;" />' . "\n";
557
  /**/
558
+ echo '<div' . ( (is_multisite () && ws_plugin__s2member_is_multisite_farm () && !is_main_site ()) ? ' style="display:none;"' : '') . '><br />' . "\n";
559
  echo '<strong>Resulting PayPal® Button Code:</strong> ( ultimately, your Shortcode will produce this snippet )<br />' . "\n";
560
  echo '<textarea id="ws-plugin--s2member-sp-button" rows="8" wrap="off" onclick="this.select ();" style="font-family:Consolas, monospace; width:99%;">';
561
  $ws_plugin__s2member_temp_s = trim (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.html"));
includes/profile.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
  Referenced by: /?s2member_profile=1
18
  See: s2Member -> API Scripting -> PHP Constants
@@ -32,7 +32,7 @@ echo '<script type="text/javascript" src="' . get_bloginfo ("wpurl") . '/?ws_plu
32
  /**/
33
  echo '<title>My Profile</title>' . "\n";
34
  /**/
35
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
36
  do_action ("ws_plugin__s2member_during_profile_head", get_defined_vars ());
37
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
38
  /**/
@@ -44,20 +44,20 @@ echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2me
44
  /**/
45
  echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-save")) . '" />' . "\n";
46
  /**/
47
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  do_action ("ws_plugin__s2member_during_profile_before_table", get_defined_vars ());
49
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
  /**/
51
  echo '<table cellpadding="5" cellspacing="5" style="width:100%; border:0;">' . "\n";
52
  echo '<tbody>' . "\n";
53
  /**/
54
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
  do_action ("ws_plugin__s2member_during_profile_before_fields", get_defined_vars ());
56
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
  /**/
58
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_username", true, get_defined_vars ()))
59
  {
60
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
61
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_username", get_defined_vars ());
62
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
63
  /**/
@@ -70,14 +70,14 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_use
70
  echo '</td>' . "\n";
71
  echo '</tr>' . "\n";
72
  /**/
73
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
74
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_username", get_defined_vars ());
75
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
  }
77
  /**/
78
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_email", true, get_defined_vars ()))
79
  {
80
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
81
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_email", get_defined_vars ());
82
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
83
  /**/
@@ -90,14 +90,14 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_ema
90
  echo '</td>' . "\n";
91
  echo '</tr>' . "\n";
92
  /**/
93
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
94
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_email", get_defined_vars ());
95
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
96
  }
97
  /**/
98
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_first_name", true, get_defined_vars ()))
99
  {
100
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
101
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_first_name", get_defined_vars ());
102
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
103
  /**/
@@ -110,14 +110,14 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_fir
110
  echo '</td>' . "\n";
111
  echo '</tr>' . "\n";
112
  /**/
113
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
114
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_first_name", get_defined_vars ());
115
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
116
  }
117
  /**/
118
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_last_name", true, get_defined_vars ()))
119
  {
120
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_last_name", get_defined_vars ());
122
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
  /**/
@@ -130,14 +130,14 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_las
130
  echo '</td>' . "\n";
131
  echo '</tr>' . "\n";
132
  /**/
133
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
134
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
135
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
136
  }
137
  /**/
138
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_display_name", true, get_defined_vars ()))
139
  {
140
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
141
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_display_name", get_defined_vars ());
142
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
143
  /**/
@@ -150,64 +150,65 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_dis
150
  echo '</td>' . "\n";
151
  echo '</tr>' . "\n";
152
  /**/
153
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  }
157
  /**/
158
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
159
  {
160
- $fields = get_user_option ("s2member_custom_fields", $current_user->ID);
161
- /**/
162
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
163
- do_action ("ws_plugin__s2member_during_profile_during_fields_before_custom_fields", get_defined_vars ());
164
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
165
- /**/
166
- foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
167
- {
168
- $une = preg_match ("/\^/", $field); /* Uneditable fields should be wrapped inside carets. */
169
- $une = ($une) ? ' disabled="disabled"' : ''; /* Preventing this field from being edited. */
170
- /**/
171
- $req = preg_match ("/\*/", $field); /* Required fields should be wrapped inside asterisks. */
172
- $req = ($req) ? ' aria-required="true"' : ''; /* Has JavaScript validation applied. */
173
- /**/
174
- if ($field = trim ($field, "^* \t\n\r\0\x0B")) /* Don't process empty fields. */
175
- {
176
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
177
- do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
178
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
179
- /**/
180
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field));
181
- $field_id_class = preg_replace ("/_/", "-", $field_var);
182
- /**/
183
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
184
- if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
185
- {
186
- echo '<tr>' . "\n";
187
- echo '<td>' . "\n";
188
- echo '<label>' . "\n";
189
- echo '<strong>' . esc_html ($field) . (($req) ? " *" : "") . '</strong><br />' . "\n";
190
- echo '<input' . $une . $req . ' type="text" maxlength="100" name="ws_plugin__s2member_profile_' . $field_var . '" id="ws-plugin--s2member-profile-' . $field_id_class . '" style="width:99%;" value="' . format_to_edit ($fields[$field_var]) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
191
- echo '</label>' . "\n";
192
- echo '</td>' . "\n";
193
- echo '</tr>' . "\n";
194
- }
195
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
196
- /**/
197
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
198
- do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
199
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
200
- }
201
- }
202
- /**/
203
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
204
- do_action ("ws_plugin__s2member_during_profile_during_fields_after_custom_fields", get_defined_vars ());
205
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
 
206
  }
207
  /**/
208
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_password", true, get_defined_vars ()))
209
  {
210
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
211
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_password", get_defined_vars ());
212
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
213
  /**/
@@ -216,22 +217,22 @@ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_pas
216
  /**/
217
  echo '<label title="Please type your Password twice to confirm.">' . "\n";
218
  echo '<strong>New Password</strong> ( only if you want to change it )<br />' . "\n";
219
- echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password" id="ws-plugin--s2member-profile-password" style="width:99%;" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($current_user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
220
  echo '</label>' . "\n";
221
  /**/
222
  echo '<label title="Please type your Password twice to confirm.">' . "\n";
223
- echo '<input type="password" maxlength="100" autocomplete="off" id="ws-plugin--s2member-profile-password-confirmation" style="width:99%;" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($current_user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
224
  echo '</label>' . "\n";
225
  /**/
226
  echo '</td>' . "\n";
227
  echo '</tr>' . "\n";
228
  /**/
229
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
230
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_password", get_defined_vars ());
231
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
232
  }
233
  /**/
234
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
235
  do_action ("ws_plugin__s2member_during_profile_after_fields", get_defined_vars ());
236
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
237
  /**/
@@ -244,7 +245,7 @@ echo '</tr>' . "\n";
244
  echo '</tbody>' . "\n";
245
  echo '</table>' . "\n";
246
  /**/
247
- eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
248
  do_action ("ws_plugin__s2member_during_profile_after_table", get_defined_vars ());
249
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
250
  /**/
12
  Direct access denial.
13
  */
14
  if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
  /*
17
  Referenced by: /?s2member_profile=1
18
  See: s2Member -> API Scripting -> PHP Constants
32
  /**/
33
  echo '<title>My Profile</title>' . "\n";
34
  /**/
35
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
36
  do_action ("ws_plugin__s2member_during_profile_head", get_defined_vars ());
37
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
38
  /**/
44
  /**/
45
  echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-save")) . '" />' . "\n";
46
  /**/
47
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
48
  do_action ("ws_plugin__s2member_during_profile_before_table", get_defined_vars ());
49
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
50
  /**/
51
  echo '<table cellpadding="5" cellspacing="5" style="width:100%; border:0;">' . "\n";
52
  echo '<tbody>' . "\n";
53
  /**/
54
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
55
  do_action ("ws_plugin__s2member_during_profile_before_fields", get_defined_vars ());
56
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
57
  /**/
58
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_username", true, get_defined_vars ()))
59
  {
60
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
61
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_username", get_defined_vars ());
62
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
63
  /**/
70
  echo '</td>' . "\n";
71
  echo '</tr>' . "\n";
72
  /**/
73
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
74
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_username", get_defined_vars ());
75
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
76
  }
77
  /**/
78
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_email", true, get_defined_vars ()))
79
  {
80
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
81
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_email", get_defined_vars ());
82
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
83
  /**/
90
  echo '</td>' . "\n";
91
  echo '</tr>' . "\n";
92
  /**/
93
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
94
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_email", get_defined_vars ());
95
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
96
  }
97
  /**/
98
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_first_name", true, get_defined_vars ()))
99
  {
100
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
101
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_first_name", get_defined_vars ());
102
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
103
  /**/
110
  echo '</td>' . "\n";
111
  echo '</tr>' . "\n";
112
  /**/
113
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
114
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_first_name", get_defined_vars ());
115
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
116
  }
117
  /**/
118
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_last_name", true, get_defined_vars ()))
119
  {
120
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
121
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_last_name", get_defined_vars ());
122
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
123
  /**/
130
  echo '</td>' . "\n";
131
  echo '</tr>' . "\n";
132
  /**/
133
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
134
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
135
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
136
  }
137
  /**/
138
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_display_name", true, get_defined_vars ()))
139
  {
140
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
141
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_display_name", get_defined_vars ());
142
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
143
  /**/
150
  echo '</td>' . "\n";
151
  echo '</tr>' . "\n";
152
  /**/
153
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
154
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
155
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
156
  }
157
  /**/
158
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
159
  {
160
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) /* Now, do we have Custom Fields? */
161
+ if ($fields_applicable = ws_plugin__s2member_custom_fields_configured_at_level ("auto-detection"))
162
+ {
163
+ $fields = get_user_option ("s2member_custom_fields", $current_user->ID); /* Existing fields. */
164
+ /**/
165
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
166
+ do_action ("ws_plugin__s2member_during_profile_during_fields_before_custom_fields", get_defined_vars ());
167
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
168
+ /**/
169
+ foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
170
+ {
171
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
172
+ do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
173
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
174
+ /**/
175
+ if (in_array ($field["id"], $fields_applicable)) /* Field applicable? */
176
+ {
177
+ if ($field["editable"] !== "no-invisible") /* Uneditable/invisible? */
178
+ {
179
+ $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
180
+ $field_id_class = preg_replace ("/_/", "-", $field_var);
181
+ /**/
182
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
183
+ if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
184
+ {
185
+ echo '<tr>' . "\n";
186
+ echo '<td>' . "\n";
187
+ echo '<label>' . "\n";
188
+ echo '<strong' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . ( ($field["required"] === "yes") ? ' *' : '') . '</strong>' . ( (preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
189
+ echo ws_plugin__s2member_custom_field_gen ("ws_plugin__s2member_profile", $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ( (preg_match ("/^(select|selects)$/", $field["type"])) ? "width:100%;" : ( (preg_match ("/^(text|textarea)$/", $field["type"])) ? "width:99%;" : "")), ($tabindex = $tabindex + 10), "", $fields, $fields[$field_var], true);
190
+ echo '</label>' . "\n";
191
+ echo '</td>' . "\n";
192
+ echo '</tr>' . "\n";
193
+ }
194
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
195
+ }
196
+ }
197
+ /**/
198
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
199
+ do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
200
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
201
+ }
202
+ /**/
203
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
204
+ do_action ("ws_plugin__s2member_during_profile_during_fields_after_custom_fields", get_defined_vars ());
205
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
206
+ }
207
  }
208
  /**/
209
  if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_password", true, get_defined_vars ()))
210
  {
211
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
212
  do_action ("ws_plugin__s2member_during_profile_during_fields_before_password", get_defined_vars ());
213
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
214
  /**/
217
  /**/
218
  echo '<label title="Please type your Password twice to confirm.">' . "\n";
219
  echo '<strong>New Password</strong> ( only if you want to change it )<br />' . "\n";
220
+ echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password" id="ws-plugin--s2member-profile-password" style="width:99%;" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . ( ($current_user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
221
  echo '</label>' . "\n";
222
  /**/
223
  echo '<label title="Please type your Password twice to confirm.">' . "\n";
224
+ echo '<input type="password" maxlength="100" autocomplete="off" id="ws-plugin--s2member-profile-password-confirmation" style="width:99%;" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . ( ($current_user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
225
  echo '</label>' . "\n";
226
  /**/
227
  echo '</td>' . "\n";
228
  echo '</tr>' . "\n";
229
  /**/
230
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
231
  do_action ("ws_plugin__s2member_during_profile_during_fields_after_password", get_defined_vars ());
232
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
233
  }
234
  /**/
235
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
236
  do_action ("ws_plugin__s2member_during_profile_after_fields", get_defined_vars ());
237
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
238
  /**/
245
  echo '</tbody>' . "\n";
246
  echo '</table>' . "\n";
247
  /**/
248
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
249
  do_action ("ws_plugin__s2member_during_profile_after_table", get_defined_vars ());
250
  unset ($__refs, $__v); /* Unset defined __refs, __v. */
251
  /**/
includes/s2member-min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){ws_plugin__s2member_unique_files_downloaded=[];if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){a("a[href*=s2member_file_download]").click(function(){if(!this.href.match(/file_download_key\=(.+)/)){var b="** Please Confirm This File Download **\n\n";b+="You've downloaded "+S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY+" protected file"+((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<1||S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY>1)?"s":"")+" in the last "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" days.\n\n";b+="You're entitled to "+((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?"UNLIMITED downloads though ( so, no worries ).":S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED+" unique downloads every "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" day period.");if(confirm(b)){if(a.inArray(this.href,ws_plugin__s2member_unique_files_downloaded)===-1){ws_plugin__s2member_unique_files_downloaded.push(this.href),S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++}return true}else{return false}}})}if(location.href.match(/\/wp-signup\.php/)){a("div#content > div.mu_register > form#setupform").submit(function(){var b="",c="";a("input#user_name",this).add("input#user_email",this).add("input#blogname",this).add("input#blog_title",this).add(":input[aria-required=true]",this).each(function(){if(!a.trim(a(this).val())&&(c=a.trim(a.trim(a(this).prev("label").html()).split(/[\r\n\t\<]+/,1)[0].replace(/\*/,"")))){b+="• "+c+"\n"}else{if(!a.trim(a(this).val())&&(c=a.trim(a.trim(a(this).prev("span.prefix_address").prev("label").html()).split(/[\r\n\t\<]+/,1)[0].replace(/\*/,"")))){b+="• "+c+"\n"}}});if(b=a.trim(b)){alert("Oops, you missed something:\n\n"+b);return false}return true})}if(location.href.match(/\/wp-login\.php/)){a("div#login > form#registerform").submit(function(){var b="",c="";a("input#user_login",this).add("input#user_email",this).add(":input[aria-required=true]",this).each(function(){if(!a.trim(a(this).val())&&(c=a.trim(a.trim(a(this).parent("label").html()).split(/[\r\n\t\<]+/,1)[0].replace(/\*/,"")))){b+="• "+c+"\n"}});if(b=a.trim(b)){alert("Oops, you missed something:\n\n"+b);return false}return true})}if(location.href.match(/\/\?s2member_profile\=1/)){a("form#ws-plugin--s2member-profile").submit(function(){var b="",d="";var c=a("input#ws-plugin--s2member-profile-password");var e=a("input#ws-plugin--s2member-profile-password-confirmation");a(":input[aria-required=true]",this).each(function(){if(!a.trim(a(this).val())&&(d=a.trim(a.trim(a("strong",a(this).parent("label")).html()).split(/[\r\n\t\<]+/,1)[0].replace(/\*/,"")))){b+="• "+d+"\n"}});if(b=a.trim(b)){alert("Oops, you missed something:\n\n"+b);return false}else{if(a.trim(c.val())&&a.trim(c.val())!==a.trim(e.val())){alert("Oops, you missed something:\n\nPasswords do not match up. Please try again.");return false}}return true})}});
1
+ jQuery(document).ready(function(a){ws_plugin__s2member_uniqueFilesDownloaded=[];if(S2MEMBER_CURRENT_USER_IS_LOGGED_IN&&S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED){a("a[href*=s2member_file_download]").click(function(){if(!this.href.match(/file_download_key\=(.+)/)){var b="** Please Confirm This File Download **\n\n";b+="You've downloaded "+S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY+" protected file"+((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY<1||S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY>1)?"s":"")+" in the last "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" days.\n\n";b+="You're entitled to "+((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED)?"UNLIMITED downloads though ( so, no worries ).":S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED+" unique downloads every "+S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS+" day period.");if(confirm(b)){if(a.inArray(this.href,ws_plugin__s2member_uniqueFilesDownloaded)===-1){ws_plugin__s2member_uniqueFilesDownloaded.push(this.href),S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++}return true}else{return false}}})}if(location.href.match(/\/wp-signup\.php/)){a("div#content > div.mu_register > form#setupform").submit(function(){var d=this,c="",b="",e="";a("input#user_name, input#user_email, input#blogname, input#blog_title",d).each(function(){if((c=a.trim(a(this).prev("label").text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d,true)){e+=b+"\n\n"}}else{if((c=a.trim(a(this).prev("span.prefix_address").prev("label").text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d,true)){e+=b+"\n\n"}}}});a(":input",d).each(function(){if((c=a.trim(a(this).prev("label").text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d)){e+=b+"\n\n"}}});if(e=a.trim(e)){alert("Oops, you missed something:\n\n"+e);return false}return true})}else{if(location.href.match(/\/wp-login\.php/)){a("div#login > form#registerform").submit(function(){var d=this,c="",b="",e="";a("input#user_login, input#user_email",d).each(function(){if((c=a.trim(a(this).parent("label").text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d,true)){e+=b+"\n\n"}}});a(":input",d).each(function(){if((c=a.trim(a(this).parent("label").children("span").slice(0,1).text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d)){e+=b+"\n\n"}}});if(e=a.trim(e)){alert("Oops, you missed something:\n\n"+e);return false}return true})}else{if(location.href.match(/\/\?s2member_profile\=1/)){a("form#ws-plugin--s2member-profile").submit(function(){var e=this,d="",c="",g="";var b=a("input#ws-plugin--s2member-profile-password");var f=a("input#ws-plugin--s2member-profile-password-confirmation");a(":input",e).each(function(){if((d=a.trim(a(this).parent("label").children("strong").slice(0,1).text().replace(/[\r\n\t]+/g," ")))){if(c=ws_plugin__s2member_validationErrors(d,this,e)){g+=c+"\n\n"}}});if(g=a.trim(g)){alert("Oops, you missed something:\n\n"+g);return false}else{if(a.trim(b.val())&&a.trim(b.val())!==a.trim(f.val())){alert("Oops, you missed something:\n\nPasswords do not match up. Please try again.");return false}}return true})}else{if(location.href.match(/\/wp-admin\/profile\.php/)){a("form#your-profile").submit(function(){var d=this,c="",b="",e="";a(':input[id^="ws-plugin--s2member-profile-"]',d).each(function(){if((c=a.trim(a(this).parent("td").prev("th").children("label").slice(0,1).text().replace(/[\r\n\t]+/g," ")))){if(b=ws_plugin__s2member_validationErrors(c,this,d)){e+=b+"\n\n"}}});if(e=a.trim(e)){alert("Oops, you missed something:\n\n"+e);return false}return true})}}}}ws_plugin__s2member_validationErrors=function(l,k,c,g,f){if(typeof l==="string"&&l&&typeof k==="object"&&typeof c==="object"){if(typeof k.tagName==="string"&&k.tagName.match(/^(input|textarea|select)$/i)){var n=k.tagName.toLowerCase(),j=a(k),i=String(j.attr("type")).toLowerCase(),b=String(j.attr("name")),m=j.val();var g=(typeof g==="boolean")?g:(j.attr("aria-required")==="true"),f=(typeof f==="string")?f:j.attr("data-expected");if(n==="input"&&i==="checkbox"&&b.match(/\[\]$/)){if(typeof k.id==="string"&&k.id.match(/-0$/)){if(g&&!a('input[name="'+b.replace(/([\[\]])/g,"$1")+'"]:checked',c).length){return l+"\nPlease check at least one of the boxes."}}}else{if(n==="input"&&i==="checkbox"){if(g&&!k.checked){return l+"\nRequired. This box must be checked."}}else{if(n==="input"&&i==="radio"){if(typeof k.id==="string"&&k.id.match(/-0$/)){if(g&&!a('input[name="'+b.replace(/([\[\]])/g,"$1")+'"]:checked',c).length){return l+"\nPlease select one of the options."}}}else{if(n==="select"&&j.attr("multiple")){if(g&&(!(m instanceof Array)||!m.length)){return l+"\nPlease select at least one of the options."}}else{if(typeof m!=="string"||(g&&!(m=a.trim(m)).length)){return l+"\nThis is a required field, please try again."}else{if(((n==="input"&&i.match(/^(text|password)$/i))||n==="textarea")&&typeof f==="string"&&f.length){if(f==="numeric-wp-commas"&&(!m.match(/^[0-9\.,]+$/)||isNaN(m.replace(/,/g,"")))){return l+"\nMust be numeric ( with or without decimals, commas allowed )."}else{if(f==="numeric"&&(!m.match(/^[0-9\.]+$/)||isNaN(m))){return l+"\nMust be numeric ( with or without decimals, no commas )."}else{if(f==="integer"&&(!m.match(/^[0-9]+$/)||isNaN(m))){return l+"\nMust be an integer ( a whole number, without any decimals )."}else{if(f==="integer-gt-0"&&(!m.match(/^[0-9]+$/)||isNaN(m)||m<=0)){return l+"\nMust be an integer > 0 ( whole number, no decimals, greater than 0 )."}else{if(f==="float"&&(!m.match(/^[0-9\.]+$/)||!m.match(/[0-9]/)||!m.match(/\./)||isNaN(m))){return l+"\nMust be a float ( floating point number, decimals required )."}else{if(f==="float-gt-0"&&(!m.match(/^[0-9\.]+$/)||!m.match(/[0-9]/)||!m.match(/\./)||isNaN(m)||m<=0)){return l+"\nMust be a float > 0 ( floating point number, decimals required, greater than 0 )."}else{if(f==="date"&&!m.match(/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/)){return l+"\nMust be a date ( required date format: dd/mm/yyyy )."}else{if(f==="email"&&!m.match(/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)){return l+"\nMust be a valid email address."}else{if(f==="url"&&!m.match(/^http(s?)\:\/\/(.{5,})$/i)){return l+"\nMust be a full URL ( starting with http or https )."}else{if(f==="domain"&&!m.match(/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i)){return l+"\nMust be a domain name ( domain name only, without http )."}else{if(f==="phone"&&(!m.match(/^[0-9 \(\)\-]+$/)||m.replace(/[^0-9]/g,"").length!==10)){return l+"\nMust be a phone # ( 10 digits w/possible hyphens,spaces,brackets )."}else{if(f==="uszip"&&!m.match(/^[0-9]{5}(-[0-9]{4})?$/)){return l+"\nMust be a US zipcode ( 5-9 digits w/possible hyphen )."}else{if(f==="cazip"&&!m.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return l+"\nMust be a Canadian zipcode ( 6 alpha-numerics w/possible space )."}else{if(f==="uczip"&&!m.match(/^[0-9]{5}(-[0-9]{4})?$/)&&!m.match(/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i)){return l+"\nMust be a zipcode ( either a US or Canadian zipcode )."}else{if(f.match(/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/)&&!m.match(/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return l+"\nPlease use alphanumerics, spaces & punctuation only."}else{if(f.match(/^alphanumerics-spaces-([0-9]+)(-e)?$/)&&!m.match(/^[a-z 0-9]+$/i)){return l+"\nPlease use alphanumerics & spaces only."}else{if(f.match(/^alphanumerics-punctuation-([0-9]+)(-e)?$/)&&!m.match(/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i)){return l+"\nPlease use alphanumerics & punctuation only ( no spaces )."}else{if(f.match(/^alphanumerics-([0-9]+)(-e)?$/)&&!m.match(/^[a-z0-9]+$/i)){return l+"\nPlease use alphanumerics only ( no spaces/punctuation )."}else{if(f.match(/^alphabetics-([0-9]+)(-e)?$/)&&!m.match(/^[a-z]+$/i)){return l+"\nPlease use alphabetics only ( no digits/spaces/punctuation )."}else{if(f.match(/^numerics-([0-9]+)(-e)?$/)&&!m.match(/^[0-9]+$/i)){return l+"\nPlease use numeric digits only."}else{if(f.match(/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/)){var h=f.split("-"),d=Number(h[1]),e=(h.length>2)?Number(h[2]):"";if(e&&m.length!==d){return l+"\nMust be exactly "+d+" "+((h[0]==="numerics")?"digit":"character")+((d>1)?"s":"")+"."}else{if(m.length<d){return l+"\nMust be at least "+d+" "+((h[0]==="numerics")?"digit":"character")+((d>1)?"s":"")+"."}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return""}});
includes/s2member.css CHANGED
@@ -17,11 +17,21 @@ If you're using a `PriMo Theme`, you can use:
17
  PriMoTheme Options -> Custom CSS
18
  See: http://www.primothemes.com/
19
  */
20
- div#content > div.mu_register > form#setupform input.ws-plugin--s2member-custom-reg-field
 
 
 
21
  {
22
  width: 100%;
23
- font-size: 24px;
24
- margin: 5px 0;
 
 
 
 
 
 
 
25
  }
26
  div#content > div.mu_register > div.mu_alert
27
  {
17
  PriMoTheme Options -> Custom CSS
18
  See: http://www.primothemes.com/
19
  */
20
+ div#content > div.mu_register > form#setupform input.ws-plugin--s2member-custom-reg-field[type = text],
21
+ div#content > div.mu_register > form#setupform input.ws-plugin--s2member-custom-reg-field[type = password],
22
+ div#content > div.mu_register > form#setupform textarea.ws-plugin--s2member-custom-reg-field,
23
+ div#content > div.mu_register > form#setupform select.ws-plugin--s2member-custom-reg-field
24
  {
25
  width: 100%;
26
+ margin: 5px 0 5px 0;
27
+ /* Match the default theme for WordPress®. ( Twenty Ten ). */
28
+ <?php if(get_current_theme() === "Twenty Ten"): ?>
29
+ font-size: 24px; /* Match font size. */
30
+ <?php endif; ?>
31
+ }
32
+ div#content > div.mu_register > form#setupform select.ws-plugin--s2member-custom-reg-field
33
+ {
34
+ width: 101%;
35
  }
36
  div#content > div.mu_register > div.mu_alert
37
  {
includes/s2member.js CHANGED
@@ -8,17 +8,11 @@ along with this software. In the main directory, see: /licensing/
8
  If not, see: <http://www.gnu.org/licenses/>.
9
  */
10
  /*
11
- Other scripting routines handled on document ready state.
12
- Note: There is only one global variable here ( no conflicts ).
13
- ws_plugin__s2member_unique_files_downloaded
14
  */
15
  jQuery (document).ready (function($)
16
  {
17
- /*
18
- Attach onclick handlers to download links.
19
- Members will need to confirm download processing.
20
- */
21
- ws_plugin__s2member_unique_files_downloaded = []; /* Maintains real-time counts. */
22
  /* This is used in case a user downloads multiple files from a single page. */
23
  /**/
24
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
@@ -28,13 +22,13 @@ jQuery (document).ready (function($)
28
  if (!this.href.match (/file_download_key\=(.+)/)) /* ~Only for links with NO key. */
29
  {
30
  var c = '** Please Confirm This File Download **\n\n';
31
- c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' protected file' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < 1 || S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n';
32
- c += 'You\'re entitled to ' + ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'UNLIMITED downloads though ( so, no worries ).' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.');
33
  /**/
34
  if (confirm (c)) /* Force the user to confirm before we allow processing. */
35
  {
36
- if ($.inArray (this.href, ws_plugin__s2member_unique_files_downloaded) === -1) /* Real-time counting. */
37
- ws_plugin__s2member_unique_files_downloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
38
  return true; /* Allow processing. */
39
  }
40
  else /* Do not process. */
@@ -49,20 +43,33 @@ jQuery (document).ready (function($)
49
  /**/
50
  $ ('div#content > div.mu_register > form#setupform').submit (function()
51
  {
52
- var fieldErrors = '', fieldLabel = '';
53
  /**/
54
- $ ('input#user_name', this).add ('input#user_email', this).add ('input#blogname', this).add ('input#blog_title', this).add (':input[aria-required=true]', this).each (function()
55
  {
56
- if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ (this).prev ('label').html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
57
- fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
 
 
 
58
  /**/
59
- else if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ (this).prev ('span.prefix_address').prev ('label').html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
60
- fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
 
 
 
 
 
 
 
 
 
 
61
  });
62
  /**/
63
- if (fieldErrors = $.trim (fieldErrors))
64
  {
65
- alert ('Oops, you missed something:\n\n' + fieldErrors);
66
  return false;
67
  }
68
  /**/
@@ -71,46 +78,56 @@ jQuery (document).ready (function($)
71
  /*
72
  Attach form submission handler to wp-login.php?action=register.
73
  */
74
- if (location.href.match (/\/wp-login\.php/))
75
  /**/
76
  $ ('div#login > form#registerform').submit (function()
77
  {
78
- var fieldErrors = '', fieldLabel = '';
 
 
 
 
 
 
 
79
  /**/
80
- $ ('input#user_login', this).add ('input#user_email', this).add (':input[aria-required=true]', this).each (function()
81
  {
82
- if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ (this).parent ('label').html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
83
- fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
 
84
  });
85
  /**/
86
- if (fieldErrors = $.trim (fieldErrors))
87
  {
88
- alert ('Oops, you missed something:\n\n' + fieldErrors);
89
  return false;
90
  }
91
  /**/
92
  return true;
93
  });
94
  /*
95
- Attach form submission handler for profile modification validation.
96
  */
97
- if (location.href.match (/\/\?s2member_profile\=1/))
98
  /**/
99
  $ ('form#ws-plugin--s2member-profile').submit (function()
100
  {
101
- var fieldErrors = '', fieldLabel = '';
 
102
  var $password = $ ('input#ws-plugin--s2member-profile-password');
103
  var $passwordConfirmation = $ ('input#ws-plugin--s2member-profile-password-confirmation');
104
  /**/
105
- $ (':input[aria-required=true]', this).each (function()
106
  {
107
- if (!$.trim ($ (this).val ()) && (fieldLabel = $.trim ($.trim ($ ('strong', $ (this).parent ('label')).html ()).split (/[\r\n\t\<]+/, 1)[0].replace (/\*/, ''))))
108
- fieldErrors += '• ' + fieldLabel + '\n'; /* Required fields. */
 
109
  });
110
  /**/
111
- if (fieldErrors = $.trim (fieldErrors))
112
  {
113
- alert ('Oops, you missed something:\n\n' + fieldErrors);
114
  return false;
115
  }
116
  /**/
@@ -122,4 +139,163 @@ jQuery (document).ready (function($)
122
  /**/
123
  return true;
124
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  });
8
  If not, see: <http://www.gnu.org/licenses/>.
9
  */
10
  /*
11
+ Scripting routines handled on document ready state.
 
 
12
  */
13
  jQuery (document).ready (function($)
14
  {
15
+ ws_plugin__s2member_uniqueFilesDownloaded = []; /* Real-time counts. */
 
 
 
 
16
  /* This is used in case a user downloads multiple files from a single page. */
17
  /**/
18
  if (S2MEMBER_CURRENT_USER_IS_LOGGED_IN && S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED)
22
  if (!this.href.match (/file_download_key\=(.+)/)) /* ~Only for links with NO key. */
23
  {
24
  var c = '** Please Confirm This File Download **\n\n';
25
+ c += 'You\'ve downloaded ' + S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY + ' protected file' + ( (S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY < 1 || S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY > 1) ? 's' : '') + ' in the last ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' days.\n\n';
26
+ c += 'You\'re entitled to ' + ( (S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? 'UNLIMITED downloads though ( so, no worries ).' : S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED + ' unique downloads every ' + S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS + ' day period.');
27
  /**/
28
  if (confirm (c)) /* Force the user to confirm before we allow processing. */
29
  {
30
+ if ($.inArray (this.href, ws_plugin__s2member_uniqueFilesDownloaded) === -1) /* Real-time counting. */
31
+ ws_plugin__s2member_uniqueFilesDownloaded.push (this.href), S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY++;
32
  return true; /* Allow processing. */
33
  }
34
  else /* Do not process. */
43
  /**/
44
  $ ('div#content > div.mu_register > form#setupform').submit (function()
45
  {
46
+ var context = this, label = '', error = '', errors = '';
47
  /**/
48
+ $ ('input#user_name, input#user_email, input#blogname, input#blog_title', context).each (function()
49
  {
50
+ if ((label = $.trim ($ (this).prev ('label').text ().replace (/[\r\n\t]+/g, ' '))))
51
+ {
52
+ if (error = ws_plugin__s2member_validationErrors (label, this, context, true))
53
+ errors += error + '\n\n'; /* Collect errors. */
54
+ }
55
  /**/
56
+ else if ((label = $.trim ($ (this).prev ('span.prefix_address').prev ('label').text ().replace (/[\r\n\t]+/g, ' '))))
57
+ {
58
+ if (error = ws_plugin__s2member_validationErrors (label, this, context, true))
59
+ errors += error + '\n\n'; /* Collect errors. */
60
+ }
61
+ });
62
+ /**/
63
+ $ (':input', context).each (function()
64
+ {
65
+ if ((label = $.trim ($ (this).prev ('label').text ().replace (/[\r\n\t]+/g, ' '))))
66
+ if (error = ws_plugin__s2member_validationErrors (label, this, context))
67
+ errors += error + '\n\n'; /* Collect errors. */
68
  });
69
  /**/
70
+ if (errors = $.trim (errors))
71
  {
72
+ alert ('Oops, you missed something:\n\n' + errors);
73
  return false;
74
  }
75
  /**/
78
  /*
79
  Attach form submission handler to wp-login.php?action=register.
80
  */
81
+ else if (location.href.match (/\/wp-login\.php/))
82
  /**/
83
  $ ('div#login > form#registerform').submit (function()
84
  {
85
+ var context = this, label = '', error = '', errors = '';
86
+ /**/
87
+ $ ('input#user_login, input#user_email', context).each (function()
88
+ {
89
+ if ((label = $.trim ($ (this).parent ('label').text ().replace (/[\r\n\t]+/g, ' '))))
90
+ if (error = ws_plugin__s2member_validationErrors (label, this, context, true))
91
+ errors += error + '\n\n'; /* Collect errors. */
92
+ });
93
  /**/
94
+ $ (':input', context).each (function()
95
  {
96
+ if ((label = $.trim ($ (this).parent ('label').children ('span').slice (0, 1).text ().replace (/[\r\n\t]+/g, ' '))))
97
+ if (error = ws_plugin__s2member_validationErrors (label, this, context))
98
+ errors += error + '\n\n'; /* Collect errors. */
99
  });
100
  /**/
101
+ if (errors = $.trim (errors))
102
  {
103
+ alert ('Oops, you missed something:\n\n' + errors);
104
  return false;
105
  }
106
  /**/
107
  return true;
108
  });
109
  /*
110
+ Attach form submission handler to ?s2member_profile=1.
111
  */
112
+ else if (location.href.match (/\/\?s2member_profile\=1/))
113
  /**/
114
  $ ('form#ws-plugin--s2member-profile').submit (function()
115
  {
116
+ var context = this, label = '', error = '', errors = '';
117
+ /**/
118
  var $password = $ ('input#ws-plugin--s2member-profile-password');
119
  var $passwordConfirmation = $ ('input#ws-plugin--s2member-profile-password-confirmation');
120
  /**/
121
+ $ (':input', context).each (function()
122
  {
123
+ if ((label = $.trim ($ (this).parent ('label').children ('strong').slice (0, 1).text ().replace (/[\r\n\t]+/g, ' '))))
124
+ if (error = ws_plugin__s2member_validationErrors (label, this, context))
125
+ errors += error + '\n\n'; /* Collect errors. */
126
  });
127
  /**/
128
+ if (errors = $.trim (errors))
129
  {
130
+ alert ('Oops, you missed something:\n\n' + errors);
131
  return false;
132
  }
133
  /**/
139
  /**/
140
  return true;
141
  });
142
+ /*
143
+ Attach form submission handler to profile.php.
144
+ */
145
+ else if (location.href.match (/\/wp-admin\/profile\.php/))
146
+ /**/
147
+ $ ('form#your-profile').submit (function() /* Validation. */
148
+ {
149
+ var context = this, label = '', error = '', errors = '';
150
+ /**/
151
+ $ (':input[id^="ws-plugin--s2member-profile-"]', context).each (function()
152
+ {
153
+ if ((label = $.trim ($ (this).parent ('td').prev ('th').children ('label').slice (0, 1).text ().replace (/[\r\n\t]+/g, ' '))))
154
+ if (error = ws_plugin__s2member_validationErrors (label, this, context))
155
+ errors += error + '\n\n'; /* Collect errors. */
156
+ });
157
+ /**/
158
+ if (errors = $.trim (errors))
159
+ {
160
+ alert ('Oops, you missed something:\n\n' + errors);
161
+ return false;
162
+ }
163
+ /**/
164
+ return true;
165
+ });
166
+ /*
167
+ Global function handles validation errors.
168
+ */
169
+ ws_plugin__s2member_validationErrors = function(label, field, context, required, expected)
170
+ {
171
+ if (typeof label === 'string' && label && typeof field === 'object' && typeof context === 'object')
172
+ if (typeof field.tagName === 'string' && field.tagName.match (/^(input|textarea|select)$/i))
173
+ {
174
+ var tag = field.tagName.toLowerCase (), $field = $ (field), type = String ($field.attr ('type')).toLowerCase (), name = String ($field.attr ('name')), value = $field.val ();
175
+ var required = ( typeof required === 'boolean') ? required : ($field.attr ('aria-required') === 'true'), expected = ( typeof expected === 'string') ? expected : $field.attr ('data-expected');
176
+ /**/
177
+ if (tag === 'input' && type === 'checkbox' && name.match (/\[\]$/))
178
+ {
179
+ if (typeof field.id === 'string' && field.id.match (/-0$/)) /* First one only. */
180
+ if (required && !$ ('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length)
181
+ return label + '\nPlease check at least one of the boxes.';
182
+ }
183
+ else if (tag === 'input' && type === 'checkbox')
184
+ {
185
+ if (required && !field.checked) /* Check required? */
186
+ return label + '\nRequired. This box must be checked.';
187
+ }
188
+ else if (tag === 'input' && type === 'radio')
189
+ {
190
+ if (typeof field.id === 'string' && field.id.match (/-0$/)) /* First one only. */
191
+ if (required && !$ ('input[name="' + name.replace (/([\[\]])/g, '\$1') + '"]:checked', context).length)
192
+ return label + '\nPlease select one of the options.';
193
+ }
194
+ else if (tag === 'select' && $field.attr ('multiple'))
195
+ {
196
+ if (required && (! (value instanceof Array) || !value.length))
197
+ return label + '\nPlease select at least one of the options.';
198
+ }
199
+ else if (typeof value !== 'string' || (required && ! (value = $.trim (value)).length))
200
+ /* If we get here, the value MUST be in string format, and we need to trim the string before validation. */
201
+ {
202
+ return label + '\nThis is a required field, please try again.'; /* Missing data. */
203
+ }
204
+ else if (( (tag === 'input' && type.match (/^(text|password)$/i)) || tag === 'textarea') && typeof expected === 'string' && expected.length)
205
+ {
206
+ if (expected === 'numeric-wp-commas' && (!value.match (/^[0-9\.,]+$/) || isNaN (value.replace (/,/g, ''))))
207
+ {
208
+ return label + '\nMust be numeric ( with or without decimals, commas allowed ).';
209
+ }
210
+ else if (expected === 'numeric' && (!value.match (/^[0-9\.]+$/) || isNaN (value)))
211
+ {
212
+ return label + '\nMust be numeric ( with or without decimals, no commas ).';
213
+ }
214
+ else if (expected === 'integer' && (!value.match (/^[0-9]+$/) || isNaN (value)))
215
+ {
216
+ return label + '\nMust be an integer ( a whole number, without any decimals ).';
217
+ }
218
+ else if (expected === 'integer-gt-0' && (!value.match (/^[0-9]+$/) || isNaN (value) || value <= 0))
219
+ {
220
+ return label + '\nMust be an integer > 0 ( whole number, no decimals, greater than 0 ).';
221
+ }
222
+ else if (expected === 'float' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN (value)))
223
+ {
224
+ return label + '\nMust be a float ( floating point number, decimals required ).';
225
+ }
226
+ else if (expected === 'float-gt-0' && (!value.match (/^[0-9\.]+$/) || !value.match (/[0-9]/) || !value.match (/\./) || isNaN (value) || value <= 0))
227
+ {
228
+ return label + '\nMust be a float > 0 ( floating point number, decimals required, greater than 0 ).';
229
+ }
230
+ else if (expected === 'date' && !value.match (/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/))
231
+ {
232
+ return label + '\nMust be a date ( required date format: dd/mm/yyyy ).';
233
+ }
234
+ else if (expected === 'email' && !value.match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i))
235
+ {
236
+ return label + '\nMust be a valid email address.';
237
+ }
238
+ else if (expected === 'url' && !value.match (/^http(s?)\:\/\/(.{5,})$/i))
239
+ {
240
+ return label + '\nMust be a full URL ( starting with http or https ).';
241
+ }
242
+ else if (expected === 'domain' && !value.match (/^([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i))
243
+ {
244
+ return label + '\nMust be a domain name ( domain name only, without http ).';
245
+ }
246
+ else if (expected === 'phone' && (!value.match (/^[0-9 \(\)\-]+$/) || value.replace (/[^0-9]/g, '').length !== 10))
247
+ {
248
+ return label + '\nMust be a phone # ( 10 digits w/possible hyphens,spaces,brackets ).';
249
+ }
250
+ else if (expected === 'uszip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/))
251
+ {
252
+ return label + '\nMust be a US zipcode ( 5-9 digits w/possible hyphen ).';
253
+ }
254
+ else if (expected === 'cazip' && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i))
255
+ {
256
+ return label + '\nMust be a Canadian zipcode ( 6 alpha-numerics w/possible space ).';
257
+ }
258
+ else if (expected === 'uczip' && !value.match (/^[0-9]{5}(-[0-9]{4})?$/) && !value.match (/^[0-9A-Z]{3}( ?)[0-9A-Z]{3}$/i))
259
+ {
260
+ return label + '\nMust be a zipcode ( either a US or Canadian zipcode ).';
261
+ }
262
+ else if (expected.match (/^alphanumerics-spaces-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i))
263
+ {
264
+ return label + '\nPlease use alphanumerics, spaces & punctuation only.';
265
+ }
266
+ else if (expected.match (/^alphanumerics-spaces-([0-9]+)(-e)?$/) && !value.match (/^[a-z 0-9]+$/i))
267
+ {
268
+ return label + '\nPlease use alphanumerics & spaces only.';
269
+ }
270
+ else if (expected.match (/^alphanumerics-punctuation-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9,\.\/\?\:;"'\{\}\[\]\|\\\+\=_\-\(\)\*&\^%\$#@\!`~]+$/i))
271
+ {
272
+ return label + '\nPlease use alphanumerics & punctuation only ( no spaces ).';
273
+ }
274
+ else if (expected.match (/^alphanumerics-([0-9]+)(-e)?$/) && !value.match (/^[a-z0-9]+$/i))
275
+ {
276
+ return label + '\nPlease use alphanumerics only ( no spaces/punctuation ).';
277
+ }
278
+ else if (expected.match (/^alphabetics-([0-9]+)(-e)?$/) && !value.match (/^[a-z]+$/i))
279
+ {
280
+ return label + '\nPlease use alphabetics only ( no digits/spaces/punctuation ).';
281
+ }
282
+ else if (expected.match (/^numerics-([0-9]+)(-e)?$/) && !value.match (/^[0-9]+$/i))
283
+ {
284
+ return label + '\nPlease use numeric digits only.';
285
+ }
286
+ else if (expected.match (/^(any|alphanumerics-spaces-punctuation|alphanumerics-spaces|alphanumerics-punctuation|alphanumerics|alphabetics|numerics)-([0-9]+)(-e)?$/))
287
+ {
288
+ var split = expected.split ('-'), length = Number (split[1]), exactLength = (split.length > 2) ? Number (split[2]) : '';
289
+ /**/
290
+ if (exactLength && value.length !== length) /* An exact length is required? */
291
+ return label + '\nMust be exactly ' + length + ' ' + ( (split[0] === 'numerics') ? 'digit' : 'character') + ( (length > 1) ? 's' : '') + '.';
292
+ /**/
293
+ else if (value.length < length) /* Otherwise, we interpret as the minimum length. */
294
+ return label + '\nMust be at least ' + length + ' ' + ( (split[0] === 'numerics') ? 'digit' : 'character') + ( (length > 1) ? 's' : '') + '.';
295
+ }
296
+ }
297
+ }
298
+ /**/
299
+ return '';
300
+ };
301
  });
includes/syscon.inc.php CHANGED
@@ -48,388 +48,397 @@ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"] = filemtime (__FILE__);
48
  /*
49
  Configure & validate all of the plugin options; and set their defaults.
50
  */
51
- function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE)
52
  {
53
- global $current_site, $current_blog; /* Multisite Networking compatiblity. */
54
- /* Here we build the default options array, which will be merged with the user options.
55
- It is important to note that sometimes default options may not or should not be pre-filled on an options form.
56
- These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields.
57
- In other words, some defaults may be used internally, but to the user, the option will be empty. */
58
- $default_options = apply_filters ("ws_plugin__s2member_default_options", array ( /* For filters. */
59
- /**/
60
- "options_version" => "1.0", /* Used internally to keep runtime files up-to-date. */
61
- /**/
62
- "sec_encryption_key" => "", /* For security. This keeps each installation unique. */
63
- "sec_encryption_key_history" => array (), /* This keeps a history of the last 10 keys. */
64
- /**/
65
- "max_ip_restriction" => "5", /* Maximum IPs on record for each Username/Post/Page. */
66
- "max_ip_restriction_time" => "3600", /* How long before restrictions are lifted? */
67
- /**/
68
- "run_deactivation_routines" => "1", /* Should deactivation routines be processed? */
69
- /**/
70
- "custom_reg_fields" => "", /* A comma-delimited list of Custom Fields to collect/use. */
71
- "custom_reg_password" => "0", /* Allow users to register their own Custom Password? */
72
- "custom_reg_opt_in" => "1", /* Use a Double Opt-In Checkbox on the Registration Form? */
73
- "custom_reg_opt_in_label" => "Yes, I want to receive updates via email.", /* Label. */
74
- /**/
75
- "allow_subscribers_in" => "0", /* Allow Subscribers to register for absolutely free access? */
76
- "mms_registration_file" => "wp-login", /* A Multisite registration ( on the main site ) uses which file? */
77
- "mms_registration_grants" => "none", /* A public visitor, on a Multisite Blog Farm can register what? */
78
- "mms_registration_blogs_level0" => "0", /* A Visitor on a Multisite Farm, can create how many Blogs? */
79
- "mms_registration_blogs_level1" => "1", /* A Customer on a Multisite Farm can create how many Blogs? */
80
- "mms_registration_blogs_level2" => "5", /* A Customer on a Multisite Farm can create how many Blogs? */
81
- "mms_registration_blogs_level3" => "25", /* A Customer on a Multisite Farm can create how many Blogs? */
82
- "mms_registration_blogs_level4" => "100", /* A Customer on a Multisite Farm can create how many Blogs? */
83
- "force_admin_lockouts" => "0", /* Redirects admin Pages/Profile to the Login Welcome Page. */
84
- "filter_wp_query" => "none", /* Off by default (none|searches|feeds|searches,feeds|all). */
85
- /**/
86
- "login_welcome_page" => "", /* Defaults to the Home Page. */
87
- "login_redirection_override" => "", /* Alternate redirection location; instead of the Welcome Page. */
88
- "membership_options_page" => "", /* Defaults to the Home Page. */
89
- /**/
90
- "login_reg_background_color" => "FFFFFF", /* Defaults to white, and the bg.png is also white. */
91
- "login_reg_background_image" => $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/bg.png",/**/
92
- "login_reg_background_image_repeat" => "repeat", /* How should the background image repeat? repeat[-x|y]*/
93
- "login_reg_background_text_color" => "000000", /* Defaults to black, which is high contrast on white. */
94
- "login_reg_background_text_shadow_color" => "CCCCCC", /* Defaults to gray, which is slightly visible. */
95
- "login_reg_background_box_shadow_color" => "CCCCCC", /* Defaults to gray, which is slightly visible. */
96
- /**/
97
- "login_reg_logo_src" => $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/logo.png",/**/
98
- "login_reg_logo_src_width" => "500", /* Defaults to the logo_src image width. */
99
- "login_reg_logo_src_height" => "100", /* Defaults to the logo_src image height. */
100
- "login_reg_logo_url" => get_bloginfo ("url"), /* Defaults to the site url. */
101
- "login_reg_logo_title" => get_bloginfo ("name"), /* Defaults to the site name. */
102
- /**/
103
- "reg_email_from_name" => get_bloginfo ("name"), /* Defaults to the site name. */
104
- "reg_email_from_email" => get_bloginfo ("admin_email"), /* Defaults to the admin. */
105
- /**/
106
- "paypal_debug" => "0", /* Use the PayPal debug/logs for development testing? */
107
- "paypal_sandbox" => "0", /* Use the PayPal sandbox for development testing? */
108
- "paypal_business" => "", /* Paypal business email address for their account. */
109
- "paypal_identity_token" => "", /* Paypal payment data transfer identity token. */
110
- /**/
111
- "signup_tracking_codes" => "", /* Signup Tracking Codes. */
112
- "signup_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
113
- "signup_email_subject" => "Congratulations! ( your membership has been approved )",/**/
114
- "signup_email_message" => "Thanks %%first_name%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%registration_url%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name"),/**/
115
- /**/
116
- "sp_tracking_codes" => "", /* Specific Post/Page Tracking. */
117
- "sp_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
118
- "sp_email_subject" => "Thank You! ( instructions for access )",/**/
119
- "sp_email_message" => "Thanks %%first_name%%!\n\n%%item_name%%\n\nYour order can be retrieved here:\n%%sp_access_url%%\n( link expires in %%sp_access_exp%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name"),/**/
120
- /**/
121
- "mailchimp_api_key" => "", /* MailChimp® API Key for MailChimp® integration. */
122
- "level0_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
123
- "level1_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
124
- "level2_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
125
- "level3_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
126
- "level4_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
127
- /**/
128
- "level0_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
129
- "level1_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
130
- "level2_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
131
- "level3_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
132
- "level4_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
133
- /**/
134
- "signup_notification_urls" => "", /* A line-delimited list of Signup Notification URLs. */
135
- "registration_notification_urls" => "", /* A line-delimited list of Registration Notification URLs. */
136
- "payment_notification_urls" => "", /* A line-delimited list of Payment Notification URLs. */
137
- "cancellation_notification_urls" => "", /* A line-delimited list of Cancellation Notification URLs. */
138
- "eot_del_notification_urls" => "", /* A line-delimited list of EOT/Del Notification URLs. */
139
- "ref_rev_notification_urls" => "", /* A line-delimited list of Ref/Rev Notification URLs. */
140
- "sp_sale_notification_urls" => "", /* A line-delimited list of Specific Post/Page Notification URLs. */
141
- "sp_ref_rev_notification_urls" => "", /* A line-delimited list of Specific Post/Page Notification URLs. */
142
- /**/
143
- "signup_notification_recipients" => "", /* Signup Notification recipients. */
144
- "registration_notification_recipients" => "", /* Registration Notification recipients. */
145
- "payment_notification_recipients" => "", /* Payment Notification recipients. */
146
- "cancellation_notification_recipients" => "", /* Cancellation Notification recipients. */
147
- "eot_del_notification_recipients" => "", /* EOT/Del Notification recipients. */
148
- "ref_rev_notification_recipients" => "", /* Ref/Rev Notification recipients. */
149
- "sp_sale_notification_recipients" => "", /* Specific Post/Page Notification recipients. */
150
- "sp_ref_rev_notification_recipients" => "", /* Specific Post/Page Notification recipients. */
151
- /**/
152
- "level0_label" => "Free", /* This is just an initial generic Level Label. */
153
- "level1_label" => "Bronze", /* This is just an initial generic Level Label. */
154
- "level2_label" => "Silver", /* This is just an initial generic Level Label. */
155
- "level3_label" => "Gold", /* This is just an initial generic Level Label. */
156
- "level4_label" => "Platinum", /* This is just an initial generic Level Label. */
157
- /**/
158
- "level0_file_downloads_allowed" => "", /* This should always be numeric or empty. */
159
- "level1_file_downloads_allowed" => "", /* This should always be numeric or empty. */
160
- "level2_file_downloads_allowed" => "", /* This should always be numeric or empty. */
161
- "level3_file_downloads_allowed" => "", /* This should always be numeric or empty. */
162
- "level4_file_downloads_allowed" => "", /* This should always be numeric or empty. */
163
- /**/
164
- "level0_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
165
- "level1_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
166
- "level2_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
167
- "level3_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
168
- "level4_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
169
- /**/
170
- "file_download_limit_exceeded_page" => "", /* Defaults to the Home Page. */
171
- "file_download_inline_extensions" => "", /* List of Extensions to serve Inline. */
172
- /**/
173
- "level0_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
174
- "level1_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
175
- "level2_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
176
- "level3_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
177
- "level4_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
178
- /**/
179
- "level0_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
180
- "level1_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
181
- "level2_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
182
- "level3_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
183
- "level4_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
184
- /**/
185
- "level0_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
186
- "level1_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
187
- "level2_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
188
- "level3_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
189
- "level4_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
190
- /**/
191
- "level0_posts" => "", /* A comma-delimited list of Post IDs to protect. */
192
- "level1_posts" => "", /* A comma-delimited list of Post IDs to protect. */
193
- "level2_posts" => "", /* A comma-delimited list of Post IDs to protect. */
194
- "level3_posts" => "", /* A comma-delimited list of Post IDs to protect. */
195
- "level4_posts" => "", /* A comma-delimited list of Post IDs to protect. */
196
- /**/
197
- "level0_pages" => "", /* A comma-delimited list of Page IDs to protect. */
198
- "level1_pages" => "", /* A comma-delimited list of Page IDs to protect. */
199
- "level2_pages" => "", /* A comma-delimited list of Page IDs to protect. */
200
- "level3_pages" => "", /* A comma-delimited list of Page IDs to protect. */
201
- "level4_pages" => "", /* A comma-delimited list of Page IDs to protect. */
202
- /**/
203
- "specific_ids" => "", /* Comma-delimited list of Specific Post/Page IDs. */
204
- /**/
205
- "triggers_immediate_eot" => "refunds,reversals", /* Immediate EOT? */
206
- "membership_eot_behavior" => "demote", /* Demote or delete Members? */
207
- "auto_eot_system_enabled" => "1")); /* 0|1|2. 1 = WP-Cron, 2 = Cron tab. */
208
- /*
209
- Disable de-activation routines ( by default ) on a Multisite Blog Farm installation; excluding the Main Site ( Dashboard Blog ).
210
- */
211
- if (is_multisite () && !is_main_site () && defined ("MULTISITE_FARM") && MULTISITE_FARM) /* Auto-protects Blog Owners. */
212
- $default_options["run_deactivation_routines"] = "0"; /* By default, disable all de-activation routines in this case. */
213
- /*
214
- Here they are merged. User options will overwrite some or all default values.
215
- */
216
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = array_merge ($default_options, ( ($options !== false) ? (array)$options : (array)get_option ("ws_plugin__s2member_options")));
217
- /*
218
- Backward compatibility for "sp_notification_urls", which was renamed in v3.2.3 to "sp_sale_notification_urls".
219
- */
220
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"] && !$options["sp_sale_notification_urls"])
221
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"];
222
- /*
223
- Backward compatibility for "sp_notification_recipients", which was renamed in v3.2.3 to "sp_sale_notification_recipients".
224
- */
225
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"] && !$options["sp_sale_notification_recipients"])
226
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"];
227
- /*
228
- Validate each option, possibly reverting back to the default value if invalid.
229
- Also check if options were passed in on some of these, in case empty values are to be allowed.
230
- */
231
- foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
232
- {
233
- if (!is_array ($value))
234
- $value = trim (stripslashes ($value));
235
- else /* A string, or an array of strings. */
236
- foreach ($value as $k => $v)
237
- $value[$k] = trim (stripslashes ($v));
238
- /**/
239
- if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
240
- unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
241
- /**/
242
- else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
243
- $value = $default_options[$key];
244
- /**/
245
- else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
246
- $value = $default_options[$key];
247
- /**/
248
- else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
249
- $value = $default_options[$key];
250
- /**/
251
- else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 1 || $value > 100))
252
- $value = $default_options[$key];
253
- /**/
254
- else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
255
- $value = $default_options[$key];
256
- /**/
257
- else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
258
- $value = $default_options[$key];
259
- /**/
260
- else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
261
- $value = $default_options[$key];
262
- /**/
263
- else if ($key === "custom_reg_password" && (!is_string ($value) || !is_numeric ($value)))
264
- $value = $default_options[$key];
265
- /**/
266
- else if ($key === "custom_reg_opt_in" && (!is_string ($value) || !is_numeric ($value)))
267
- $value = $default_options[$key];
268
- /**/
269
- else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
270
- $value = $default_options[$key];
271
- /**/
272
- else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
273
- $value = $default_options[$key];
274
- /**/
275
- else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
276
- $value = $default_options[$key];
277
- /**/
278
- else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
279
- $value = $default_options[$key];
280
- /**/
281
- else if (preg_match ("/^mms_registration_blogs_level[0-4]$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
282
- $value = $default_options[$key];
283
- /**/
284
- else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
285
- $value = $default_options[$key];
286
- /**/
287
- else if ($key === "filter_wp_query" && (!is_string ($value) || !preg_match ("/^(none|searches|feeds|searches,feeds|all)$/", $value)))
288
- $value = $default_options[$key];
289
- /**/
290
- else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
291
- $value = $default_options[$key];
292
- /**/
293
- else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
294
- $value = $default_options[$key];
295
- /**/
296
- else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
297
- $value = $default_options[$key];
298
- /**/
299
- else if ($key === "login_reg_background_color" && (!is_string ($value) || !strlen ($value)))
300
- $value = $default_options[$key];
301
- /**/
302
- else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
303
- $value = $default_options[$key];
304
- /**/
305
- else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
306
- $value = $default_options[$key];
307
- /**/
308
- else if ($key === "login_reg_logo_src" && (!is_string ($value) || !strlen ($value)))
309
- $value = $default_options[$key];
310
- /**/
311
- else if ($key === "login_reg_logo_src_width" && (!is_string ($value) || !is_numeric ($value)))
312
- $value = $default_options[$key];
313
- /**/
314
- else if ($key === "login_reg_logo_src_height" && (!is_string ($value) || !is_numeric ($value)))
315
- $value = $default_options[$key];
316
- /**/
317
- else if ($key === "login_reg_logo_url" && (!is_string ($value) || !strlen ($value)))
318
- $value = $default_options[$key];
319
- /**/
320
- else if ($key === "login_reg_logo_title" && (!is_string ($value) || !strlen ($value)))
321
- $value = $default_options[$key];
322
- /**/
323
- else if ($key === "reg_email_from_name" && (!is_string ($value) || !strlen ($value)))
324
- $value = $default_options[$key];
325
- /**/
326
- else if ($key === "reg_email_from_email" && (!is_string ($value) || !strlen ($value)))
327
- $value = $default_options[$key];
328
- /**/
329
- else if ($key === "paypal_debug" && (!is_string ($value) || !is_numeric ($value)))
330
- $value = $default_options[$key];
331
- /**/
332
- else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
333
- $value = $default_options[$key];
334
- /**/
335
- else if ($key === "paypal_business" && (!is_string ($value) || !strlen ($value)))
336
- $value = $default_options[$key];
337
- /**/
338
- else if ($key === "paypal_identity_token" && (!is_string ($value) || !strlen ($value)))
339
- $value = $default_options[$key];
340
- /**/
341
- else if ($key === "signup_tracking_codes" && (!is_string ($value) || !strlen ($value)))
342
- $value = $default_options[$key];
343
- /**/
344
- else if ($key === "signup_email_recipients" && !is_string ($value)) /* Can be empty. */
345
- $value = $default_options[$key];
346
- /**/
347
- else if ($key === "signup_email_subject" && (!is_string ($value) || !strlen ($value)))
348
- $value = $default_options[$key];
349
- /**/
350
- else if ($key === "signup_email_message" && (!is_string ($value) || !strlen ($value)))
351
- $value = $default_options[$key];
352
- /**/
353
- else if ($key === "sp_tracking_codes" && (!is_string ($value) || !strlen ($value)))
354
- $value = $default_options[$key];
355
- /**/
356
- else if ($key === "sp_email_recipients" && !is_string ($value)) /* Can be empty. */
357
- $value = $default_options[$key];
358
- /**/
359
- else if ($key === "sp_email_subject" && (!is_string ($value) || !strlen ($value)))
360
- $value = $default_options[$key];
361
- /**/
362
- else if ($key === "sp_email_message" && (!is_string ($value) || !strlen ($value)))
363
- $value = $default_options[$key];
364
- /**/
365
- else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
366
- $value = $default_options[$key];
367
- /**/
368
- else if (preg_match ("/^level[0-4]_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
369
- $value = $default_options[$key];
370
- /**/
371
- else if (preg_match ("/^level[0-4]_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
372
- $value = $default_options[$key];
373
- /**/
374
- else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
375
- $value = $default_options[$key];
376
- /**/
377
- else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
378
- $value = $default_options[$key];
379
- /**/
380
- else if (preg_match ("/^level[0-4]_label$/", $key) && (!is_string ($value) || !strlen ($value)))
381
- $value = $default_options[$key];
382
- /**/
383
- else if (preg_match ("/^level[0-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
384
- $value = $default_options[$key];
385
- /**/
386
- else if (preg_match ("/^level[0-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
387
- $value = $default_options[$key];
388
- /**/
389
- else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
390
- $value = $default_options[$key];
391
- /**/
392
- else if ($key === "file_download_inline_extensions" && (!is_string ($value) || ! ($value = strtolower (preg_replace ("/\s+/", "", $value)))))
393
- $value = $default_options[$key];
394
- /**/
395
- else if (preg_match ("/^level[0-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
396
- $value = $default_options[$key];
397
- /**/
398
- else if (preg_match ("/^level[0-4]_catgs$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
399
- $value = $default_options[$key];
400
- /**/
401
- else if (preg_match ("/^level[0-4]_ptags$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
402
- $value = $default_options[$key];
403
- /**/
404
- else if (preg_match ("/^level[0-4]_posts$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
405
- $value = $default_options[$key];
406
- /**/
407
- else if (preg_match ("/^level[0-4]_pages$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
408
- $value = $default_options[$key];
409
- /**/
410
- else if ($key === "specific_ids" && (!is_string ($value) || ! ($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
411
- $value = $default_options[$key];
412
- /**/
413
- else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
414
- $value = $default_options[$key];
415
- /**/
416
- else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
417
- $value = $default_options[$key];
418
- /**/
419
- else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
420
- $value = $default_options[$key];
421
- }
422
- /*
423
- Keeps a history of the last 10 Security Encryption Keys configured for this installation.
424
- */
425
- if ($options !== false && is_string ($options["sec_encryption_key"]) && strlen ($options["sec_encryption_key"]) && !in_array ($options["sec_encryption_key"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]))
426
  {
427
- array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
428
- $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  }
430
  /**/
431
- return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
432
  }
433
- /**/
434
- call_user_func ("ws_plugin__s2member_configure_options_and_their_defaults");
435
  ?>
48
  /*
49
  Configure & validate all of the plugin options; and set their defaults.
50
  */
51
+ if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"))
52
  {
53
+ function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  {
55
+ global $current_site, $current_blog; /* Multisite Networking compatiblity. */
56
+ /* Here we build the default options array, which will be merged with the user options.
57
+ It is important to note that sometimes default options may not or should not be pre-filled on an options form.
58
+ These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields.
59
+ In other words, some defaults may be used internally, but to the user, the option will be empty. */
60
+ $default_options = apply_filters ("ws_plugin__s2member_default_options", array ( /* For filters. */
61
+ /**/
62
+ "options_version" => "1.0", /* Used internally to keep runtime files up-to-date. */
63
+ /**/
64
+ "sec_encryption_key" => "", /* For security. This keeps each installation unique. */
65
+ "sec_encryption_key_history" => array (), /* This keeps a history of the last 10 keys. */
66
+ /**/
67
+ "max_ip_restriction" => "5", /* Maximum IPs on record for each Username/Post/Page. */
68
+ "max_ip_restriction_time" => "3600", /* How long before restrictions are lifted? */
69
+ /**/
70
+ "run_deactivation_routines" => "1", /* Should deactivation routines be processed? */
71
+ /**/
72
+ "custom_reg_fields" => "", /* A comma-delimited list of Custom Fields to collect/use. */
73
+ "custom_reg_password" => "0", /* Allow users to register their own Custom Password? */
74
+ "custom_reg_opt_in" => "1", /* Use a Double Opt-In Checkbox on the Registration Form? */
75
+ "custom_reg_opt_in_label" => "Yes, I want to receive updates via email.", /* Label. */
76
+ /**/
77
+ "allow_subscribers_in" => "0", /* Allow Subscribers to register for absolutely free access? */
78
+ "mms_registration_file" => "wp-login", /* A Multisite registration ( on the main site ) uses which file? */
79
+ "mms_registration_grants" => "none", /* A public visitor, on a Multisite Blog Farm can register what? */
80
+ "mms_registration_blogs_level0" => "0", /* A Visitor on a Multisite Farm, can create how many Blogs? */
81
+ "mms_registration_blogs_level1" => "1", /* A Customer on a Multisite Farm can create how many Blogs? */
82
+ "mms_registration_blogs_level2" => "5", /* A Customer on a Multisite Farm can create how many Blogs? */
83
+ "mms_registration_blogs_level3" => "25", /* A Customer on a Multisite Farm can create how many Blogs? */
84
+ "mms_registration_blogs_level4" => "100", /* A Customer on a Multisite Farm can create how many Blogs? */
85
+ "force_admin_lockouts" => "0", /* Redirects admin Pages/Profile to the Login Welcome Page. */
86
+ "filter_wp_query" => "none", /* Off by default (none|searches|feeds|searches,feeds|all). */
87
+ /**/
88
+ "login_welcome_page" => "", /* Defaults to the Home Page. */
89
+ "login_redirection_override" => "", /* Alternate redirection location; instead of the Welcome Page. */
90
+ "membership_options_page" => "", /* Defaults to the Home Page. */
91
+ /**/
92
+ "login_reg_background_color" => "FFFFFF", /* Defaults to white, and the bg.png is also white. */
93
+ "login_reg_background_image" => $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/bg.png",/**/
94
+ "login_reg_background_image_repeat" => "repeat", /* How should the background image repeat? repeat[-x|y]*/
95
+ /**/
96
+ "login_reg_background_text_color" => "000000", /* Defaults to black, which is high contrast on white. */
97
+ "login_reg_background_text_shadow_color" => "EEEEEE", /* Defaults to gray, which is slightly visible. */
98
+ "login_reg_background_box_shadow_color" => "EEEEEE", /* Defaults to gray, which is slightly visible. */
99
+ /**/
100
+ "login_reg_logo_src" => $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/logo.png",/**/
101
+ "login_reg_logo_src_width" => "500", /* Defaults to the logo_src image width. */
102
+ "login_reg_logo_src_height" => "100", /* Defaults to the logo_src image height. */
103
+ "login_reg_logo_url" => get_bloginfo ("url"), /* Defaults to the site url. */
104
+ "login_reg_logo_title" => get_bloginfo ("name"), /* Defaults to the site name. */
105
+ /**/
106
+ "login_reg_font_size" => "12px", /* Overall font size. Used as the base size. */
107
+ "login_reg_font_family" => "'Verdana', 'Arial', sans-serif", /* Overall fonts. */
108
+ "login_reg_font_field_size" => "18px", /* This is size for all form fields. */
109
+ /**/
110
+ "reg_email_from_name" => get_bloginfo ("name"), /* Defaults to the site name. */
111
+ "reg_email_from_email" => get_bloginfo ("admin_email"), /* Defaults to the admin. */
112
+ /**/
113
+ "paypal_debug" => "0", /* Use the PayPal debug/logs for development testing? */
114
+ "paypal_sandbox" => "0", /* Use the PayPal sandbox for development testing? */
115
+ "paypal_business" => "", /* Paypal business email address for their account. */
116
+ "paypal_identity_token" => "", /* Paypal payment data transfer identity token. */
117
+ /**/
118
+ "signup_tracking_codes" => "", /* Signup Tracking Codes. */
119
+ "signup_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
120
+ "signup_email_subject" => "Congratulations! ( your membership has been approved )",/**/
121
+ "signup_email_message" => "Thanks %%first_name%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%registration_url%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name"),/**/
122
+ /**/
123
+ "sp_tracking_codes" => "", /* Specific Post/Page Tracking. */
124
+ "sp_email_recipients" => '"%%full_name%%" <%%payer_email%%>',/**/
125
+ "sp_email_subject" => "Thank You! ( instructions for access )",/**/
126
+ "sp_email_message" => "Thanks %%first_name%%!\n\n%%item_name%%\n\nYour order can be retrieved here:\n%%sp_access_url%%\n( link expires in %%sp_access_exp%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name"),/**/
127
+ /**/
128
+ "mailchimp_api_key" => "", /* MailChimp® API Key for MailChimp® integration. */
129
+ "level0_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
130
+ "level1_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
131
+ "level2_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
132
+ "level3_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
133
+ "level4_mailchimp_list_ids" => "", /* A comma-delimited list of MailChimp® List IDs. */
134
+ /**/
135
+ "level0_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
136
+ "level1_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
137
+ "level2_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
138
+ "level3_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
139
+ "level4_aweber_list_ids" => "", /* A comma-delimited list of AWeber® List IDs. */
140
+ /**/
141
+ "signup_notification_urls" => "", /* A line-delimited list of Signup Notification URLs. */
142
+ "registration_notification_urls" => "", /* A line-delimited list of Registration Notification URLs. */
143
+ "payment_notification_urls" => "", /* A line-delimited list of Payment Notification URLs. */
144
+ "cancellation_notification_urls" => "", /* A line-delimited list of Cancellation Notification URLs. */
145
+ "eot_del_notification_urls" => "", /* A line-delimited list of EOT/Del Notification URLs. */
146
+ "ref_rev_notification_urls" => "", /* A line-delimited list of Ref/Rev Notification URLs. */
147
+ "sp_sale_notification_urls" => "", /* A line-delimited list of Specific Post/Page Notification URLs. */
148
+ "sp_ref_rev_notification_urls" => "", /* A line-delimited list of Specific Post/Page Notification URLs. */
149
+ /**/
150
+ "signup_notification_recipients" => "", /* Signup Notification recipients. */
151
+ "registration_notification_recipients" => "", /* Registration Notification recipients. */
152
+ "payment_notification_recipients" => "", /* Payment Notification recipients. */
153
+ "cancellation_notification_recipients" => "", /* Cancellation Notification recipients. */
154
+ "eot_del_notification_recipients" => "", /* EOT/Del Notification recipients. */
155
+ "ref_rev_notification_recipients" => "", /* Ref/Rev Notification recipients. */
156
+ "sp_sale_notification_recipients" => "", /* Specific Post/Page Notification recipients. */
157
+ "sp_ref_rev_notification_recipients" => "", /* Specific Post/Page Notification recipients. */
158
+ /**/
159
+ "level0_label" => "Free", /* This is just an initial generic Level Label. */
160
+ "level1_label" => "Bronze", /* This is just an initial generic Level Label. */
161
+ "level2_label" => "Silver", /* This is just an initial generic Level Label. */
162
+ "level3_label" => "Gold", /* This is just an initial generic Level Label. */
163
+ "level4_label" => "Platinum", /* This is just an initial generic Level Label. */
164
+ /**/
165
+ "level0_file_downloads_allowed" => "", /* This should always be numeric or empty. */
166
+ "level1_file_downloads_allowed" => "", /* This should always be numeric or empty. */
167
+ "level2_file_downloads_allowed" => "", /* This should always be numeric or empty. */
168
+ "level3_file_downloads_allowed" => "", /* This should always be numeric or empty. */
169
+ "level4_file_downloads_allowed" => "", /* This should always be numeric or empty. */
170
+ /**/
171
+ "level0_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
172
+ "level1_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
173
+ "level2_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
174
+ "level3_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
175
+ "level4_file_downloads_allowed_days" => "", /* This should be numeric or empty. */
176
+ /**/
177
+ "file_download_limit_exceeded_page" => "", /* Defaults to the Home Page. */
178
+ "file_download_inline_extensions" => "", /* List of Extensions to serve Inline. */
179
+ /**/
180
+ "level0_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
181
+ "level1_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
182
+ "level2_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
183
+ "level3_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
184
+ "level4_ruris" => "", /* A line-delimited list of URIs, and/or URI fragments. */
185
+ /**/
186
+ "level0_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
187
+ "level1_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
188
+ "level2_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
189
+ "level3_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
190
+ "level4_catgs" => "", /* A comma-delimited list of Category IDs to protect. */
191
+ /**/
192
+ "level0_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
193
+ "level1_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
194
+ "level2_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
195
+ "level3_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
196
+ "level4_ptags" => "", /* A comma-delimited list of Post/Page Tags to protect. */
197
+ /**/
198
+ "level0_posts" => "", /* A comma-delimited list of Post IDs to protect. */
199
+ "level1_posts" => "", /* A comma-delimited list of Post IDs to protect. */
200
+ "level2_posts" => "", /* A comma-delimited list of Post IDs to protect. */
201
+ "level3_posts" => "", /* A comma-delimited list of Post IDs to protect. */
202
+ "level4_posts" => "", /* A comma-delimited list of Post IDs to protect. */
203
+ /**/
204
+ "level0_pages" => "", /* A comma-delimited list of Page IDs to protect. */
205
+ "level1_pages" => "", /* A comma-delimited list of Page IDs to protect. */
206
+ "level2_pages" => "", /* A comma-delimited list of Page IDs to protect. */
207
+ "level3_pages" => "", /* A comma-delimited list of Page IDs to protect. */
208
+ "level4_pages" => "", /* A comma-delimited list of Page IDs to protect. */
209
+ /**/
210
+ "specific_ids" => "", /* Comma-delimited list of Specific Post/Page IDs. */
211
+ /**/
212
+ "triggers_immediate_eot" => "refunds,reversals", /* Immediate EOT? */
213
+ "membership_eot_behavior" => "demote", /* Demote or delete Members? */
214
+ "auto_eot_system_enabled" => "1")); /* 0|1|2. 1 = WP-Cron, 2 = Cron tab. */
215
+ /*
216
+ Disable de-activation routines ( by default ) on a Multisite Blog Farm installation; excluding the Main Site ( Dashboard Blog ).
217
+ */
218
+ if (is_multisite () && !is_main_site () && defined ("MULTISITE_FARM") && MULTISITE_FARM) /* Auto-protects Blog Owners. */
219
+ $default_options["run_deactivation_routines"] = "0"; /* By default, disable all de-activation routines in this case. */
220
+ /*
221
+ Here they are merged. User options will overwrite some or all default values.
222
+ */
223
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = array_merge ($default_options, ( ($options !== false) ? (array)$options : (array)get_option ("ws_plugin__s2member_options")));
224
+ /*
225
+ Backward compatibility for "sp_notification_urls", which was renamed in v3.2.3 to "sp_sale_notification_urls".
226
+ */
227
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"] && !$options["sp_sale_notification_urls"])
228
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"];
229
+ /*
230
+ Backward compatibility for "sp_notification_recipients", which was renamed in v3.2.3 to "sp_sale_notification_recipients".
231
+ */
232
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"] && !$options["sp_sale_notification_recipients"])
233
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_recipients"];
234
+ /*
235
+ Backward compatibility for "custom_reg_fields", which was re-formatted in v3.2.7 to a JSON encoded array of fields.
236
+ */
237
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] && !$options["custom_reg_fields"] && !is_array (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])))
238
+ {
239
+ $fields = array (); /* Initialize the new array of field objects. */
240
+ /**/
241
+ foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) as $field)
242
+ {
243
+ $required = (preg_match ("/\*/", $field)) ? 'yes' : 'no';
244
+ $editable = (preg_match ("/\^/", $field)) ? 'no' : 'yes';
245
+ /**/
246
+ if ($field = trim ($field, "^* \t\n\r\0\x0B"))
247
+ {
248
+ $fields[] = array ("id" => $field, "label" => $field, "type" => "text", "options" => "", "expected_format" => "", "required" => $required, "levels" => "all", "editable" => $editable, "classes" => "", "styles" => "", "attrs" => "");
249
+ }
250
+ }
251
+ /**/
252
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] = json_encode ($fields);
253
+ /**/
254
+ unset ($une, $editable, $req, $required, $field, $fields);
255
+ }
256
+ /*
257
+ Validate each option, possibly reverting back to the default value if invalid.
258
+ Also check if options were passed in on some of these, in case empty values are to be allowed.
259
+ */
260
+ foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
261
+ {
262
+ if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
263
+ unset ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
264
+ /**/
265
+ else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
266
+ $value = $default_options[$key];
267
+ /**/
268
+ else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
269
+ $value = $default_options[$key];
270
+ /**/
271
+ else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
272
+ $value = $default_options[$key];
273
+ /**/
274
+ else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 1 || $value > 100))
275
+ $value = $default_options[$key];
276
+ /**/
277
+ else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
278
+ $value = $default_options[$key];
279
+ /**/
280
+ else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
281
+ $value = $default_options[$key];
282
+ /**/
283
+ else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
284
+ $value = $default_options[$key];
285
+ /**/
286
+ else if ($key === "custom_reg_password" && (!is_string ($value) || !is_numeric ($value)))
287
+ $value = $default_options[$key];
288
+ /**/
289
+ else if ($key === "custom_reg_opt_in" && (!is_string ($value) || !is_numeric ($value)))
290
+ $value = $default_options[$key];
291
+ /**/
292
+ else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
293
+ $value = $default_options[$key];
294
+ /**/
295
+ else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
296
+ $value = $default_options[$key];
297
+ /**/
298
+ else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
299
+ $value = $default_options[$key];
300
+ /**/
301
+ else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
302
+ $value = $default_options[$key];
303
+ /**/
304
+ else if (preg_match ("/^mms_registration_blogs_level[0-4]$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
305
+ $value = $default_options[$key];
306
+ /**/
307
+ else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
308
+ $value = $default_options[$key];
309
+ /**/
310
+ else if ($key === "filter_wp_query" && (!is_string ($value) || !preg_match ("/^(none|searches|feeds|searches,feeds|all)$/", $value)))
311
+ $value = $default_options[$key];
312
+ /**/
313
+ else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
314
+ $value = $default_options[$key];
315
+ /**/
316
+ else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
317
+ $value = $default_options[$key];
318
+ /**/
319
+ else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
320
+ $value = $default_options[$key];
321
+ /**/
322
+ else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
323
+ $value = $default_options[$key];
324
+ /**/
325
+ else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
326
+ $value = $default_options[$key];
327
+ /**/
328
+ else if (preg_match ("/^login_reg_(background|logo|font)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
329
+ $value = $default_options[$key];
330
+ /**/
331
+ else if ($key === "reg_email_from_name" && (!is_string ($value) || !strlen ($value)))
332
+ $value = $default_options[$key];
333
+ /**/
334
+ else if ($key === "reg_email_from_email" && (!is_string ($value) || !strlen ($value)))
335
+ $value = $default_options[$key];
336
+ /**/
337
+ else if ($key === "paypal_debug" && (!is_string ($value) || !is_numeric ($value)))
338
+ $value = $default_options[$key];
339
+ /**/
340
+ else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
341
+ $value = $default_options[$key];
342
+ /**/
343
+ else if ($key === "paypal_business" && (!is_string ($value) || !strlen ($value)))
344
+ $value = $default_options[$key];
345
+ /**/
346
+ else if ($key === "paypal_identity_token" && (!is_string ($value) || !strlen ($value)))
347
+ $value = $default_options[$key];
348
+ /**/
349
+ else if ($key === "signup_tracking_codes" && (!is_string ($value) || !strlen ($value)))
350
+ $value = $default_options[$key];
351
+ /**/
352
+ else if ($key === "signup_email_recipients" && !is_string ($value)) /* Can be empty. */
353
+ $value = $default_options[$key];
354
+ /**/
355
+ else if ($key === "signup_email_subject" && (!is_string ($value) || !strlen ($value)))
356
+ $value = $default_options[$key];
357
+ /**/
358
+ else if ($key === "signup_email_message" && (!is_string ($value) || !strlen ($value)))
359
+ $value = $default_options[$key];
360
+ /**/
361
+ else if ($key === "sp_tracking_codes" && (!is_string ($value) || !strlen ($value)))
362
+ $value = $default_options[$key];
363
+ /**/
364
+ else if ($key === "sp_email_recipients" && !is_string ($value)) /* Can be empty. */
365
+ $value = $default_options[$key];
366
+ /**/
367
+ else if ($key === "sp_email_subject" && (!is_string ($value) || !strlen ($value)))
368
+ $value = $default_options[$key];
369
+ /**/
370
+ else if ($key === "sp_email_message" && (!is_string ($value) || !strlen ($value)))
371
+ $value = $default_options[$key];
372
+ /**/
373
+ else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
374
+ $value = $default_options[$key];
375
+ /**/
376
+ else if (preg_match ("/^level[0-4]_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
377
+ $value = $default_options[$key];
378
+ /**/
379
+ else if (preg_match ("/^level[0-4]_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
380
+ $value = $default_options[$key];
381
+ /**/
382
+ else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
383
+ $value = $default_options[$key];
384
+ /**/
385
+ else if (preg_match ("/^(signup|registration|payment|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
386
+ $value = $default_options[$key];
387
+ /**/
388
+ else if (preg_match ("/^level[0-4]_label$/", $key) && (!is_string ($value) || !strlen ($value)))
389
+ $value = $default_options[$key];
390
+ /**/
391
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
392
+ $value = $default_options[$key];
393
+ /**/
394
+ else if (preg_match ("/^level[0-4]_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
395
+ $value = $default_options[$key];
396
+ /**/
397
+ else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
398
+ $value = $default_options[$key];
399
+ /**/
400
+ else if ($key === "file_download_inline_extensions" && (!is_string ($value) || ! ($value = strtolower (preg_replace ("/\s+/", "", $value)))))
401
+ $value = $default_options[$key];
402
+ /**/
403
+ else if (preg_match ("/^level[0-4]_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
404
+ $value = $default_options[$key];
405
+ /**/
406
+ else if (preg_match ("/^level[0-4]_catgs$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
407
+ $value = $default_options[$key];
408
+ /**/
409
+ else if (preg_match ("/^level[0-4]_ptags$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
410
+ $value = $default_options[$key];
411
+ /**/
412
+ else if (preg_match ("/^level[0-4]_posts$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
413
+ $value = $default_options[$key];
414
+ /**/
415
+ else if (preg_match ("/^level[0-4]_pages$/", $key) && (!is_string ($value) || ! ($value = ( ($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
416
+ $value = $default_options[$key];
417
+ /**/
418
+ else if ($key === "specific_ids" && (!is_string ($value) || ! ($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
419
+ $value = $default_options[$key];
420
+ /**/
421
+ else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
422
+ $value = $default_options[$key];
423
+ /**/
424
+ else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
425
+ $value = $default_options[$key];
426
+ /**/
427
+ else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
428
+ $value = $default_options[$key];
429
+ }
430
+ /*
431
+ Keeps a history of the last 10 Security Encryption Keys configured for this installation.
432
+ */
433
+ if ($options !== false && is_string ($options["sec_encryption_key"]) && strlen ($options["sec_encryption_key"]) && !in_array ($options["sec_encryption_key"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]))
434
+ {
435
+ array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
436
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
437
+ }
438
+ /**/
439
+ return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
440
  }
441
  /**/
442
+ call_user_func ("ws_plugin__s2member_configure_options_and_their_defaults");
443
  }
 
 
444
  ?>
includes/templates/shortcodes/paypal-checkout-button-shortcode.html CHANGED
@@ -1 +1 @@
1
- [s2Member-PayPal-Button level="%%level%%" ccaps="" desc="%%level_label%% description and pricing details here." ps="paypal" cc="USD" ns="1" custom="%%domain%%" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
1
+ [s2Member-PayPal-Button level="%%level%%" ccaps="" desc="%%level_label%% description and pricing details here." ps="paypal" cc="USD" ns="1" custom="%%domain%%" ta="0" tp="0" tt="D" ra="0.01" rp="1" rt="M" rr="1" image="default" /]
readme.txt CHANGED
@@ -1,8 +1,8 @@
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
8
  bbPress Compatible: yes
@@ -25,9 +25,9 @@ Donate link: http://www.primothemes.com/donate/
25
  Plugin Name: s2Member
26
  Pro Module / Prices: http://www.s2member.com/prices/
27
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
28
- Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
29
  PayPal Pro Integration: http://www.primothemes.com/forums/viewtopic.php?f=4&t=304
30
  Professional Installation URI: http://www.s2member.com/professional-installation/
 
31
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with Multisite Networking, and even with BuddyPress if you like.
32
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, includes extensive documentation, highly extensible
33
 
@@ -140,7 +140,7 @@ Yes it is. In fact, we must say... the s2Member/BuddyPress combination is just a
140
  s2Member uses its built-in Auto-EOT System ( new ). EOT = End Of Term. Whenever you generate a PayPal® Button with s2Member, you'll configure a length for the Subscription. Depending on the type of Subscription you choose ( recurring, non-recurring, lifetime, or fixed-term ); s2Member will either use PayPal's IPN/`subscr_cancel,subscr_eot` notices, or it will set an Automatic EOT Time, which is processed automatically by s2Member via WP_Cron. For each Member, you can also override the EOT Time, by forcing a specific expiration date. To manually adjust the EOT Time for a specific Member, go to: `WordPress® -> Users`, and click the Edit link next the Member you want to work on.
141
 
142
  = Do I need the s2Clean Theme? =
143
- No. Both s2Member ( the [free version](http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/) ), as well as the [s2Member Pro Module](http://www.s2member.com/prices/) will work in just about ANY WordPress® theme. That being said, if you're starting a brand new site, we DO suggest the [s2Clean Theme](http://www.primothemes.com/post/s2clean-theme-for-wordpress/), because it has already been setup specifically for s2Member, which will cut down on your development time. For example, the s2Clean Theme comes with a login box built into the site, and it also comes with pre-built Page Templates for s2Member's Login Welcome Page. You could create both of these inside WordPress® using any theme, even without Templates; but the s2Clean Theme makes it all much easier to work with.
144
 
145
  = Why do I get memory errors during installation and/or upgrade? =
146
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
@@ -161,7 +161,7 @@ Yes, without a doubt. The free version of s2Member ( aka: the s2Member Framework
161
  We get this type of question a lot. The answer is most definitely **yes**. The entire s2Member Framework is extremely versatile. For instance, the s2Member Pro Module is built on top of the free s2Member Framework; on top of the worlds' most powerful publishing platform ( WordPress® ). That being said, you WILL need be familiar with PHP, and/or WordPress® Hooks/Filters in order to accomplish advanced customizations. We suggest hiring a freelance developer at Elance.com, or hiring Jason Caldwell ( our own Lead Developer ) @ PriMoThemes.com / WebSharks, Inc. [Jason Caldwell](http://www.primothemes.com/post/author/websharksinc-jason/) is the Lead Developer behind the s2Member plugin, and also the s2Member Pro Module.
162
 
163
  = Can s2Member be used with ClickBank® or Google® Checkout? =
164
- Not yet. This is coming soon though. It will be included in a future release of the s2Member Pro Module, which already works with PayPal® Pro; using direct ( on-site ) credit card processing for Visa®, MasterCard®, American Express®, Discover®, Maestro®, Solo®, and PayPal® Express Checkout. [s2Member Pro](http://www.s2member.com/) is an add-on module for the [free version](http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/) of s2Member. s2Member Pro adds full PayPal® Pro integration, a PayPal® Pro Form Generator, User Import/Export tools; along with full access to our [video tutorial library](http://www.s2member.com/videos/).
165
 
166
  == Upgrade Notice ==
167
 
@@ -170,6 +170,17 @@ Not yet. This is coming soon though. It will be included in a future release of
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.
@@ -283,7 +294,7 @@ Not yet. This is coming soon though. It will be included in a future release of
283
 
284
  = 3.1 =
285
  * bbPress® compatiblity. There is a new internal Bridge that can be installed into bbPress® by s2Member. This new bbPress® (Bridge/plugin) makes it possible for s2Member Levels [0-4] to be converted into bbPress® "Members" on-the-fly, and it will guard your forums against unauthorized access; including forum registrations, which are redirected to your Membership Options Page for s2Member. To install this Bridge Integration, check your WordPress® Dashboard, under: `s2Member -> Bridge Integrations`.
286
- * New plugin that is HIGHLY recommended for s2Member. Get [WP Show IDs](http://www.primothemes.com/post/wp-show-ids-plugin/). Simple, yet elegant. Shows IDs for Posts, Pages, Media, Links, Categories, Tags, and Users in the admin tables for easy access. Very lightweight. Also supports Custom Post Types / Taxonomies.
287
  * New feature. There is a new Replacement Code available for the Login Welcome Page. You can now set a Special Redirection URL, which includes `%%current_user_level%%`, making it possible to have a separate Login Welcome Page for each Membership Level that you plan to offer. For further details, log into your WP Dashboard, and go to: `s2Member -> General Options -> Login Welcome Page`.
288
  * New feature. s2Member now supports 3rd-party IPN integrations, where you can have another service, such as PayDotCom® send simulated IPN transactions to your s2Member installation. For further details, log into your WordPress® Dashboard, and go to: `s2Member -> PayPal Options -> IPN Integration` ( at the bottom of that sub-section, you'll find your Proxy IPN Key ). Full instructions for services like PayDotCom® &amp; eJunkie® will be provided in the next release. The framework is in place, but full documentation has not been written yet.
289
  * New feature. s2Member now allows you to customize a list of Recipients for both the Signup Confirmation Email, and also the Specific Post/Page Confirmation Email. This makes it possible to prevent these emails from going out ( definitely NOT recommended though ). More importantly, it allows you to have copies of these messages sent to various departments, or even to a list server; such as AWeber/MailChimp. It should also be noted that your list of Recipients, your Subject Line, and your Messages; can all be modified easily, and ALL of these fields support the full list of Replacement Codes listed in those sections. For further details, see: `s2Member -> PayPal® Options`.
@@ -490,14 +501,14 @@ Not yet. This is coming soon though. It will be included in a future release of
490
  * Please thank [Jennifer Stuart](http://scriptygoddess.com/) for a generous donation that helped make s2Member v2.8 possible.
491
  * Also thank Stree Overlord with LARGE Inc. for his generous contribution that helped make s2Member v2.8 possible.
492
  * Also thank Martin B. for his donation too. You'll find him the Comment threads. Say thanks!
493
- * For more info, feature requests, etc; Visit: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
494
 
495
  = 2.7.2 =
496
  * WebSharks Framework for Plugins has been updated to P-2.1.
497
  * The s2Member file download headers (`file-download-access.inc.php`) has been updated to support CGI/FastCGI implementations. s2Member has been tested with HostGator, BlueHost, (mt)MediaTemple (gs) and (dv), The Rackspace Cloud, and several dedicated servers running with Apache; including support for both `mod_php` and also `CGI/FastCGI` implementations. s2Member should work fine with any Apache/PHP combination. Please report all bugs through the [Support Forum](http://www.primothemes.com/forums/viewforum.php?f=4).
498
 
499
  = 2.7.1 =
500
- * A bug in Custom Registration Fields has been corrected. This bug was introduced in v2.7, and has been corrected in v2.7.1. This bug was causing a mysterious [Empty Registration Field](http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/comment-page-3/#comment-312) to appear on the form; when a new Customer registers their Username. Please thank [Jeffrey Nichols](http://jeffreyanichols.com/) for reporting this important issue.
501
 
502
  = 2.7 =
503
  * s2Member is now compatible with BuddyPress :-) And I must say... the s2Member/BuddyPress combination is just awesome. These two plugins running together make all sorts of things possible.
1
  === s2Member ( Membership w/ PayPal® Integration ) ~ now Multisite compatible! ===
2
 
3
+ Version: 3.2.7
4
+ Stable tag: 3.2.7
5
+ Framework: WS-P-3.1
6
 
7
  SSL Compatible: yes
8
  bbPress Compatible: yes
25
  Plugin Name: s2Member
26
  Pro Module / Prices: http://www.s2member.com/prices/
27
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
 
28
  PayPal Pro Integration: http://www.primothemes.com/forums/viewtopic.php?f=4&t=304
29
  Professional Installation URI: http://www.s2member.com/professional-installation/
30
+ Plugin URI: http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/
31
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with Multisite Networking, and even with BuddyPress if you like.
32
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, includes extensive documentation, highly extensible
33
 
140
  s2Member uses its built-in Auto-EOT System ( new ). EOT = End Of Term. Whenever you generate a PayPal® Button with s2Member, you'll configure a length for the Subscription. Depending on the type of Subscription you choose ( recurring, non-recurring, lifetime, or fixed-term ); s2Member will either use PayPal's IPN/`subscr_cancel,subscr_eot` notices, or it will set an Automatic EOT Time, which is processed automatically by s2Member via WP_Cron. For each Member, you can also override the EOT Time, by forcing a specific expiration date. To manually adjust the EOT Time for a specific Member, go to: `WordPress® -> Users`, and click the Edit link next the Member you want to work on.
141
 
142
  = Do I need the s2Clean Theme? =
143
+ No. Both s2Member ( the [free version](http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/) ), as well as the [s2Member Pro Module](http://www.s2member.com/prices/) will work in just about ANY WordPress® theme. That being said, if you're starting a brand new site, we DO suggest the [s2Clean Theme](http://www.primothemes.com/post/product/s2clean-theme-for-wordpress/), because it has already been setup specifically for s2Member, which will cut down on your development time. For example, the s2Clean Theme comes with a login box built into the site, and it also comes with pre-built Page Templates for s2Member's Login Welcome Page. You could create both of these inside WordPress® using any theme, even without Templates; but the s2Clean Theme makes it all much easier to work with.
144
 
145
  = Why do I get memory errors during installation and/or upgrade? =
146
  This depends on your hosting provider and/or server configuration. Some web hosting companies impose very low limits on the amount of memory available to WordPress® during the execution of a single script. Since s2Member is a larger plugin, WordPress® may exceed conservative limits set forth by shared hosting companies. Don't feel bad, it's a very common problem. The solution is to upgrade manually. Memory limits only affect the WordPress® auto-installation/upgrade routine, not the actual functionality of WordPress® or s2Member.
161
  We get this type of question a lot. The answer is most definitely **yes**. The entire s2Member Framework is extremely versatile. For instance, the s2Member Pro Module is built on top of the free s2Member Framework; on top of the worlds' most powerful publishing platform ( WordPress® ). That being said, you WILL need be familiar with PHP, and/or WordPress® Hooks/Filters in order to accomplish advanced customizations. We suggest hiring a freelance developer at Elance.com, or hiring Jason Caldwell ( our own Lead Developer ) @ PriMoThemes.com / WebSharks, Inc. [Jason Caldwell](http://www.primothemes.com/post/author/websharksinc-jason/) is the Lead Developer behind the s2Member plugin, and also the s2Member Pro Module.
162
 
163
  = Can s2Member be used with ClickBank® or Google® Checkout? =
164
+ Not yet. This is coming soon though. It will be included in a future release of the s2Member Pro Module, which already works with PayPal® Pro; using direct ( on-site ) credit card processing for Visa®, MasterCard®, American Express®, Discover®, Maestro®, Solo®, and PayPal® Express Checkout. [s2Member Pro](http://www.s2member.com/) is an add-on module for the [free version](http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/) of s2Member. s2Member Pro adds full PayPal® Pro integration, a PayPal® Pro Form Generator, User Import/Export tools; along with full access to our [video tutorial library](http://www.s2member.com/videos/).
165
 
166
  == Upgrade Notice ==
167
 
170
 
171
  == Changelog ==
172
 
173
+ = 3.2.7 =
174
+ * Custom Fields ( new features ). s2Member is now equipped with a VERY powerful set of features; designed to extend the functionality of Custom Fields. s2Member now supports Text Fields ( single/multi-line ), Checkboxes ( single/multi-option ), Radio Buttons ( single/multi-option ), and Dropdowns ( single/multi-option ). In addition, with s2Member it is now possible to configure Custom Fields differently for each Membership Level. Other tools: including Validation Formats and Visibility are also available. For full details, check your Dashboard under: `s2Member -> General Options -> Custom Fields`.
175
+ * Attn Developers ( before upgrading ). Hooks/Filters ( e.g. those related to Custom Fields ) have been modified in ways that may break custom scripts you've created to work with previous versions of s2Member. We suggest dropping all of your Hooks/Filters related to Custom Fields. Instead, use the NEW improved tools w/s2Member v3.2.7+. Please see: `s2Member -> General Options -> Custom Fields`.
176
+ * BuddyPress/Multisite. A plugin conflict was resolved between BuddyPress/s2Member when both of these plugins were installed on a Multisite Network together. BuddyPress bypasses the default Filter ( `pre_site_option_registration` ) and instead, it uses: `bp_core_get_site_options()`. This has been resolved in s2Member v3.2.6+.
177
+ * Bug fix. A bug was found in s2Member's handling of Custom Fields columns. This minor bug was conflicting with other plugins that attempt to create User-based columns. This was been resolved in s2Member v3.2.7+.
178
+ * New Shortcode attribute. s2Member's PayPal Button Shortcode now accepts a new attribute ( `ta="0.00"`, Trial Amount ). In the past, if you intended to offer a "paid" initial period at a different price, you had to use the Full Button Code. Now you can just change the `ta="0.00"` attribute ( which is easier ).
179
+ * More informative. s2Member now generates warnings for newbies that create conflicts between their Membership Options Page and Login Welcome Page. s2Member is now capable of detecting the most common conflicts, in order to produce informative messages that assist site owners.
180
+ * Login/Registration Design. s2Member v3.2.7+ includes additional customization tools that allow font sizes and font families to be configured for the Login/Registration system. In your Dashboard, go to: `s2Member -> General Options -> Login/Registration Design`.
181
+ * Bug fix. The Default Profile Editing Panel ( e.g. `/wp-admin/profile.php` ) was NOT validating Custom Fields. s2Member v3.2.7 resolves this for Users/Members. Administrators are exempt ( the intended functionality ).
182
+ * Better instructions inside in the General Options panel for s2Member. Just a few subtle improvements based on User feedback. Hopefully these will make life a little easier for newbies.
183
+
184
  = 3.2.5 =
185
  * 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`. ).
186
  * 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.
294
 
295
  = 3.1 =
296
  * bbPress® compatiblity. There is a new internal Bridge that can be installed into bbPress® by s2Member. This new bbPress® (Bridge/plugin) makes it possible for s2Member Levels [0-4] to be converted into bbPress® "Members" on-the-fly, and it will guard your forums against unauthorized access; including forum registrations, which are redirected to your Membership Options Page for s2Member. To install this Bridge Integration, check your WordPress® Dashboard, under: `s2Member -> Bridge Integrations`.
297
+ * New plugin that is HIGHLY recommended for s2Member. Get [WP Show IDs](http://www.primothemes.com/post/product/wp-show-ids-plugin/). Simple, yet elegant. Shows IDs for Posts, Pages, Media, Links, Categories, Tags, and Users in the admin tables for easy access. Very lightweight. Also supports Custom Post Types / Taxonomies.
298
  * New feature. There is a new Replacement Code available for the Login Welcome Page. You can now set a Special Redirection URL, which includes `%%current_user_level%%`, making it possible to have a separate Login Welcome Page for each Membership Level that you plan to offer. For further details, log into your WP Dashboard, and go to: `s2Member -> General Options -> Login Welcome Page`.
299
  * New feature. s2Member now supports 3rd-party IPN integrations, where you can have another service, such as PayDotCom® send simulated IPN transactions to your s2Member installation. For further details, log into your WordPress® Dashboard, and go to: `s2Member -> PayPal Options -> IPN Integration` ( at the bottom of that sub-section, you'll find your Proxy IPN Key ). Full instructions for services like PayDotCom® &amp; eJunkie® will be provided in the next release. The framework is in place, but full documentation has not been written yet.
300
  * New feature. s2Member now allows you to customize a list of Recipients for both the Signup Confirmation Email, and also the Specific Post/Page Confirmation Email. This makes it possible to prevent these emails from going out ( definitely NOT recommended though ). More importantly, it allows you to have copies of these messages sent to various departments, or even to a list server; such as AWeber/MailChimp. It should also be noted that your list of Recipients, your Subject Line, and your Messages; can all be modified easily, and ALL of these fields support the full list of Replacement Codes listed in those sections. For further details, see: `s2Member -> PayPal® Options`.
501
  * Please thank [Jennifer Stuart](http://scriptygoddess.com/) for a generous donation that helped make s2Member v2.8 possible.
502
  * Also thank Stree Overlord with LARGE Inc. for his generous contribution that helped make s2Member v2.8 possible.
503
  * Also thank Martin B. for his donation too. You'll find him the Comment threads. Say thanks!
504
+ * For more info, feature requests, etc; Visit: http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/
505
 
506
  = 2.7.2 =
507
  * WebSharks Framework for Plugins has been updated to P-2.1.
508
  * The s2Member file download headers (`file-download-access.inc.php`) has been updated to support CGI/FastCGI implementations. s2Member has been tested with HostGator, BlueHost, (mt)MediaTemple (gs) and (dv), The Rackspace Cloud, and several dedicated servers running with Apache; including support for both `mod_php` and also `CGI/FastCGI` implementations. s2Member should work fine with any Apache/PHP combination. Please report all bugs through the [Support Forum](http://www.primothemes.com/forums/viewforum.php?f=4).
509
 
510
  = 2.7.1 =
511
+ * A bug in Custom Registration Fields has been corrected. This bug was introduced in v2.7, and has been corrected in v2.7.1. This bug was causing a mysterious [Empty Registration Field](http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/comment-page-3/#comment-312) to appear on the form; when a new Customer registers their Username. Please thank [Jeffrey Nichols](http://jeffreyanichols.com/) for reporting this important issue.
512
 
513
  = 2.7 =
514
  * s2Member is now compatible with BuddyPress :-) And I must say... the s2Member/BuddyPress combination is just awesome. These two plugins running together make all sorts of things possible.
s2member.php CHANGED
@@ -9,9 +9,9 @@ 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.5
13
- Stable tag: 3.2.5
14
- Framework: WS-P-3.0
15
 
16
  SSL Compatible: yes
17
  bbPress Compatible: yes
@@ -34,9 +34,9 @@ Donate link: http://www.primothemes.com/donate/
34
  Plugin Name: s2Member
35
  Pro Module / Prices: http://www.s2member.com/prices/
36
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
37
- Plugin URI: http://www.primothemes.com/post/s2member-membership-plugin-with-paypal/
38
  PayPal Pro Integration: http://www.primothemes.com/forums/viewtopic.php?f=4&t=304
39
  Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
 
40
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with Multisite Networking, and even with BuddyPress if you like.
41
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, includes extensive documentation, highly extensible
42
  */
@@ -48,10 +48,10 @@ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
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
  */
9
  If not, see: <http://www.gnu.org/licenses/>.
10
  */
11
  /*
12
+ Version: 3.2.7
13
+ Stable tag: 3.2.7
14
+ Framework: WS-P-3.1
15
 
16
  SSL Compatible: yes
17
  bbPress Compatible: yes
34
  Plugin Name: s2Member
35
  Pro Module / Prices: http://www.s2member.com/prices/
36
  Forum URI: http://www.primothemes.com/forums/viewforum.php?f=4
 
37
  PayPal Pro Integration: http://www.primothemes.com/forums/viewtopic.php?f=4&t=304
38
  Professional Installation URI: http://www.primothemes.com/forums/viewtopic.php?f=4&t=107
39
+ Plugin URI: http://www.primothemes.com/post/product/s2member-membership-plugin-with-paypal/
40
  Description: Empowers WordPress® with membership capabilities. Integrates seamlessly with PayPal®. Also compatible with Multisite Networking, and even with BuddyPress if you like.
41
  Tags: membership, members, member, register, signup, paypal, pay pal, s2member, subscriber, members only, buddypress, buddy press, buddy press compatible, shopping cart, checkout, api, options panel included, websharks framework, w3c validated code, includes extensive documentation, highly extensible
42
  */
48
  /*
49
  Define versions.
50
  */
51
+ define ("WS_PLUGIN__S2MEMBER_VERSION", "3.2.7");
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.7");
55
  /*
56
  Compatibility checks.
57
  */