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

Version Description

= v140603 =

(Maintenance Release) Upgrade immediately.

Download this release

Release Info

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

Code changes from version 140520 to 140603

Files changed (173) hide show
  1. checksum.txt +1 -1
  2. includes/classes/admin-css-js.inc.php +2 -2
  3. includes/classes/admin-lockouts.inc.php +11 -11
  4. includes/classes/admin-notices.inc.php +24 -34
  5. includes/classes/auto-eots.inc.php +34 -34
  6. includes/classes/brute-force.inc.php +12 -12
  7. includes/classes/cache.inc.php +3 -3
  8. includes/classes/catgs-sp.inc.php +13 -13
  9. includes/classes/catgs.inc.php +6 -6
  10. includes/classes/constants.inc.php +8 -8
  11. includes/classes/cron-jobs-in.inc.php +9 -9
  12. includes/classes/cron-jobs.inc.php +2 -2
  13. includes/classes/css-js-themes.inc.php +10 -10
  14. includes/classes/css-js.inc.php +2 -2
  15. includes/classes/custom-reg-fields-4bp.inc.php +258 -266
  16. includes/classes/custom-reg-fields.inc.php +44 -52
  17. includes/classes/database.inc.php +1 -1
  18. includes/classes/email-configs.inc.php +47 -47
  19. includes/classes/files-in.inc.php +36 -37
  20. includes/classes/files.inc.php +12 -12
  21. includes/classes/ip-restrictions.inc.php +10 -10
  22. includes/classes/labels.inc.php +9 -9
  23. includes/classes/list-servers.inc.php +130 -126
  24. includes/classes/login-checks.inc.php +16 -16
  25. includes/classes/login-customizations.inc.php +40 -7
  26. includes/classes/login-redirects-r.inc.php +4 -4
  27. includes/classes/login-redirects.inc.php +28 -28
  28. includes/classes/menu-pages-rs.inc.php +2 -2
  29. includes/classes/menu-pages-tb.inc.php +2 -2
  30. includes/classes/menu-pages.inc.php +6 -6
  31. includes/classes/meta-box-saves.inc.php +20 -20
  32. includes/classes/meta-box-security.inc.php +2 -2
  33. includes/classes/meta-boxes.inc.php +7 -7
  34. includes/classes/mms-patches.inc.php +12 -12
  35. includes/classes/mo-page-in.inc.php +7 -7
  36. includes/classes/mo-page.inc.php +7 -7
  37. includes/classes/no-cache.inc.php +194 -187
  38. includes/classes/op-notices.inc.php +10 -10
  39. includes/classes/option-forces.inc.php +42 -42
  40. includes/classes/pages-sp.inc.php +23 -23
  41. includes/classes/pages.inc.php +10 -10
  42. includes/classes/paypal-notify-in-billing-agreement-signup.inc.php +10 -10
  43. includes/classes/paypal-notify-in-cart.inc.php +10 -10
  44. includes/classes/paypal-notify-in-express-checkout.inc.php +10 -10
  45. includes/classes/paypal-notify-in-merch-pmt.inc.php +10 -10
  46. includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +14 -14
  47. includes/classes/paypal-notify-in-send-money.inc.php +10 -10
  48. includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +17 -17
  49. includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +26 -26
  50. includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +23 -23
  51. includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +10 -10
  52. includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +14 -14
  53. includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +24 -24
  54. includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +54 -54
  55. includes/classes/paypal-notify-in-virtual-terminal.inc.php +10 -10
  56. includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +28 -28
  57. includes/classes/paypal-notify-in-web-accept-sp.inc.php +21 -21
  58. includes/classes/paypal-notify-in.inc.php +22 -22
  59. includes/classes/paypal-notify.inc.php +1 -1
  60. includes/classes/paypal-return-in-no-tx-data.inc.php +9 -9
  61. includes/classes/paypal-return-in-proxy-ty-email.inc.php +9 -9
  62. includes/classes/paypal-return-in-proxy-x-preview.inc.php +8 -8
  63. includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +4 -4
  64. includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +9 -9
  65. includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +17 -17
  66. includes/classes/paypal-return-in-web-accept-sp.inc.php +15 -15
  67. includes/classes/paypal-return-in.inc.php +23 -23
  68. includes/classes/paypal-return.inc.php +1 -1
  69. includes/classes/paypal-utilities.inc.php +30 -30
  70. includes/classes/posts-sp.inc.php +22 -22
  71. includes/classes/posts.inc.php +10 -10
  72. includes/classes/profile-in.inc.php +277 -268
  73. includes/classes/profile-mods-4bp-in.inc.php +105 -103
  74. includes/classes/profile-mods-4bp.inc.php +38 -43
  75. includes/classes/profile-mods-in.inc.php +145 -143
  76. includes/classes/profile-mods.inc.php +38 -43
  77. includes/classes/profile.inc.php +40 -43
  78. includes/classes/ptags-sp.inc.php +13 -13
  79. includes/classes/ptags.inc.php +7 -7
  80. includes/classes/querys.inc.php +15 -15
  81. includes/classes/readmes.inc.php +19 -19
  82. includes/classes/register-access.inc.php +15 -15
  83. includes/classes/register-in.inc.php +6 -6
  84. includes/classes/register.inc.php +1 -1
  85. includes/classes/registration-times.inc.php +5 -5
  86. includes/classes/registrations.inc.php +178 -137
  87. includes/classes/return-templates.inc.php +14 -14
  88. includes/classes/ruris-sp.inc.php +10 -10
  89. includes/classes/ruris.inc.php +12 -12
  90. includes/classes/s-badge-status-in.inc.php +4 -4
  91. includes/classes/s-badge-status.inc.php +1 -1
  92. includes/classes/sc-files-in.inc.php +10 -10
  93. includes/classes/sc-files.inc.php +6 -6
  94. includes/classes/sc-gets-in.inc.php +8 -8
  95. includes/classes/sc-gets.inc.php +2 -2
  96. includes/classes/sc-if-conds-in.inc.php +25 -25
  97. includes/classes/sc-if-conds.inc.php +2 -2
  98. includes/classes/sc-keys-in.inc.php +9 -9
  99. includes/classes/sc-keys.inc.php +2 -2
  100. includes/classes/sc-paypal-button-e.inc.php +9 -9
  101. includes/classes/sc-paypal-button-in.inc.php +21 -21
  102. includes/classes/sc-paypal-button.inc.php +2 -2
  103. includes/classes/sc-profile-in.inc.php +292 -279
  104. includes/classes/sc-profile.inc.php +2 -2
  105. includes/classes/sc-s-badge-in.inc.php +7 -7
  106. includes/classes/sc-s-badge.inc.php +2 -2
  107. includes/classes/security.inc.php +5 -5
  108. includes/classes/sp-access.inc.php +28 -28
  109. includes/classes/ssl.inc.php +4 -4
  110. includes/classes/systematics-sp.inc.php +21 -21
  111. includes/classes/systematics.inc.php +18 -18
  112. includes/classes/tracking-codes.inc.php +22 -22
  113. includes/classes/tracking-cookies-in.inc.php +8 -8
  114. includes/classes/tracking-cookies.inc.php +2 -2
  115. includes/classes/translations.inc.php +24 -24
  116. includes/classes/user-access.inc.php +29 -29
  117. includes/classes/user-deletions.inc.php +31 -31
  118. includes/classes/user-drip-access.inc.php +0 -147
  119. includes/classes/user-new-in.inc.php +64 -64
  120. includes/classes/user-new.inc.php +3 -3
  121. includes/classes/user-notes.inc.php +17 -17
  122. includes/classes/user-securities.inc.php +19 -19
  123. includes/classes/users-list-in.inc.php +46 -46
  124. includes/classes/users-list.inc.php +32 -26
  125. includes/classes/utilities.inc.php +16 -16
  126. includes/classes/utils-arrays.inc.php +17 -17
  127. includes/classes/utils-captchas.inc.php +9 -9
  128. includes/classes/utils-conds.inc.php +2 -2
  129. includes/classes/utils-css.inc.php +3 -3
  130. includes/classes/utils-cur.inc.php +92 -97
  131. includes/classes/utils-dirs.inc.php +17 -17
  132. includes/classes/utils-encryption.inc.php +16 -16
  133. includes/classes/utils-forms.inc.php +5 -5
  134. includes/classes/utils-gets.inc.php +38 -38
  135. includes/classes/utils-html.inc.php +4 -4
  136. includes/classes/utils-logs.inc.php +2 -2
  137. includes/classes/utils-s2o.inc.php +9 -9
  138. includes/classes/utils-strings.inc.php +47 -47
  139. includes/classes/utils-time.inc.php +21 -21
  140. includes/classes/utils-urls.inc.php +24 -24
  141. includes/classes/utils-users.inc.php +31 -31
  142. includes/classes/wp-footer.inc.php +2 -2
  143. includes/externals/mailchimp/nc-mcapi.inc.php +119 -119
  144. includes/externals/markdown/nc-markdown.inc.php +2 -2
  145. includes/funcs.inc.php +1 -1
  146. includes/functions/api-functions.inc.php +52 -52
  147. includes/functions/class-autoloader.inc.php +5 -5
  148. includes/functions/deprecated.inc.php +1 -1
  149. includes/functions/pluggables.inc.php +1 -1
  150. includes/hooks.inc.php +162 -161
  151. includes/menu-pages/api-ops.inc.php +36 -36
  152. includes/menu-pages/code-samples/jwplayer-streaming-mp4-webm.x-php +2 -2
  153. includes/menu-pages/code-samples/jwplayer-streaming-mp4.x-php +1 -1
  154. includes/menu-pages/code-samples/s2drip-example1.x-php +13 -2
  155. includes/menu-pages/down-ops.inc.php +4 -4
  156. includes/menu-pages/gen-ops.inc.php +2 -2
  157. includes/menu-pages/info.inc.php +6 -6
  158. includes/menu-pages/logs.inc.php +4 -4
  159. includes/menu-pages/paypal-buttons.inc.php +40 -40
  160. includes/menu-pages/res-ops.inc.php +50 -50
  161. includes/menu-pages/scripting.inc.php +57 -57
  162. includes/menu-pages/start.inc.php +56 -56
  163. includes/menu-pages/trk-ops.inc.php +33 -33
  164. includes/syscon.inc.php +1 -1
  165. includes/templates/badges/s-badge.php +18 -3
  166. includes/templates/cfg-files/s2member-files-no-gzip.php +2 -2
  167. includes/templates/cfg-files/s2member-files.php +2 -2
  168. includes/templates/cfg-files/s2o-nw-plugins.php +3 -3
  169. includes/templates/cfg-files/s2o-st-plugins.php +3 -3
  170. includes/translations/s2member.pot +283 -278
  171. readme.txt +28 -4
  172. s2member-o.php +1 -1
  173. s2member.php +4 -4
checksum.txt CHANGED
@@ -1 +1 @@
1
- 8ff3c403b6da2ebb6c3e93dafb2f9314
1
+ 5f401849e0869c8ca09d847e2211b610
includes/classes/admin-css-js.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
39
*/
40
public static function menu_pages_css ()
41
{
42
- if (!empty ($_GET["ws_plugin__s2member_menu_pages_css"]))
43
{
44
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
45
}
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
56
*/
57
public static function menu_pages_js ()
58
{
59
- if (!empty ($_GET["ws_plugin__s2member_menu_pages_js"]))
60
{
61
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
62
}
39
*/
40
public static function menu_pages_css ()
41
{
42
+ if (!empty($_GET["ws_plugin__s2member_menu_pages_css"]))
43
{
44
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
45
}
56
*/
57
public static function menu_pages_js ()
58
{
59
+ if (!empty($_GET["ws_plugin__s2member_menu_pages_js"]))
60
{
61
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
62
}
includes/classes/admin-lockouts.inc.php CHANGED
@@ -39,10 +39,10 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
39
*/
40
public static function admin_lockout ()
41
{
42
- do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
43
44
if (is_admin () && (!defined ("DOING_AJAX") || !DOING_AJAX) && !current_user_can ("edit_posts") /* Give Filters a chance here too. */)
45
- if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
46
{
47
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
48
/* Special Redirection. */wp_redirect ($redirection_url) . exit ();
@@ -50,7 +50,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
50
else // Else we use the Login Welcome Page configured for s2Member.
51
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . exit ();
52
}
53
- do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
54
55
return /* Return for uniformity. */;
56
}
@@ -62,12 +62,12 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
62
*
63
* @attaches-to ``add_action("admin_bar_menu");``
64
*
65
- * @param obj $wp_admin_bar Expects the ``$wp_admin_bar``, by reference; passed in by the Action Hook.
66
* @return null After modifying ``$wp_admin_var``.
67
*/
68
public static function filter_admin_menu_bar (&$wp_admin_bar = FALSE)
69
{
70
- do_action ("ws_plugin__s2member_before_filter_admin_menu_bar", get_defined_vars ());
71
72
$uses_nodes = (version_compare (get_bloginfo ("version"), "3.3-RC1", ">=")) ? true : false;
73
@@ -80,7 +80,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
80
$title = ($title !== get_bloginfo ("name")) ? trim ($title) . "…" : $title;
81
$href = /* Change to front page. */ site_url ("/");
82
83
- $wp_admin_bar->add_node (array ("id" => $id, "title" => $title, "href" => $href));
84
$wp_admin_bar->remove_node /* Ditch now, replacing this. */ ("site-name");
85
86
unset /* A little housekeeping. */ ($id, $title, $href);
@@ -98,19 +98,19 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
98
$wp_admin_bar->remove_node /* Ditch this node. */ ("my-sites");
99
}
100
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* If locking Users/Members out of `/wp-admin/` areas. */)
101
- if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
102
{
103
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ();
104
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
105
106
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-account"))
107
- $wp_admin_bar->add_node /* Update this node. */ (array ("id" => "my-account", "href" => $lwp));
108
109
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("user-info"))
110
- $wp_admin_bar->add_node /* Update this node. */ (array ("id" => "user-info", "href" => $lwp));
111
112
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("edit-profile"))
113
- $wp_admin_bar->add_node /* Update this node. */ (array ("id" => "edit-profile", "href" => $lwp));
114
// -------
115
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["href"]))
116
$wp_admin_bar->menu->{"my-account"}["href"] = /* Update this item. */ $lwp;
@@ -130,7 +130,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
130
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"]))
131
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
132
}
133
- do_action ("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
134
135
return /* Return for uniformity. */;
136
}
39
*/
40
public static function admin_lockout ()
41
{
42
+ do_action("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
43
44
if (is_admin () && (!defined ("DOING_AJAX") || !DOING_AJAX) && !current_user_can ("edit_posts") /* Give Filters a chance here too. */)
45
+ if (apply_filters("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
46
{
47
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
48
/* Special Redirection. */wp_redirect ($redirection_url) . exit ();
50
else // Else we use the Login Welcome Page configured for s2Member.
51
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . exit ();
52
}
53
+ do_action("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
54
55
return /* Return for uniformity. */;
56
}
62
*
63
* @attaches-to ``add_action("admin_bar_menu");``
64
*
65
+ * @param object $wp_admin_bar Expects the ``$wp_admin_bar``, by reference; passed in by the Action Hook.
66
* @return null After modifying ``$wp_admin_var``.
67
*/
68
public static function filter_admin_menu_bar (&$wp_admin_bar = FALSE)
69
{
70
+ do_action("ws_plugin__s2member_before_filter_admin_menu_bar", get_defined_vars ());
71
72
$uses_nodes = (version_compare (get_bloginfo ("version"), "3.3-RC1", ">=")) ? true : false;
73
80
$title = ($title !== get_bloginfo ("name")) ? trim ($title) . "…" : $title;
81
$href = /* Change to front page. */ site_url ("/");
82
83
+ $wp_admin_bar->add_node (array("id" => $id, "title" => $title, "href" => $href));
84
$wp_admin_bar->remove_node /* Ditch now, replacing this. */ ("site-name");
85
86
unset /* A little housekeeping. */ ($id, $title, $href);
98
$wp_admin_bar->remove_node /* Ditch this node. */ ("my-sites");
99
}
100
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* If locking Users/Members out of `/wp-admin/` areas. */)
101
+ if (apply_filters("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
102
{
103
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ();
104
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
105
106
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-account"))
107
+ $wp_admin_bar->add_node /* Update this node. */ (array("id" => "my-account", "href" => $lwp));
108
109
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("user-info"))
110
+ $wp_admin_bar->add_node /* Update this node. */ (array("id" => "user-info", "href" => $lwp));
111
112
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("edit-profile"))
113
+ $wp_admin_bar->add_node /* Update this node. */ (array("id" => "edit-profile", "href" => $lwp));
114
// -------
115
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["href"]))
116
$wp_admin_bar->menu->{"my-account"}["href"] = /* Update this item. */ $lwp;
130
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"]))
131
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
132
}
133
+ do_action("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
134
135
return /* Return for uniformity. */;
136
}
includes/classes/admin-notices.inc.php CHANGED
@@ -33,34 +33,31 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
33
* @package s2Member\Admin_Notices
34
* @since 3.5
35
*
36
- * @param str $notice String value of actual notice *(i.e. the message)*.
37
- * @param str|array $on_pages Optional. Defaults to any page. String or array of pages to display this notice on.
38
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
39
* @param int $time Optional. Unix timestamp indicating when this notice will be displayed.
40
* @param bool $dismiss Optional. If true, the notice will remain persistent, until dismissed. Defaults to false.
41
- * @return null
42
*/
43
public static function enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE, $dismiss = FALSE)
44
{
45
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
46
- do_action ("ws_plugin__s2member_before_enqueue_admin_notice", get_defined_vars ());
47
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
48
49
if /* If we have a valid string. */(is_string ($notice) && $notice)
50
{
51
$notices = (array)get_option ("ws_plugin__s2member_notices");
52
53
- array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time, "dismiss" => $dismiss));
54
55
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
56
- do_action ("ws_plugin__s2member_during_enqueue_admin_notice", get_defined_vars ());
57
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
58
59
update_option ("ws_plugin__s2member_notices", c_ws_plugin__s2member_utils_arrays::array_unique ($notices));
60
}
61
- do_action ("ws_plugin__s2member_after_enqueue_admin_notice", get_defined_vars ());
62
-
63
- return /* Return for uniformity. */;
64
}
65
/**
66
* Displays an administrative notice.
@@ -68,16 +65,15 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
68
* @package s2Member\Admin_Notices
69
* @since 3.5
70
*
71
- * @param str $notice String value of actual notice *(i.e. the message)*.
72
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
73
* @param bool $dismiss Optional. If true, the notice will be displayed with a dismissal link. Defaults to false.
74
- * @return null
75
*/
76
public static function display_admin_notice ($notice = FALSE, $error = FALSE, $dismiss = FALSE)
77
{
78
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
79
- do_action ("ws_plugin__s2member_before_display_admin_notice", get_defined_vars ());
80
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
81
82
if /* Slightly different/special format for errors. */ (is_string ($notice) && $notice && $error)
83
{
@@ -91,9 +87,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
91
92
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
93
}
94
- do_action ("ws_plugin__s2member_after_display_admin_notice", get_defined_vars ());
95
-
96
- return /* Return for uniformity. */;
97
}
98
/**
99
* Processes all administrative notices.
@@ -105,16 +99,14 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
105
* @attaches-to ``add_action("user_admin_notices");``
106
* @attaches-to ``add_action("network_admin_notices");``
107
* @todo Update to ``add_action("all_admin_notices");``.
108
- *
109
- * @return null
110
*/
111
public static function admin_notices ()
112
{
113
global /* This holds the current page filename. */ $pagenow;
114
115
- do_action ("ws_plugin__s2member_before_admin_notices", get_defined_vars ());
116
117
- if (is_admin () && is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
118
{
119
$a = (is_blog_admin ()) ? "blog" : "";
120
$a = (is_user_admin ()) ? "user" : $a;
@@ -122,7 +114,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
122
$a = /* Default Blog Admin. */(!$a) ? "blog" : $a;
123
124
foreach /* Check several things about each Notice. */ ($notices as $i => $notice)
125
- foreach (((!$notice["on_pages"]) ? array ("*"): (array)$notice["on_pages"]) as $page)
126
{
127
if /* NO prefix? */ (!preg_match ("/^(.+?)\:/", $page))
128
$page = /* `blog:` */ "blog:" . ltrim ($page, ":");
@@ -130,22 +122,22 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
130
$adms = preg_split ("/\|/", preg_replace ("/\:(.*)#x2F;i", "", $page));
131
$page = preg_replace ("/^([^\:]*)\:/i", "", $page);
132
133
- if (empty ($adms) || in_array ("*", $adms) || in_array ($a, $adms))
134
if (!$page || "*" === $page || $pagenow === $page || @$_GET["page"] === $page)
135
{
136
if /* Time to show it? */ (strtotime ("now") >= (int)$notice["time"])
137
{
138
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
139
- do_action ("ws_plugin__s2member_during_admin_notices_before_display", get_defined_vars ());
140
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
141
142
- if (!$notice["dismiss"] || (!empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) && $_GET["ws-plugin--s2member-dismiss-admin-notice"] === md5 ($notice["notice"])))
143
unset /* Clear this administrative notice now? */($notices[$i]);
144
145
- if (!$notice["dismiss"] || empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
146
c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
147
148
- do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
149
}
150
continue /* This Notice processed; continue. */ 2;
151
}
@@ -153,14 +145,12 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
153
$notices = /* Re-index array. */array_merge ($notices);
154
155
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
156
- do_action ("ws_plugin__s2member_during_admin_notices", get_defined_vars ());
157
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
158
159
update_option ("ws_plugin__s2member_notices", $notices);
160
}
161
- do_action ("ws_plugin__s2member_after_admin_notices", get_defined_vars ());
162
-
163
- return /* Return for uniformity. */;
164
}
165
}
166
}
33
* @package s2Member\Admin_Notices
34
* @since 3.5
35
*
36
+ * @param string $notice String value of actual notice *(i.e. the message)*.
37
+ * @param string|array $on_pages Optional. Defaults to any page. String or array of pages to display this notice on.
38
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
39
* @param int $time Optional. Unix timestamp indicating when this notice will be displayed.
40
* @param bool $dismiss Optional. If true, the notice will remain persistent, until dismissed. Defaults to false.
41
*/
42
public static function enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE, $dismiss = FALSE)
43
{
44
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
45
+ do_action("ws_plugin__s2member_before_enqueue_admin_notice", get_defined_vars ());
46
+ unset($__refs, $__v);
47
48
if /* If we have a valid string. */(is_string ($notice) && $notice)
49
{
50
$notices = (array)get_option ("ws_plugin__s2member_notices");
51
52
+ array_push ($notices, array("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time, "dismiss" => $dismiss));
53
54
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
55
+ do_action("ws_plugin__s2member_during_enqueue_admin_notice", get_defined_vars ());
56
+ unset($__refs, $__v);
57
58
update_option ("ws_plugin__s2member_notices", c_ws_plugin__s2member_utils_arrays::array_unique ($notices));
59
}
60
+ do_action("ws_plugin__s2member_after_enqueue_admin_notice", get_defined_vars ());
61
}
62
/**
63
* Displays an administrative notice.
65
* @package s2Member\Admin_Notices
66
* @since 3.5
67
*
68
+ * @param string $notice String value of actual notice *(i.e. the message)*.
69
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
70
* @param bool $dismiss Optional. If true, the notice will be displayed with a dismissal link. Defaults to false.
71
*/
72
public static function display_admin_notice ($notice = FALSE, $error = FALSE, $dismiss = FALSE)
73
{
74
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
75
+ do_action("ws_plugin__s2member_before_display_admin_notice", get_defined_vars ());
76
+ unset($__refs, $__v);
77
78
if /* Slightly different/special format for errors. */ (is_string ($notice) && $notice && $error)
79
{
87
88
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
89
}
90
+ do_action("ws_plugin__s2member_after_display_admin_notice", get_defined_vars ());
91
}
92
/**
93
* Processes all administrative notices.
99
* @attaches-to ``add_action("user_admin_notices");``
100
* @attaches-to ``add_action("network_admin_notices");``
101
* @todo Update to ``add_action("all_admin_notices");``.
102
*/
103
public static function admin_notices ()
104
{
105
global /* This holds the current page filename. */ $pagenow;
106
107
+ do_action("ws_plugin__s2member_before_admin_notices", get_defined_vars ());
108
109
+ if (is_admin () && is_array($notices = get_option ("ws_plugin__s2member_notices")) && !empty($notices))
110
{
111
$a = (is_blog_admin ()) ? "blog" : "";
112
$a = (is_user_admin ()) ? "user" : $a;
114
$a = /* Default Blog Admin. */(!$a) ? "blog" : $a;
115
116
foreach /* Check several things about each Notice. */ ($notices as $i => $notice)
117
+ foreach (((!$notice["on_pages"]) ? array("*"): (array)$notice["on_pages"]) as $page)
118
{
119
if /* NO prefix? */ (!preg_match ("/^(.+?)\:/", $page))
120
$page = /* `blog:` */ "blog:" . ltrim ($page, ":");
122
$adms = preg_split ("/\|/", preg_replace ("/\:(.*)#x2F;i", "", $page));
123
$page = preg_replace ("/^([^\:]*)\:/i", "", $page);
124
125
+ if (empty($adms) || in_array("*", $adms) || in_array($a, $adms))
126
if (!$page || "*" === $page || $pagenow === $page || @$_GET["page"] === $page)
127
{
128
if /* Time to show it? */ (strtotime ("now") >= (int)$notice["time"])
129
{
130
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
131
+ do_action("ws_plugin__s2member_during_admin_notices_before_display", get_defined_vars ());
132
+ unset($__refs, $__v);
133
134
+ if (!$notice["dismiss"] || (!empty($_GET["ws-plugin--s2member-dismiss-admin-notice"]) && $_GET["ws-plugin--s2member-dismiss-admin-notice"] === md5 ($notice["notice"])))
135
unset /* Clear this administrative notice now? */($notices[$i]);
136
137
+ if (!$notice["dismiss"] || empty($_GET["ws-plugin--s2member-dismiss-admin-notice"]) || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
138
c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
139
140
+ do_action("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
141
}
142
continue /* This Notice processed; continue. */ 2;
143
}
145
$notices = /* Re-index array. */array_merge ($notices);
146
147
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
148
+ do_action("ws_plugin__s2member_during_admin_notices", get_defined_vars ());
149
+ unset($__refs, $__v);
150
151
update_option ("ws_plugin__s2member_notices", $notices);
152
}
153
+ do_action("ws_plugin__s2member_after_admin_notices", get_defined_vars ());
154
}
155
}
156
}
includes/classes/auto-eots.inc.php CHANGED
@@ -37,21 +37,21 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
37
*/
38
public static function add_auto_eot_system ()
39
{
40
- do_action ("ws_plugin__s2member_before_add_auto_eot_system", get_defined_vars ());
41
42
if (!c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ())
43
{
44
- return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
45
}
46
else if /* Otherwise, we can schedule? */ (function_exists ("wp_cron"))
47
{
48
wp_schedule_event (time (), "every10m", "ws_plugin__s2member_auto_eot_system__schedule");
49
50
- return apply_filters ("ws_plugin__s2member_add_auto_eot_system", true, get_defined_vars ());
51
}
52
else // Otherwise, it would appear that WP-Cron is not available.
53
{
54
- return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
55
}
56
}
57
/**
@@ -64,17 +64,17 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
64
*/
65
public static function delete_auto_eot_system ()
66
{
67
- do_action ("ws_plugin__s2member_before_delete_auto_eot_system", get_defined_vars ());
68
69
if /* Is `wp_cron()` even available? */ (function_exists ("wp_cron"))
70
{
71
wp_clear_scheduled_hook /* Since v3.0.3. */ ("ws_plugin__s2member_auto_eot_system__schedule");
72
73
- return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
74
}
75
else // Otherwise, it would appear that WP-Cron is not available.
76
{
77
- return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", false, get_defined_vars ());
78
}
79
}
80
/**
@@ -103,17 +103,17 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
103
include_once ABSPATH . "wp-admin/includes/admin.php";
104
105
@set_time_limit /* Make time for processing a larger userbase. */ (0);
106
- @ini_set ("memory_limit", apply_filters ("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
107
108
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
109
- do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
110
- unset /* Unset defined __refs, __v. */($__refs, $__v);
111
112
if /* Enabled? */($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
113
{
114
- $per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
115
116
- if (is_array ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . esc_sql(strtotime ("now")) . "' LIMIT " . $per_process)))
117
{
118
foreach /* Go through the array of EOTS. We need to (demote|delete) each of them. */ ($eots as $eot)
119
{
@@ -138,10 +138,10 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
138
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
139
140
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
141
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
142
- do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
143
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
144
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
145
146
if /* Only if NOT the existing Role. */($existing_role !== $demotion_role)
147
$user->set_role /* Give User the demotion Role. */ ($demotion_role);
@@ -158,7 +158,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
158
delete_user_option ($user_id, "s2member_subscr_gateway");
159
160
delete_user_option ($user_id, "s2member_ipn_signup_vars");
161
- if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
162
delete_user_option ($user_id, "s2member_paid_registration_times");
163
164
delete_user_option ($user_id, "s2member_last_status_scan");
@@ -173,7 +173,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
173
if($subscr_gateway && $subscr_id) // Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
174
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Paid Subscr. ID @ time of demotion: ".$subscr_gateway." -› ".$subscr_id);
175
176
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
177
{
178
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
179
@@ -185,7 +185,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
185
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
186
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
187
{
188
- if (is_array ($fields) && !empty ($fields))
189
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
190
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
191
break;
@@ -194,7 +194,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
194
c_ws_plugin__s2member_utils_urls::remote ($url);
195
}
196
}
197
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
198
{
199
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
200
c_ws_plugin__s2member_email_configs::email_config_release ();
@@ -212,7 +212,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
212
$msg .= "user_ip: %%user_ip%%\n";
213
$msg .= "user_id: %%user_id%%\n";
214
215
- if (is_array ($fields) && !empty ($fields))
216
foreach ($fields as $var => $val)
217
$msg .= $var . ": %%" . $var . "%%\n";
218
@@ -235,7 +235,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
235
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
236
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
237
{
238
- if (is_array ($fields) && !empty ($fields))
239
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
240
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
241
break;
@@ -243,23 +243,23 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
243
if /* Still have a ``$sbj`` and a ``$msg``? */ ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
244
245
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
246
- wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
247
}
248
if /* Back on? */ ($email_configs_were_on)
249
c_ws_plugin__s2member_email_configs::email_config ();
250
}
251
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
252
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
253
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
254
}
255
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
256
{
257
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
258
259
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
260
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
261
- do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
262
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
263
264
if /* Multisite does NOT actually delete; ONLY removes. */(is_multisite ())
265
{
@@ -272,12 +272,12 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
272
wp_delete_user /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */ ($user_id);
273
274
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
275
- do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
276
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
277
}
278
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
279
- do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
280
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
281
}
282
}
283
}
@@ -287,8 +287,8 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
287
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients /* Cleanup. */ ();
288
289
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
290
- do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
291
- unset /* Unset defined __refs, __v. */($__refs, $__v);
292
293
return /* Return for uniformity. */;
294
}
37
*/
38
public static function add_auto_eot_system ()
39
{
40
+ do_action("ws_plugin__s2member_before_add_auto_eot_system", get_defined_vars ());
41
42
if (!c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ())
43
{
44
+ return apply_filters("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
45
}
46
else if /* Otherwise, we can schedule? */ (function_exists ("wp_cron"))
47
{
48
wp_schedule_event (time (), "every10m", "ws_plugin__s2member_auto_eot_system__schedule");
49
50
+ return apply_filters("ws_plugin__s2member_add_auto_eot_system", true, get_defined_vars ());
51
}
52
else // Otherwise, it would appear that WP-Cron is not available.
53
{
54
+ return apply_filters("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
55
}
56
}
57
/**
64
*/
65
public static function delete_auto_eot_system ()
66
{
67
+ do_action("ws_plugin__s2member_before_delete_auto_eot_system", get_defined_vars ());
68
69
if /* Is `wp_cron()` even available? */ (function_exists ("wp_cron"))
70
{
71
wp_clear_scheduled_hook /* Since v3.0.3. */ ("ws_plugin__s2member_auto_eot_system__schedule");
72
73
+ return apply_filters("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
74
}
75
else // Otherwise, it would appear that WP-Cron is not available.
76
{
77
+ return apply_filters("ws_plugin__s2member_delete_auto_eot_system", false, get_defined_vars ());
78
}
79
}
80
/**
103
include_once ABSPATH . "wp-admin/includes/admin.php";
104
105
@set_time_limit /* Make time for processing a larger userbase. */ (0);
106
+ @ini_set ("memory_limit", apply_filters("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
107
108
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
109
+ do_action("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
110
+ unset($__refs, $__v);
111
112
if /* Enabled? */($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
113
{
114
+ $per_process = apply_filters("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
115
116
+ if (is_array($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . esc_sql(strtotime ("now")) . "' LIMIT " . $per_process)))
117
{
118
foreach /* Go through the array of EOTS. We need to (demote|delete) each of them. */ ($eots as $eot)
119
{
138
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
139
140
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
141
+ do_action("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
142
+ do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
143
+ do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
144
+ unset($__refs, $__v);
145
146
if /* Only if NOT the existing Role. */($existing_role !== $demotion_role)
147
$user->set_role /* Give User the demotion Role. */ ($demotion_role);
158
delete_user_option ($user_id, "s2member_subscr_gateway");
159
160
delete_user_option ($user_id, "s2member_ipn_signup_vars");
161
+ if (!apply_filters("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
162
delete_user_option ($user_id, "s2member_paid_registration_times");
163
164
delete_user_option ($user_id, "s2member_last_status_scan");
173
if($subscr_gateway && $subscr_id) // Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
174
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Paid Subscr. ID @ time of demotion: ".$subscr_gateway." -› ".$subscr_id);
175
176
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array($cv = preg_split ("/\|/", $custom)))
177
{
178
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
179
185
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
186
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
187
{
188
+ if (is_array($fields) && !empty($fields))
189
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
190
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
191
break;
194
c_ws_plugin__s2member_utils_urls::remote ($url);
195
}
196
}
197
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array($cv = preg_split ("/\|/", $custom)))
198
{
199
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
200
c_ws_plugin__s2member_email_configs::email_config_release ();
212
$msg .= "user_ip: %%user_ip%%\n";
213
$msg .= "user_id: %%user_id%%\n";
214
215
+ if (is_array($fields) && !empty($fields))
216
foreach ($fields as $var => $val)
217
$msg .= $var . ": %%" . $var . "%%\n";
218
235
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
236
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
237
{
238
+ if (is_array($fields) && !empty($fields))
239
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
240
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
241
break;
243
if /* Still have a ``$sbj`` and a ``$msg``? */ ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
244
245
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
246
+ wp_mail ($recipient, apply_filters("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
247
}
248
if /* Back on? */ ($email_configs_were_on)
249
c_ws_plugin__s2member_email_configs::email_config ();
250
}
251
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
252
+ do_action("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
253
+ unset($__refs, $__v);
254
}
255
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
256
{
257
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
258
259
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
260
+ do_action("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
261
+ do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
262
+ unset($__refs, $__v);
263
264
if /* Multisite does NOT actually delete; ONLY removes. */(is_multisite ())
265
{
272
wp_delete_user /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */ ($user_id);
273
274
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
275
+ do_action("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
276
+ unset($__refs, $__v);
277
}
278
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
279
+ do_action("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
280
+ unset($__refs, $__v);
281
}
282
}
283
}
287
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients /* Cleanup. */ ();
288
289
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
290
+ do_action("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
291
+ unset($__refs, $__v);
292
293
return /* Return for uniformity. */;
294
}
includes/classes/brute-force.inc.php CHANGED
@@ -38,24 +38,24 @@ if (!class_exists ("c_ws_plugin__s2member_brute_force"))
38
*
39
* @attaches-to ``add_action("wp_login_failed");``
40
*
41
- * @param str $username Expects the $username to be passed in through the Hook.
42
* @return null
43
*/
44
public static function track_failed_logins ($username = FALSE)
45
{
46
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
47
- do_action ("ws_plugin__s2member_before_track_failed_logins", get_defined_vars ());
48
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
49
50
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
51
{
52
- $exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
53
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
54
55
$transient = "s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"]);
56
set_transient ($transient, (int)get_transient ($transient) + 1, $exp_secs);
57
}
58
- do_action ("ws_plugin__s2member_after_track_failed_logins", get_defined_vars ());
59
60
return /* Return for uniformity. */;
61
}
@@ -70,31 +70,31 @@ if (!class_exists ("c_ws_plugin__s2member_brute_force"))
70
*
71
* @attaches-to ``add_filter("authenticate");``
72
*
73
- * @param obj $user Expects a WP_User object, or possibly a null value.
74
* This parameter value is simply passed through this routine.
75
* @return obj|null Either null, the ``$user`` obj, or a `WP_Error` obj.
76
*/
77
public static function stop_brute_force_logins ($user = FALSE)
78
{
79
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
80
- do_action ("ws_plugin__s2member_before_stop_brute_force_logins", get_defined_vars ());
81
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
82
83
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
84
{
85
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
86
{
87
- $exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
88
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
89
$about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
90
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
91
92
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
93
- do_action ("ws_plugin__s2member_during_stop_brute_force_logins", get_defined_vars ());
94
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
95
}
96
}
97
- return apply_filters ("ws_plugin__s2member_stop_brute_force_logins", ((!empty ($errors)) ? $errors : $user), get_defined_vars ());
98
}
99
}
100
}
38
*
39
* @attaches-to ``add_action("wp_login_failed");``
40
*
41
+ * @param string $username Expects the $username to be passed in through the Hook.
42
* @return null
43
*/
44
public static function track_failed_logins ($username = FALSE)
45
{
46
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
47
+ do_action("ws_plugin__s2member_before_track_failed_logins", get_defined_vars ());
48
+ unset($__refs, $__v);
49
50
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
51
{
52
+ $exp_secs = strtotime ("+" . apply_filters("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
53
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
54
55
$transient = "s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"]);
56
set_transient ($transient, (int)get_transient ($transient) + 1, $exp_secs);
57
}
58
+ do_action("ws_plugin__s2member_after_track_failed_logins", get_defined_vars ());
59
60
return /* Return for uniformity. */;
61
}
70
*
71
* @attaches-to ``add_filter("authenticate");``
72
*
73
+ * @param object $user Expects a WP_User object, or possibly a null value.
74
* This parameter value is simply passed through this routine.
75
* @return obj|null Either null, the ``$user`` obj, or a `WP_Error` obj.
76
*/
77
public static function stop_brute_force_logins ($user = FALSE)
78
{
79
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
80
+ do_action("ws_plugin__s2member_before_stop_brute_force_logins", get_defined_vars ());
81
+ unset($__refs, $__v);
82
83
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
84
{
85
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
86
{
87
+ $exp_secs = strtotime ("+" . apply_filters("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
88
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
89
$about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
90
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
91
92
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
93
+ do_action("ws_plugin__s2member_during_stop_brute_force_logins", get_defined_vars ());
94
+ unset($__refs, $__v);
95
}
96
}
97
+ return apply_filters("ws_plugin__s2member_stop_brute_force_logins", ((!empty($errors)) ? $errors : $user), get_defined_vars ());
98
}
99
}
100
}
includes/classes/cache.inc.php CHANGED
@@ -42,7 +42,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
42
*/
43
public static function cached_page_links ()
44
{
45
- do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
46
47
$lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
48
$mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
@@ -52,7 +52,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
52
$mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
53
$fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
54
55
- $links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
56
57
if (isset ($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime ("-15 minutes") && $lwp_cache["link"])
58
{
@@ -98,7 +98,7 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
98
foreach /* Conversions for SSL and non-SSL mode. */ ($links as &$link)
99
$link = preg_replace ("/^https?\:\/\//i", $scheme . "://", $link);
100
101
- return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
102
}
103
}
104
}
42
*/
43
public static function cached_page_links ()
44
{
45
+ do_action("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
46
47
$lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
48
$mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
52
$mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
53
$fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
54
55
+ $links = array("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
56
57
if (isset ($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime ("-15 minutes") && $lwp_cache["link"])
58
{
98
foreach /* Conversions for SSL and non-SSL mode. */ ($links as &$link)
99
$link = preg_replace ("/^https?\:\/\//i", $scheme . "://", $link);
100
101
+ return apply_filters("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
102
}
103
}
104
}
includes/classes/catgs-sp.inc.php CHANGED
@@ -33,15 +33,15 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
33
* @package s2Member\Categories
34
* @since 3.5
35
*
36
- * @param int|str $cat_id Numeric Category ID.
37
* @param bool $check_user Test permissions against the current User? Defaults to true.
38
- * @return null|array Non-empty array (with details) if access is denied, else null if access is allowed.
39
*/
40
public static function check_specific_catg_level_access ($cat_id = FALSE, $check_user = TRUE)
41
{
42
- do_action ("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars ());
43
44
- $excluded = apply_filters ("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
45
46
if (!$excluded && is_numeric ($cat_id) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
@@ -49,25 +49,25 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
49
50
if /* Do NOT touch WordPress Systematics. */ (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri))
51
{
52
- $user = /* Current User's object. */(is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
53
54
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "#x2F;", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
55
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
56
57
else if /* Never restrict Systematics. However, there is 1 exception ^. */ (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $cat_uri))
58
{
59
for /* Category Level restrictions. Go through each Level. We also check nested Categories. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
60
{
61
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
62
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
63
64
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
65
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
66
67
else if /* Check Category ancestry. */ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])
68
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
69
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
70
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
71
}
72
73
for /* URIs. Go through each Level. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
@@ -76,13 +76,13 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
76
77
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
78
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
79
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
80
}
81
}
82
- do_action ("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
83
}
84
}
85
- return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars ());
86
}
87
}
88
}
33
* @package s2Member\Categories
34
* @since 3.5
35
*
36
+ * @param int|string $cat_id Numeric Category ID.
37
* @param bool $check_user Test permissions against the current User? Defaults to true.
38
+ * @return null|array Non-empty array(with details) if access is denied, else null if access is allowed.
39
*/
40
public static function check_specific_catg_level_access ($cat_id = FALSE, $check_user = TRUE)
41
{
42
+ do_action("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars ());
43
44
+ $excluded = apply_filters("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
45
46
if (!$excluded && is_numeric ($cat_id) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
49
50
if /* Do NOT touch WordPress Systematics. */ (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri))
51
{
52
+ $user = /* Current User's object. */(is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false;
53
54
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "#x2F;", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
55
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => 0), get_defined_vars ());
56
57
else if /* Never restrict Systematics. However, there is 1 exception ^. */ (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $cat_uri))
58
{
59
for /* Category Level restrictions. Go through each Level. We also check nested Categories. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
60
{
61
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
62
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars ());
63
64
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
65
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars ());
66
67
else if /* Check Category ancestry. */ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])
68
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
69
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
70
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars ());
71
}
72
73
for /* URIs. Go through each Level. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
76
77
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
78
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
79
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", array("s2member_level_req" => $n), get_defined_vars ());
80
}
81
}
82
+ do_action("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
83
}
84
}
85
+ return apply_filters("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars ());
86
}
87
}
88
}
includes/classes/catgs.inc.php CHANGED
@@ -39,15 +39,15 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
39
{
40
global /* ``get_the_ID()`` is NOT available outside The Loop. */ $post;
41
42
- do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
43
44
- $excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
45
46
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
48
if /* Do NOT touch WordPress Systematics. This excludes all WordPress Systematics. */ (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ())
49
{
50
- $user = /* Current User's object. */ (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
51
52
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "#x2F;", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
53
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
@@ -59,7 +59,7 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
59
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
60
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
61
62
- else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
63
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
64
65
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] /* Check Category ancestry. */)
@@ -76,10 +76,10 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
76
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
77
}
78
}
79
- do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
80
}
81
}
82
- do_action ("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
83
84
return /* For uniformity. */;
85
}
39
{
40
global /* ``get_the_ID()`` is NOT available outside The Loop. */ $post;
41
42
+ do_action("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
43
44
+ $excluded = apply_filters("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
45
46
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
47
{
48
if /* Do NOT touch WordPress Systematics. This excludes all WordPress Systematics. */ (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ())
49
{
50
+ $user = /* Current User's object. */ (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false;
51
52
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "#x2F;", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
53
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
59
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
60
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
61
62
+ else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
63
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
64
65
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] /* Check Category ancestry. */)
76
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
77
}
78
}
79
+ do_action("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
80
}
81
}
82
+ do_action("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
83
84
return /* For uniformity. */;
85
}
includes/classes/constants.inc.php CHANGED
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
43
*/
44
public static function constants ()
45
{
46
- do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
47
48
$links = c_ws_plugin__s2member_cache::cached_page_links ();
49
@@ -57,13 +57,13 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
57
$subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
58
$subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
59
$registration_ip = ($user) ? get_user_option ("s2member_registration_ip", $user->ID) : "";
60
- $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
61
- $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
62
$login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
63
64
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
65
- do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
66
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
67
/**
68
* Current version of s2Member.
69
*
@@ -1007,7 +1007,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
1007
* @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
1008
*/
1009
if (!defined ("S2MEMBER_CURRENT_USER_FIELDS"))
1010
- define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "reg_ip" => S2MEMBER_CURRENT_USER_REGISTRATION_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
1011
/**
1012
* Indicates the number of unique Files the current User is allowed to download every X days.
1013
*
@@ -2377,7 +2377,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2377
/*
2378
Allows other Constants to be calculated with their checksums included too.
2379
*/
2380
- $c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ());
2381
/**
2382
* Used internally by s2Member to compare the value of all API Constants at once.
2383
*
@@ -2391,7 +2391,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
2391
/*
2392
Calls the after Hook. Do NOT set Constants here.
2393
*/
2394
- do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
2395
2396
return /* Return for uniformity. */;
2397
}
43
*/
44
public static function constants ()
45
{
46
+ do_action("ws_plugin__s2member_before_constants", get_defined_vars ());
47
48
$links = c_ws_plugin__s2member_cache::cached_page_links ();
49
57
$subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
58
$subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
59
$registration_ip = ($user) ? get_user_option ("s2member_registration_ip", $user->ID) : "";
60
+ $custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array();
61
+ $paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array();
62
$login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
63
64
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
65
+ do_action("ws_plugin__s2member_during_constants", get_defined_vars ());
66
+ unset($__refs, $__v);
67
/**
68
* Current version of s2Member.
69
*
1007
* @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
1008
*/
1009
if (!defined ("S2MEMBER_CURRENT_USER_FIELDS"))
1010
+ define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($user) ? json_encode (array_merge (array("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "reg_ip" => S2MEMBER_CURRENT_USER_REGISTRATION_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array()))));
1011
/**
1012
* Indicates the number of unique Files the current User is allowed to download every X days.
1013
*
2377
/*
2378
Allows other Constants to be calculated with their checksums included too.
2379
*/
2380
+ $c = apply_filters("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ());
2381
/**
2382
* Used internally by s2Member to compare the value of all API Constants at once.
2383
*
2391
/*
2392
Calls the after Hook. Do NOT set Constants here.
2393
*/
2394
+ do_action("ws_plugin__s2member_after_constants", get_defined_vars ());
2395
2396
return /* Return for uniformity. */;
2397
}
includes/classes/cron-jobs-in.inc.php CHANGED
@@ -38,15 +38,15 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs_in"))
38
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
39
* @return array Array of WP_Cron schedules after having added a 10 minute cycle.
40
*/
41
- public static function extend_cron_schedules ($schedules = array ())
42
{
43
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
44
- do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
45
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
46
47
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
48
49
- return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
50
}
51
/**
52
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
@@ -60,19 +60,19 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs_in"))
60
*/
61
public static function auto_eot_system_via_cron ()
62
{
63
- do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
64
65
- if /* Called through HTTP? */ (!empty ($_GET["s2member_auto_eot_system_via_cron"]))
66
{
67
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
68
{
69
c_ws_plugin__s2member_auto_eots::auto_eot_system (); // Process.
70
71
- do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
72
}
73
exit /* Clean exit. */ ();
74
}
75
- do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
76
}
77
}
78
}
38
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
39
* @return array Array of WP_Cron schedules after having added a 10 minute cycle.
40
*/
41
+ public static function extend_cron_schedules ($schedules = array())
42
{
43
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
44
+ do_action("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
45
+ unset($__refs, $__v);
46
47
+ $array = array("every10m" => array("interval" => 600, "display" => "Every 10 Minutes"));
48
49
+ return apply_filters("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
50
}
51
/**
52
* Allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
60
*/
61
public static function auto_eot_system_via_cron ()
62
{
63
+ do_action("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
64
65
+ if /* Called through HTTP? */ (!empty($_GET["s2member_auto_eot_system_via_cron"]))
66
{
67
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
68
{
69
c_ws_plugin__s2member_auto_eots::auto_eot_system (); // Process.
70
71
+ do_action("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
72
}
73
exit /* Clean exit. */ ();
74
}
75
+ do_action("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
76
}
77
}
78
}
includes/classes/cron-jobs.inc.php CHANGED
@@ -38,7 +38,7 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs"))
38
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
39
* @return inner Return-value of inner routine.
40
*/
41
- public static function extend_cron_schedules ($schedules = array ())
42
{
43
return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules ($schedules);
44
}
@@ -54,7 +54,7 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs"))
54
*/
55
public static function auto_eot_system_via_cron ()
56
{
57
- if (!empty ($_GET["s2member_auto_eot_system_via_cron"]))
58
{
59
return c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron ();
60
}
38
* @param array $schedules Expects an array of WP_Cron schedules passed in by the Filter.
39
* @return inner Return-value of inner routine.
40
*/
41
+ public static function extend_cron_schedules ($schedules = array())
42
{
43
return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules ($schedules);
44
}
54
*/
55
public static function auto_eot_system_via_cron ()
56
{
57
+ if (!empty($_GET["s2member_auto_eot_system_via_cron"]))
58
{
59
return c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron ();
60
}
includes/classes/css-js-themes.inc.php CHANGED
@@ -49,7 +49,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
49
else if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())
50
$load = TRUE;
51
52
- else if(!empty($_GET[apply_filters ("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", array())]))
53
$load = TRUE;
54
55
else if(c_ws_plugin__s2member_utils_conds::bp_is_installed()
@@ -84,17 +84,17 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
84
*/
85
public static function add_css ()
86
{
87
- do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
88
89
if(!is_admin () && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
90
{
91
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
92
93
- wp_enqueue_style ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_css=1&qcABC=1", array (), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
94
95
- do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
96
}
97
- do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
98
99
return /* Return for uniformity. */;
100
}
@@ -114,7 +114,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
114
{
115
global /* Need this for comparisons. */ $pagenow;
116
117
- do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
118
119
if ((!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
120
|| (is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
@@ -126,15 +126,15 @@ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
126
$md5 = /* An MD5 hash based on global key => values. */ WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
127
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
128
// For instance, the global variables may change when a User who is logged-in changes their Profile.
129
- wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode ($md5) . "&qcABC=1", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
130
}
131
else // Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5.
132
{ // This essentially creates 2 versions of the script. One while logged in & another when not.
133
- wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
134
}
135
- do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
136
}
137
- do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
138
139
return /* Return for uniformity. */;
140
}
49
else if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())
50
$load = TRUE;
51
52
+ else if(!empty($_GET[apply_filters("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", array())]))
53
$load = TRUE;
54
55
else if(c_ws_plugin__s2member_utils_conds::bp_is_installed()
84
*/
85
public static function add_css ()
86
{
87
+ do_action("ws_plugin__s2member_before_add_css", get_defined_vars ());
88
89
if(!is_admin () && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
90
{
91
$s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
92
93
+ wp_enqueue_style ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_css=1&qcABC=1", array(), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
94
95
+ do_action("ws_plugin__s2member_during_add_css", get_defined_vars ());
96
}
97
+ do_action("ws_plugin__s2member_after_add_css", get_defined_vars ());
98
99
return /* Return for uniformity. */;
100
}
114
{
115
global /* Need this for comparisons. */ $pagenow;
116
117
+ do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
118
119
if ((!is_admin() && c_ws_plugin__s2member_css_js_themes::lazy_load_css_js())
120
|| (is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
126
$md5 = /* An MD5 hash based on global key => values. */ WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
127
// The MD5 hash allows the script to be cached in the browser until the globals happen to change.
128
// For instance, the global variables may change when a User who is logged-in changes their Profile.
129
+ wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode ($md5) . "&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
130
}
131
else // Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5.
132
{ // This essentially creates 2 versions of the script. One while logged in & another when not.
133
+ wp_enqueue_script ("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery"), c_ws_plugin__s2member_utilities::ver_checksum (), TRUE);
134
}
135
+ do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
136
}
137
+ do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
138
139
return /* Return for uniformity. */;
140
}
includes/classes/css-js.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
39
*/
40
public static function css ()
41
{
42
- if (!empty ($_GET["ws_plugin__s2member_css"]))
43
{
44
return c_ws_plugin__s2member_css_js_in::css ();
45
}
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
56
*/
57
public static function js_w_globals ()
58
{
59
- if (!empty ($_GET["ws_plugin__s2member_js_w_globals"]))
60
{
61
return c_ws_plugin__s2member_css_js_in::js_w_globals ();
62
}
39
*/
40
public static function css ()
41
{
42
+ if (!empty($_GET["ws_plugin__s2member_css"]))
43
{
44
return c_ws_plugin__s2member_css_js_in::css ();
45
}
56
*/
57
public static function js_w_globals ()
58
{
59
+ if (!empty($_GET["ws_plugin__s2member_js_w_globals"]))
60
{
61
return c_ws_plugin__s2member_css_js_in::js_w_globals ();
62
}
includes/classes/custom-reg-fields-4bp.inc.php CHANGED
@@ -1,286 +1,278 @@
1
<?php
2
/**
3
- * Custom Registration/Profile Fields for BuddyPress integration.
4
- *
5
- * Copyright: © 2009-2011
6
- * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
7
- * (coded in the USA)
8
- *
9
- * Released under the terms of the GNU General Public License.
10
- * You should have received a copy of the GNU General Public License,
11
- * along with this software. In the main directory, see: /licensing/
12
- * If not, see: {@link http://www.gnu.org/licenses/}.
13
- *
14
- * @package s2Member\Custom_Reg_Fields
15
- * @since 3.5
16
- */
17
- if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
18
- exit("Do not access this file directly.");
19
-
20
- if (!class_exists ("c_ws_plugin__s2member_custom_reg_fields_4bp"))
21
{
22
/**
23
- * Custom Registration/Profile Fields for BuddyPress integration.
24
- *
25
- * @package s2Member\Custom_Reg_Fields
26
- * @since 3.5
27
- */
28
- class c_ws_plugin__s2member_custom_reg_fields_4bp
29
- {
30
- /**
31
- * Adds Custom Fields to BuddyPress Registration Form.
32
- *
33
- * @package s2Member\Custom_Reg_Fields
34
- * @since 110524RC
35
- *
36
- * @attaches-to ``add_action("bp_after_signup_profile_fields");``
37
- *
38
- * @return null
39
- *
40
- * @todo Optimize with ``empty()``.
41
- */
42
- public static function custom_registration_fields_4bp ()
43
{
44
- static $processed = /* Process this routine only one time. */ false;
45
-
46
- do_action ("ws_plugin__s2member_before_custom_registration_fields_4bp", get_defined_vars ());
47
-
48
- if (!$processed && in_array ("registration", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
49
- if (apply_filters ("ws_plugin__s2member_custom_registration_fields_4bp_display", true, get_defined_vars ()))
50
- if (bp_is_register_page () && ($processed = true))
51
{
52
- $_p = (!empty ($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) : array ();
53
-
54
- if (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"] && ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))) || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ()))
55
- if (($close_section_container = true))
56
- {
57
- echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-section" class="ws-plugin--s2member-custom-reg-fields-4bp-section register-section">' . "\n";
58
- echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-container" class="ws-plugin--s2member-custom-reg-fields-4bp-container">' . "\n";
59
- echo '<input type="hidden" name="ws_plugin__s2member_registration" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-registration")) . '" />' . "\n";
60
- }
61
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
62
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before", get_defined_vars ());
63
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
64
-
65
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
66
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "registration"))
67
- {
68
- foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
69
- {
70
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
71
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields", get_defined_vars ());
72
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
73
-
74
- if /* Field applicable? */ (in_array ($field["id"], $fields_applicable))
75
- {
76
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
77
- $field_id_class = preg_replace ("/_/", "-", $field_var);
78
-
79
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
80
- if (apply_filters ("ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
81
- {
82
- if /* Starts a new section? */ (!empty ($field["section"]) && $field["section"] === "yes")
83
- echo '<div class="ws-plugin--s2member-custom-reg-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div>';
84
-
85
- echo '<div class="ws-plugin--s2member-custom-reg-field-4bp ws-plugin--s2member-custom-reg-field-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' editfield">' . "\n";
86
- echo '<label for="ws-plugin--s2member-custom-reg-field-4bp-' . esc_attr ($field_id_class) . '">' . "\n";
87
- echo '<span' . ((preg_match ("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</span></label>' . "\n";
88
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-4bp-", "ws-plugin--s2member-custom-reg-field-4bp", "", "", "", $_p, $_p["ws_plugin__s2member_custom_reg_field_" . $field_var], "registration");
89
- echo '</div>' . "\n";
90
- }
91
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
92
- }
93
-
94
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
95
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields", get_defined_vars ());
96
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
97
- }
98
- }
99
-
100
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated ())
101
- {
102
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
103
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in", get_defined_vars ());
104
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
105
-
106
- echo '<div class="ws-plugin--s2member-custom-reg-field-4bp field_opt_in editfield">' . "\n";
107
- echo '<label for="ws-plugin--s2member-custom-reg-field-4bp-opt-in">' . "\n";
108
- echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-4bp-opt-in" class="ws-plugin--s2member-custom-reg-field-4bp" value="1"' . (((empty ($_p) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || $_p["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '') . ' />' . "\n";
109
- echo $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in_label"] . "\n";
110
- echo '</label>' . "\n";
111
- echo '</div>' . "\n";
112
-
113
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
114
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in", get_defined_vars ());
115
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
116
- }
117
-
118
- if (isset ($close_section_container) && $close_section_container)
119
- echo '</div>' . "\n" . '</div>' . "\n";
120
-
121
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
122
- do_action ("ws_plugin__s2member_during_custom_registration_fields_4bp_after", get_defined_vars ());
123
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
124
}
125
-
126
- do_action ("ws_plugin__s2member_after_custom_registration_fields_4bp", get_defined_vars ());
127
-
128
- return /* Return for uniformity. */;
129
}
130
- /**
131
- * Adds Custom Fields to BuddyPress Profiles.
132
- *
133
- * @package s2Member\Custom_Reg_Fields
134
- * @since 110524RC
135
- *
136
- * @attaches-to ``add_action("bp_after_profile_field_content");``
137
- *
138
- * @return null
139
- */
140
- public static function custom_profile_fields_4bp ()
141
- {
142
- global /* Global BuddyPress object reference. */ $bp;
143
- static $processed = /* Process this routine only one time. */ false;
144
-
145
- do_action ("ws_plugin__s2member_before_custom_profile_fields_4bp", get_defined_vars ());
146
-
147
- if (!$processed && in_array ("profile", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
148
- if (apply_filters ("ws_plugin__s2member_custom_profile_fields_4bp_display", true, get_defined_vars ()))
149
- if (bp_is_user_profile () && (( /* BuddyPress v1.5. */function_exists ("bp_is_user_profile_edit") && bp_is_user_profile_edit ())
150
- || ( /* for BuddyPress < v1.5. */function_exists ("bp_is_profile_edit") && bp_is_profile_edit ())) && (int)bp_get_the_profile_group_id () === 1)
151
- if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
152
- if (($processed = true) /* Mark as having been processed now. */)
153
- {
154
- echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-4bp-save")) . '" />' . "\n";
155
156
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
157
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before", get_defined_vars ());
158
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
159
-
160
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
161
- if (($level = c_ws_plugin__s2member_user_access::user_access_level (new WP_User ($user_id))) >= 0)
162
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile"))
163
- {
164
- $fields = /* Existing Custom Fields. */get_user_option ("s2member_custom_fields", $user_id);
165
-
166
- foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
167
- {
168
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
169
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields", get_defined_vars ());
170
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
171
-
172
- if /* Field applicable? */ (in_array ($field["id"], $fields_applicable))
173
- {
174
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
175
- $field_id_class = preg_replace ("/_/", "-", $field_var);
176
-
177
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
178
- if (apply_filters ("ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display", true, get_defined_vars ()))
179
- {
180
- if /* Starts a new section? */ (!empty ($field["section"]) && $field["section"] === "yes")
181
- echo '<div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div>';
182
183
- echo '<div class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' editfield">' . "\n";
184
- echo '<label for="ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . '">' . "\n";
185
- echo '<span' . ((preg_match ("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</span></label>' . "\n";
186
- echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile");
187
- echo '</div>' . "\n";
188
- }
189
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
190
- }
191
192
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
193
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields", get_defined_vars ());
194
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
195
- }
196
- }
197
198
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
199
- do_action ("ws_plugin__s2member_during_custom_profile_fields_4bp_after", get_defined_vars ());
200
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
201
}
202
203
- do_action ("ws_plugin__s2member_after_custom_profile_fields_4bp", get_defined_vars ());
204
-
205
- return /* Return for uniformity. */;
206
- }
207
- /**
208
- * Adds Custom Fields to BuddyPress Profiles in public view.
209
- *
210
- * @package s2Member\Custom_Reg_Fields
211
- * @since 110524RC
212
- *
213
- * @attaches-to ``add_action("bp_profile_field_item");``
214
- *
215
- * @return null
216
- */
217
- public static function custom_profile_field_items_4bp ()
218
- {
219
- global /* Global BuddyPress object reference. */ $bp;
220
- static $processed = /* Process this routine only one time. */ false;
221
222
- do_action ("ws_plugin__s2member_before_custom_profile_field_items_4bp", get_defined_vars ());
223
224
- if (!$processed && in_array ("profile-view", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
225
- if (apply_filters ("ws_plugin__s2member_custom_profile_field_items_4bp_display", true, get_defined_vars ()))
226
- if (bp_is_user_profile () && (( /* BuddyPress v1.5. */function_exists ("bp_is_user_profile_edit") && !bp_is_user_profile_edit ())
227
- || ( /* for BuddyPress < v1.5. */function_exists ("bp_is_profile_edit") && !bp_is_profile_edit ())) && (int)bp_get_the_profile_group_id () === 1)
228
- if (isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id))
229
- if /* Mark as having been processed now. */ (($processed = true))
230
{
231
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
232
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before", get_defined_vars ());
233
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
234
-
235
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
236
- if (($level = c_ws_plugin__s2member_user_access::user_access_level (new WP_User ($user_id))) >= 0)
237
- if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ($level, "profile-view"))
238
- {
239
- $fields = /* Existing Custom Fields. */ get_user_option ("s2member_custom_fields", $user_id);
240
-
241
- foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
242
- {
243
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
244
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields", get_defined_vars ());
245
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
246
-
247
- if /* Field applicable? */ (in_array ($field["id"], $fields_applicable))
248
- {
249
- $field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
250
- $field_id_class = preg_replace ("/_/", "-", $field_var);
251
-
252
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
253
- if (apply_filters ("ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display", true, get_defined_vars ()))
254
- {
255
- if /* New section? */ (!empty ($field["section"]) && $field["section"] === "yes")
256
- {
257
- echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">' . "\n";
258
- echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td>' . "\n";
259
- echo '</tr>' . "\n";
260
- }
261
-
262
- echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . '">' . "\n";
263
- echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' label"><span>' . $field["label"] . '</span></td>' . "\n";
264
- echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-' . esc_attr ($field_id_class) . ' field_' . esc_attr ($field_var) . ' data">' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_4bp_", "ws-plugin--s2member-profile-4bp-", "ws-plugin--s2member-profile-field-4bp", "", "", "", $fields, $fields[$field_var], "profile-view") . '</td>' . "\n";
265
- echo '</tr>' . "\n";
266
- }
267
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
268
- }
269
270
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
271
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields", get_defined_vars ());
272
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
273
- }
274
- }
275
-
276
- foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
277
- do_action ("ws_plugin__s2member_during_custom_profile_field_items_4bp_after", get_defined_vars ());
278
- unset /* Unset defined __refs, __v. */ ($__refs, $__v);
279
}
280
- do_action ("ws_plugin__s2member_after_custom_profile_field_items_4bp", get_defined_vars ());
281
-
282
- return /* Return for uniformity. */;
283
- }
284
- }
285
}
286
- ?>
1
<?php
2
/**
3
+ * Custom Registration/Profile Fields for BuddyPress integration.
4
+ *
5
+ * Copyright: © 2009-2011
6
+ * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
7
+ * (coded in the USA)
8
+ *
9
+ * Released under the terms of the GNU General Public License.
10
+ * You should have received a copy of the GNU General Public License,
11
+ * along with this software. In the main directory, see: /licensing/
12
+ * If not, see: {@link http://www.gnu.org/licenses/}.
13
+ *
14
+ * @package s2Member\Custom_Reg_Fields
15
+ * @since 3.5
16
+ */
17
+ if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
18
+ exit('Do not access this file directly.');
19
+
20
+ if(!class_exists('c_ws_plugin__s2member_custom_reg_fields_4bp'))
21
+ {
22
+ /**
23
+ * Custom Registration/Profile Fields for BuddyPress integration.
24
+ *
25
+ * @package s2Member\Custom_Reg_Fields
26
+ * @since 3.5
27
+ */
28
+ class c_ws_plugin__s2member_custom_reg_fields_4bp
29
{
30
/**
31
+ * Adds Custom Fields to BuddyPress Registration Form.
32
+ *
33
+ * @package s2Member\Custom_Reg_Fields
34
+ * @since 110524RC
35
+ *
36
+ * @attaches-to ``add_action('bp_after_signup_profile_fields');``
37
+ */
38
+ public static function custom_registration_fields_4bp()
39
+ {
40
+ global $bp; // Global reference to the BuddyPress object.
41
+ static $processed = FALSE; // Process this routine only one time.
42
+
43
+ do_action('ws_plugin__s2member_before_custom_registration_fields_4bp', get_defined_vars());
44
+
45
+ if(!$processed && in_array('registration', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp']))
46
+ if(apply_filters('ws_plugin__s2member_custom_registration_fields_4bp_display', TRUE, get_defined_vars()))
47
+ if(bp_is_register_page() && ($processed = TRUE))
48
{
49
+ $_p = (!empty($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) : array();
50
+
51
+ if(($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'] && ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'registration'))) || ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated()))
52
+ if(($close_section_container = TRUE))
53
+ {
54
+ echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-section" class="ws-plugin--s2member-custom-reg-fields-4bp-section register-section">'."\n";
55
+ echo '<div id="ws-plugin--s2member-custom-reg-fields-4bp-container" class="ws-plugin--s2member-custom-reg-fields-4bp-container">'."\n";
56
+ echo '<input type="hidden" name="ws_plugin__s2member_registration" value="'.esc_attr(wp_create_nonce('ws-plugin--s2member-registration')).'" />'."\n";
57
+ }
58
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
59
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_before', get_defined_vars());
60
+ unset($__refs, $__v);
61
+
62
+ if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'])
63
+ if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'registration'))
64
+ {
65
+ foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
66
+ {
67
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
68
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_before_custom_fields', get_defined_vars());
69
+ unset($__refs, $__v);
70
+
71
+ if(in_array($field['id'], $fields_applicable))
72
{
73
+ $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
74
+ $field_id_class = preg_replace('/_/', '-', $field_var);
75
+
76
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
77
+ if(apply_filters('ws_plugin__s2member_during_custom_registration_fields_4bp_during_custom_fields_display', TRUE, get_defined_vars()))
78
+ {
79
+ if(!empty($field['section']) && $field['section'] === 'yes')
80
+ echo '<div class="ws-plugin--s2member-custom-reg-field-4bp-divider-section'.((!empty($field['sectitle'])) ? '-title' : '').'">'.((!empty($field['sectitle'])) ? $field['sectitle'] : '').'</div>';
81
+
82
+ echo '<div class="ws-plugin--s2member-custom-reg-field-4bp ws-plugin--s2member-custom-reg-field-4bp-'.esc_attr($field_id_class).' field_'.esc_attr($field_var).' editfield">'."\n";
83
+ echo '<label for="ws-plugin--s2member-custom-reg-field-4bp-'.esc_attr($field_id_class).'">'."\n";
84
+ echo '<span'.((preg_match('/^(checkbox|pre_checkbox)#x2F;', $field['type'])) ? ' style="display:none;"' : '').'>'.$field['label'].(($field['required'] === 'yes') ? ' *' : '').'</span></label>'."\n";
85
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_custom_reg_field_', 'ws-plugin--s2member-custom-reg-field-4bp-', 'ws-plugin--s2member-custom-reg-field-4bp', '', '', '', $_p, @$_p['ws_plugin__s2member_custom_reg_field_'.$field_var], 'registration');
86
+ echo '</div>'."\n";
87
+ }
88
+ unset($__refs, $__v);
89
}
90
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
91
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_after_custom_fields', get_defined_vars());
92
+ unset($__refs, $__v);
93
+ }
94
+ }
95
+ if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
96
+ {
97
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
98
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_before_opt_in', get_defined_vars());
99
+ unset($__refs, $__v);
100
+
101
+ echo '<div class="ws-plugin--s2member-custom-reg-field-4bp field_opt_in editfield">'."\n";
102
+ echo '<label for="ws-plugin--s2member-custom-reg-field-4bp-opt-in">'."\n";
103
+ echo '<input type="checkbox" name="ws_plugin__s2member_custom_reg_field_opt_in" id="ws-plugin--s2member-custom-reg-field-4bp-opt-in" class="ws-plugin--s2member-custom-reg-field-4bp" value="1"'.(((empty($_p) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] == 1) || $_p['ws_plugin__s2member_custom_reg_field_opt_in']) ? ' checked="checked"' : '').' />'."\n";
104
+ echo $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label']."\n";
105
+ echo '</label>'."\n";
106
+ echo '</div>'."\n";
107
+
108
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
109
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_after_opt_in', get_defined_vars());
110
+ unset($__refs, $__v);
111
+ }
112
+ if(isset ($close_section_container) && $close_section_container)
113
+ echo '</div>'."\n".'</div>'."\n";
114
+
115
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
116
+ do_action('ws_plugin__s2member_during_custom_registration_fields_4bp_after', get_defined_vars());
117
+ unset($__refs, $__v);
118
}
119
+ do_action('ws_plugin__s2member_after_custom_registration_fields_4bp', get_defined_vars());
120
+ }
121
122
+ /**
123
+ * Adds Custom Fields to BuddyPress Profiles.
124
+ *
125
+ * @package s2Member\Custom_Reg_Fields
126
+ * @since 110524RC
127
+ *
128
+ * @attaches-to ``add_action('bp_after_profile_field_content');``
129
+ */
130
+ public static function custom_profile_fields_4bp()
131
+ {
132
+ global $bp; // Global reference to the BuddyPress object.
133
+ static $processed = FALSE; // Process this routine only one time.
134
+
135
+ do_action('ws_plugin__s2member_before_custom_profile_fields_4bp', get_defined_vars());
136
+
137
+ if(!$processed && in_array('profile', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp']))
138
+ if(apply_filters('ws_plugin__s2member_custom_profile_fields_4bp_display', TRUE, get_defined_vars()))
139
+ if(bp_is_user_profile() && bp_is_user_profile_edit() && (integer)bp_get_the_profile_group_id() === 1)
140
+ if(isset($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id) && ($processed = TRUE))
141
+ {
142
+ echo '<input type="hidden" name="ws_plugin__s2member_profile_4bp_save" id="ws-plugin--s2member-profile-4bp-save" value="'.esc_attr(wp_create_nonce('ws-plugin--s2member-profile-4bp-save')).'" />'."\n";
143
+
144
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
145
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_before', get_defined_vars());
146
+ unset($__refs, $__v);
147
+
148
+ if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'])
149
+ if(($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User($user_id))) >= 0)
150
+ if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, 'profile'))
151
+ {
152
+ $fields = get_user_option('s2member_custom_fields', $user_id);
153
154
+ foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
155
+ {
156
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
157
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_before_custom_fields', get_defined_vars());
158
+ unset($__refs, $__v);
159
160
+ if(in_array($field['id'], $fields_applicable))
161
+ {
162
+ $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
163
+ $field_id_class = preg_replace('/_/', '-', $field_var);
164
165
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
166
+ if(apply_filters('ws_plugin__s2member_during_custom_profile_fields_4bp_during_custom_fields_display', TRUE, get_defined_vars()))
167
+ {
168
+ if(!empty($field['section']) && $field['section'] === 'yes')
169
+ echo '<div class="ws-plugin--s2member-profile-field-4bp-divider-section'.((!empty($field['sectitle'])) ? '-title' : '').'">'.((!empty($field['sectitle'])) ? $field['sectitle'] : '').'</div>';
170
+
171
+ echo '<div class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-'.esc_attr($field_id_class).' field_'.esc_attr($field_var).' editfield">'."\n";
172
+ echo '<label for="ws-plugin--s2member-profile-4bp-'.esc_attr($field_id_class).'">'."\n";
173
+ echo '<span'.((preg_match('/^(checkbox|pre_checkbox)#x2F;', $field['type'])) ? ' style="display:none;"' : '').'>'.$field['label'].(($field['required'] === 'yes') ? ' *' : '').'</span></label>'."\n";
174
+ echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_4bp_', 'ws-plugin--s2member-profile-4bp-', 'ws-plugin--s2member-profile-field-4bp', '', '', '', $fields, @$fields[$field_var], 'profile');
175
+ echo '</div>'."\n";
176
+ }
177
+ unset($__refs, $__v);
178
}
179
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
180
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_after_custom_fields', get_defined_vars());
181
+ unset($__refs, $__v);
182
+ }
183
+ }
184
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
185
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_after', get_defined_vars());
186
+ unset($__refs, $__v);
187
+
188
+ if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
189
+ {
190
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
191
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_before_opt_in', get_defined_vars());
192
+ unset($__refs, $__v);
193
+
194
+ echo '<div class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-opt-in field_opt_in editfield">'."\n";
195
+ echo '<label for="ws-plugin--s2member-profile-4bp-opt-in">'."\n";
196
+ echo '<input type="checkbox" name="ws_plugin__s2member_profile_4bp_opt_in" id="ws-plugin--s2member-profile-4bp-opt-in" class="ws-plugin--s2member-profile-field-4bp" value="1"'.((get_user_option('s2member_opt_in', $user_id)) ? ' checked="checked"' : '').' />'."\n";
197
+ echo $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label']."\n";
198
+ echo '</label>'."\n";
199
+ echo '</div>'."\n";
200
+
201
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
202
+ do_action('ws_plugin__s2member_during_custom_profile_fields_4bp_after_opt_in', get_defined_vars());
203
+ unset($__refs, $__v);
204
+ }
205
+ }
206
+ do_action('ws_plugin__s2member_after_custom_profile_fields_4bp', get_defined_vars());
207
+ }
208
209
+ /**
210
+ * Adds Custom Fields to BuddyPress Profiles in public view.
211
+ *
212
+ * @package s2Member\Custom_Reg_Fields
213
+ * @since 110524RC
214
+ *
215
+ * @attaches-to ``add_action('bp_profile_field_item');``
216
+ */
217
+ public static function custom_profile_field_items_4bp()
218
+ {
219
+ global $bp; // Global reference to the BuddyPress object.
220
+ static $processed = FALSE; // Process this routine only one time.
221
+
222
+ do_action('ws_plugin__s2member_before_custom_profile_field_items_4bp', get_defined_vars());
223
+
224
+ if(!$processed && in_array('profile-view', $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields_4bp']))
225
+ if(apply_filters('ws_plugin__s2member_custom_profile_field_items_4bp_display', TRUE, get_defined_vars()))
226
+ if(bp_is_user_profile() && !bp_is_user_profile_edit() && (integer)bp_get_the_profile_group_id() === 1)
227
+ if(isset ($bp->displayed_user->id) && ($user_id = $bp->displayed_user->id) && ($processed = TRUE))
228
+ {
229
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
230
+ do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before', get_defined_vars());
231
+ unset($__refs, $__v);
232
+
233
+ if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'])
234
+ if(($level = c_ws_plugin__s2member_user_access::user_access_level(new WP_User ($user_id))) >= 0)
235
+ if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, 'profile-view'))
236
+ {
237
+ $fields = get_user_option('s2member_custom_fields', $user_id);
238
239
+ foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
240
+ {
241
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
242
+ do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_before_custom_fields', get_defined_vars());
243
+ unset($__refs, $__v);
244
245
+ if(in_array($field['id'], $fields_applicable))
246
{
247
+ $field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
248
+ $field_id_class = preg_replace('/_/', '-', $field_var);
249
250
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
251
+ if(apply_filters('ws_plugin__s2member_during_custom_profile_field_items_4bp_during_custom_fields_display', TRUE, get_defined_vars()))
252
+ {
253
+ if(!empty($field['section']) && $field['section'] === 'yes')
254
+ {
255
+ echo '<tr class="ws-plugin--s2member-profile-field-4bp-divider-section">'."\n";
256
+ echo '<td colspan="2"><div class="ws-plugin--s2member-profile-field-4bp-divider-section'.((!empty($field['sectitle'])) ? '-title' : '').'">'.((!empty($field['sectitle'])) ? $field['sectitle'] : '').'</div></td>'."\n";
257
+ echo '</tr>'."\n";
258
+ }
259
+ echo '<tr class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-'.esc_attr($field_id_class).' field_'.esc_attr($field_var).'">'."\n";
260
+ echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-'.esc_attr($field_id_class).' field_'.esc_attr($field_var).' label"><span>'.$field['label'].'</span></td>'."\n";
261
+ echo '<td class="ws-plugin--s2member-profile-field-4bp ws-plugin--s2member-profile-4bp-'.esc_attr($field_id_class).' field_'.esc_attr($field_var).' data">'.c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_4bp_', 'ws-plugin--s2member-profile-4bp-', 'ws-plugin--s2member-profile-field-4bp', '', '', '', $fields, @$fields[$field_var], 'profile-view').'</td>'."\n";
262
+ echo '</tr>'."\n";
263
+ }
264
+ unset($__refs, $__v);
265
}
266
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
267
+ do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after_custom_fields', get_defined_vars());
268
+ unset($__refs, $__v);
269
+ }
270
+ }
271
+ foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $__v;
272
+ do_action('ws_plugin__s2member_during_custom_profile_field_items_4bp_after', get_defined_vars());
273
+ unset($__refs, $__v);
274
+ }
275
+ do_action('ws_plugin__s2member_after_custom_profile_field_items_4bp', get_defined_vars());
276
+ }
277
}
278
+ }
includes/classes/custom-reg-fields.inc.php CHANGED
@@ -33,30 +33,30 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
33
* @package s2Member\Custom_Reg_Fields
34
* @since 3.5
35
*
36
- * @param str $_function Function calling upon this routine.
37
* @param array $_field The Field array of configuration options.
38
- * @param str $_name_prefix The `name=""` attribute prefix.
39
- * @param str $_id_prefix The `id=""` attribute prefix.
40
- * @param str $_classes Optional. String of space separated classes that will go inside the Field's `class=""` attribute.
41
- * @param str $_styles Optional. String of CSS styles that will go inside the Field's `style=""` attribute.
42
- * @param str|int $_tabindex. Optional numeric tabindex for the `tabindex=""` attribute.
43
- * @param str $_attrs Optional. Some additional Field attributes and values.
44
* @param array $_submission Optional. But should be passed in with any submission data related to this Field. For instance, you might pass in ``$_POST``.
45
- * @param str|array $_value Optional. The value of this Field, either by default, or from the ``$_submission`` array.
46
- * @param str $_editable_context Optional. One of `profile|profile-view|registration`.
47
- * @return str The resulting Custom Field, in HTML format.
48
*/
49
public static function 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, $_editable_context = FALSE)
50
{
51
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
52
do_action("ws_plugin__s2member_before_custom_field_gen", get_defined_vars());
53
- unset /* Unset defined __refs, __v. */($__refs, $__v);
54
55
if(!($gen = "") && $_function && is_array($field = $_field) && !empty($field["type"]) && !empty($field["id"]) && $_name_prefix && $_id_prefix)
56
{
57
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
58
do_action("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars());
59
- unset /* Unset defined __refs, __v. */($__refs, $__v);
60
61
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
62
$field_id_class = preg_replace("/_/", "-", $field_var);
@@ -264,7 +264,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
264
}
265
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
266
do_action("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars());
267
- unset /* Unset defined __refs, __v. */($__refs, $__v);
268
}
269
return apply_filters("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars());
270
}
@@ -284,7 +284,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
284
{
285
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
286
do_action("ws_plugin__s2member_before_custom_fields_configured_at_level", get_defined_vars());
287
- unset /* Unset defined __refs, __v. */($__refs, $__v);
288
289
$level = ($_level === "auto-detection") ? c_ws_plugin__s2member_user_access::user_access_level() : $_level;
290
if($_level === "auto-detection" && $level < 0 && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok()) && extract($reg_cookies) && preg_match($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty($m[1]) && is_numeric($m[1]))
@@ -311,15 +311,13 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
311
*
312
* @attaches-to ``add_action("signup_extra_fields");``
313
*
314
- * @return null
315
- *
316
* @todo Optimize with ``empty()``.
317
*/
318
public static function ms_custom_registration_fields()
319
{
320
do_action("ws_plugin__s2member_before_ms_custom_registration_fields", get_defined_vars());
321
322
- if /* Must be Main Site of a Network. */(is_multisite() && is_main_site())
323
{
324
$_p = (!empty($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) : array();
325
@@ -327,7 +325,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
327
328
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
329
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars());
330
- unset /* Unset defined __refs, __v. */($__refs, $__v);
331
332
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"])
333
{
@@ -335,7 +333,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
335
336
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
337
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars());
338
- unset /* Unset defined __refs, __v. */($__refs, $__v);
339
340
echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">'._x("First Name", "s2member-front", "s2member").' *</label>'."\n";
341
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" 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 form-control" value="'.esc_attr(@$_p["ws_plugin__s2member_custom_reg_field_first_name"]).'" />'."\n";
@@ -343,11 +341,11 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
343
344
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
345
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars());
346
- unset /* Unset defined __refs, __v. */($__refs, $__v);
347
348
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
349
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars());
350
- unset /* Unset defined __refs, __v. */($__refs, $__v);
351
352
echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">'._x("Last Name", "s2member-front", "s2member").' *</label>'."\n";
353
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" 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 form-control" value="'.esc_attr(@$_p["ws_plugin__s2member_custom_reg_field_last_name"]).'" />'."\n";
@@ -355,7 +353,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
355
356
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
357
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars());
358
- unset /* Unset defined __refs, __v. */($__refs, $__v);
359
}
360
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
361
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level("auto-detection", "registration"))
@@ -363,9 +361,9 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
363
{
364
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
365
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars());
366
- unset /* Unset defined __refs, __v. */($__refs, $__v);
367
368
- if /* Field applicable? */(in_array($field["id"], $fields_applicable))
369
{
370
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
371
$field_id_class = preg_replace("/_/", "-", $field_var);
@@ -373,24 +371,24 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
373
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
374
if(apply_filters("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars()))
375
{
376
- if /* Starts a new section? */(!empty($field["section"]) && $field["section"] === "yes")
377
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section'.((!empty($field["sectitle"])) ? '-title' : '').'">'.((!empty($field["sectitle"])) ? $field["sectitle"] : '').'</div>';
378
379
echo '<label for="ws-plugin--s2member-custom-reg-field-'.esc_attr($field_id_class).'"'.((preg_match("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? ' style="display:none;"' : '').'>'.$field["label"].(($field["required"] === "yes") ? ' *' : '').'</label>'.((preg_match("/^(checkbox|pre_checkbox)#x2F;", $field["type"])) ? '<br />' : '')."\n";
380
echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_custom_reg_field_", "ws-plugin--s2member-custom-reg-field-", "ws-plugin--s2member-custom-reg-field", "", "", "", $_p, @$_p["ws_plugin__s2member_custom_reg_field_".$field_var], "registration");
381
echo '<br />'."\n";
382
}
383
- unset /* Unset defined __refs, __v. */($__refs, $__v);
384
}
385
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
386
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars());
387
- unset /* Unset defined __refs, __v. */($__refs, $__v);
388
}
389
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
390
{
391
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
392
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars());
393
- unset /* Unset defined __refs, __v. */($__refs, $__v);
394
395
echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">'."\n";
396
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($_p) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] == 1) || @$_p["ws_plugin__s2member_custom_reg_field_opt_in"]) ? ' checked="checked"' : '').' />'."\n";
@@ -400,17 +398,15 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
400
401
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
402
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars());
403
- unset /* Unset defined __refs, __v. */($__refs, $__v);
404
}
405
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
406
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars());
407
- unset /* Unset defined __refs, __v. */($__refs, $__v);
408
}
409
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
410
do_action("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars());
411
- unset /* Unset defined __refs, __v. */($__refs, $__v);
412
-
413
- return /* Return for uniformity. */;
414
}
415
/**
416
* Adds Custom Fields to: `/wp-login.php?action=register`.
@@ -420,8 +416,6 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
420
*
421
* @attaches-to ``add_action("register_form");``
422
*
423
- * @return null
424
- *
425
* @todo Optimize with ``empty()``.
426
*/
427
public static function custom_registration_fields()
@@ -432,17 +426,17 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
432
433
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-registration")).'" />'."\n";
434
435
- $tabindex = /* Incremented tabindex starting with 20. */ 20;
436
437
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
438
do_action("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars());
439
- unset /* Unset defined __refs, __v. */($__refs, $__v);
440
441
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
442
{
443
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
444
do_action("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars());
445
- unset /* Unset defined __refs, __v. */($__refs, $__v);
446
447
echo '<p>'."\n";
448
@@ -461,7 +455,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
461
462
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
463
do_action("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars());
464
- unset /* Unset defined __refs, __v. */($__refs, $__v);
465
}
466
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"])
467
{
@@ -469,7 +463,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
469
470
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
471
do_action("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars());
472
- unset /* Unset defined __refs, __v. */($__refs, $__v);
473
474
echo '<p>'."\n";
475
echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">'."\n";
@@ -480,11 +474,11 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
480
481
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
482
do_action("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars());
483
- unset /* Unset defined __refs, __v. */($__refs, $__v);
484
485
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
486
do_action("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars());
487
- unset /* Unset defined __refs, __v. */($__refs, $__v);
488
489
echo '<p>'."\n";
490
echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">'."\n";
@@ -495,7 +489,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
495
496
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
497
do_action("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars());
498
- unset /* Unset defined __refs, __v. */($__refs, $__v);
499
}
500
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
501
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level("auto-detection", "registration"))
@@ -506,7 +500,7 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
506
{
507
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
508
do_action("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars());
509
- unset /* Unset defined __refs, __v. */($__refs, $__v);
510
511
if /* Field applicable? */(in_array($field["id"], $fields_applicable))
512
{
@@ -525,18 +519,18 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
525
echo c_ws_plugin__s2member_custom_reg_fields::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 + 1), "", $_p, @$_p["ws_plugin__s2member_custom_reg_field_".$field_var], "registration");
526
echo '</p>'."\n";
527
}
528
- unset /* Unset defined __refs, __v. */($__refs, $__v);
529
}
530
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
531
do_action("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars());
532
- unset /* Unset defined __refs, __v. */($__refs, $__v);
533
}
534
}
535
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
536
{
537
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
538
do_action("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars());
539
- unset /* Unset defined __refs, __v. */($__refs, $__v);
540
541
echo '<p>'."\n";
542
echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">'."\n";
@@ -547,17 +541,15 @@ if(!class_exists("c_ws_plugin__s2member_custom_reg_fields"))
547
548
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
549
do_action("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars());
550
- unset /* Unset defined __refs, __v. */($__refs, $__v);
551
}
552
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
553
do_action("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars());
554
- unset /* Unset defined __refs, __v. */($__refs, $__v);
555
556
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
557
do_action("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars());
558
- unset /* Unset defined __refs, __v. */($__refs, $__v);
559
-
560
- return /* Return for uniformity. */;
561
}
562
563
/**
33
* @package s2Member\Custom_Reg_Fields
34
* @since 3.5
35
*
36
+ * @param string $_function Function calling upon this routine.
37
* @param array $_field The Field array of configuration options.
38
+ * @param string $_name_prefix The `name=""` attribute prefix.
39
+ * @param string $_id_prefix The `id=""` attribute prefix.
40
+ * @param string $_classes Optional. String of space separated classes that will go inside the Field's `class=""` attribute.
41
+ * @param string $_styles Optional. String of CSS styles that will go inside the Field's `style=""` attribute.
42
+ * @param string|int $_tabindex. Optional numeric tabindex for the `tabindex=""` attribute.
43
+ * @param string $_attrs Optional. Some additional Field attributes and values.
44
* @param array $_submission Optional. But should be passed in with any submission data related to this Field. For instance, you might pass in ``$_POST``.
45
+ * @param string|array $_value Optional. The value of this Field, either by default, or from the ``$_submission`` array.
46
+ * @param string $_editable_context Optional. One of `profile|profile-view|registration`.
47
+ * @return string The resulting Custom Field, in HTML format.
48
*/
49
public static function 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, $_editable_context = FALSE)
50
{
51
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
52
do_action("ws_plugin__s2member_before_custom_field_gen", get_defined_vars());
53
+ unset($__refs, $__v);
54
55
if(!($gen = "") && $_function && is_array($field = $_field) && !empty($field["type"]) && !empty($field["id"]) && $_name_prefix && $_id_prefix)
56
{
57
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;
58
do_action("ws_plugin__s2member_during_custom_field_gen_before", get_defined_vars());
59
+ unset($__refs, $__v);
60
61
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
62
$field_id_class = preg_replace("/_/", "-", $field_var);
264
}
265
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;