Version Description
= v140603 =
(Maintenance Release) Upgrade immediately.
Download this release
Release Info
Developer | JasWSInc |
Plugin | s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) |
Version | 140603 |
Comparing to | |
See all releases |
Code changes from version 140520 to 140603
- checksum.txt +1 -1
- includes/classes/admin-css-js.inc.php +2 -2
- includes/classes/admin-lockouts.inc.php +11 -11
- includes/classes/admin-notices.inc.php +24 -34
- includes/classes/auto-eots.inc.php +34 -34
- includes/classes/brute-force.inc.php +12 -12
- includes/classes/cache.inc.php +3 -3
- includes/classes/catgs-sp.inc.php +13 -13
- includes/classes/catgs.inc.php +6 -6
- includes/classes/constants.inc.php +8 -8
- includes/classes/cron-jobs-in.inc.php +9 -9
- includes/classes/cron-jobs.inc.php +2 -2
- includes/classes/css-js-themes.inc.php +10 -10
- includes/classes/css-js.inc.php +2 -2
- includes/classes/custom-reg-fields-4bp.inc.php +258 -266
- includes/classes/custom-reg-fields.inc.php +44 -52
- includes/classes/database.inc.php +1 -1
- includes/classes/email-configs.inc.php +47 -47
- includes/classes/files-in.inc.php +36 -37
- includes/classes/files.inc.php +12 -12
- includes/classes/ip-restrictions.inc.php +10 -10
- includes/classes/labels.inc.php +9 -9
- includes/classes/list-servers.inc.php +130 -126
- includes/classes/login-checks.inc.php +16 -16
- includes/classes/login-customizations.inc.php +40 -7
- includes/classes/login-redirects-r.inc.php +4 -4
- includes/classes/login-redirects.inc.php +28 -28
- includes/classes/menu-pages-rs.inc.php +2 -2
- includes/classes/menu-pages-tb.inc.php +2 -2
- includes/classes/menu-pages.inc.php +6 -6
- includes/classes/meta-box-saves.inc.php +20 -20
- includes/classes/meta-box-security.inc.php +2 -2
- includes/classes/meta-boxes.inc.php +7 -7
- includes/classes/mms-patches.inc.php +12 -12
- includes/classes/mo-page-in.inc.php +7 -7
- includes/classes/mo-page.inc.php +7 -7
- includes/classes/no-cache.inc.php +194 -187
- includes/classes/op-notices.inc.php +10 -10
- includes/classes/option-forces.inc.php +42 -42
- includes/classes/pages-sp.inc.php +23 -23
- includes/classes/pages.inc.php +10 -10
- includes/classes/paypal-notify-in-billing-agreement-signup.inc.php +10 -10
- includes/classes/paypal-notify-in-cart.inc.php +10 -10
- includes/classes/paypal-notify-in-express-checkout.inc.php +10 -10
- includes/classes/paypal-notify-in-merch-pmt.inc.php +10 -10
- includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +14 -14
- includes/classes/paypal-notify-in-send-money.inc.php +10 -10
- includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +17 -17
- includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +26 -26
- includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +23 -23
- includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +10 -10
- includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +14 -14
- includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +24 -24
- includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +54 -54
- includes/classes/paypal-notify-in-virtual-terminal.inc.php +10 -10
- includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +28 -28
- includes/classes/paypal-notify-in-web-accept-sp.inc.php +21 -21
- includes/classes/paypal-notify-in.inc.php +22 -22
- includes/classes/paypal-notify.inc.php +1 -1
- includes/classes/paypal-return-in-no-tx-data.inc.php +9 -9
- includes/classes/paypal-return-in-proxy-ty-email.inc.php +9 -9
- includes/classes/paypal-return-in-proxy-x-preview.inc.php +8 -8
- includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +4 -4
- includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +9 -9
- includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +17 -17
- includes/classes/paypal-return-in-web-accept-sp.inc.php +15 -15
- includes/classes/paypal-return-in.inc.php +23 -23
- includes/classes/paypal-return.inc.php +1 -1
- includes/classes/paypal-utilities.inc.php +30 -30
- includes/classes/posts-sp.inc.php +22 -22
- includes/classes/posts.inc.php +10 -10
- includes/classes/profile-in.inc.php +277 -268
- includes/classes/profile-mods-4bp-in.inc.php +105 -103
- includes/classes/profile-mods-4bp.inc.php +38 -43
- includes/classes/profile-mods-in.inc.php +145 -143
- includes/classes/profile-mods.inc.php +38 -43
- includes/classes/profile.inc.php +40 -43
- includes/classes/ptags-sp.inc.php +13 -13
- includes/classes/ptags.inc.php +7 -7
- includes/classes/querys.inc.php +15 -15
- includes/classes/readmes.inc.php +19 -19
- includes/classes/register-access.inc.php +15 -15
- includes/classes/register-in.inc.php +6 -6
- includes/classes/register.inc.php +1 -1
- includes/classes/registration-times.inc.php +5 -5
- includes/classes/registrations.inc.php +178 -137
- includes/classes/return-templates.inc.php +14 -14
- includes/classes/ruris-sp.inc.php +10 -10
- includes/classes/ruris.inc.php +12 -12
- includes/classes/s-badge-status-in.inc.php +4 -4
- includes/classes/s-badge-status.inc.php +1 -1
- includes/classes/sc-files-in.inc.php +10 -10
- includes/classes/sc-files.inc.php +6 -6
- includes/classes/sc-gets-in.inc.php +8 -8
- includes/classes/sc-gets.inc.php +2 -2
- includes/classes/sc-if-conds-in.inc.php +25 -25
- includes/classes/sc-if-conds.inc.php +2 -2
- includes/classes/sc-keys-in.inc.php +9 -9
- includes/classes/sc-keys.inc.php +2 -2
- includes/classes/sc-paypal-button-e.inc.php +9 -9
- includes/classes/sc-paypal-button-in.inc.php +21 -21
- includes/classes/sc-paypal-button.inc.php +2 -2
- includes/classes/sc-profile-in.inc.php +292 -279
- includes/classes/sc-profile.inc.php +2 -2
- includes/classes/sc-s-badge-in.inc.php +7 -7
- includes/classes/sc-s-badge.inc.php +2 -2
- includes/classes/security.inc.php +5 -5
- includes/classes/sp-access.inc.php +28 -28
- includes/classes/ssl.inc.php +4 -4
- includes/classes/systematics-sp.inc.php +21 -21
- includes/classes/systematics.inc.php +18 -18
- includes/classes/tracking-codes.inc.php +22 -22
- includes/classes/tracking-cookies-in.inc.php +8 -8
- includes/classes/tracking-cookies.inc.php +2 -2
- includes/classes/translations.inc.php +24 -24
- includes/classes/user-access.inc.php +29 -29
- includes/classes/user-deletions.inc.php +31 -31
- includes/classes/user-drip-access.inc.php +0 -147
- includes/classes/user-new-in.inc.php +64 -64
- includes/classes/user-new.inc.php +3 -3
- includes/classes/user-notes.inc.php +17 -17
- includes/classes/user-securities.inc.php +19 -19
- includes/classes/users-list-in.inc.php +46 -46
- includes/classes/users-list.inc.php +32 -26
- includes/classes/utilities.inc.php +16 -16
- includes/classes/utils-arrays.inc.php +17 -17
- includes/classes/utils-captchas.inc.php +9 -9
- includes/classes/utils-conds.inc.php +2 -2
- includes/classes/utils-css.inc.php +3 -3
- includes/classes/utils-cur.inc.php +92 -97
- includes/classes/utils-dirs.inc.php +17 -17
- includes/classes/utils-encryption.inc.php +16 -16
- includes/classes/utils-forms.inc.php +5 -5
- includes/classes/utils-gets.inc.php +38 -38
- includes/classes/utils-html.inc.php +4 -4
- includes/classes/utils-logs.inc.php +2 -2
- includes/classes/utils-s2o.inc.php +9 -9
- includes/classes/utils-strings.inc.php +47 -47
checksum.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
37 |
-
* @param
|
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
|
47 |
-
unset
|
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
|
54 |
|
55 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
-
do_action
|
57 |
-
unset
|
58 |
|
59 |
update_option ("ws_plugin__s2member_notices", c_ws_plugin__s2member_utils_arrays::array_unique ($notices));
|
60 |
}
|
61 |
-
do_action
|
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
|
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
|
80 |
-
unset
|
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
|
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
|
116 |
|
117 |
-
if (is_admin () && is_array
|
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
|
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 ("/\:(.*)$/i", "", $page));
|
131 |
$page = preg_replace ("/^([^\:]*)\:/i", "", $page);
|
132 |
|
133 |
-
if (empty
|
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
|
140 |
-
unset
|
141 |
|
142 |
-
if (!$notice["dismiss"] || (!empty
|
143 |
unset /* Clear this administrative notice now? */($notices[$i]);
|
144 |
|
145 |
-
if (!$notice["dismiss"] || empty
|
146 |
c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
|
147 |
|
148 |
-
do_action
|
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
|
157 |
-
unset
|
158 |
|
159 |
update_option ("ws_plugin__s2member_notices", $notices);
|
160 |
}
|
161 |
-
do_action
|
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 ("/\:(.*)$/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
|
41 |
|
42 |
if (!c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ())
|
43 |
{
|
44 |
-
return apply_filters
|
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
|
51 |
}
|
52 |
else // Otherwise, it would appear that WP-Cron is not available.
|
53 |
{
|
54 |
-
return apply_filters
|
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
|
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
|
74 |
}
|
75 |
else // Otherwise, it would appear that WP-Cron is not available.
|
76 |
{
|
77 |
-
return apply_filters
|
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
|
107 |
|
108 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
109 |
-
do_action
|
110 |
-
unset
|
111 |
|
112 |
if /* Enabled? */($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
|
113 |
{
|
114 |
-
$per_process = apply_filters
|
115 |
|
116 |
-
if (is_array
|
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
|
142 |
-
do_action
|
143 |
-
do_action
|
144 |
-
unset
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
253 |
-
unset
|
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
|
261 |
-
do_action
|
262 |
-
unset
|
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
|
276 |
-
unset
|
277 |
}
|
278 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
279 |
-
do_action
|
280 |
-
unset
|
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
|
291 |
-
unset
|
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
|
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
|
48 |
-
unset
|
49 |
|
50 |
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
|
51 |
{
|
52 |
-
$exp_secs = strtotime ("+" . apply_filters
|
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
|
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
|
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
|
81 |
-
unset
|
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
|
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
|
94 |
-
unset
|
95 |
}
|
96 |
}
|
97 |
-
return apply_filters
|
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
|
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
|
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
|
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|
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array
|
39 |
*/
|
40 |
public static function check_specific_catg_level_access ($cat_id = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
-
$excluded = apply_filters
|
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
|
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, "/") . "$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
-
return apply_filters
|
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
|
63 |
|
64 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array
|
65 |
-
return apply_filters
|
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
|
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
|
80 |
}
|
81 |
}
|
82 |
-
do_action
|
83 |
}
|
84 |
}
|
85 |
-
return apply_filters
|
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, "/") . "$/", $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
|
43 |
|
44 |
-
$excluded = apply_filters
|
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
|
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, "/") . "$/", $_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
|
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
|
80 |
}
|
81 |
}
|
82 |
-
do_action
|
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, "/") . "$/", $_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
|
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
|
66 |
-
unset
|
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
|
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
|
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
|
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
|
45 |
-
unset
|
46 |
|
47 |
-
$array = array
|
48 |
|
49 |
-
return apply_filters
|
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
|
64 |
|
65 |
-
if /* Called through HTTP? */ (!empty
|
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
|
72 |
}
|
73 |
exit /* Clean exit. */ ();
|
74 |
}
|
75 |
-
do_action
|
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
|
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
|
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
|
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
|
94 |
|
95 |
-
do_action
|
96 |
}
|
97 |
-
do_action
|
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
|
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
|
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
|
134 |
}
|
135 |
-
do_action
|
136 |
}
|
137 |
-
do_action
|
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
|
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
|
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
|
18 |
-
exit(
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
* @todo Optimize with ``empty()``.
|
41 |
-
*/
|
42 |
-
public static function custom_registration_fields_4bp ()
|
43 |
{
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
{
|
52 |
-
$
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
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)$/", $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 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
-
|
131 |
-
|
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 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
}
|
189 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
190 |
-
}
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
}
|
197 |
|
198 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]
|
199 |
-
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
-
|
|
|
|
|
|
|
|
|
223 |
|
224 |
-
|
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 |
-
|
232 |
-
|
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 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
}
|
280 |
-
|
281 |
-
|
282 |
-
|
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)$/', $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)$/', $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
|
37 |
* @param array $_field The Field array of configuration options.
|
38 |
-
* @param
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @param
|
42 |
-
* @param
|
43 |
-
* @param
|
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
|
46 |
-
* @param
|
47 |
-
* @return
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
367 |
|
368 |
-
if
|
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
|
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)$/", $field["type"])) ? ' style="display:none;"' : '').'>'.$field["label"].(($field["required"] === "yes") ? ' *' : '').'</label>'.((preg_match("/^(checkbox|pre_checkbox)$/", $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
|
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
|
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
|
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
|
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
|
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
|
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 =
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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;
|
266 |
do_action("ws_plugin__s2member_during_custom_field_gen_after", get_defined_vars());
|
267 |
+
unset($__refs, $__v);
|
268 |
}
|
269 |
return apply_filters("ws_plugin__s2member_custom_field_gen", $gen, get_defined_vars());
|
270 |
}
|
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($__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 |
*
|
312 |
* @attaches-to ``add_action("signup_extra_fields");``
|
313 |
*
|
|
|
|
|
314 |
* @todo Optimize with ``empty()``.
|
315 |
*/
|
316 |
public static function ms_custom_registration_fields()
|
317 |
{
|
318 |
do_action("ws_plugin__s2member_before_ms_custom_registration_fields", get_defined_vars());
|
319 |
|
320 |
+
if(is_multisite() && is_main_site())
|
321 |
{
|
322 |
$_p = (!empty($_POST)) ? c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) : array();
|
323 |
|
325 |
|
326 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
327 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before", get_defined_vars());
|
328 |
+
unset($__refs, $__v);
|
329 |
|
330 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"])
|
331 |
{
|
333 |
|
334 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
335 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_first_name", get_defined_vars());
|
336 |
+
unset($__refs, $__v);
|
337 |
|
338 |
echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">'._x("First Name", "s2member-front", "s2member").' *</label>'."\n";
|
339 |
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";
|
341 |
|
342 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
343 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_first_name", get_defined_vars());
|
344 |
+
unset($__refs, $__v);
|
345 |
|
346 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
347 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_last_name", get_defined_vars());
|
348 |
+
unset($__refs, $__v);
|
349 |
|
350 |
echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">'._x("Last Name", "s2member-front", "s2member").' *</label>'."\n";
|
351 |
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";
|
353 |
|
354 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
355 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_last_name", get_defined_vars());
|
356 |
+
unset($__refs, $__v);
|
357 |
}
|
358 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
|
359 |
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level("auto-detection", "registration"))
|
361 |
{
|
362 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
363 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_custom_fields", get_defined_vars());
|
364 |
+
unset($__refs, $__v);
|
365 |
|
366 |
+
if(in_array($field["id"], $fields_applicable))
|
367 |
{
|
368 |
$field_var = preg_replace("/[^a-z0-9]/i", "_", strtolower($field["id"]));
|
369 |
$field_id_class = preg_replace("/_/", "-", $field_var);
|
371 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
372 |
if(apply_filters("ws_plugin__s2member_during_ms_custom_registration_fields_during_custom_fields_display", true, get_defined_vars()))
|
373 |
{
|
374 |
+
if(!empty($field["section"]) && $field["section"] === "yes")
|
375 |
echo '<div class="ws-plugin--s2member-custom-reg-field-divider-section'.((!empty($field["sectitle"])) ? '-title' : '').'">'.((!empty($field["sectitle"])) ? $field["sectitle"] : '').'</div>';
|
376 |
|
377 |
echo '<label for="ws-plugin--s2member-custom-reg-field-'.esc_attr($field_id_class).'"'.((preg_match("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '').'>'.$field["label"].(($field["required"] === "yes") ? ' *' : '').'</label>'.((preg_match("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '<br />' : '')."\n";
|
378 |
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");
|
379 |
echo '<br />'."\n";
|
380 |
}
|
381 |
+
unset($__refs, $__v);
|
382 |
}
|
383 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
384 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_custom_fields", get_defined_vars());
|
385 |
+
unset($__refs, $__v);
|
386 |
}
|
387 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
|
388 |
{
|
389 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
390 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_before_opt_in", get_defined_vars());
|
391 |
+
unset($__refs, $__v);
|
392 |
|
393 |
echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">'."\n";
|
394 |
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";
|
398 |
|
399 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
400 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after_opt_in", get_defined_vars());
|
401 |
+
unset($__refs, $__v);
|
402 |
}
|
403 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
404 |
do_action("ws_plugin__s2member_during_ms_custom_registration_fields_after", get_defined_vars());
|
405 |
+
unset($__refs, $__v);
|
406 |
}
|
407 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
408 |
do_action("ws_plugin__s2member_after_ms_custom_registration_fields", get_defined_vars());
|
409 |
+
unset($__refs, $__v);
|
|
|
|
|
410 |
}
|
411 |
/**
|
412 |
* Adds Custom Fields to: `/wp-login.php?action=register`.
|
416 |
*
|
417 |
* @attaches-to ``add_action("register_form");``
|
418 |
*
|
|
|
|
|
419 |
* @todo Optimize with ``empty()``.
|
420 |
*/
|
421 |
public static function custom_registration_fields()
|
426 |
|
427 |
echo '<input type="hidden" name="ws_plugin__s2member_registration" value="'.esc_attr(wp_create_nonce("ws-plugin--s2member-registration")).'" />'."\n";
|
428 |
|
429 |
+
$tabindex = 20; // Incremented tabindex starting with 20.
|
430 |
|
431 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
432 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before", get_defined_vars());
|
433 |
+
unset($__refs, $__v);
|
434 |
|
435 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
436 |
{
|
437 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
438 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before_user_pass", get_defined_vars());
|
439 |
+
unset($__refs, $__v);
|
440 |
|
441 |
echo '<p>'."\n";
|
442 |
|
455 |
|
456 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
457 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after_user_pass", get_defined_vars());
|
458 |
+
unset($__refs, $__v);
|
459 |
}
|
460 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"])
|
461 |
{
|
463 |
|
464 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
465 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before_first_name", get_defined_vars());
|
466 |
+
unset($__refs, $__v);
|
467 |
|
468 |
echo '<p>'."\n";
|
469 |
echo '<label for="ws-plugin--s2member-custom-reg-field-first-name">'."\n";
|
474 |
|
475 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
476 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after_first_name", get_defined_vars());
|
477 |
+
unset($__refs, $__v);
|
478 |
|
479 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
480 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before_last_name", get_defined_vars());
|
481 |
+
unset($__refs, $__v);
|
482 |
|
483 |
echo '<p>'."\n";
|
484 |
echo '<label for="ws-plugin--s2member-custom-reg-field-last-name">'."\n";
|
489 |
|
490 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
491 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after_last_name", get_defined_vars());
|
492 |
+
unset($__refs, $__v);
|
493 |
}
|
494 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
|
495 |
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level("auto-detection", "registration"))
|
500 |
{
|
501 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
502 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before_custom_fields", get_defined_vars());
|
503 |
+
unset($__refs, $__v);
|
504 |
|
505 |
if /* Field applicable? */(in_array($field["id"], $fields_applicable))
|
506 |
{
|
519 |
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");
|
520 |
echo '</p>'."\n";
|
521 |
}
|
522 |
+
unset($__refs, $__v);
|
523 |
}
|
524 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
525 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after_custom_fields", get_defined_vars());
|
526 |
+
unset($__refs, $__v);
|
527 |
}
|
528 |
}
|
529 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
|
530 |
{
|
531 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
532 |
do_action("ws_plugin__s2member_during_custom_registration_fields_before_opt_in", get_defined_vars());
|
533 |
+
unset($__refs, $__v);
|
534 |
|
535 |
echo '<p>'."\n";
|
536 |
echo '<label for="ws-plugin--s2member-custom-reg-field-opt-in">'."\n";
|
541 |
|
542 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
543 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after_opt_in", get_defined_vars());
|
544 |
+
unset($__refs, $__v);
|
545 |
}
|
546 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
547 |
do_action("ws_plugin__s2member_during_custom_registration_fields_after", get_defined_vars());
|
548 |
+
unset($__refs, $__v);
|
549 |
|
550 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
551 |
do_action("ws_plugin__s2member_after_custom_registration_fields", get_defined_vars());
|
552 |
+
unset($__refs, $__v);
|
|
|
|
|
553 |
}
|
554 |
|
555 |
/**
|
includes/classes/database.inc.php
CHANGED
@@ -38,7 +38,7 @@ if (!class_exists ("c_ws_plugin__s2member_database"))
|
|
38 |
global $wpdb; // Global database object reference.
|
39 |
|
40 |
if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page ()
|
41 |
-
|| (!empty
|
42 |
$increase_wait_timeout = TRUE;
|
43 |
|
44 |
if(empty($increase_wait_timeout) && !empty($_POST)) foreach(array_keys($_POST) as $post_key)
|
38 |
global $wpdb; // Global database object reference.
|
39 |
|
40 |
if(c_ws_plugin__s2member_systematics::is_s2_systematic_use_page ()
|
41 |
+
|| (!empty($_SERVER["QUERY_STRING"]) && preg_match ("/[\?&]s2member/", $_SERVER["QUERY_STRING"])))
|
42 |
$increase_wait_timeout = TRUE;
|
43 |
|
44 |
if(empty($increase_wait_timeout) && !empty($_POST)) foreach(array_keys($_POST) as $post_key)
|
includes/classes/email-configs.inc.php
CHANGED
@@ -39,14 +39,14 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
39 |
*/
|
40 |
public static function email_config ()
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
45 |
|
46 |
add_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
|
47 |
add_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
|
48 |
|
49 |
-
do_action
|
50 |
|
51 |
return /* Return for uniformity. */;
|
52 |
}
|
@@ -58,14 +58,14 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
58 |
*
|
59 |
* @attaches-to ``add_filter("wp_mail_from");``
|
60 |
*
|
61 |
-
* @param
|
62 |
-
* @return
|
63 |
*/
|
64 |
public static function _email_config_email ($email = FALSE)
|
65 |
{
|
66 |
-
do_action
|
67 |
|
68 |
-
return apply_filters
|
69 |
}
|
70 |
/**
|
71 |
* A sort of callback function that applies the name Filter.
|
@@ -75,14 +75,14 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
75 |
*
|
76 |
* @attaches-to ``add_filter("wp_mail_from_name");``
|
77 |
*
|
78 |
-
* @param
|
79 |
-
* @return
|
80 |
*/
|
81 |
public static function _email_config_name ($name = FALSE)
|
82 |
{
|
83 |
-
do_action
|
84 |
|
85 |
-
return apply_filters
|
86 |
}
|
87 |
/**
|
88 |
* Checks the status of Filters being applied to the email From: "Name" <address>.
|
@@ -95,15 +95,15 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
95 |
*/
|
96 |
public static function email_config_status ($any = FALSE)
|
97 |
{
|
98 |
-
do_action
|
99 |
|
100 |
if (has_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email") || has_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name"))
|
101 |
-
return apply_filters
|
102 |
|
103 |
else if ($any && (has_filter ("wp_mail_from") || has_filter ("wp_mail_from_name")))
|
104 |
-
return apply_filters
|
105 |
|
106 |
-
return apply_filters
|
107 |
}
|
108 |
/**
|
109 |
* Releases Filters that modify the email From: "Name" <address>.
|
@@ -116,7 +116,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
116 |
*/
|
117 |
public static function email_config_release ($all = FALSE)
|
118 |
{
|
119 |
-
do_action
|
120 |
|
121 |
remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
|
122 |
remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
|
@@ -124,7 +124,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
124 |
if /* If ``$all`` is true, remove ALL attached WordPress Filters. */ ($all)
|
125 |
remove_all_filters ("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
|
126 |
|
127 |
-
do_action
|
128 |
|
129 |
return /* Return for uniformity. */;
|
130 |
}
|
@@ -138,18 +138,18 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
138 |
*
|
139 |
* @attaches-to ``add_filter("wpmu_signup_user_notification_email");``
|
140 |
*
|
141 |
-
* @param
|
142 |
-
* @return
|
143 |
*/
|
144 |
public static function ms_nice_email_roles ($message = FALSE)
|
145 |
{
|
146 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
147 |
-
do_action
|
148 |
-
unset
|
149 |
|
150 |
$message = preg_replace ("/ as a (subscriber|s2member_level[0-9]+)/i", " " . _x ("as a Member", "s2member-front", "s2member"), $message);
|
151 |
|
152 |
-
return apply_filters
|
153 |
}
|
154 |
/**
|
155 |
* Filters email addresses passed to ``wp_mail()``.
|
@@ -165,13 +165,13 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
165 |
*/
|
166 |
public static function email_filter ($array = FALSE)
|
167 |
{
|
168 |
-
if (isset ($array["to"]) && !empty
|
169 |
// Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*.
|
170 |
// Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>.
|
171 |
// Also supplements WordPress. WordPress currently does NOT support semicolon `;` delimitation, s2Member does.
|
172 |
$array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
|
173 |
|
174 |
-
return apply_filters
|
175 |
}
|
176 |
/**
|
177 |
* Resets a User/Member password and resends the New User Notification email message (to the User/Member only).
|
@@ -179,21 +179,21 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
179 |
* @package s2Member\Email_Configs
|
180 |
* @since 110707
|
181 |
*
|
182 |
-
* @param
|
183 |
-
* @param
|
184 |
* If omitted, a new password will be generated automatically.
|
185 |
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
|
186 |
* This defaults to a value of `array('user')`. We notify the User/Member only (and NOT the administrator).
|
187 |
-
* @param
|
188 |
* @return bool True if all required parameters are supplied, else false.
|
189 |
*/
|
190 |
-
public static function reset_pass_resend_new_user_notification ($user_id = FALSE, $user_pass = FALSE, $notify = array
|
191 |
{
|
192 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
193 |
-
do_action
|
194 |
-
unset
|
195 |
|
196 |
-
if ($user_id && ($user = new WP_User ($user_id)) && !empty
|
197 |
{
|
198 |
$user_pass = (is_string($user_pass) && $user_pass) ? $user_pass : wp_generate_password();
|
199 |
|
@@ -201,7 +201,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
201 |
|
202 |
$return = c_ws_plugin__s2member_email_configs::new_user_notification($user_id, $user_pass, $notify, $user_email);
|
203 |
}
|
204 |
-
return apply_filters
|
205 |
}
|
206 |
/**
|
207 |
* Handles new User/Member notifications.
|
@@ -209,25 +209,25 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
209 |
* @package s2Member\Email_Configs
|
210 |
* @since 110707
|
211 |
*
|
212 |
-
* @param
|
213 |
-
* @param
|
214 |
* If omitted, only the administrative notification will be sent.
|
215 |
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
|
216 |
-
* @param
|
217 |
* @return bool True if all required parameters are supplied, else false.
|
218 |
*/
|
219 |
-
public static function new_user_notification ($user_id = FALSE, $user_pass = FALSE, $notify = array
|
220 |
{
|
221 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
222 |
-
do_action
|
223 |
-
unset
|
224 |
|
225 |
-
if ($user_id && ($user = new WP_User ($user_id)) && !empty
|
226 |
{
|
227 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
228 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
229 |
|
230 |
-
if /* Send User a notification? */ (in_array
|
231 |
{
|
232 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
233 |
$cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
|
@@ -257,7 +257,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
257 |
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
|
258 |
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
|
259 |
{
|
260 |
-
if (is_array
|
261 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
262 |
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
|
263 |
break;
|
@@ -278,7 +278,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
278 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
|
279 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
280 |
{
|
281 |
-
if (is_array
|
282 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
283 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
284 |
break;
|
@@ -296,7 +296,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
296 |
}
|
297 |
}
|
298 |
|
299 |
-
if /* Send Admin(s) a notification? */ (in_array
|
300 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"])
|
301 |
{
|
302 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
@@ -327,7 +327,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
327 |
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $rec)))
|
328 |
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $rec)))
|
329 |
{
|
330 |
-
if (is_array
|
331 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
332 |
if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec)))
|
333 |
break;
|
@@ -348,7 +348,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
348 |
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
|
349 |
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
|
350 |
{
|
351 |
-
if (is_array
|
352 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
353 |
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
|
354 |
break;
|
@@ -369,7 +369,7 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
369 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
|
370 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
371 |
{
|
372 |
-
if (is_array
|
373 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
374 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
375 |
break;
|
@@ -392,9 +392,9 @@ if (!class_exists ("c_ws_plugin__s2member_email_configs"))
|
|
392 |
if /* Back on? */ ($email_configs_were_on)
|
393 |
c_ws_plugin__s2member_email_configs::email_config ();
|
394 |
|
395 |
-
return apply_filters
|
396 |
}
|
397 |
-
else return apply_filters
|
398 |
}
|
399 |
}
|
400 |
}
|
39 |
*/
|
40 |
public static function email_config ()
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_email_config", get_defined_vars ());
|
43 |
|
44 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
45 |
|
46 |
add_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
|
47 |
add_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
|
48 |
|
49 |
+
do_action("ws_plugin__s2member_after_email_config", get_defined_vars ());
|
50 |
|
51 |
return /* Return for uniformity. */;
|
52 |
}
|
58 |
*
|
59 |
* @attaches-to ``add_filter("wp_mail_from");``
|
60 |
*
|
61 |
+
* @param string $email Expects the email address to be passed in by the Filter.
|
62 |
+
* @return string s2Member-configured email address.
|
63 |
*/
|
64 |
public static function _email_config_email ($email = FALSE)
|
65 |
{
|
66 |
+
do_action("_ws_plugin__s2member_before_email_config_email", get_defined_vars ());
|
67 |
|
68 |
+
return apply_filters("_ws_plugin__s2member_email_config_email", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"], get_defined_vars ());
|
69 |
}
|
70 |
/**
|
71 |
* A sort of callback function that applies the name Filter.
|
75 |
*
|
76 |
* @attaches-to ``add_filter("wp_mail_from_name");``
|
77 |
*
|
78 |
+
* @param string $name Expects the name to be passed in by the Filter.
|
79 |
+
* @return string s2Member-configured name.
|
80 |
*/
|
81 |
public static function _email_config_name ($name = FALSE)
|
82 |
{
|
83 |
+
do_action("_ws_plugin__s2member_before_email_config_name", get_defined_vars ());
|
84 |
|
85 |
+
return apply_filters("_ws_plugin__s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
|
86 |
}
|
87 |
/**
|
88 |
* Checks the status of Filters being applied to the email From: "Name" <address>.
|
95 |
*/
|
96 |
public static function email_config_status ($any = FALSE)
|
97 |
{
|
98 |
+
do_action("ws_plugin__s2member_before_email_config_status", get_defined_vars ());
|
99 |
|
100 |
if (has_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email") || has_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name"))
|
101 |
+
return apply_filters("ws_plugin__s2member_email_config_status", true, get_defined_vars ());
|
102 |
|
103 |
else if ($any && (has_filter ("wp_mail_from") || has_filter ("wp_mail_from_name")))
|
104 |
+
return apply_filters("ws_plugin__s2member_email_config_status", true, get_defined_vars ());
|
105 |
|
106 |
+
return apply_filters("ws_plugin__s2member_email_config_status", false, get_defined_vars ());
|
107 |
}
|
108 |
/**
|
109 |
* Releases Filters that modify the email From: "Name" <address>.
|
116 |
*/
|
117 |
public static function email_config_release ($all = FALSE)
|
118 |
{
|
119 |
+
do_action("ws_plugin__s2member_before_email_config_release", get_defined_vars ());
|
120 |
|
121 |
remove_filter ("wp_mail_from", "c_ws_plugin__s2member_email_configs::_email_config_email");
|
122 |
remove_filter ("wp_mail_from_name", "c_ws_plugin__s2member_email_configs::_email_config_name");
|
124 |
if /* If ``$all`` is true, remove ALL attached WordPress Filters. */ ($all)
|
125 |
remove_all_filters ("wp_mail_from") . remove_all_filters ("wp_mail_from_name");
|
126 |
|
127 |
+
do_action("ws_plugin__s2member_after_email_config_release", get_defined_vars ());
|
128 |
|
129 |
return /* Return for uniformity. */;
|
130 |
}
|
138 |
*
|
139 |
* @attaches-to ``add_filter("wpmu_signup_user_notification_email");``
|
140 |
*
|
141 |
+
* @param string $message Expects the message string to be passed in by the Filter.
|
142 |
+
* @return string Message after having been Filtered by s2Member.
|
143 |
*/
|
144 |
public static function ms_nice_email_roles ($message = FALSE)
|
145 |
{
|
146 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
147 |
+
do_action("ws_plugin__s2member_before_ms_nice_email_roles", get_defined_vars ());
|
148 |
+
unset($__refs, $__v);
|
149 |
|
150 |
$message = preg_replace ("/ as a (subscriber|s2member_level[0-9]+)/i", " " . _x ("as a Member", "s2member-front", "s2member"), $message);
|
151 |
|
152 |
+
return apply_filters("ws_plugin__s2member_ms_nice_email_roles", $message, get_defined_vars ());
|
153 |
}
|
154 |
/**
|
155 |
* Filters email addresses passed to ``wp_mail()``.
|
165 |
*/
|
166 |
public static function email_filter ($array = FALSE)
|
167 |
{
|
168 |
+
if (isset ($array["to"]) && !empty($array["to"])) // Filter list of recipients?
|
169 |
// Reduces `"Name" <email>`, to just an email address *(for best cross-platform compatibility across various MTAs)*.
|
170 |
// Also works around bug in PHP versions prior to fix in 5.2.11. See bug report: <https://bugs.php.net/bug.php?id=28038>.
|
171 |
// Also supplements WordPress. WordPress currently does NOT support semicolon `;` delimitation, s2Member does.
|
172 |
$array["to"] = implode (",", c_ws_plugin__s2member_utils_strings::parse_emails ($array["to"]));
|
173 |
|
174 |
+
return apply_filters("ws_plugin__s2member_after_email_filter", $array, get_defined_vars ());
|
175 |
}
|
176 |
/**
|
177 |
* Resets a User/Member password and resends the New User Notification email message (to the User/Member only).
|
179 |
* @package s2Member\Email_Configs
|
180 |
* @since 110707
|
181 |
*
|
182 |
+
* @param string|int $user_id A numeric WordPress User ID.
|
183 |
+
* @param string $user_pass Optional. A plain text version of the User's password.
|
184 |
* If omitted, a new password will be generated automatically.
|
185 |
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
|
186 |
* This defaults to a value of `array('user')`. We notify the User/Member only (and NOT the administrator).
|
187 |
+
* @param string $user_email Optional. This defaults to the user's currently configured email address.
|
188 |
* @return bool True if all required parameters are supplied, else false.
|
189 |
*/
|
190 |
+
public static function reset_pass_resend_new_user_notification ($user_id = FALSE, $user_pass = FALSE, $notify = array("user"), $user_email = FALSE)
|
191 |
{
|
192 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
193 |
+
do_action("ws_plugin__s2member_before_reset_pass_resend_new_user_notification", get_defined_vars ());
|
194 |
+
unset($__refs, $__v);
|
195 |
|
196 |
+
if ($user_id && ($user = new WP_User ($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify))
|
197 |
{
|
198 |
$user_pass = (is_string($user_pass) && $user_pass) ? $user_pass : wp_generate_password();
|
199 |
|
201 |
|
202 |
$return = c_ws_plugin__s2member_email_configs::new_user_notification($user_id, $user_pass, $notify, $user_email);
|
203 |
}
|
204 |
+
return apply_filters("ws_plugin__s2member_reset_pass_resend_new_user_notification", ((!empty($return)) ? true : false), get_defined_vars ());
|
205 |
}
|
206 |
/**
|
207 |
* Handles new User/Member notifications.
|
209 |
* @package s2Member\Email_Configs
|
210 |
* @since 110707
|
211 |
*
|
212 |
+
* @param string|int $user_id A numeric WordPress User ID.
|
213 |
+
* @param string $user_pass Optional. A plain text version of the User's password.
|
214 |
* If omitted, only the administrative notification will be sent.
|
215 |
* @param array $notify An array of directives. Must be non-empty, with at least one of these values `user,admin`.
|
216 |
+
* @param string $user_email Optional. This defaults to the user's currently configured email address.
|
217 |
* @return bool True if all required parameters are supplied, else false.
|
218 |
*/
|
219 |
+
public static function new_user_notification ($user_id = FALSE, $user_pass = FALSE, $notify = array("user", "admin"), $user_email = FALSE)
|
220 |
{
|
221 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
222 |
+
do_action("ws_plugin__s2member_before_new_user_notification", get_defined_vars ());
|
223 |
+
unset($__refs, $__v);
|
224 |
|
225 |
+
if ($user_id && ($user = new WP_User ($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && is_array($notify) && !empty($notify))
|
226 |
{
|
227 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
228 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
229 |
|
230 |
+
if /* Send User a notification? */ (in_array("user", $notify) && $user_pass)
|
231 |
{
|
232 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
233 |
$cv = preg_split ("/\|/", get_user_option ("s2member_custom", $user_id));
|
257 |
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
|
258 |
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
|
259 |
{
|
260 |
+
if (is_array($fields) && !empty($fields))
|
261 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
262 |
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
|
263 |
break;
|
278 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
|
279 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
280 |
{
|
281 |
+
if (is_array($fields) && !empty($fields))
|
282 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
283 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
284 |
break;
|
296 |
}
|
297 |
}
|
298 |
|
299 |
+
if /* Send Admin(s) a notification? */ (in_array("admin", $notify))
|
300 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["new_user_admin_email_recipients"])
|
301 |
{
|
302 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
327 |
if (($rec = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $rec)))
|
328 |
if (($rec = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $rec)))
|
329 |
{
|
330 |
+
if (is_array($fields) && !empty($fields))
|
331 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
332 |
if (!($rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec)))
|
333 |
break;
|
348 |
if (($sbj = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $sbj)))
|
349 |
if (($sbj = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $sbj)))
|
350 |
{
|
351 |
+
if (is_array($fields) && !empty($fields))
|
352 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
353 |
if (!($sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj)))
|
354 |
break;
|
369 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ip), $msg)))
|
370 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
371 |
{
|
372 |
+
if (is_array($fields) && !empty($fields))
|
373 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
374 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
375 |
break;
|
392 |
if /* Back on? */ ($email_configs_were_on)
|
393 |
c_ws_plugin__s2member_email_configs::email_config ();
|
394 |
|
395 |
+
return apply_filters("ws_plugin__s2member_new_user_notification", true, get_defined_vars ());
|
396 |
}
|
397 |
+
else return apply_filters("ws_plugin__s2member_new_user_notification", false, get_defined_vars ());
|
398 |
}
|
399 |
}
|
400 |
}
|
includes/classes/files-in.inc.php
CHANGED
@@ -45,7 +45,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
45 |
{
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
do_action("ws_plugin__s2member_before_file_download_access", get_defined_vars());
|
48 |
-
unset
|
49 |
|
50 |
$_g = !empty($_GET) ? $_GET : array();
|
51 |
$_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_g));
|
@@ -65,7 +65,6 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
65 |
$serving_range = true;
|
66 |
unset($_header, $_value);
|
67 |
}
|
68 |
-
|
69 |
$req["file_download"] = ($creating) ? @$create["file_download"] : @$_g["s2member_file_download"];
|
70 |
$req["file_download_key"] = ($creating) ? @$create["file_download_key"] : @$_g["s2member_file_download_key"];
|
71 |
|
@@ -314,7 +313,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
314 |
|
315 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
316 |
do_action("ws_plugin__s2member_during_file_download_access", get_defined_vars());
|
317 |
-
unset
|
318 |
|
319 |
if($using_amazon_storage && $using_amazon_cf_storage && ($serving || ($creating && $url_to_storage_source)))
|
320 |
{
|
@@ -534,7 +533,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
534 |
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
|
535 |
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
|
536 |
* @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
|
537 |
-
* @return
|
538 |
*
|
539 |
* @see s2Member\API_Functions\s2member_file_download_url()
|
540 |
*/
|
@@ -542,7 +541,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
542 |
{
|
543 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
544 |
do_action("ws_plugin__s2member_before_create_file_download_url", get_defined_vars());
|
545 |
-
unset
|
546 |
|
547 |
$config = (is_array($config)) ? $config : /* This absolutely MUST be an array. */ array();
|
548 |
|
@@ -556,7 +555,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
556 |
{
|
557 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
558 |
do_action("ws_plugin__s2member_during_create_file_download_url", get_defined_vars());
|
559 |
-
unset
|
560 |
|
561 |
$extension = strtolower(substr($config["file_download"], strrpos($config["file_download"], ".") + 1));
|
562 |
$streaming = (isset($config["file_stream"])) ? filter_var($config["file_stream"], FILTER_VALIDATE_BOOLEAN) : ((in_array($extension, preg_split("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"]))) ? true : false);
|
@@ -585,14 +584,14 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
585 |
*
|
586 |
* @attaches-to ``add_filter("ws_plugin__s2member_check_file_download_access_user");``
|
587 |
*
|
588 |
-
* @param
|
589 |
* @return obj A `WP_User` object, possibly obtained through Header Authorization.
|
590 |
*/
|
591 |
public static function check_file_remote_authorization($user = FALSE)
|
592 |
{
|
593 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
594 |
do_action("ws_plugin__s2member_before_check_file_remote_authorization", get_defined_vars());
|
595 |
-
unset
|
596 |
|
597 |
$_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep(((!empty($_GET)) ? $_GET : array())));
|
598 |
|
@@ -631,15 +630,15 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
631 |
* @package s2Member\Files
|
632 |
* @since 110926
|
633 |
*
|
634 |
-
* @param
|
635 |
-
* @param
|
636 |
* @return bool True if valid, else false.
|
637 |
*/
|
638 |
public static function check_file_download_key($file = FALSE, $key = FALSE)
|
639 |
{
|
640 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
641 |
do_action("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars());
|
642 |
-
unset
|
643 |
|
644 |
if($file && is_string($file) && ($file = trim($file, "/")) && $key && is_string($key))
|
645 |
{
|
@@ -658,8 +657,8 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
658 |
* @package s2Member\Files
|
659 |
* @since 110524RC
|
660 |
*
|
661 |
-
* @param
|
662 |
-
* @return
|
663 |
*/
|
664 |
public static function amazon_s3_sign($string = FALSE)
|
665 |
{
|
@@ -673,13 +672,13 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
673 |
* @package s2Member\Files
|
674 |
* @since 110926
|
675 |
*
|
676 |
-
* @param
|
677 |
* @param bool $stream Is this resource file to be served as streaming media?
|
678 |
* @param bool $inline Is this resource file to be served inline, or no?
|
679 |
* @param bool $ssl Is this resource file to be served via SSL, or no?
|
680 |
-
* @param
|
681 |
-
* @param
|
682 |
-
* @return
|
683 |
*/
|
684 |
public static function amazon_s3_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
|
685 |
{
|
@@ -793,8 +792,8 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
793 |
* @package s2Member\Files
|
794 |
* @since 110926
|
795 |
*
|
796 |
-
* @param
|
797 |
-
* @return
|
798 |
*/
|
799 |
public static function amazon_cf_sign($string = FALSE)
|
800 |
{
|
@@ -808,7 +807,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
808 |
* @package s2Member\Files
|
809 |
* @since 110926
|
810 |
*
|
811 |
-
* @param
|
812 |
* @return str|bool An RSA-SHA1 signature for Amazon CloudFront, else false on failure.
|
813 |
*/
|
814 |
public static function amazon_cf_rsa_sign($string = FALSE)
|
@@ -823,13 +822,13 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
823 |
* @package s2Member\Files
|
824 |
* @since 110926
|
825 |
*
|
826 |
-
* @param
|
827 |
* @param bool $stream Is this resource file to be served as streaming media?
|
828 |
* @param bool $inline Is this resource file to be served inline, or no?
|
829 |
* @param bool $ssl Is this resource file to be served via SSL, or no?
|
830 |
-
* @param
|
831 |
-
* @param
|
832 |
-
* @return
|
833 |
*/
|
834 |
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
|
835 |
{
|
@@ -1036,7 +1035,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1036 |
* @package s2Member\Files
|
1037 |
* @since 110926
|
1038 |
*
|
1039 |
-
* @param
|
1040 |
* @return array Array containing a true `success` and `etag`, `xml` elements on success, else a failure array.
|
1041 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1042 |
*/
|
@@ -1082,9 +1081,9 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1082 |
* @package s2Member\Files
|
1083 |
* @since 110926
|
1084 |
*
|
1085 |
-
* @param
|
1086 |
-
* @param
|
1087 |
-
* @param
|
1088 |
* @return array Array containing a true `success` element on success, else a failure array.
|
1089 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1090 |
*/
|
@@ -1167,8 +1166,8 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1167 |
* @package s2Member\Files
|
1168 |
* @since 110926
|
1169 |
*
|
1170 |
-
* @param
|
1171 |
-
* @param
|
1172 |
* @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
|
1173 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1174 |
*/
|
@@ -1214,9 +1213,9 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1214 |
* @package s2Member\Files
|
1215 |
* @since 110926
|
1216 |
*
|
1217 |
-
* @param
|
1218 |
-
* @param
|
1219 |
-
* @param
|
1220 |
* @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
|
1221 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1222 |
*/
|
@@ -1268,9 +1267,9 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1268 |
* @package s2Member\Files
|
1269 |
* @since 110926
|
1270 |
*
|
1271 |
-
* @param
|
1272 |
-
* @param
|
1273 |
-
* @param
|
1274 |
* @return array Array containing a true `success` element on success, else a failure array.
|
1275 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1276 |
*/
|
@@ -1338,7 +1337,7 @@ if(!class_exists("c_ws_plugin__s2member_files_in"))
|
|
1338 |
* @package s2Member\Files
|
1339 |
* @since 110926
|
1340 |
*
|
1341 |
-
* @param
|
1342 |
* @return array Array containing a true `success` and `distro_[distro_type]_id`, `distro_[distro_type]_dname` elements on success, else a failure array.
|
1343 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1344 |
*/
|
45 |
{
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
do_action("ws_plugin__s2member_before_file_download_access", get_defined_vars());
|
48 |
+
unset($__refs, $__v);
|
49 |
|
50 |
$_g = !empty($_GET) ? $_GET : array();
|
51 |
$_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_g));
|
65 |
$serving_range = true;
|
66 |
unset($_header, $_value);
|
67 |
}
|
|
|
68 |
$req["file_download"] = ($creating) ? @$create["file_download"] : @$_g["s2member_file_download"];
|
69 |
$req["file_download_key"] = ($creating) ? @$create["file_download_key"] : @$_g["s2member_file_download_key"];
|
70 |
|
313 |
|
314 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
315 |
do_action("ws_plugin__s2member_during_file_download_access", get_defined_vars());
|
316 |
+
unset($__refs, $__v);
|
317 |
|
318 |
if($using_amazon_storage && $using_amazon_cf_storage && ($serving || ($creating && $url_to_storage_source)))
|
319 |
{
|
533 |
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
|
534 |
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
|
535 |
* @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
|
536 |
+
* @return string A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
|
537 |
*
|
538 |
* @see s2Member\API_Functions\s2member_file_download_url()
|
539 |
*/
|
541 |
{
|
542 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
543 |
do_action("ws_plugin__s2member_before_create_file_download_url", get_defined_vars());
|
544 |
+
unset($__refs, $__v);
|
545 |
|
546 |
$config = (is_array($config)) ? $config : /* This absolutely MUST be an array. */ array();
|
547 |
|
555 |
{
|
556 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
557 |
do_action("ws_plugin__s2member_during_create_file_download_url", get_defined_vars());
|
558 |
+
unset($__refs, $__v);
|
559 |
|
560 |
$extension = strtolower(substr($config["file_download"], strrpos($config["file_download"], ".") + 1));
|
561 |
$streaming = (isset($config["file_stream"])) ? filter_var($config["file_stream"], FILTER_VALIDATE_BOOLEAN) : ((in_array($extension, preg_split("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_stream_extensions"]))) ? true : false);
|
584 |
*
|
585 |
* @attaches-to ``add_filter("ws_plugin__s2member_check_file_download_access_user");``
|
586 |
*
|
587 |
+
* @param object $user Expects a WP_User object passed in by the Filter.
|
588 |
* @return obj A `WP_User` object, possibly obtained through Header Authorization.
|
589 |
*/
|
590 |
public static function check_file_remote_authorization($user = FALSE)
|
591 |
{
|
592 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
593 |
do_action("ws_plugin__s2member_before_check_file_remote_authorization", get_defined_vars());
|
594 |
+
unset($__refs, $__v);
|
595 |
|
596 |
$_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep(((!empty($_GET)) ? $_GET : array())));
|
597 |
|
630 |
* @package s2Member\Files
|
631 |
* @since 110926
|
632 |
*
|
633 |
+
* @param string $file Input File Download to validate.
|
634 |
+
* @param string $key Input File Download Key to validate.
|
635 |
* @return bool True if valid, else false.
|
636 |
*/
|
637 |
public static function check_file_download_key($file = FALSE, $key = FALSE)
|
638 |
{
|
639 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
640 |
do_action("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars());
|
641 |
+
unset($__refs, $__v);
|
642 |
|
643 |
if($file && is_string($file) && ($file = trim($file, "/")) && $key && is_string($key))
|
644 |
{
|
657 |
* @package s2Member\Files
|
658 |
* @since 110524RC
|
659 |
*
|
660 |
+
* @param string $string Input string/data, to be signed by this routine.
|
661 |
+
* @return string An HMAC-SHA1 signature for Amazon S3.
|
662 |
*/
|
663 |
public static function amazon_s3_sign($string = FALSE)
|
664 |
{
|
672 |
* @package s2Member\Files
|
673 |
* @since 110926
|
674 |
*
|
675 |
+
* @param string $file Input file path, to be signed by this routine.
|
676 |
* @param bool $stream Is this resource file to be served as streaming media?
|
677 |
* @param bool $inline Is this resource file to be served inline, or no?
|
678 |
* @param bool $ssl Is this resource file to be served via SSL, or no?
|
679 |
+
* @param string $basename The absolute basename of the resource file.
|
680 |
+
* @param string $mimetype The MIME content-type of the resource file.
|
681 |
+
* @return string An HMAC-SHA1 signature URL for Amazon S3.
|
682 |
*/
|
683 |
public static function amazon_s3_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
|
684 |
{
|
792 |
* @package s2Member\Files
|
793 |
* @since 110926
|
794 |
*
|
795 |
+
* @param string $string Input string/data, to be signed by this routine.
|
796 |
+
* @return string An HMAC-SHA1 signature for Amazon CloudFront.
|
797 |
*/
|
798 |
public static function amazon_cf_sign($string = FALSE)
|
799 |
{
|
807 |
* @package s2Member\Files
|
808 |
* @since 110926
|
809 |
*
|
810 |
+
* @param string $string Input string/data, to be signed by this routine.
|
811 |
* @return str|bool An RSA-SHA1 signature for Amazon CloudFront, else false on failure.
|
812 |
*/
|
813 |
public static function amazon_cf_rsa_sign($string = FALSE)
|
822 |
* @package s2Member\Files
|
823 |
* @since 110926
|
824 |
*
|
825 |
+
* @param string $file Input file path, to be signed by this routine.
|
826 |
* @param bool $stream Is this resource file to be served as streaming media?
|
827 |
* @param bool $inline Is this resource file to be served inline, or no?
|
828 |
* @param bool $ssl Is this resource file to be served via SSL, or no?
|
829 |
+
* @param string $basename The absolute basename of the resource file.
|
830 |
+
* @param string $mimetype The MIME content-type of the resource file.
|
831 |
+
* @return string An RSA-SHA1 signature URL for Amazon CloudFront.
|
832 |
*/
|
833 |
public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
|
834 |
{
|
1035 |
* @package s2Member\Files
|
1036 |
* @since 110926
|
1037 |
*
|
1038 |
+
* @param string $access_id Required. An Origin Access ID.
|
1039 |
* @return array Array containing a true `success` and `etag`, `xml` elements on success, else a failure array.
|
1040 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1041 |
*/
|
1081 |
* @package s2Member\Files
|
1082 |
* @since 110926
|
1083 |
*
|
1084 |
+
* @param string $access_id Required. An Origin Access ID.
|
1085 |
+
* @param string $access_id_etag Required. An Origin Access ETag header.
|
1086 |
+
* @param string $access_id_xml Required. An Origin Access Identity's XML configuration.
|
1087 |
* @return array Array containing a true `success` element on success, else a failure array.
|
1088 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1089 |
*/
|
1166 |
* @package s2Member\Files
|
1167 |
* @since 110926
|
1168 |
*
|
1169 |
+
* @param string $distro_id Required. A Distro ID.
|
1170 |
+
* @param string $distro_type Required: `downloads|streaming`.
|
1171 |
* @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
|
1172 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1173 |
*/
|
1213 |
* @package s2Member\Files
|
1214 |
* @since 110926
|
1215 |
*
|
1216 |
+
* @param string $distro_id Required. A Distro ID.
|
1217 |
+
* @param string $distro_id_etag Required. A Distro ETag header.
|
1218 |
+
* @param string $distro_id_xml Required. A Distro's XML configuration.
|
1219 |
* @return array Array containing a true `success` and `etag`, `xml`, `deployed` elements on success, else a failure array.
|
1220 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1221 |
*/
|
1267 |
* @package s2Member\Files
|
1268 |
* @since 110926
|
1269 |
*
|
1270 |
+
* @param string $distro_id Required. A Distro ID.
|
1271 |
+
* @param string $distro_id_etag Required. A Distro ETag header.
|
1272 |
+
* @param string $distro_id_xml Required. A Distro's XML configuration.
|
1273 |
* @return array Array containing a true `success` element on success, else a failure array.
|
1274 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1275 |
*/
|
1337 |
* @package s2Member\Files
|
1338 |
* @since 110926
|
1339 |
*
|
1340 |
+
* @param string $distro_type Required: `downloads|streaming`.
|
1341 |
* @return array Array containing a true `success` and `distro_[distro_type]_id`, `distro_[distro_type]_dname` elements on success, else a failure array.
|
1342 |
* Failure array will contain a failure `code`, and a failure `message`.
|
1343 |
*/
|
includes/classes/files.inc.php
CHANGED
@@ -57,7 +57,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
57 |
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
|
58 |
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
|
59 |
* @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
|
60 |
-
* @return
|
61 |
*
|
62 |
* @see s2Member\API_Functions\s2member_file_download_url()
|
63 |
*/
|
@@ -142,18 +142,18 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
142 |
* @package s2Member\Files
|
143 |
* @since 3.5
|
144 |
*
|
145 |
-
* @param
|
146 |
* In other words, just the name of the file *(i.e. `file.zip` )*.
|
147 |
-
* @param
|
148 |
* `ip-forever` = a Download Key that never expires, tied only to a specific file and IP address.
|
149 |
* `universal` and/or `cache-compatible` = a Download Key which never expires, and is NOT tied to any specific User. Use at your own risk.
|
150 |
-
* @return
|
151 |
*/
|
152 |
public static function file_download_key($file = FALSE, $directive = FALSE)
|
153 |
{
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
do_action("ws_plugin__s2member_before_file_download_key", get_defined_vars());
|
156 |
-
unset
|
157 |
|
158 |
$file = ($file && is_string($file) && ($file = trim($file, "/"))) ? $file : "";
|
159 |
|
@@ -176,8 +176,8 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
176 |
* @package s2Member\Files
|
177 |
* @since 3.5
|
178 |
*
|
179 |
-
* @param
|
180 |
-
* @param
|
181 |
* relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
|
182 |
* @param array $user_log Optional. Prevents another database connection *(i.e. the User's log does not need to be pulled again)*.
|
183 |
* @param array $user_arc Optional. Prevents another database connection *(i.e. the User's archive does not need to be pulled again)*.
|
@@ -190,7 +190,7 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
190 |
{
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
do_action("ws_plugin__s2member_before_user_downloads", get_defined_vars());
|
193 |
-
unset
|
194 |
|
195 |
$allowed = $allowed_days = $currently = /* Initialize these to zero. */ 0;
|
196 |
$log = $arc = /* Initialize these to a default empty array value. */ array();
|
@@ -227,8 +227,8 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
227 |
* @package s2Member\Files
|
228 |
* @since 111026
|
229 |
*
|
230 |
-
* @param
|
231 |
-
* @param
|
232 |
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
|
233 |
* @return int The total for this particular ``$file``, based on configuration of function arguments.
|
234 |
*
|
@@ -262,8 +262,8 @@ if(!class_exists("c_ws_plugin__s2member_files"))
|
|
262 |
* @package s2Member\Files
|
263 |
* @since 111026
|
264 |
*
|
265 |
-
* @param
|
266 |
-
* @param
|
267 |
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
|
268 |
* @return int The total for this particular ``$file``, based on configuration of function arguments.
|
269 |
*
|
57 |
* @param array $config Required. This is an array of configuration options associated with permissions being checked against the current User/Member; and also the actual URL generated by this routine.
|
58 |
* Possible ``$config`` array elements: `file_download` *(required)*, `file_download_key`, `file_stream`, `file_inline`, `file_storage`, `file_remote`, `file_ssl`, `file_rewrite`, `file_rewrite_base`, `skip_confirmation`, `url_to_storage_source`, `count_against_user`, `check_user`.
|
59 |
* @param bool $get_streamer_array Optional. Defaults to `false`. If `true`, this function will return an array with the following elements: `streamer`, `file`, `url`. For further details, please review this section in your Dashboard: `s2Member -› Download Options -› JW Player & RTMP Protocol Examples`.
|
60 |
+
* @return string A File Download URL string on success; or an array on success, with elements `streamer`, `file`, `url` when/if ``$get_streamer_array`` is true; else false on any type of failure.
|
61 |
*
|
62 |
* @see s2Member\API_Functions\s2member_file_download_url()
|
63 |
*/
|
142 |
* @package s2Member\Files
|
143 |
* @since 3.5
|
144 |
*
|
145 |
+
* @param string $file Location of your protected file, relative to the `/s2member-files/` directory.
|
146 |
* In other words, just the name of the file *(i.e. `file.zip` )*.
|
147 |
+
* @param string $directive Optional. One of `ip-forever|universal|cache-compatible`.
|
148 |
* `ip-forever` = a Download Key that never expires, tied only to a specific file and IP address.
|
149 |
* `universal` and/or `cache-compatible` = a Download Key which never expires, and is NOT tied to any specific User. Use at your own risk.
|
150 |
+
* @return string A Download Key. MD5 hash, 32 characters, URL-safe.
|
151 |
*/
|
152 |
public static function file_download_key($file = FALSE, $directive = FALSE)
|
153 |
{
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
do_action("ws_plugin__s2member_before_file_download_key", get_defined_vars());
|
156 |
+
unset($__refs, $__v);
|
157 |
|
158 |
$file = ($file && is_string($file) && ($file = trim($file, "/"))) ? $file : "";
|
159 |
|
176 |
* @package s2Member\Files
|
177 |
* @since 3.5
|
178 |
*
|
179 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User's object.
|
180 |
+
* @param string $not_counting_this_particular_file Optional. If you want to exclude a particular file,
|
181 |
* relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
|
182 |
* @param array $user_log Optional. Prevents another database connection *(i.e. the User's log does not need to be pulled again)*.
|
183 |
* @param array $user_arc Optional. Prevents another database connection *(i.e. the User's archive does not need to be pulled again)*.
|
190 |
{
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
do_action("ws_plugin__s2member_before_user_downloads", get_defined_vars());
|
193 |
+
unset($__refs, $__v);
|
194 |
|
195 |
$allowed = $allowed_days = $currently = /* Initialize these to zero. */ 0;
|
196 |
$log = $arc = /* Initialize these to a default empty array value. */ array();
|
227 |
* @package s2Member\Files
|
228 |
* @since 111026
|
229 |
*
|
230 |
+
* @param string $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
|
231 |
+
* @param string|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
|
232 |
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
|
233 |
* @return int The total for this particular ``$file``, based on configuration of function arguments.
|
234 |
*
|
262 |
* @package s2Member\Files
|
263 |
* @since 111026
|
264 |
*
|
265 |
+
* @param string $file Required. Location of the file, relative to the `/s2member-files/` directory, or relative to the root of your Amazon S3 Bucket *(when applicable)*.
|
266 |
+
* @param string|int $user_id Optional. If specified, s2Member will return total downloads by a particular User/Member, instead of collectively *(i.e among all Users/Members)*.
|
267 |
* @param bool $check_archives_too Optional. Defaults to true. When true, s2Member checks its File Download Archive too, instead of ONLY looking at Files downloaded in the current Period. Period is based on your Basic Download Restrictions setting of allowed days across various Levels of Membership, for each respective User/Member. Or, if ``$user_id`` is specified, based solely on a specific User's `allowed_days`, configured in your Basic Download Restrictions, at the User's current Membership Level.
|
268 |
* @return int The total for this particular ``$file``, based on configuration of function arguments.
|
269 |
*
|
includes/classes/ip-restrictions.inc.php
CHANGED
@@ -35,15 +35,15 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
35 |
* @package s2Member\IP_Restrictions
|
36 |
* @since 3.5
|
37 |
*
|
38 |
-
* @param
|
39 |
-
* @param
|
40 |
* @return bool True if IP Restrictions are OK, otherwise this function will exit script execution after issuing a warning.
|
41 |
*/
|
42 |
public static function ip_restrictions_ok($ip = FALSE, $restriction = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
do_action("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars());
|
46 |
-
unset
|
47 |
|
48 |
if(!apply_filters("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars())
|
49 |
/* Also allow specific exclusions here. */ && !apply_filters("ws_plugin__s2member_disable_specific_ip_restriction", false, get_defined_vars())
|
@@ -84,7 +84,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
|
87 |
-
unset
|
88 |
|
89 |
exit /* Clean exit with 503 error message. */($msg_503);
|
90 |
}
|
@@ -109,7 +109,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
109 |
|
110 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
111 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
|
112 |
-
unset
|
113 |
|
114 |
exit /* Clean exit with 503 error message. */($msg_503);
|
115 |
}
|
@@ -118,7 +118,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
118 |
{
|
119 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
120 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
|
121 |
-
unset
|
122 |
|
123 |
return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
|
124 |
}
|
@@ -126,7 +126,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
126 |
|
127 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
128 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
|
129 |
-
unset
|
130 |
|
131 |
return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
|
132 |
}
|
@@ -136,7 +136,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
136 |
* @package s2Member\IP_Restrictions
|
137 |
* @since 130407
|
138 |
*
|
139 |
-
* @param
|
140 |
* @return bool TRUE if at or above max allowable IPs; else FALSE.
|
141 |
*/
|
142 |
public static function specific_ip_restriction_at_or_above_max($restriction = FALSE)
|
@@ -170,7 +170,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
170 |
* @package s2Member\IP_Restrictions
|
171 |
* @since 3.5
|
172 |
*
|
173 |
-
* @param
|
174 |
* @return bool True if the specific IP Restriction is associated with a security breach, else false.
|
175 |
*/
|
176 |
public static function specific_ip_restriction_breached_security($restriction = FALSE)
|
@@ -189,7 +189,7 @@ if(!class_exists("c_ws_plugin__s2member_ip_restrictions"))
|
|
189 |
* @package s2Member\IP_Restrictions
|
190 |
* @since 3.5
|
191 |
*
|
192 |
-
* @param
|
193 |
* @return bool Always returns a `true` value.
|
194 |
*
|
195 |
* @todo Make return value conditional, based on success.
|
35 |
* @package s2Member\IP_Restrictions
|
36 |
* @since 3.5
|
37 |
*
|
38 |
+
* @param string $ip IP Address.
|
39 |
+
* @param string $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
|
40 |
* @return bool True if IP Restrictions are OK, otherwise this function will exit script execution after issuing a warning.
|
41 |
*/
|
42 |
public static function ip_restrictions_ok($ip = FALSE, $restriction = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
do_action("ws_plugin__s2member_before_ip_restrictions_ok", get_defined_vars());
|
46 |
+
unset($__refs, $__v);
|
47 |
|
48 |
if(!apply_filters("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars())
|
49 |
/* Also allow specific exclusions here. */ && !apply_filters("ws_plugin__s2member_disable_specific_ip_restriction", false, get_defined_vars())
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
|
87 |
+
unset($__refs, $__v);
|
88 |
|
89 |
exit /* Clean exit with 503 error message. */($msg_503);
|
90 |
}
|
109 |
|
110 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
111 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_no", get_defined_vars());
|
112 |
+
unset($__refs, $__v);
|
113 |
|
114 |
exit /* Clean exit with 503 error message. */($msg_503);
|
115 |
}
|
118 |
{
|
119 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
120 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
|
121 |
+
unset($__refs, $__v);
|
122 |
|
123 |
return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
|
124 |
}
|
126 |
|
127 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
128 |
do_action("ws_plugin__s2member_during_ip_restrictions_ok_yes", get_defined_vars());
|
129 |
+
unset($__refs, $__v);
|
130 |
|
131 |
return apply_filters("ws_plugin__s2member_ip_restrictions_ok", true, get_defined_vars());
|
132 |
}
|
136 |
* @package s2Member\IP_Restrictions
|
137 |
* @since 130407
|
138 |
*
|
139 |
+
* @param string $restriction Unique IP Restriction name/identifier. Such as Username, or a unique access code.
|
140 |
* @return bool TRUE if at or above max allowable IPs; else FALSE.
|
141 |
*/
|
142 |
public static function specific_ip_restriction_at_or_above_max($restriction = FALSE)
|
170 |
* @package s2Member\IP_Restrictions
|
171 |
* @since 3.5
|
172 |
*
|
173 |
+
* @param string $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
|
174 |
* @return bool True if the specific IP Restriction is associated with a security breach, else false.
|
175 |
*/
|
176 |
public static function specific_ip_restriction_breached_security($restriction = FALSE)
|
189 |
* @package s2Member\IP_Restrictions
|
190 |
* @since 3.5
|
191 |
*
|
192 |
+
* @param string $restriction Unique IP Restriction name/identifier. Such as a Username, or a unique access code.
|
193 |
* @return bool Always returns a `true` value.
|
194 |
*
|
195 |
* @todo Make return value conditional, based on success.
|
includes/classes/labels.inc.php
CHANGED
@@ -39,12 +39,12 @@ if (!class_exists ("c_ws_plugin__s2member_labels"))
|
|
39 |
*/
|
40 |
public static function config_label_translations ()
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["apply_label_translations"])
|
45 |
add_filter ("gettext_with_context", "c_ws_plugin__s2member_labels::_label_translations", 10, 3);
|
46 |
|
47 |
-
do_action
|
48 |
|
49 |
return /* Return for uniformity. */;
|
50 |
}
|
@@ -56,22 +56,22 @@ if (!class_exists ("c_ws_plugin__s2member_labels"))
|
|
56 |
*
|
57 |
* @attaches-to ``add_filter("gettext_with_context");``
|
58 |
*
|
59 |
-
* @param
|
60 |
-
* @param
|
61 |
-
* @param
|
62 |
-
* @return
|
63 |
*/
|
64 |
public static function _label_translations ($translation = FALSE, $original = FALSE, $context = FALSE)
|
65 |
{
|
66 |
if ($original && $context && stripos ($context, "User role") === 0 && ($role = $original))
|
67 |
{
|
68 |
-
if (preg_match ("/^(Free )?Subscriber$/i", $role) && !empty
|
69 |
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
|
70 |
|
71 |
-
else if (preg_match ("/^s2Member Level ([0-9]+)$/i", $role, $m) && !empty
|
72 |
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $m[1] . "_label"];
|
73 |
|
74 |
-
$translation = apply_filters
|
75 |
}
|
76 |
|
77 |
return /* Return translation. */ $translation;
|
39 |
*/
|
40 |
public static function config_label_translations ()
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_config_label_translations", get_defined_vars ());
|
43 |
|
44 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["apply_label_translations"])
|
45 |
add_filter ("gettext_with_context", "c_ws_plugin__s2member_labels::_label_translations", 10, 3);
|
46 |
|
47 |
+
do_action("ws_plugin__s2member_after_config_label_translations", get_defined_vars ());
|
48 |
|
49 |
return /* Return for uniformity. */;
|
50 |
}
|
56 |
*
|
57 |
* @attaches-to ``add_filter("gettext_with_context");``
|
58 |
*
|
59 |
+
* @param string $translation Expects a string; already translated.
|
60 |
+
* @param string $original The original text, passed in by the Filter.
|
61 |
+
* @param string $context Contextual specification for this translation.
|
62 |
+
* @return string The ``$translation``, after translations applied by this routine.
|
63 |
*/
|
64 |
public static function _label_translations ($translation = FALSE, $original = FALSE, $context = FALSE)
|
65 |
{
|
66 |
if ($original && $context && stripos ($context, "User role") === 0 && ($role = $original))
|
67 |
{
|
68 |
+
if (preg_match ("/^(Free )?Subscriber$/i", $role) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"]))
|
69 |
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
|
70 |
|
71 |
+
else if (preg_match ("/^s2Member Level ([0-9]+)$/i", $role, $m) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $m[1] . "_label"]))
|
72 |
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $m[1] . "_label"];
|
73 |
|
74 |
+
$translation = apply_filters("_ws_plugin__s2member_label_translations", $translation, get_defined_vars ());
|
75 |
}
|
76 |
|
77 |
return /* Return translation. */ $translation;
|
includes/classes/list-servers.inc.php
CHANGED
@@ -37,13 +37,13 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
37 |
*/
|
38 |
public static function list_servers_integrated ()
|
39 |
{
|
40 |
-
do_action
|
41 |
|
42 |
for /* Go through each Level; looking for a configured list. */ ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
43 |
-
if (!empty
|
44 |
-
return apply_filters
|
45 |
|
46 |
-
return apply_filters
|
47 |
}
|
48 |
/**
|
49 |
* Processes List Server integrations for s2Member.
|
@@ -51,17 +51,17 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
51 |
* @package s2Member\List_Servers
|
52 |
* @since 3.5
|
53 |
*
|
54 |
-
* @param
|
55 |
-
* @param int|
|
56 |
-
* @param
|
57 |
-
* @param
|
58 |
-
* @param
|
59 |
-
* @param
|
60 |
-
* @param
|
61 |
-
* @param
|
62 |
* @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in.
|
63 |
* @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk.
|
64 |
-
* @param int|
|
65 |
* @return bool True if at least one List Server is processed successfully, else false.
|
66 |
*
|
67 |
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
@@ -73,17 +73,17 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
73 |
global /* For Multisite support. */ $current_site, $current_blog;
|
74 |
|
75 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
76 |
-
do_action
|
77 |
-
unset
|
78 |
|
79 |
-
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && ($args = func_get_args ()) && $role && is_string ($role) && is_numeric ($level) && $login && is_string ($login) && is_string ($pass = (string)$pass) && $email && is_string ($email) && is_email ($email) && is_string ($fname = (string)$fname) && is_string ($lname = (string)$lname) && is_string ($ip = (string)$ip) && is_bool ($opt_in = (bool)$opt_in) && $opt_in && is_bool ($double_opt_in = (bool)$double_opt_in) && $user_id && is_numeric ($user_id) && is_object ($user = new WP_User ($user_id)) && !empty
|
80 |
{
|
81 |
$ccaps = /* Get Custom Capabilities. */ implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
82 |
|
83 |
$email_configs_were_on = /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs::email_config_status ();
|
84 |
c_ws_plugin__s2member_email_configs::email_config_release /* Release s2Member Filters before we begin this routine. */ ();
|
85 |
|
86 |
-
if (!empty
|
87 |
{
|
88 |
if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
|
89 |
include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
|
@@ -92,7 +92,7 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
92 |
|
93 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
|
94 |
{
|
95 |
-
$mailchimp = array
|
96 |
|
97 |
if (($mailchimp["list"] = trim ($mailchimp_list)))
|
98 |
{
|
@@ -102,26 +102,28 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
102 |
|
103 |
if /* This is a title configured by the list master. */ (($mailchimp["interest_groups_title"] = trim ($mailchimp["interest_groups_title"])))
|
104 |
if (($mailchimp["interest_groups"] = (trim ($mailchimp["interest_groups"])) ? preg_split ("/\|/", trim ($mailchimp["interest_groups"])) : false))
|
105 |
-
$mailchimp["interest_groups"] = array
|
106 |
|
107 |
-
if /* Need to double-check this. If empty, skip over this entry. */ (empty
|
108 |
continue /* Continue to next List, if there is one. */;
|
109 |
}
|
110 |
else // Else, it's just a List ID.
|
111 |
$mailchimp["list_id"] = $mailchimp["list"];
|
112 |
|
113 |
-
$
|
114 |
-
$
|
115 |
-
$mailchimp["merge_array"] =
|
|
|
|
|
116 |
// Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`.
|
117 |
|
118 |
if ($mailchimp["api_response"] = $mcapi->{$mailchimp["api_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/` for full details.
|
119 |
-
($mailchimp["api_merge_array"] = apply_filters
|
120 |
-
($mailchimp["api_email_type"] = apply_filters
|
121 |
-
($mailchimp["api_double_optin"] = apply_filters
|
122 |
-
($mailchimp["api_update_existing"] = apply_filters
|
123 |
-
($mailchimp["api_replace_interests"] = apply_filters
|
124 |
-
($mailchimp["api_send_welcome"] = apply_filters
|
125 |
$mailchimp["api_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
126 |
$mailchimp["api_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
127 |
|
@@ -142,28 +144,48 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
142 |
}
|
143 |
}
|
144 |
}
|
145 |
-
|
146 |
-
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
147 |
{
|
148 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
149 |
{
|
150 |
-
$getresponse = array
|
151 |
|
152 |
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
153 |
{
|
154 |
-
$getresponse["
|
155 |
-
$getresponse["
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
$getresponse["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
|
|
|
|
|
|
167 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
168 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
169 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
@@ -181,22 +203,21 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
181 |
}
|
182 |
}
|
183 |
}
|
184 |
-
|
185 |
-
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
186 |
{
|
187 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
188 |
{
|
189 |
-
$aweber = array
|
190 |
|
191 |
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
192 |
{
|
193 |
-
$aweber["bcc"] = apply_filters
|
194 |
-
$aweber["pass_inclusion"] = (apply_filters
|
195 |
-
$buyer = ($fname || $lname) ? trim ($fname . " " . $lname) : /* Must have. AWeber's PayPal Email Parser chokes on an empty value. */ ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
196 |
|
197 |
if ($aweber["wp_mail_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
198 |
-
($aweber["wp_mail_sbj"] = apply_filters
|
199 |
-
($aweber["wp_mail_msg"] = apply_filters
|
200 |
($aweber["wp_mail_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["bcc"]) ? "\r\nBcc: " . $aweber["bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
201 |
$aweber["wp_mail_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
202 |
|
@@ -217,20 +238,18 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
217 |
}
|
218 |
}
|
219 |
}
|
220 |
-
|
221 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
222 |
-
do_action
|
223 |
-
unset
|
224 |
|
225 |
if /* Back on? */ ($email_configs_were_on)
|
226 |
c_ws_plugin__s2member_email_configs::email_config ();
|
227 |
}
|
228 |
-
|
229 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
230 |
-
do_action
|
231 |
-
unset
|
232 |
|
233 |
-
return apply_filters
|
234 |
}
|
235 |
/**
|
236 |
* Processes List Server removals for s2Member.
|
@@ -238,16 +257,16 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
238 |
* @package s2Member\List_Servers
|
239 |
* @since 3.5
|
240 |
*
|
241 |
-
* @param
|
242 |
-
* @param int|
|
243 |
-
* @param
|
244 |
-
* @param
|
245 |
-
* @param
|
246 |
-
* @param
|
247 |
-
* @param
|
248 |
-
* @param
|
249 |
* @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out.
|
250 |
-
* @param int|
|
251 |
* @return bool True if at least one List Server is processed successfully, else false.
|
252 |
*
|
253 |
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
@@ -259,17 +278,17 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
259 |
global /* For Multisite support. */ $current_site, $current_blog;
|
260 |
|
261 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
262 |
-
do_action
|
263 |
-
unset
|
264 |
|
265 |
-
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && ($args = func_get_args ()) && $role && is_string ($role) && is_numeric ($level) && $login && is_string ($login) && is_string ($pass = (string)$pass) && $email && is_string ($email) && is_email ($email) && is_string ($fname = (string)$fname) && is_string ($lname = (string)$lname) && is_string ($ip = (string)$ip) && is_bool ($opt_out = (bool)$opt_out) && $opt_out && $user_id && is_numeric ($user_id) && is_object ($user = new WP_User ($user_id)) && !empty
|
266 |
{
|
267 |
$ccaps = /* Get Custom Capabilities. */ implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
268 |
|
269 |
$email_configs_were_on = /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs::email_config_status ();
|
270 |
c_ws_plugin__s2member_email_configs::email_config_release /* Release s2Member Filters before we begin this routine. */ ();
|
271 |
|
272 |
-
if (!empty
|
273 |
{
|
274 |
if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
|
275 |
include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
|
@@ -278,14 +297,14 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
278 |
|
279 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
|
280 |
{
|
281 |
-
$mailchimp = array
|
282 |
|
283 |
if /* Trim & strip groups. */ (($mailchimp["list_id"] = trim (preg_replace ("/\:\:.*$/", "", $mailchimp_list))))
|
284 |
{
|
285 |
if ($mailchimp["api_removal_response"] = $mcapi->{$mailchimp["api_removal_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/`.
|
286 |
-
($mailchimp["api_removal_delete_member"] = apply_filters
|
287 |
-
($mailchimp["api_removal_send_goodbye"] = apply_filters
|
288 |
-
($mailchimp["api_removal_send_notify"] = apply_filters
|
289 |
$mailchimp["api_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
290 |
$mailchimp["api_removal_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
291 |
|
@@ -306,35 +325,27 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
306 |
}
|
307 |
}
|
308 |
}
|
309 |
-
|
310 |
-
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
311 |
{
|
312 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
313 |
{
|
314 |
-
$getresponse = array
|
315 |
|
316 |
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
317 |
{
|
|
|
318 |
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
319 |
-
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"],
|
320 |
-
array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
|
321 |
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
322 |
|
323 |
-
if (is_object($getresponse["api_response"] =
|
324 |
-
json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"],
|
325 |
-
array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error)
|
326 |
-
&& ($getresponse["api_response_contact_ids"] = array_keys((array)$getresponse["api_response"]->result))
|
327 |
-
&& ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0]))
|
328 |
{
|
329 |
$getresponse["api_method"] = "delete_contact"; // Update method now.
|
330 |
-
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
331 |
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"]));
|
332 |
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
333 |
|
334 |
-
if (is_object($getresponse["api_response"] =
|
335 |
-
|
336 |
-
array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error)
|
337 |
-
&& $getresponse["api_response"]->result->deleted) $getresponse["api_success"] = $success = true;
|
338 |
}
|
339 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
340 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
@@ -353,22 +364,21 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
353 |
}
|
354 |
}
|
355 |
}
|
356 |
-
|
357 |
-
if (!empty ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
358 |
{
|
359 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
360 |
{
|
361 |
-
$aweber = array
|
362 |
|
363 |
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
364 |
{
|
365 |
-
$aweber["removal_bcc"] = apply_filters
|
366 |
|
367 |
c_ws_plugin__s2member_email_configs::email_config (); // Email configs MUST be ON for removal requests.
|
368 |
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
|
369 |
|
370 |
if ($aweber["wp_mail_removal_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
371 |
-
($aweber["wp_mail_removal_sbj"] = apply_filters
|
372 |
($aweber["wp_mail_removal_msg"] = "REMOVE"), ($aweber["wp_mail_removal_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["removal_bcc"]) ? "\r\nBcc: " . $aweber["removal_bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
373 |
$aweber["wp_mail_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
374 |
|
@@ -391,20 +401,18 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
391 |
}
|
392 |
}
|
393 |
}
|
394 |
-
|
395 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
396 |
-
do_action
|
397 |
-
unset
|
398 |
|
399 |
if /* Back on? */ ($email_configs_were_on)
|
400 |
c_ws_plugin__s2member_email_configs::email_config ();
|
401 |
}
|
402 |
-
|
403 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
404 |
-
do_action
|
405 |
-
unset
|
406 |
|
407 |
-
return apply_filters
|
408 |
}
|
409 |
/**
|
410 |
* Listens to Collective EOT/MOD Events processed internally by s2Member.
|
@@ -417,35 +425,34 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
417 |
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
|
418 |
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
|
419 |
*
|
420 |
-
* @param int|
|
421 |
* @param array $vars Required. An array of defined variables passed by the calling Hook.
|
422 |
-
* @param
|
423 |
-
* @param
|
424 |
-
* @param
|
425 |
-
* @param
|
426 |
-
* @param
|
427 |
-
* @return null This function does not have a return value.
|
428 |
*/
|
429 |
public static function auto_process_list_server_removals ($user_id = FALSE, $vars = FALSE, $event = FALSE, $event_spec = FALSE, $mod_new_role = FALSE, $mod_new_user = FALSE, $mod_old_user = FALSE)
|
430 |
{
|
431 |
global /* For Multisite support. */ $current_site, $current_blog;
|
432 |
-
static $auto_processed = /* Process ONE time for each User. */ array
|
433 |
|
434 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
435 |
-
do_action
|
436 |
-
unset
|
437 |
|
438 |
$custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "$/i");
|
439 |
|
440 |
-
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && $user_id && is_numeric ($user_id) && !in_array
|
441 |
{
|
442 |
-
$mod_new_role = ($event_spec === "modification" && $mod_new_role && is_string ($mod_new_role)) ? $mod_new_role : /* Might be empty
|
443 |
-
$mod_new_user = ($event_spec === "modification" && $mod_new_user && is_object ($mod_new_user) && !empty
|
444 |
-
$mod_old_user = ($event_spec === "modification" && $mod_old_user && is_object ($mod_old_user) && !empty
|
445 |
|
446 |
$user = ($event_spec === "modification" && $mod_old_user) ? $mod_old_user : $_user; // Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
|
447 |
|
448 |
-
if (($event_spec !== "modification" || ($event_spec === "modification" && /* Might be empty
|
449 |
{
|
450 |
$removed = c_ws_plugin__s2member_list_servers::process_list_server_removals (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user->ID);
|
451 |
|
@@ -456,21 +463,18 @@ if (!class_exists ("c_ws_plugin__s2member_list_servers"))
|
|
456 |
$transitioned = c_ws_plugin__s2member_list_servers::process_list_servers ($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level ($mod_new_role), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, (($removed) ? false : true), $user->ID);
|
457 |
|
458 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
459 |
-
do_action
|
460 |
-
unset
|
461 |
}
|
462 |
|
463 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
464 |
-
do_action
|
465 |
-
unset
|
466 |
}
|
467 |
}
|
468 |
-
|
469 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
470 |
-
do_action
|
471 |
-
unset
|
472 |
-
|
473 |
-
return /* Return for uniformity. */;
|
474 |
}
|
475 |
}
|
476 |
}
|
37 |
*/
|
38 |
public static function list_servers_integrated ()
|
39 |
{
|
40 |
+
do_action("ws_plugin__s2member_before_list_servers_integrated", get_defined_vars ());
|
41 |
|
42 |
for /* Go through each Level; looking for a configured list. */ ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
43 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_mailchimp_list_ids"]) || !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_getresponse_list_ids"]) || !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_aweber_list_ids"]))
|
44 |
+
return apply_filters("ws_plugin__s2member_list_servers_integrated", true, get_defined_vars ());
|
45 |
|
46 |
+
return apply_filters("ws_plugin__s2member_list_servers_integrated", false, get_defined_vars ());
|
47 |
}
|
48 |
/**
|
49 |
* Processes List Server integrations for s2Member.
|
51 |
* @package s2Member\List_Servers
|
52 |
* @since 3.5
|
53 |
*
|
54 |
+
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
55 |
+
* @param int|string $level A numeric s2Member Access Level number.
|
56 |
+
* @param string $login Username for the User.
|
57 |
+
* @param string $pass Plain Text Password for the User.
|
58 |
+
* @param string $email Email Address for the User.
|
59 |
+
* @param string $fname First Name for the User.
|
60 |
+
* @param string $lname Last Name for the User.
|
61 |
+
* @param string $ip IP Address for the User.
|
62 |
* @param bool $opt_in Defaults to false; must be set to true. Indicates the User IS opting in.
|
63 |
* @param bool $double_opt_in Defaults to true. If false, no email confirmation is required. Use at your own risk.
|
64 |
+
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
65 |
* @return bool True if at least one List Server is processed successfully, else false.
|
66 |
*
|
67 |
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
73 |
global /* For Multisite support. */ $current_site, $current_blog;
|
74 |
|
75 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
76 |
+
do_action("ws_plugin__s2member_before_process_list_servers", get_defined_vars ());
|
77 |
+
unset($__refs, $__v);
|
78 |
|
79 |
+
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && ($args = func_get_args ()) && $role && is_string ($role) && is_numeric ($level) && $login && is_string ($login) && is_string ($pass = (string)$pass) && $email && is_string ($email) && is_email ($email) && is_string ($fname = (string)$fname) && is_string ($lname = (string)$lname) && is_string ($ip = (string)$ip) && is_bool ($opt_in = (bool)$opt_in) && $opt_in && is_bool ($double_opt_in = (bool)$double_opt_in) && $user_id && is_numeric ($user_id) && is_object ($user = new WP_User ($user_id)) && !empty($user->ID))
|
80 |
{
|
81 |
$ccaps = /* Get Custom Capabilities. */ implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
82 |
|
83 |
$email_configs_were_on = /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs::email_config_status ();
|
84 |
c_ws_plugin__s2member_email_configs::email_config_release /* Release s2Member Filters before we begin this routine. */ ();
|
85 |
|
86 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
|
87 |
{
|
88 |
if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
|
89 |
include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
|
92 |
|
93 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
|
94 |
{
|
95 |
+
$mailchimp = array("function" => __FUNCTION__, "func_get_args" => $args, "api_method" => "listSubscribe");
|
96 |
|
97 |
if (($mailchimp["list"] = trim ($mailchimp_list)))
|
98 |
{
|
102 |
|
103 |
if /* This is a title configured by the list master. */ (($mailchimp["interest_groups_title"] = trim ($mailchimp["interest_groups_title"])))
|
104 |
if (($mailchimp["interest_groups"] = (trim ($mailchimp["interest_groups"])) ? preg_split ("/\|/", trim ($mailchimp["interest_groups"])) : false))
|
105 |
+
$mailchimp["interest_groups"] = array("GROUPINGS" => array(array("name" => $mailchimp["interest_groups_title"], "groups" => implode (",", $mailchimp["interest_groups"]))));
|
106 |
|
107 |
+
if /* Need to double-check this. If empty, skip over this entry. */ (empty($mailchimp["list_id"]))
|
108 |
continue /* Continue to next List, if there is one. */;
|
109 |
}
|
110 |
else // Else, it's just a List ID.
|
111 |
$mailchimp["list_id"] = $mailchimp["list"];
|
112 |
|
113 |
+
$fname = (!$fname) ? ucwords (strstr($email, '@', TRUE)) : $fname; $lname = (!$lname) ? '-' : $lname;
|
114 |
+
$name = ($fname || $lname) ? trim ($fname . " " . $lname) : ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
115 |
+
$mailchimp["merge_array"] = array("MERGE1" => $fname, "MERGE2" => $lname, "OPTIN_IP" => $ip, "OPTIN_TIME" => date ("Y-m-d H:i:s"));
|
116 |
+
$mailchimp["merge_array"] = (!empty($mailchimp["interest_groups"])) ? array_merge ($mailchimp["merge_array"], $mailchimp["interest_groups"]) : $mailchimp["merge_array"];
|
117 |
+
$mailchimp["merge_array"] = apply_filters( /* Deprecated. */"ws_plugin__s2member_mailchimp_array", $mailchimp["merge_array"], get_defined_vars ());
|
118 |
// Filter: `ws_plugin__s2member_mailchimp_array` deprecated in v110523. Please use Filter: `ws_plugin__s2member_mailchimp_merge_array`.
|
119 |
|
120 |
if ($mailchimp["api_response"] = $mcapi->{$mailchimp["api_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/` for full details.
|
121 |
+
($mailchimp["api_merge_array"] = apply_filters("ws_plugin__s2member_mailchimp_merge_array", $mailchimp["merge_array"], get_defined_vars ())), // Configured merge array above.
|
122 |
+
($mailchimp["api_email_type"] = apply_filters("ws_plugin__s2member_mailchimp_email_type", "html", get_defined_vars ())), // Type of email to receive (i.e. html,text,mobile).
|
123 |
+
($mailchimp["api_double_optin"] = apply_filters("ws_plugin__s2member_mailchimp_double_optin", $double_opt_in, get_defined_vars ())), // Abuse of this may cause account suspension.
|
124 |
+
($mailchimp["api_update_existing"] = apply_filters("ws_plugin__s2member_mailchimp_update_existing", true, get_defined_vars ())), // Existing subscribers should be updated with this?
|
125 |
+
($mailchimp["api_replace_interests"] = apply_filters("ws_plugin__s2member_mailchimp_replace_interests", true, get_defined_vars ())), // Replace interest groups? (only if provided).
|
126 |
+
($mailchimp["api_send_welcome"] = apply_filters("ws_plugin__s2member_mailchimp_send_welcome", false, get_defined_vars ())))) // See documentation. This is a weird option.
|
127 |
$mailchimp["api_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
128 |
$mailchimp["api_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
129 |
|
144 |
}
|
145 |
}
|
146 |
}
|
147 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
|
|
148 |
{
|
149 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
150 |
{
|
151 |
+
$getresponse = array("function" => __FUNCTION__, "func_get_args" => $args, "api_method" => "add_contact");
|
152 |
|
153 |
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
154 |
{
|
155 |
+
$getresponse["api_method"] = "add_contact";
|
156 |
+
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
157 |
+
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
|
158 |
+
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
159 |
+
$name = ($fname || $lname) ? trim ($fname . " " . $lname) : ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
160 |
+
|
161 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && ($getresponse["api_response_contact_ids"] = array_keys((array)$getresponse["api_response"]->result)) && ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0]))
|
162 |
+
{
|
163 |
+
$getresponse["api_method"] = "set_contact_name";
|
164 |
+
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"], "name" => $name));
|
165 |
+
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
166 |
+
|
167 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error))
|
168 |
+
{
|
169 |
+
$getresponse["api_method"] = "set_contact_customs";
|
170 |
+
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"], "customs" => apply_filters("ws_plugin__s2member_getresponse_customs_array", array(), get_defined_vars ())));
|
171 |
+
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
172 |
|
173 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error))
|
174 |
+
$getresponse["api_success"] = $success = true;
|
175 |
+
}
|
176 |
+
}
|
177 |
+
else // Create a new contact; i.e. they do not exist on this list yet.
|
178 |
+
{
|
179 |
+
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"],
|
180 |
+
array("name" => $name, "email" => $email, "ip" => $ip,
|
181 |
+
"campaign" => $getresponse["list_id"], "action" => "standard", "cycle_day" => 0,
|
182 |
+
"customs" => apply_filters("ws_plugin__s2member_getresponse_customs_array", array(), get_defined_vars ())));
|
183 |
+
if(!$getresponse["api_params"][1]["ip"] || $getresponse["api_params"][1]["ip"] === "unknown") unset($getresponse["api_params"][1]["ip"]);
|
184 |
+
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
185 |
|
186 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && $getresponse["api_response"]->result->queued)
|
187 |
+
$getresponse["api_success"] = $success = true;
|
188 |
+
}
|
189 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
190 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
191 |
$logm = c_ws_plugin__s2member_utilities::mem_details ();
|
203 |
}
|
204 |
}
|
205 |
}
|
206 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
|
|
207 |
{
|
208 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
209 |
{
|
210 |
+
$aweber = array("function" => __FUNCTION__, "func_get_args" => $args, "wp_mail_method" => "listSubscribe");
|
211 |
|
212 |
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
213 |
{
|
214 |
+
$aweber["bcc"] = apply_filters("ws_plugin__s2member_aweber_bcc", false, get_defined_vars ());
|
215 |
+
$aweber["pass_inclusion"] = (apply_filters("ws_plugin__s2member_aweber_pass_inclusion", false, get_defined_vars ()) && $pass) ? "\nPass: " . $pass : false;
|
216 |
+
$name = $buyer = ($fname || $lname) ? trim ($fname . " " . $lname) : /* Must have. AWeber's PayPal Email Parser chokes on an empty value. */ ucwords (preg_replace ("/^(.+?)@.+/", "$1", $email));
|
217 |
|
218 |
if ($aweber["wp_mail_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
219 |
+
($aweber["wp_mail_sbj"] = apply_filters("ws_plugin__s2member_aweber_sbj", "s2Member Subscription Request", get_defined_vars ())), // These Filters make it possible to customize these emails.
|
220 |
+
($aweber["wp_mail_msg"] = apply_filters("ws_plugin__s2member_aweber_msg", "s2Member Subscription Request\ns2Member w/ PayPal Email ID\nAd Tracking: s2Member-" . ((is_multisite () && !is_main_site ()) ? $current_blog->domain . $current_blog->path : $_SERVER["HTTP_HOST"]) . "\nEMail Address: " . $email . "\nBuyer: " . $buyer . "\nFull Name: " . trim ($fname . " " . $lname) . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nUser ID: " . $user_id . "\nLogin: " . $login . $aweber["pass_inclusion"] . "\nRole: " . $role . "\nLevel: " . $level . "\nCCaps: " . $ccaps . "\n - end.", get_defined_vars ())),
|
221 |
($aweber["wp_mail_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["bcc"]) ? "\r\nBcc: " . $aweber["bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
222 |
$aweber["wp_mail_success"] = $success = true; // Flag indicating that we DO have a successful processing of a new List; affects the function's overall return value.
|
223 |
|
238 |
}
|
239 |
}
|
240 |
}
|
|
|
241 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
242 |
+
do_action("ws_plugin__s2member_during_process_list_servers", get_defined_vars ());
|
243 |
+
unset($__refs, $__v);
|
244 |
|
245 |
if /* Back on? */ ($email_configs_were_on)
|
246 |
c_ws_plugin__s2member_email_configs::email_config ();
|
247 |
}
|
|
|
248 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
249 |
+
do_action("ws_plugin__s2member_after_process_list_servers", get_defined_vars ());
|
250 |
+
unset($__refs, $__v);
|
251 |
|
252 |
+
return apply_filters("ws_plugin__s2member_process_list_servers", (isset ($success) && $success), get_defined_vars ());
|
253 |
}
|
254 |
/**
|
255 |
* Processes List Server removals for s2Member.
|
257 |
* @package s2Member\List_Servers
|
258 |
* @since 3.5
|
259 |
*
|
260 |
+
* @param string $role A WordPress Role ID/Name, such as `subscriber`, or `s2member_level1`.
|
261 |
+
* @param int|string $level A numeric s2Member Access Level number.
|
262 |
+
* @param string $login Username for the User.
|
263 |
+
* @param string $pass Plain Text Password for the User.
|
264 |
+
* @param string $email Email address for the User.
|
265 |
+
* @param string $fname First Name for the User.
|
266 |
+
* @param string $lname Last Name for the User.
|
267 |
+
* @param string $ip IP Address for the User.
|
268 |
* @param bool $opt_out Defaults to false; must be set to true. Indicates the User IS opting out.
|
269 |
+
* @param int|string $user_id A WordPress User ID, numeric string or integer.
|
270 |
* @return bool True if at least one List Server is processed successfully, else false.
|
271 |
*
|
272 |
* @todo Integrate {@link https://labs.aweber.com/docs/php-library-walkthrough AWeber's API}.
|
278 |
global /* For Multisite support. */ $current_site, $current_blog;
|
279 |
|
280 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
281 |
+
do_action("ws_plugin__s2member_before_process_list_server_removals", get_defined_vars ());
|
282 |
+
unset($__refs, $__v);
|
283 |
|
284 |
+
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && ($args = func_get_args ()) && $role && is_string ($role) && is_numeric ($level) && $login && is_string ($login) && is_string ($pass = (string)$pass) && $email && is_string ($email) && is_email ($email) && is_string ($fname = (string)$fname) && is_string ($lname = (string)$lname) && is_string ($ip = (string)$ip) && is_bool ($opt_out = (bool)$opt_out) && $opt_out && $user_id && is_numeric ($user_id) && is_object ($user = new WP_User ($user_id)) && !empty($user->ID))
|
285 |
{
|
286 |
$ccaps = /* Get Custom Capabilities. */ implode (",", c_ws_plugin__s2member_user_access::user_access_ccaps ($user));
|
287 |
|
288 |
$email_configs_were_on = /* s2Member Filters enabled? */ c_ws_plugin__s2member_email_configs::email_config_status ();
|
289 |
c_ws_plugin__s2member_email_configs::email_config_release /* Release s2Member Filters before we begin this routine. */ ();
|
290 |
|
291 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]))
|
292 |
{
|
293 |
if /* Include the MailChimp API Class here. */ (!class_exists ("NC_MCAPI"))
|
294 |
include_once /* MailChimp API (no-conflict version). */ dirname (dirname (__FILE__)) . "/externals/mailchimp/nc-mcapi.inc.php";
|
297 |
|
298 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_mailchimp_list_ids"]) as $mailchimp_list)
|
299 |
{
|
300 |
+
$mailchimp = array("function" => __FUNCTION__, "func_get_args" => $args, "api_removal_method" => "listUnsubscribe");
|
301 |
|
302 |
if /* Trim & strip groups. */ (($mailchimp["list_id"] = trim (preg_replace ("/\:\:.*$/", "", $mailchimp_list))))
|
303 |
{
|
304 |
if ($mailchimp["api_removal_response"] = $mcapi->{$mailchimp["api_removal_method"]}($mailchimp["list_id"], $email, // See: `http://apidocs.mailchimp.com/`.
|
305 |
+
($mailchimp["api_removal_delete_member"] = apply_filters("ws_plugin__s2member_mailchimp_removal_delete_member", false, get_defined_vars ())), // Completely delete?
|
306 |
+
($mailchimp["api_removal_send_goodbye"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_goodbye", false, get_defined_vars ())), // Send goodbye letter?
|
307 |
+
($mailchimp["api_removal_send_notify"] = apply_filters("ws_plugin__s2member_mailchimp_removal_send_notify", false, get_defined_vars ())))) // Send notification?
|
308 |
$mailchimp["api_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
309 |
$mailchimp["api_removal_properties"] = $mcapi; // Include API instance too; as it contains some additional information after each method is processed (need this in the logs).
|
310 |
|
325 |
}
|
326 |
}
|
327 |
}
|
328 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"]) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]))
|
|
|
329 |
{
|
330 |
foreach (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_getresponse_list_ids"]) as $getresponse_list)
|
331 |
{
|
332 |
+
$getresponse = array("function" => __FUNCTION__, "func_get_args" => $args, "api_removal_method" => "delete_contact");
|
333 |
|
334 |
if (($getresponse["list_id"] = $getresponse["list"] = trim ($getresponse_list)))
|
335 |
{
|
336 |
+
$getresponse["api_method"] = "get_contacts";
|
337 |
$getresponse["api_headers"] = array("Content-Type" => "application/json");
|
338 |
+
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("campaigns" => array($getresponse["list_id"]), "email" => array("EQUALS" => $email)));
|
|
|
339 |
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
340 |
|
341 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && ($getresponse["api_response_contact_ids"] = array_keys((array)$getresponse["api_response"]->result)) && ($getresponse["api_response_contact_id"] = $getresponse["api_response_contact_ids"][0]))
|
|
|
|
|
|
|
|
|
342 |
{
|
343 |
$getresponse["api_method"] = "delete_contact"; // Update method now.
|
|
|
344 |
$getresponse["api_params"] = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["getresponse_api_key"], array("contact" => $getresponse["api_response_contact_id"]));
|
345 |
$getresponse["api_request"] = json_encode(array("method" => $getresponse["api_method"], "params" => $getresponse["api_params"], "id" => uniqid("", TRUE)));
|
346 |
|
347 |
+
if (is_object($getresponse["api_response"] = json_decode(c_ws_plugin__s2member_utils_urls::remote("https://api2.getresponse.com", $getresponse["api_request"], array("headers" => $getresponse["api_headers"])))) && empty($getresponse["api_response"]->error) && $getresponse["api_response"]->result->deleted)
|
348 |
+
$getresponse["api_success"] = $success = true;
|
|
|
|
|
349 |
}
|
350 |
$logt = c_ws_plugin__s2member_utilities::time_details ();
|
351 |
$logv = c_ws_plugin__s2member_utilities::ver_details ();
|
364 |
}
|
365 |
}
|
366 |
}
|
367 |
+
if (!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]))
|
|
|
368 |
{
|
369 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_aweber_list_ids"]) as $aweber_list)
|
370 |
{
|
371 |
+
$aweber = array("function" => __FUNCTION__, "func_get_args" => $args, "wp_mail_removal_method" => "listUnsubscribe");
|
372 |
|
373 |
if /* Trim this up. NO trailing white space. */ (($aweber["list_id"] = trim ($aweber_list)))
|
374 |
{
|
375 |
+
$aweber["removal_bcc"] = apply_filters("ws_plugin__s2member_aweber_removal_bcc", false, get_defined_vars ());
|
376 |
|
377 |
c_ws_plugin__s2member_email_configs::email_config (); // Email configs MUST be ON for removal requests.
|
378 |
// The `From:` address MUST match AWeber account. See: <http://www.aweber.com/faq/questions/62/Can+I+Unsubscribe+People+Via+Email%3F>.
|
379 |
|
380 |
if ($aweber["wp_mail_removal_response"] = wp_mail ($aweber["list_id"] . "@aweber.com", // AWeber List ID converts to email address @aweber.com.
|
381 |
+
($aweber["wp_mail_removal_sbj"] = apply_filters("ws_plugin__s2member_aweber_removal_sbj", "REMOVE#" . $email . "#s2Member#" . $aweber["list_id"], get_defined_vars ())), // Bug fix. AWeber does not like dots (possibly other chars) in the Ad Tracking field. Now using just: `s2Member`.
|
382 |
($aweber["wp_mail_removal_msg"] = "REMOVE"), ($aweber["wp_mail_removal_headers"] = "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">" . (($aweber["removal_bcc"]) ? "\r\nBcc: " . $aweber["removal_bcc"] : "") . "\r\nContent-Type: text/plain; charset=UTF-8")))
|
383 |
$aweber["wp_mail_removal_success"] = $removal_success = true; // Flag indicating that we DO have a successful removal; affects the function's overall return value.
|
384 |
|
401 |
}
|
402 |
}
|
403 |
}
|
|
|
404 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
405 |
+
do_action("ws_plugin__s2member_during_process_list_server_removals", get_defined_vars ());
|
406 |
+
unset($__refs, $__v);
|
407 |
|
408 |
if /* Back on? */ ($email_configs_were_on)
|
409 |
c_ws_plugin__s2member_email_configs::email_config ();
|
410 |
}
|
|
|
411 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
412 |
+
do_action("ws_plugin__s2member_after_process_list_server_removals", get_defined_vars ());
|
413 |
+
unset($__refs, $__v);
|
414 |
|
415 |
+
return apply_filters("ws_plugin__s2member_process_list_server_removals", (isset ($removal_success) && $removal_success), get_defined_vars ());
|
416 |
}
|
417 |
/**
|
418 |
* Listens to Collective EOT/MOD Events processed internally by s2Member.
|
425 |
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_mods");``
|
426 |
* @attaches-to ``add_action("ws_plugin__s2member_during_collective_eots");``
|
427 |
*
|
428 |
+
* @param int|string $user_id Required. A WordPress User ID, numeric string or integer.
|
429 |
* @param array $vars Required. An array of defined variables passed by the calling Hook.
|
430 |
+
* @param string $event Required. A specific event that triggered this call from the Action Hook.
|
431 |
+
* @param string $event_spec Required. A specific event specification *(a broader classification)*.
|
432 |
+
* @param string $mod_new_role Required if ``$event_spec === "modification"`` (but can be empty). Role the User is being modified to.
|
433 |
+
* @param string $mod_new_user Optional. If ``$event_spec === "modification"``, the new User object with current details.
|
434 |
+
* @param string $mod_old_user Optional. If ``$event_spec === "modification"``, the old/previous User obj with old details.
|
|
|
435 |
*/
|
436 |
public static function auto_process_list_server_removals ($user_id = FALSE, $vars = FALSE, $event = FALSE, $event_spec = FALSE, $mod_new_role = FALSE, $mod_new_user = FALSE, $mod_old_user = FALSE)
|
437 |
{
|
438 |
global /* For Multisite support. */ $current_site, $current_blog;
|
439 |
+
static $auto_processed = /* Process ONE time for each User. */ array();
|
440 |
|
441 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
442 |
+
do_action("ws_plugin__s2member_before_auto_process_list_server_removals", get_defined_vars ());
|
443 |
+
unset($__refs, $__v);
|
444 |
|
445 |
$custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "$/i");
|
446 |
|
447 |
+
if (c_ws_plugin__s2member_list_servers::list_servers_integrated () && $user_id && is_numeric ($user_id) && !in_array($user_id, $auto_processed) && is_array($vars) && is_string ($event = (string)$event) && is_string ($event_spec = (string)$event_spec) && (c_ws_plugin__s2member_utils_arrays::in_regex_array($event, $custom_reg_auto_op_outs) || c_ws_plugin__s2member_utils_arrays::in_regex_array($event_spec, $custom_reg_auto_op_outs)) && is_object ($user = $_user = new WP_User ($user_id)) && !empty($user->ID))
|
448 |
{
|
449 |
+
$mod_new_role = ($event_spec === "modification" && $mod_new_role && is_string ($mod_new_role)) ? $mod_new_role : /* Might be empty(i.e. they now have NO Role). */ false;
|
450 |
+
$mod_new_user = ($event_spec === "modification" && $mod_new_user && is_object ($mod_new_user) && !empty($mod_new_user->ID) && $mod_new_user->ID === $_user->ID) ? $mod_new_user : false;
|
451 |
+
$mod_old_user = ($event_spec === "modification" && $mod_old_user && is_object ($mod_old_user) && !empty($mod_old_user->ID) && $mod_old_user->ID === $_user->ID) ? $mod_old_user : false;
|
452 |
|
453 |
$user = ($event_spec === "modification" && $mod_old_user) ? $mod_old_user : $_user; // Now, should we switch over to the old/previous User object ``$mod_old_user`` here? Or, should we use the one pulled by this routine with the User's ID?
|
454 |
|
455 |
+
if (($event_spec !== "modification" || ($event_spec === "modification" && /* Might be empty(i.e. they now have NO Role). */ (string)$mod_new_role !== c_ws_plugin__s2member_user_access::user_access_role ($user) && strtotime ($user->user_registered) < strtotime ("-10 seconds") && ($event !== "user-role-change" || ($event === "user-role-change" && !empty($vars["_p"]["ws_plugin__s2member_custom_reg_auto_opt_out_transitions"]))))) && ($auto_processed[$user->ID] = true))
|
456 |
{
|
457 |
$removed = c_ws_plugin__s2member_list_servers::process_list_server_removals (c_ws_plugin__s2member_user_access::user_access_role ($user), c_ws_plugin__s2member_user_access::user_access_level ($user), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, $user->ID);
|
458 |
|
463 |
$transitioned = c_ws_plugin__s2member_list_servers::process_list_servers ($mod_new_role, c_ws_plugin__s2member_user_access::user_access_role_to_level ($mod_new_role), $user->user_login, false, $user->user_email, $user->first_name, $user->last_name, false, true, (($removed) ? false : true), $user->ID);
|
464 |
|
465 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
466 |
+
do_action("ws_plugin__s2member_during_auto_process_list_server_removal_transitions", get_defined_vars ());
|
467 |
+
unset($__refs, $__v);
|
468 |
}
|
469 |
|
470 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
471 |
+
do_action("ws_plugin__s2member_during_auto_process_list_server_removals", get_defined_vars ());
|
472 |
+
unset($__refs, $__v);
|
473 |
}
|
474 |
}
|
|
|
475 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
476 |
+
do_action("ws_plugin__s2member_after_auto_process_list_server_removals", get_defined_vars ());
|
477 |
+
unset($__refs, $__v);
|
|
|
|
|
478 |
}
|
479 |
}
|
480 |
}
|
includes/classes/login-checks.inc.php
CHANGED
@@ -43,13 +43,13 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
43 |
if(!is_multisite()) return $user_or_wp_error;
|
44 |
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if(is_a($user_or_wp_error, "WP_User") && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && !in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user->ID)), TRUE))
|
50 |
$user_or_wp_error = new WP_Error("invalid_username", _x("<strong>ERROR</strong>: Invalid username for this site.", "s2member-front", "s2member"));
|
51 |
|
52 |
-
return apply_filters
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -69,13 +69,13 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
69 |
return $user_or_wp_error; // Simultaneous login monitoring not enabled here.
|
70 |
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
-
do_action
|
73 |
-
unset
|
74 |
|
75 |
if(is_a($user_or_wp_error, "WP_User") && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && c_ws_plugin__s2member_login_checks::get_simultaneous_logins($user->user_login) + 1 > $max)
|
76 |
$user_or_wp_error = new WP_Error("max_simultaneous_logins", sprintf(_x('<strong>ERROR</strong>: Max simultaneous logins for username: %1$s. Please wait %2$s and try again.', "s2member-front", "s2member"), $user->user_login, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_simultaneous_logins_timeout"]));
|
77 |
|
78 |
-
return apply_filters
|
79 |
}
|
80 |
|
81 |
/**
|
@@ -98,8 +98,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
98 |
return; // Simultaneous login monitoring not enabled here.
|
99 |
|
100 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
101 |
-
do_action
|
102 |
-
unset
|
103 |
|
104 |
$user = wp_get_current_user();
|
105 |
$username = $user->user_login; // The username.
|
@@ -123,8 +123,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
123 |
return; // Simultaneous login monitoring not enabled here.
|
124 |
|
125 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
126 |
-
do_action
|
127 |
-
unset
|
128 |
|
129 |
$user = wp_get_current_user();
|
130 |
$username = $user->user_login; // The username.
|
@@ -145,8 +145,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
145 |
if(!$username) return 0; // Nothing to get; should not happen.
|
146 |
|
147 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
148 |
-
do_action
|
149 |
-
unset
|
150 |
|
151 |
$prefix = /* s2Member Transient prefix for all simultaneous login monitoring. */ "s2m_slm_";
|
152 |
$transient_entries = $prefix.md5("s2member_simultaneous_login_entries_for_".strtolower((string)$username));
|
@@ -178,8 +178,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
178 |
if(!$username) return; // Nothing to do; should not happen.
|
179 |
|
180 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
181 |
-
do_action
|
182 |
-
unset
|
183 |
|
184 |
$prefix = /* s2Member Transient prefix for all simultaneous login monitoring. */ "s2m_slm_";
|
185 |
$transient_entries = $prefix.md5("s2member_simultaneous_login_entries_for_".strtolower((string)$username));
|
@@ -201,8 +201,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_checks"))
|
|
201 |
set_transient($transient_entries, $entries, strtotime("+".$timeout) - time());
|
202 |
|
203 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
204 |
-
do_action
|
205 |
-
unset
|
206 |
}
|
207 |
}
|
208 |
}
|
43 |
if(!is_multisite()) return $user_or_wp_error;
|
44 |
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_ms_wp_authenticate_user", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if(is_a($user_or_wp_error, "WP_User") && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && !in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user->ID)), TRUE))
|
50 |
$user_or_wp_error = new WP_Error("invalid_username", _x("<strong>ERROR</strong>: Invalid username for this site.", "s2member-front", "s2member"));
|
51 |
|
52 |
+
return apply_filters("ws_plugin__s2member_ms_wp_authenticate_user", $user_or_wp_error, get_defined_vars ());
|
53 |
}
|
54 |
|
55 |
/**
|
69 |
return $user_or_wp_error; // Simultaneous login monitoring not enabled here.
|
70 |
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
+
do_action("ws_plugin__s2member_before_stop_simultaneous_logins", get_defined_vars ());
|
73 |
+
unset($__refs, $__v);
|
74 |
|
75 |
if(is_a($user_or_wp_error, "WP_User") && ($user = $user_or_wp_error) && $user->ID && !is_super_admin($user->ID) && c_ws_plugin__s2member_login_checks::get_simultaneous_logins($user->user_login) + 1 > $max)
|
76 |
$user_or_wp_error = new WP_Error("max_simultaneous_logins", sprintf(_x('<strong>ERROR</strong>: Max simultaneous logins for username: %1$s. Please wait %2$s and try again.', "s2member-front", "s2member"), $user->user_login, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_simultaneous_logins_timeout"]));
|
77 |
|
78 |
+
return apply_filters("ws_plugin__s2member_stop_simultaneous_logins", $user_or_wp_error, get_defined_vars ());
|
79 |
}
|
80 |
|
81 |
/**
|
98 |
return; // Simultaneous login monitoring not enabled here.
|
99 |
|
100 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
101 |
+
do_action("ws_plugin__s2member_before_monitor_simultaneous_logins", get_defined_vars ());
|
102 |
+
unset($__refs, $__v);
|
103 |
|
104 |
$user = wp_get_current_user();
|
105 |
$username = $user->user_login; // The username.
|
123 |
return; // Simultaneous login monitoring not enabled here.
|
124 |
|
125 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
126 |
+
do_action("ws_plugin__s2member_before_simultaneous_logout", get_defined_vars ());
|
127 |
+
unset($__refs, $__v);
|
128 |
|
129 |
$user = wp_get_current_user();
|
130 |
$username = $user->user_login; // The username.
|
145 |
if(!$username) return 0; // Nothing to get; should not happen.
|
146 |
|
147 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
148 |
+
do_action("ws_plugin__s2member_before_get_simultaneous_logins", get_defined_vars ());
|
149 |
+
unset($__refs, $__v);
|
150 |
|
151 |
$prefix = /* s2Member Transient prefix for all simultaneous login monitoring. */ "s2m_slm_";
|
152 |
$transient_entries = $prefix.md5("s2member_simultaneous_login_entries_for_".strtolower((string)$username));
|
178 |
if(!$username) return; // Nothing to do; should not happen.
|
179 |
|
180 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
181 |
+
do_action("ws_plugin__s2member_before_update_simultaneous_logins", get_defined_vars ());
|
182 |
+
unset($__refs, $__v);
|
183 |
|
184 |
$prefix = /* s2Member Transient prefix for all simultaneous login monitoring. */ "s2m_slm_";
|
185 |
$transient_entries = $prefix.md5("s2member_simultaneous_login_entries_for_".strtolower((string)$username));
|
201 |
set_transient($transient_entries, $entries, strtotime("+".$timeout) - time());
|
202 |
|
203 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
204 |
+
do_action("ws_plugin__s2member_after_update_simultaneous_logins", get_defined_vars ());
|
205 |
+
unset($__refs, $__v);
|
206 |
}
|
207 |
}
|
208 |
}
|
includes/classes/login-customizations.inc.php
CHANGED
@@ -35,8 +35,8 @@ if(!class_exists("c_ws_plugin__s2member_login_customizations"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_filter("login_headerurl");``
|
37 |
*
|
38 |
-
* @param
|
39 |
-
* @return
|
40 |
*/
|
41 |
public static function login_header_url($url = FALSE)
|
42 |
{
|
@@ -57,8 +57,8 @@ if(!class_exists("c_ws_plugin__s2member_login_customizations"))
|
|
57 |
*
|
58 |
* @attaches-to ``add_filter("login_headertitle");``
|
59 |
*
|
60 |
-
* @param
|
61 |
-
* @return
|
62 |
*/
|
63 |
public static function login_header_title($title = FALSE)
|
64 |
{
|
@@ -91,7 +91,7 @@ if(!class_exists("c_ws_plugin__s2member_login_customizations"))
|
|
91 |
|
92 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
93 |
do_action("ws_plugin__s2member_before_login_header_styles", get_defined_vars());
|
94 |
-
unset
|
95 |
|
96 |
$a[] = /* Open style tag, then give Filters a chance below. */ '<style type="text/css">';
|
97 |
$i = apply_filters("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars());
|
@@ -143,7 +143,7 @@ if(!class_exists("c_ws_plugin__s2member_login_customizations"))
|
|
143 |
|
144 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
145 |
do_action("ws_plugin__s2member_during_login_header_styles", get_defined_vars());
|
146 |
-
unset
|
147 |
|
148 |
$a = apply_filters("ws_plugin__s2member_login_header_styles_array", $a, get_defined_vars());
|
149 |
$s .= /* Now put all array elements together. */ "\n".implode("\n", $a)."\n\n";
|
@@ -186,6 +186,39 @@ if(!class_exists("c_ws_plugin__s2member_login_customizations"))
|
|
186 |
|
187 |
return /* Return for uniformity. */;
|
188 |
}
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
}
|
191 |
?>
|
35 |
*
|
36 |
* @attaches-to ``add_filter("login_headerurl");``
|
37 |
*
|
38 |
+
* @param string $url Expects a login header URL passed in by the Filter.
|
39 |
+
* @return string A URL based on s2Member's UI configuration.
|
40 |
*/
|
41 |
public static function login_header_url($url = FALSE)
|
42 |
{
|
57 |
*
|
58 |
* @attaches-to ``add_filter("login_headertitle");``
|
59 |
*
|
60 |
+
* @param string $title Expects a title passed in by the Filter.
|
61 |
+
* @return string A title based on s2Member's UI configuration.
|
62 |
*/
|
63 |
public static function login_header_title($title = FALSE)
|
64 |
{
|
91 |
|
92 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
93 |
do_action("ws_plugin__s2member_before_login_header_styles", get_defined_vars());
|
94 |
+
unset($__refs, $__v);
|
95 |
|
96 |
$a[] = /* Open style tag, then give Filters a chance below. */ '<style type="text/css">';
|
97 |
$i = apply_filters("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars());
|
143 |
|
144 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
145 |
do_action("ws_plugin__s2member_during_login_header_styles", get_defined_vars());
|
146 |
+
unset($__refs, $__v);
|
147 |
|
148 |
$a = apply_filters("ws_plugin__s2member_login_header_styles_array", $a, get_defined_vars());
|
149 |
$s .= /* Now put all array elements together. */ "\n".implode("\n", $a)."\n\n";
|
186 |
|
187 |
return /* Return for uniformity. */;
|
188 |
}
|
189 |
+
/**
|
190 |
+
* Filters the Lost Password URL when the call is made from the /wp-login.php system
|
191 |
+
* and changes the default behavior of wp_lostpassword_url() so that it uses site_url()
|
192 |
+
* instead of network_site_url(), but only if the current $_SERVER['REQUEST_URI'] differs
|
193 |
+
* from the Parent Site URL, as returned by network_site_url(). In a non-multisite
|
194 |
+
* environment, the default WordPress behavior (as of v3.9.1) is used.
|
195 |
+
*
|
196 |
+
* @package s2Member\Login_Customizations
|
197 |
+
* @since 140603
|
198 |
+
*
|
199 |
+
* @attaches-to ``add_filter("lostpassword_url");``
|
200 |
+
*
|
201 |
+
* @param string $lostpassword_url The lost password page URL.
|
202 |
+
* @param string $redirect The path to redirect to on login.
|
203 |
+
*
|
204 |
+
* @return string Lost password URL.
|
205 |
+
*/
|
206 |
+
public static function lost_password_url($lostpassword_url, $redirect)
|
207 |
+
{
|
208 |
+
$scheme = (is_ssl()) ? 'https' : 'http'; // Build a URL that we can compare to site_url() and network_site_url()
|
209 |
+
$url = $scheme.'://'.$_SERVER["HTTP_HOST"].strtok($_SERVER["REQUEST_URI"], '?'); // Request URL minus query vars
|
210 |
+
|
211 |
+
if(basename(strtok($_SERVER['REQUEST_URI'], '?')) === 'wp-login.php'
|
212 |
+
&& strpos($url, (string)network_site_url('wp-login.php')) === FALSE
|
213 |
+
&& apply_filters("ws_plugin__s2member_tweak_lost_password_url", TRUE, get_defined_vars()))
|
214 |
+
{
|
215 |
+
$args = array('action' => 'lostpassword');
|
216 |
+
if(!empty($redirect)) $args['redirect_to'] = $redirect;
|
217 |
+
|
218 |
+
$lostpassword_url = add_query_arg(urlencode_deep($args), site_url('wp-login.php', 'login'));
|
219 |
+
}
|
220 |
+
return apply_filters("ws_plugin__s2member_lost_password_url", $lostpassword_url, $redirect, get_defined_vars());
|
221 |
+
}
|
222 |
+
}
|
223 |
}
|
224 |
?>
|
includes/classes/login-redirects-r.inc.php
CHANGED
@@ -78,17 +78,17 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
|
|
78 |
*/
|
79 |
public static function remove_login_redirect_filters ()
|
80 |
{
|
81 |
-
do_action
|
82 |
|
83 |
-
if (!apply_filters
|
84 |
{
|
85 |
remove_all_filters /* Removes all `login_redirect` Filters. */("login_redirect");
|
86 |
add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_empty_login_redirect_filter");
|
87 |
add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_http_login_redirect_filter");
|
88 |
|
89 |
-
do_action
|
90 |
}
|
91 |
-
do_action
|
92 |
|
93 |
return /* Return for uniformity. */;
|
94 |
}
|
78 |
*/
|
79 |
public static function remove_login_redirect_filters ()
|
80 |
{
|
81 |
+
do_action("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
|
82 |
|
83 |
+
if (!apply_filters("ws_plugin__s2member_allow_other_login_redirect_filters", false, get_defined_vars ()))
|
84 |
{
|
85 |
remove_all_filters /* Removes all `login_redirect` Filters. */("login_redirect");
|
86 |
add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_empty_login_redirect_filter");
|
87 |
add_filter ("login_redirect", "c_ws_plugin__s2member_login_redirects_r::_http_login_redirect_filter");
|
88 |
|
89 |
+
do_action("ws_plugin__s2member_during_remove_login_redirect_filters", get_defined_vars ());
|
90 |
}
|
91 |
+
do_action("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
|
92 |
|
93 |
return /* Return for uniformity. */;
|
94 |
}
|
includes/classes/login-redirects.inc.php
CHANGED
@@ -35,17 +35,17 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_action("wp_login");``
|
37 |
*
|
38 |
-
* @param
|
39 |
* @param WP_User $user Expects a WP_User object instance.
|
40 |
* @return null Or exits script execution after a redirection takes place.
|
41 |
*/
|
42 |
public static function login_redirect ($username = FALSE, $user = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
-
do_action
|
46 |
-
unset
|
47 |
|
48 |
-
if (is_string($username) && $username && is_object ($user) && !empty
|
49 |
{
|
50 |
update_user_option ($user_id, "s2member_last_login_time", time());
|
51 |
|
@@ -59,11 +59,11 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
59 |
delete_user_setting ("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
|
60 |
|
61 |
if (($ok = true) && !is_super_admin ($user_id) && $username !== "demo" // Exclude super admins, the `demo` user, and anyone who can edit posts.
|
62 |
-
&& !apply_filters
|
63 |
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower($username));
|
64 |
|
65 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_always_http"]) // Alter value of `redirect_to`?
|
66 |
-
if(!empty
|
67 |
{
|
68 |
$_REQUEST["redirect_to"] = preg_replace("/^https\:\/\//i", "http://", $_REQUEST["redirect_to"]);
|
69 |
if(stripos($_REQUEST["redirect_to"], "http://") !== 0) // Force an absolute URL in this case.
|
@@ -73,15 +73,15 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
73 |
$_REQUEST["redirect_to"] = $http_home_base.'/'.ltrim($_REQUEST["redirect_to"], '/');
|
74 |
}
|
75 |
}
|
76 |
-
if (($redirect = apply_filters
|
77 |
{
|
78 |
-
$obey_redirect_to = apply_filters
|
79 |
|
80 |
-
if (!$obey_redirect_to || empty
|
81 |
{
|
82 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
83 |
-
do_action
|
84 |
-
unset
|
85 |
|
86 |
if($redirect && is_string ($redirect)) $redirect = $redirect; // Custom?
|
87 |
|
@@ -109,8 +109,8 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
109 |
}
|
110 |
}
|
111 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
112 |
-
do_action
|
113 |
-
unset
|
114 |
|
115 |
return /* Return for uniformity. */;
|
116 |
}
|
@@ -120,20 +120,20 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
120 |
* @package s2Member\Login_Redirects
|
121 |
* @since 3.5
|
122 |
*
|
123 |
-
* @param
|
124 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
|
125 |
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
|
126 |
*/
|
127 |
public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
|
128 |
{
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
-
do_action
|
131 |
-
unset
|
132 |
|
133 |
$url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"];
|
134 |
$url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars ($url, $user, $root_returns_false);
|
135 |
|
136 |
-
return apply_filters
|
137 |
}
|
138 |
/**
|
139 |
* Parses a Special Login Redirection URI.
|
@@ -141,20 +141,20 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
141 |
* @package s2Member\Login_Redirects
|
142 |
* @since 3.5
|
143 |
*
|
144 |
-
* @param
|
145 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URI is reduced to the site root.
|
146 |
* @return str|bool A Special Login Redirection URI with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URI is the site root.
|
147 |
*/
|
148 |
public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
|
149 |
{
|
150 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
151 |
-
do_action
|
152 |
-
unset
|
153 |
|
154 |
if (($url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user, $root_returns_false)))
|
155 |
$uri = c_ws_plugin__s2member_utils_urls::parse_uri ($url);
|
156 |
|
157 |
-
return apply_filters
|
158 |
}
|
159 |
/**
|
160 |
* Fills Replacement Codes in Special Redirection URLs.
|
@@ -162,21 +162,21 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
162 |
* @package s2Member\Login_Redirects
|
163 |
* @since 3.5
|
164 |
*
|
165 |
-
* @param
|
166 |
-
* @param
|
167 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
|
168 |
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
|
169 |
*/
|
170 |
public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
|
171 |
{
|
172 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
173 |
-
do_action
|
174 |
-
unset
|
175 |
|
176 |
$url = /* Force ``$url`` to a string value. */ (string)$url;
|
177 |
$orig_url = /* Record the original URL that was passed in. */ $url;
|
178 |
|
179 |
-
$user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty
|
180 |
|
181 |
$user_id = ($user) ? (string)$user->ID : "";
|
182 |
$user_login = ($user) ? (string)strtolower ($user->user_login) : "";
|
@@ -193,13 +193,13 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
|
|
193 |
$url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $url);
|
194 |
$url = preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_logins), $url);
|
195 |
|
196 |
-
if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url ($url, -1, false)) || (!empty
|
197 |
$url = /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */ site_url ("/");
|
198 |
|
199 |
if ($root_returns_false /* Used by s2Member's security gate. */ && c_ws_plugin__s2member_utils_conds::is_site_root ($url))
|
200 |
$url = /* In case we need to return false on root URLs (i.e. don't protect the Home Page inadvertently). */ false;
|
201 |
|
202 |
-
return apply_filters
|
203 |
}
|
204 |
}
|
205 |
}
|
35 |
*
|
36 |
* @attaches-to ``add_action("wp_login");``
|
37 |
*
|
38 |
+
* @param string $username Expects Username.
|
39 |
* @param WP_User $user Expects a WP_User object instance.
|
40 |
* @return null Or exits script execution after a redirection takes place.
|
41 |
*/
|
42 |
public static function login_redirect ($username = FALSE, $user = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
+
do_action("ws_plugin__s2member_before_login_redirect", get_defined_vars ());
|
46 |
+
unset($__refs, $__v);
|
47 |
|
48 |
+
if (is_string($username) && $username && is_object ($user) && !empty($user->ID) && ($user_id = $user->ID))
|
49 |
{
|
50 |
update_user_option ($user_id, "s2member_last_login_time", time());
|
51 |
|
59 |
delete_user_setting ("default_password_nag") . update_user_option ($user_id, "default_password_nag", false, true);
|
60 |
|
61 |
if (($ok = true) && !is_super_admin ($user_id) && $username !== "demo" // Exclude super admins, the `demo` user, and anyone who can edit posts.
|
62 |
+
&& !apply_filters("ws_plugin__s2member_disable_login_ip_restrictions", (($user->has_cap ("edit_posts")) ? true : false), get_defined_vars ()))
|
63 |
$ok = c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower($username));
|
64 |
|
65 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_always_http"]) // Alter value of `redirect_to`?
|
66 |
+
if(!empty($_REQUEST["redirect_to"]) && is_string ($_REQUEST["redirect_to"]) && strpos($_REQUEST["redirect_to"], "wp-admin") === FALSE)
|
67 |
{
|
68 |
$_REQUEST["redirect_to"] = preg_replace("/^https\:\/\//i", "http://", $_REQUEST["redirect_to"]);
|
69 |
if(stripos($_REQUEST["redirect_to"], "http://") !== 0) // Force an absolute URL in this case.
|
73 |
$_REQUEST["redirect_to"] = $http_home_base.'/'.ltrim($_REQUEST["redirect_to"], '/');
|
74 |
}
|
75 |
}
|
76 |
+
if (($redirect = apply_filters("ws_plugin__s2member_login_redirect", (($user->has_cap ("edit_posts")) ? false : true), get_defined_vars ())))
|
77 |
{
|
78 |
+
$obey_redirect_to = apply_filters("ws_plugin__s2member_obey_login_redirect_to", /* By default, we obey this. */ true, get_defined_vars ());
|
79 |
|
80 |
+
if (!$obey_redirect_to || empty($_REQUEST["redirect_to"]) || !is_string ($_REQUEST["redirect_to"]) || $_REQUEST["redirect_to"] === admin_url () || preg_match ("/^\/?wp-admin\/?$/", $_REQUEST["redirect_to"]))
|
81 |
{
|
82 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
83 |
+
do_action("ws_plugin__s2member_during_login_redirect", get_defined_vars ());
|
84 |
+
unset($__refs, $__v);
|
85 |
|
86 |
if($redirect && is_string ($redirect)) $redirect = $redirect; // Custom?
|
87 |
|
109 |
}
|
110 |
}
|
111 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
112 |
+
do_action("ws_plugin__s2member_after_login_redirect", get_defined_vars ());
|
113 |
+
unset($__refs, $__v);
|
114 |
|
115 |
return /* Return for uniformity. */;
|
116 |
}
|
120 |
* @package s2Member\Login_Redirects
|
121 |
* @since 3.5
|
122 |
*
|
123 |
+
* @param object $user Optional. A WP_User object. Defaults to the current User, if logged-in.
|
124 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
|
125 |
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
|
126 |
*/
|
127 |
public static function login_redirection_url ($user = FALSE, $root_returns_false = FALSE)
|
128 |
{
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
+
do_action("ws_plugin__s2member_before_login_redirection_url", get_defined_vars ());
|
131 |
+
unset($__refs, $__v);
|
132 |
|
133 |
$url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"];
|
134 |
$url = c_ws_plugin__s2member_login_redirects::fill_login_redirect_rc_vars ($url, $user, $root_returns_false);
|
135 |
|
136 |
+
return apply_filters("ws_plugin__s2member_login_redirection_url", $url, get_defined_vars ());
|
137 |
}
|
138 |
/**
|
139 |
* Parses a Special Login Redirection URI.
|
141 |
* @package s2Member\Login_Redirects
|
142 |
* @since 3.5
|
143 |
*
|
144 |
+
* @param object $user Optional. A WP_User object. Defaults to the current User, if logged-in.
|
145 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URI is reduced to the site root.
|
146 |
* @return str|bool A Special Login Redirection URI with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URI is the site root.
|
147 |
*/
|
148 |
public static function login_redirection_uri ($user = FALSE, $root_returns_false = FALSE)
|
149 |
{
|
150 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
151 |
+
do_action("ws_plugin__s2member_before_login_redirection_uri", get_defined_vars ());
|
152 |
+
unset($__refs, $__v);
|
153 |
|
154 |
if (($url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user, $root_returns_false)))
|
155 |
$uri = c_ws_plugin__s2member_utils_urls::parse_uri ($url);
|
156 |
|
157 |
+
return apply_filters("ws_plugin__s2member_login_redirection_uri", ((!empty($uri)) ? $uri : false), get_defined_vars ());
|
158 |
}
|
159 |
/**
|
160 |
* Fills Replacement Codes in Special Redirection URLs.
|
162 |
* @package s2Member\Login_Redirects
|
163 |
* @since 3.5
|
164 |
*
|
165 |
+
* @param string $url A URL with possible Replacement Codes in it.
|
166 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
|
167 |
* @param bool $root_returns_false Defaults to false. True if the function should return false when a URL is reduced to the site root.
|
168 |
* @return str|bool A Special Login Redirection URL with Replacement Codes having been parsed, or false if ``$root_returns_false = true`` and the URL is the site root.
|
169 |
*/
|
170 |
public static function fill_login_redirect_rc_vars ($url = FALSE, $user = FALSE, $root_returns_false = FALSE)
|
171 |
{
|
172 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
173 |
+
do_action("ws_plugin__s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
|
174 |
+
unset($__refs, $__v);
|
175 |
|
176 |
$url = /* Force ``$url`` to a string value. */ (string)$url;
|
177 |
$orig_url = /* Record the original URL that was passed in. */ $url;
|
178 |
|
179 |
+
$user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty($user->ID)) ? $user : false;
|
180 |
|
181 |
$user_id = ($user) ? (string)$user->ID : "";
|
182 |
$user_login = ($user) ? (string)strtolower ($user->user_login) : "";
|
193 |
$url = preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $url);
|
194 |
$url = preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_logins), $url);
|
195 |
|
196 |
+
if ( /* Only if s2Member's fault » */$url !== $orig_url && (!($parse = c_ws_plugin__s2member_utils_urls::parse_url ($url, -1, false)) || (!empty($parse["path"]) && strpos ($parse["path"], "//") !== false)))
|
197 |
$url = /* Defaults to Home Page. We don't return invalid URLs produced by empty Replacement Codes ( i.e. with `//` ). */ site_url ("/");
|
198 |
|
199 |
if ($root_returns_false /* Used by s2Member's security gate. */ && c_ws_plugin__s2member_utils_conds::is_site_root ($url))
|
200 |
$url = /* In case we need to return false on root URLs (i.e. don't protect the Home Page inadvertently). */ false;
|
201 |
|
202 |
+
return apply_filters("ws_plugin__s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
|
203 |
}
|
204 |
}
|
205 |
}
|
includes/classes/menu-pages-rs.inc.php
CHANGED
@@ -37,7 +37,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages_rs"))
|
|
37 |
*/
|
38 |
public static function display ()
|
39 |
{
|
40 |
-
do_action
|
41 |
|
42 |
ob_start(); // output buffer these so we can display a toggler conditionally.
|
43 |
|
@@ -96,7 +96,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages_rs"))
|
|
96 |
((!empty($_GET['page']) && preg_match('/\-(?:start|info)$/', $_GET['page'])) ? ' default-state="open"' : '').'></div>' . "\n".$rs;
|
97 |
echo $rs; // output content now; w/ possible toggler.
|
98 |
}
|
99 |
-
do_action
|
100 |
|
101 |
return /* return for uniformity. */;
|
102 |
}
|
37 |
*/
|
38 |
public static function display ()
|
39 |
{
|
40 |
+
do_action("ws_plugin__s2member_during_menu_pages_before_right_sections", get_defined_vars ());
|
41 |
|
42 |
ob_start(); // output buffer these so we can display a toggler conditionally.
|
43 |
|
96 |
((!empty($_GET['page']) && preg_match('/\-(?:start|info)$/', $_GET['page'])) ? ' default-state="open"' : '').'></div>' . "\n".$rs;
|
97 |
echo $rs; // output content now; w/ possible toggler.
|
98 |
}
|
99 |
+
do_action("ws_plugin__s2member_during_menu_pages_after_right_sections", get_defined_vars ());
|
100 |
|
101 |
return /* return for uniformity. */;
|
102 |
}
|
includes/classes/menu-pages-tb.inc.php
CHANGED
@@ -37,7 +37,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages_tb"))
|
|
37 |
*/
|
38 |
public static function display ()
|
39 |
{
|
40 |
-
do_action
|
41 |
|
42 |
ob_start(); // output buffer these so we can display a toggler conditionally.
|
43 |
|
@@ -74,7 +74,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages_tb"))
|
|
74 |
$links = '<div class="links">'.$links.'</div>';
|
75 |
echo $links; // output content now; w/ possible toggler.
|
76 |
}
|
77 |
-
do_action
|
78 |
|
79 |
return /* return for uniformity. */;
|
80 |
}
|
37 |
*/
|
38 |
public static function display ()
|
39 |
{
|
40 |
+
do_action("ws_plugin__s2member_during_menu_pages_before_toolbox_sections", get_defined_vars ());
|
41 |
|
42 |
ob_start(); // output buffer these so we can display a toggler conditionally.
|
43 |
|
74 |
$links = '<div class="links">'.$links.'</div>';
|
75 |
echo $links; // output content now; w/ possible toggler.
|
76 |
}
|
77 |
+
do_action("ws_plugin__s2member_during_menu_pages_after_toolbox_sections", get_defined_vars ());
|
78 |
|
79 |
return /* return for uniformity. */;
|
80 |
}
|
includes/classes/menu-pages.inc.php
CHANGED
@@ -59,7 +59,7 @@ if(!class_exists("c_ws_plugin__s2member_menu_pages"))
|
|
59 |
|
60 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
61 |
do_action("ws_plugin__s2member_before_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
62 |
-
unset
|
63 |
|
64 |
if($verified || (!empty($_POST["ws_plugin__s2member_options_save"]) && ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-options-save")))
|
65 |
{
|
@@ -81,7 +81,7 @@ if(!class_exists("c_ws_plugin__s2member_menu_pages"))
|
|
81 |
|
82 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
83 |
do_action("ws_plugin__s2member_during_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
84 |
-
unset
|
85 |
|
86 |
$options = ws_plugin__s2member_configure_options_and_their_defaults(($options = array_merge($options, array("options_version" => (string)($options["options_version"] + 0.001)))));
|
87 |
update_option("ws_plugin__s2member_options", $options).((is_multisite() && is_main_site()) ? update_site_option("ws_plugin__s2member_options", $options) : null).update_option("ws_plugin__s2member_cache", array());
|
@@ -120,7 +120,7 @@ if(!class_exists("c_ws_plugin__s2member_menu_pages"))
|
|
120 |
|
121 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
122 |
do_action("ws_plugin__s2member_after_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
123 |
-
unset
|
124 |
|
125 |
return apply_filters("ws_plugin__s2member_update_all_options", (($updated_all_options) ? true : false), get_defined_vars());
|
126 |
}
|
@@ -262,14 +262,14 @@ if(!class_exists("c_ws_plugin__s2member_menu_pages"))
|
|
262 |
* @attaches-to ``add_filter("plugin_action_links");``
|
263 |
*
|
264 |
* @param array $actions Expects an existing array of actions links, passed in by the Filter.
|
265 |
-
* @param
|
266 |
* @return array An array of links, Filtered by this routine.
|
267 |
*/
|
268 |
public static function _add_settings_link($actions = FALSE, $plugin_file = FALSE)
|
269 |
{
|
270 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
271 |
do_action("_ws_plugin__s2member_before_add_settings_link", get_defined_vars());
|
272 |
-
unset
|
273 |
|
274 |
if($plugin_file === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"] && is_array($actions))
|
275 |
{
|
@@ -278,7 +278,7 @@ if(!class_exists("c_ws_plugin__s2member_menu_pages"))
|
|
278 |
|
279 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
280 |
do_action("_ws_plugin__s2member_during_add_settings_link", get_defined_vars());
|
281 |
-
unset
|
282 |
}
|
283 |
|
284 |
return apply_filters("_ws_plugin__s2member_add_settings_link", $actions, get_defined_vars());
|
59 |
|
60 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
61 |
do_action("ws_plugin__s2member_before_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
62 |
+
unset($__refs, $__v);
|
63 |
|
64 |
if($verified || (!empty($_POST["ws_plugin__s2member_options_save"]) && ($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce($nonce, "ws-plugin--s2member-options-save")))
|
65 |
{
|
81 |
|
82 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
83 |
do_action("ws_plugin__s2member_during_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
84 |
+
unset($__refs, $__v);
|
85 |
|
86 |
$options = ws_plugin__s2member_configure_options_and_their_defaults(($options = array_merge($options, array("options_version" => (string)($options["options_version"] + 0.001)))));
|
87 |
update_option("ws_plugin__s2member_options", $options).((is_multisite() && is_main_site()) ? update_site_option("ws_plugin__s2member_options", $options) : null).update_option("ws_plugin__s2member_cache", array());
|
120 |
|
121 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
122 |
do_action("ws_plugin__s2member_after_update_all_options", get_defined_vars()); // If you use this Hook, be sure to use ``wp_verify_nonce()``.
|
123 |
+
unset($__refs, $__v);
|
124 |
|
125 |
return apply_filters("ws_plugin__s2member_update_all_options", (($updated_all_options) ? true : false), get_defined_vars());
|
126 |
}
|
262 |
* @attaches-to ``add_filter("plugin_action_links");``
|
263 |
*
|
264 |
* @param array $actions Expects an existing array of actions links, passed in by the Filter.
|
265 |
+
* @param string $plugin_file Expects path to a plugin file. We need to test against this for s2Member.
|
266 |
* @return array An array of links, Filtered by this routine.
|
267 |
*/
|
268 |
public static function _add_settings_link($actions = FALSE, $plugin_file = FALSE)
|
269 |
{
|
270 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
271 |
do_action("_ws_plugin__s2member_before_add_settings_link", get_defined_vars());
|
272 |
+
unset($__refs, $__v);
|
273 |
|
274 |
if($plugin_file === $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["plugin_basename"] && is_array($actions))
|
275 |
{
|
278 |
|
279 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
280 |
do_action("_ws_plugin__s2member_during_add_settings_link", get_defined_vars());
|
281 |
+
unset($__refs, $__v);
|
282 |
}
|
283 |
|
284 |
return apply_filters("_ws_plugin__s2member_add_settings_link", $actions, get_defined_vars());
|
includes/classes/meta-box-saves.inc.php
CHANGED
@@ -35,17 +35,17 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_action("save_post");``
|
37 |
*
|
38 |
-
* @param int|
|
39 |
* @return null
|
40 |
*/
|
41 |
public static function save_meta_boxes ($post_id = FALSE)
|
42 |
{
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action
|
45 |
-
unset
|
46 |
|
47 |
-
if ($post_id && !empty
|
48 |
-
if (!empty
|
49 |
// We do NOT process historical revisions here; because it causes confusion in the General Options panel for s2Member.
|
50 |
{
|
51 |
$_p = /* Clean and create a local copy. */ c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
|
@@ -66,18 +66,18 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
|
|
66 |
if (($i = array_search ($page_id, $pages[$n])) !== false)
|
67 |
unset($pages[$n][$i]);
|
68 |
|
69 |
-
if (isset ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array
|
70 |
-
if ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array
|
71 |
array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], (string)$page_id);
|
72 |
|
73 |
-
for ($n = 0, $new_options = array
|
74 |
-
$new_options = array_merge ($new_options, array
|
75 |
|
76 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
77 |
-
do_action
|
78 |
-
unset
|
79 |
|
80 |
-
c_ws_plugin__s2member_menu_pages::update_all_options ($new_options, true, false, array
|
81 |
}
|
82 |
}
|
83 |
|
@@ -92,18 +92,18 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
|
|
92 |
if (($i = array_search ($post_id, $posts[$n])) !== false)
|
93 |
unset($posts[$n][$i]);
|
94 |
|
95 |
-
if (isset ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array
|
96 |
-
if ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array
|
97 |
array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], (string)$post_id);
|
98 |
|
99 |
-
for ($n = 0, $new_options = array
|
100 |
-
$new_options = array_merge ($new_options, array
|
101 |
|
102 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
103 |
-
do_action
|
104 |
-
unset
|
105 |
|
106 |
-
c_ws_plugin__s2member_menu_pages::update_all_options ($new_options, true, false, array
|
107 |
}
|
108 |
}
|
109 |
|
@@ -139,7 +139,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
|
|
139 |
}
|
140 |
}
|
141 |
|
142 |
-
do_action
|
143 |
|
144 |
return /* Return for uniformity. */;
|
145 |
}
|
35 |
*
|
36 |
* @attaches-to ``add_action("save_post");``
|
37 |
*
|
38 |
+
* @param int|string $post_id Numeric Post/Page ID.
|
39 |
* @return null
|
40 |
*/
|
41 |
public static function save_meta_boxes ($post_id = FALSE)
|
42 |
{
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
+
do_action("ws_plugin__s2member_before_save_meta_boxes", get_defined_vars ());
|
45 |
+
unset($__refs, $__v);
|
46 |
|
47 |
+
if ($post_id && !empty($_POST["ws_plugin__s2member_security_meta_box_save"]) && ($nonce = $_POST["ws_plugin__s2member_security_meta_box_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-security-meta-box-save"))
|
48 |
+
if (!empty($_POST["ws_plugin__s2member_security_meta_box_save_id"]) && $post_id == $_POST["ws_plugin__s2member_security_meta_box_save_id"] && !empty($_POST["post_type"]))
|
49 |
// We do NOT process historical revisions here; because it causes confusion in the General Options panel for s2Member.
|
50 |
{
|
51 |
$_p = /* Clean and create a local copy. */ c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST));
|
66 |
if (($i = array_search ($page_id, $pages[$n])) !== false)
|
67 |
unset($pages[$n][$i]);
|
68 |
|
69 |
+
if (isset ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array($pages[$_p["ws_plugin__s2member_security_meta_box_level"]]))
|
70 |
+
if ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array("all") && !in_array("all-page", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && !in_array("all-pages", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
|
71 |
array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], (string)$page_id);
|
72 |
|
73 |
+
for ($n = 0, $new_options = array(); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
74 |
+
$new_options = array_merge ($new_options, array("ws_plugin__s2member_level" . $n . "_pages" => trim (implode (",", $pages[$n]))));
|
75 |
|
76 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
77 |
+
do_action("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
|
78 |
+
unset($__refs, $__v);
|
79 |
|
80 |
+
c_ws_plugin__s2member_menu_pages::update_all_options ($new_options, true, false, array("page-conflict-warnings"), true);
|
81 |
}
|
82 |
}
|
83 |
|
92 |
if (($i = array_search ($post_id, $posts[$n])) !== false)
|
93 |
unset($posts[$n][$i]);
|
94 |
|
95 |
+
if (isset ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && is_array($posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
|
96 |
+
if ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array("all") && !in_array("all-" . $_p["post_type"], $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]) && !in_array("all-" . $_p["post_type"] . "s", $posts[$_p["ws_plugin__s2member_security_meta_box_level"]]))
|
97 |
array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], (string)$post_id);
|
98 |
|
99 |
+
for ($n = 0, $new_options = array(); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
100 |
+
$new_options = array_merge ($new_options, array("ws_plugin__s2member_level" . $n . "_posts" => trim (implode (",", $posts[$n]))));
|
101 |
|
102 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
103 |
+
do_action("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
|
104 |
+
unset($__refs, $__v);
|
105 |
|
106 |
+
c_ws_plugin__s2member_menu_pages::update_all_options ($new_options, true, false, array("page-conflict-warnings"), true);
|
107 |
}
|
108 |
}
|
109 |
|
139 |
}
|
140 |
}
|
141 |
|
142 |
+
do_action("ws_plugin__s2member_after_save_meta_boxes", get_defined_vars ());
|
143 |
|
144 |
return /* Return for uniformity. */;
|
145 |
}
|
includes/classes/meta-box-security.inc.php
CHANGED
@@ -33,14 +33,14 @@ if(!class_exists("c_ws_plugin__s2member_meta_box_security"))
|
|
33 |
* @package s2Member\Meta_Boxes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
* @return null
|
38 |
*/
|
39 |
public static function security_meta_box($post = FALSE)
|
40 |
{
|
41 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
42 |
do_action("ws_plugin__s2member_before_security_meta_box", get_defined_vars());
|
43 |
-
unset
|
44 |
|
45 |
if(is_object($post) && ($post_id = $post->ID) && (($post->post_type === "page" && current_user_can("edit_page", $post_id)) || current_user_can("edit_post", $post_id)))
|
46 |
{
|
33 |
* @package s2Member\Meta_Boxes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param object $post Post/Page object.
|
37 |
* @return null
|
38 |
*/
|
39 |
public static function security_meta_box($post = FALSE)
|
40 |
{
|
41 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
42 |
do_action("ws_plugin__s2member_before_security_meta_box", get_defined_vars());
|
43 |
+
unset($__refs, $__v);
|
44 |
|
45 |
if(is_object($post) && ($post_id = $post->ID) && (($post->post_type === "page" && current_user_can("edit_page", $post_id)) || current_user_can("edit_post", $post_id)))
|
46 |
{
|
includes/classes/meta-boxes.inc.php
CHANGED
@@ -31,27 +31,27 @@ if (!class_exists ("c_ws_plugin__s2member_meta_boxes"))
|
|
31 |
* Adds meta boxes to Post/Page editing stations.
|
32 |
*
|
33 |
* Note: WordPress also calls this Hook with ``$type`` set to: `link` and `comment`. Possibly others.
|
34 |
-
* Thus, the need for: ``in_array
|
35 |
*
|
36 |
* @package s2Member\Meta_Boxes
|
37 |
* @since 3.5
|
38 |
*
|
39 |
* @attaches-to ``add_action("add_meta_boxes");``
|
40 |
*
|
41 |
-
* @param
|
42 |
* @return null
|
43 |
*/
|
44 |
public static function add_meta_boxes ($type = FALSE)
|
45 |
{
|
46 |
-
do_action
|
47 |
|
48 |
-
$excluded_types = array
|
49 |
-
$excluded_types = apply_filters
|
50 |
|
51 |
-
if (in_array
|
52 |
add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
|
53 |
|
54 |
-
do_action
|
55 |
|
56 |
return /* Return for uniformity. */;
|
57 |
}
|
31 |
* Adds meta boxes to Post/Page editing stations.
|
32 |
*
|
33 |
* Note: WordPress also calls this Hook with ``$type`` set to: `link` and `comment`. Possibly others.
|
34 |
+
* Thus, the need for: ``in_array($type, array_keys (get_post_types ()))``.
|
35 |
*
|
36 |
* @package s2Member\Meta_Boxes
|
37 |
* @since 3.5
|
38 |
*
|
39 |
* @attaches-to ``add_action("add_meta_boxes");``
|
40 |
*
|
41 |
+
* @param string $type String indicating type of Post, or another classification *( i.e. `nav_menu_item` )*.
|
42 |
* @return null
|
43 |
*/
|
44 |
public static function add_meta_boxes ($type = FALSE)
|
45 |
{
|
46 |
+
do_action("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
|
47 |
|
48 |
+
$excluded_types = array("link", "comment", "revision", "attachment", "nav_menu_item", "snippet", "redirect");
|
49 |
+
$excluded_types = apply_filters("ws_plugin__s2member_add_meta_boxes_excluded_types", $excluded_types, get_defined_vars ());
|
50 |
|
51 |
+
if (in_array($type, array_keys (get_post_types ())) && !in_array($type, $excluded_types))
|
52 |
add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
|
53 |
|
54 |
+
do_action("ws_plugin__s2member_after_add_meta_boxes", get_defined_vars ());
|
55 |
|
56 |
return /* Return for uniformity. */;
|
57 |
}
|
includes/classes/mms-patches.inc.php
CHANGED
@@ -35,22 +35,22 @@ if (!class_exists ("c_ws_plugin__s2member_mms_patches"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_filter("update_feedback");``
|
37 |
*
|
38 |
-
* @param
|
39 |
-
* @return
|
40 |
*/
|
41 |
public static function sync_mms_patches ($message = FALSE)
|
42 |
{
|
43 |
global $pagenow; // Need access to this global var.
|
44 |
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (is_multisite () && is_network_admin () && $pagenow === "update-core.php")
|
50 |
if ($message === "Upgrading database…" && c_ws_plugin__s2member_mms_patches::mms_patches ())
|
51 |
-
apply_filters
|
52 |
|
53 |
-
return apply_filters
|
54 |
}
|
55 |
/**
|
56 |
* Handles patches on a Multisite Network installation.
|
@@ -64,13 +64,13 @@ if (!class_exists ("c_ws_plugin__s2member_mms_patches"))
|
|
64 |
public static function mms_patches ($display_notices = FALSE)
|
65 |
{
|
66 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
67 |
-
do_action
|
68 |
-
unset
|
69 |
|
70 |
if (is_multisite () && is_admin () && is_main_site () && $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"])
|
71 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_auto_patch"] && (!defined ("DISALLOW_FILE_MODS") || !DISALLOW_FILE_MODS))
|
72 |
{
|
73 |
-
do_action
|
74 |
|
75 |
$wp_login_file = ABSPATH . "wp-login.php"; // This works for WordPress 3.0, 3.1, all the way up to 3.7. WordPress 3.1+ uses: `site_url('wp-signup.php')`. WordPress 3.5+ uses: `network_site_url('wp-signup.php')`. WordPress v3.7 uses `$sign_up_url`.
|
76 |
$wp_login_section = "/(\s+)(wp_redirect( *?)\(( *?)apply_filters( *?)\(( *?)['\"]wp_signup_location['\"]( *?),( *?)(site_url( *?)\(( *?)['\"]wp-signup\.php['\"]( *?)\)|network_site_url( *?)\(( *?)['\"]wp-signup\.php['\"]( *?)\)|get_bloginfo( *?)\(['\"]wpurl['\"]\)( *?)\.( *?)['\"]\/wp-signup\.php['\"]|\\\$sign_?up_url)( *?)\)( *?)\)( *?);)(\s+)(exit( *?);)/";
|
@@ -138,12 +138,12 @@ if (!class_exists ("c_ws_plugin__s2member_mms_patches"))
|
|
138 |
|
139 |
$ran_mms_patches = true; // Flag indicating this routine was indeed processed.
|
140 |
|
141 |
-
do_action
|
142 |
}
|
143 |
|
144 |
-
do_action
|
145 |
|
146 |
-
return !empty
|
147 |
}
|
148 |
}
|
149 |
}
|
35 |
*
|
36 |
* @attaches-to ``add_filter("update_feedback");``
|
37 |
*
|
38 |
+
* @param string $message Expects message string passed through by the Filter.
|
39 |
+
* @return string Message after having been Filtered by this routine.
|
40 |
*/
|
41 |
public static function sync_mms_patches ($message = FALSE)
|
42 |
{
|
43 |
global $pagenow; // Need access to this global var.
|
44 |
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_sync_mms_patches", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (is_multisite () && is_network_admin () && $pagenow === "update-core.php")
|
50 |
if ($message === "Upgrading database…" && c_ws_plugin__s2member_mms_patches::mms_patches ())
|
51 |
+
apply_filters("update_feedback", "s2 Multisite patches applied…");
|
52 |
|
53 |
+
return apply_filters("ws_plugin__s2member_sync_mms_patches", $message, get_defined_vars ());
|
54 |
}
|
55 |
/**
|
56 |
* Handles patches on a Multisite Network installation.
|
64 |
public static function mms_patches ($display_notices = FALSE)
|
65 |
{
|
66 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
67 |
+
do_action("ws_plugin__s2member_before_mms_patches", get_defined_vars ());
|
68 |
+
unset($__refs, $__v);
|
69 |
|
70 |
if (is_multisite () && is_admin () && is_main_site () && $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"])
|
71 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_auto_patch"] && (!defined ("DISALLOW_FILE_MODS") || !DISALLOW_FILE_MODS))
|
72 |
{
|
73 |
+
do_action("ws_plugin__s2member_during_mms_patches_before", get_defined_vars ());
|
74 |
|
75 |
$wp_login_file = ABSPATH . "wp-login.php"; // This works for WordPress 3.0, 3.1, all the way up to 3.7. WordPress 3.1+ uses: `site_url('wp-signup.php')`. WordPress 3.5+ uses: `network_site_url('wp-signup.php')`. WordPress v3.7 uses `$sign_up_url`.
|
76 |
$wp_login_section = "/(\s+)(wp_redirect( *?)\(( *?)apply_filters( *?)\(( *?)['\"]wp_signup_location['\"]( *?),( *?)(site_url( *?)\(( *?)['\"]wp-signup\.php['\"]( *?)\)|network_site_url( *?)\(( *?)['\"]wp-signup\.php['\"]( *?)\)|get_bloginfo( *?)\(['\"]wpurl['\"]\)( *?)\.( *?)['\"]\/wp-signup\.php['\"]|\\\$sign_?up_url)( *?)\)( *?)\)( *?);)(\s+)(exit( *?);)/";
|
138 |
|
139 |
$ran_mms_patches = true; // Flag indicating this routine was indeed processed.
|
140 |
|
141 |
+
do_action("ws_plugin__s2member_during_mms_patches_after", get_defined_vars ());
|
142 |
}
|
143 |
|
144 |
+
do_action("ws_plugin__s2member_after_mms_patches", get_defined_vars ());
|
145 |
|
146 |
+
return !empty($ran_mms_patches) ? $ran_mms_patches : false;
|
147 |
}
|
148 |
}
|
149 |
}
|
includes/classes/mo-page-in.inc.php
CHANGED
@@ -48,7 +48,7 @@ if(!class_exists("c_ws_plugin__s2member_mo_page_in"))
|
|
48 |
{
|
49 |
do_action("ws_plugin__s2member_before_membership_options_page", get_defined_vars());
|
50 |
|
51 |
-
if(!empty
|
52 |
{
|
53 |
$args = array(); // Initialize this to an empty array value.
|
54 |
|
@@ -72,12 +72,12 @@ if(!class_exists("c_ws_plugin__s2member_mo_page_in"))
|
|
72 |
* @package s2Member\Membership_Options_Page
|
73 |
* @since 111101
|
74 |
*
|
75 |
-
* @param
|
76 |
-
* @param
|
77 |
-
* @param
|
78 |
-
* @param
|
79 |
-
* @param
|
80 |
-
* @param
|
81 |
* One of: `post|page|catg|ptag|file|ruri|ccap|sp|sys`.
|
82 |
* Defaults to ``$seeking_type``.
|
83 |
*
|
48 |
{
|
49 |
do_action("ws_plugin__s2member_before_membership_options_page", get_defined_vars());
|
50 |
|
51 |
+
if(!empty($_GET["s2member_membership_options_page"]) && is_array($_g = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_GET))))
|
52 |
{
|
53 |
$args = array(); // Initialize this to an empty array value.
|
54 |
|
72 |
* @package s2Member\Membership_Options_Page
|
73 |
* @since 111101
|
74 |
*
|
75 |
+
* @param string $seeking_type Seeking content type. One of: `post|page|catg|ptag|file|ruri`.
|
76 |
+
* @param string|int $seeking_type_value Seeking content type data. String, or a Post/Page ID.
|
77 |
+
* @param string $req_type Access requirement type. One of these values: `level|ccap|sp`.
|
78 |
+
* @param string|int $req_type_value Access requirement. String, or a Post/Page ID.
|
79 |
+
* @param string $seeking_uri The full URI that access was attempted on.
|
80 |
+
* @param string $res_type Restriction type that's preventing access.
|
81 |
* One of: `post|page|catg|ptag|file|ruri|ccap|sp|sys`.
|
82 |
* Defaults to ``$seeking_type``.
|
83 |
*
|
includes/classes/mo-page.inc.php
CHANGED
@@ -42,7 +42,7 @@ if(!class_exists("c_ws_plugin__s2member_mo_page"))
|
|
42 |
*/
|
43 |
public static function membership_options_page()
|
44 |
{
|
45 |
-
if(!empty
|
46 |
{
|
47 |
return c_ws_plugin__s2member_mo_page_in::membership_options_page();
|
48 |
}
|
@@ -54,12 +54,12 @@ if(!class_exists("c_ws_plugin__s2member_mo_page"))
|
|
54 |
* @package s2Member\Membership_Options_Page
|
55 |
* @since 111101
|
56 |
*
|
57 |
-
* @param
|
58 |
-
* @param
|
59 |
-
* @param
|
60 |
-
* @param
|
61 |
-
* @param
|
62 |
-
* @param
|
63 |
* One of: `post|page|catg|ptag|file|ruri|ccap|sp|sys`.
|
64 |
* Defaults to ``$seeking_type``.
|
65 |
*
|
42 |
*/
|
43 |
public static function membership_options_page()
|
44 |
{
|
45 |
+
if(!empty($_GET["s2member_membership_options_page"]))
|
46 |
{
|
47 |
return c_ws_plugin__s2member_mo_page_in::membership_options_page();
|
48 |
}
|
54 |
* @package s2Member\Membership_Options_Page
|
55 |
* @since 111101
|
56 |
*
|
57 |
+
* @param string $seeking_type Seeking content type. One of: `post|page|catg|ptag|file|ruri`.
|
58 |
+
* @param string|int $seeking_type_value Seeking content type data. String, or a Post/Page ID.
|
59 |
+
* @param string $req_type Access requirement type. One of these values: `level|ccap|sp`.
|
60 |
+
* @param string|int $req_type_value Access requirement. String, or a Post/Page ID.
|
61 |
+
* @param string $seeking_uri The full URI that access was attempted on.
|
62 |
+
* @param string $res_type Restriction type that's preventing access.
|
63 |
* One of: `post|page|catg|ptag|file|ruri|ccap|sp|sys`.
|
64 |
* Defaults to ``$seeking_type``.
|
65 |
*
|
includes/classes/no-cache.inc.php
CHANGED
@@ -1,198 +1,205 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* No-cache routines.
|
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\No_Cache
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
/**
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
/**
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
*/
|
51 |
-
public static function no_cache ($no_cache = FALSE)
|
52 |
-
{
|
53 |
-
do_action ("ws_plugin__s2member_before_no_cache", get_defined_vars ());
|
54 |
-
|
55 |
-
c_ws_plugin__s2member_no_cache::no_cache_constants ($no_cache) . c_ws_plugin__s2member_no_cache::no_cache_headers ($no_cache);
|
56 |
-
|
57 |
-
do_action ("ws_plugin__s2member_after_no_cache", get_defined_vars ());
|
58 |
-
|
59 |
-
return true; // Always return true.
|
60 |
-
}
|
61 |
/**
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
* However, this routine will ALWAYS obey the `?qcAC` query string parameter.
|
73 |
-
* This Quick Cache parameter explicitly allows caching to occur.
|
74 |
-
*
|
75 |
-
* @package s2Member\No_Cache
|
76 |
-
* @since 3.5
|
77 |
-
*
|
78 |
-
* @also-called-by Other routines within s2Member.
|
79 |
-
*
|
80 |
-
* @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible.
|
81 |
-
* @return bool This function will always return `true`.
|
82 |
-
*/
|
83 |
-
public static function no_cache_constants ($no_cache = FALSE)
|
84 |
-
{
|
85 |
-
static $once; // We only need to set these constants once.
|
86 |
-
|
87 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
88 |
-
do_action ("ws_plugin__s2member_before_no_cache_constants", get_defined_vars ());
|
89 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
90 |
-
|
91 |
-
if (!$once && empty ($_GET["qcAC"]) && ($no_cache
|
92 |
-
|| (is_user_logged_in () && (!defined("QUICK_CACHE_WHEN_LOGGED_IN") || !QUICK_CACHE_WHEN_LOGGED_IN))
|
93 |
-
|| c_ws_plugin__s2member_systematics::is_s2_systematic_use_page ()))
|
94 |
-
{
|
95 |
-
/**
|
96 |
-
* No-cache DB queries for plugins.
|
97 |
-
*
|
98 |
-
* @package s2Member\No_Cache
|
99 |
-
* @since 111115
|
100 |
-
*
|
101 |
-
* @var bool
|
102 |
-
*/
|
103 |
-
if (!defined ("DONOTCACHEDB"))
|
104 |
-
define ("DONOTCACHEDB", true);
|
105 |
-
/**
|
106 |
-
* No-cache Page for plugins.
|
107 |
-
*
|
108 |
-
* @package s2Member\No_Cache
|
109 |
-
* @since 3.5
|
110 |
-
*
|
111 |
-
* @var bool
|
112 |
-
*/
|
113 |
-
if (!defined ("DONOTCACHEPAGE"))
|
114 |
-
define ("DONOTCACHEPAGE", true);
|
115 |
-
/**
|
116 |
-
* No-cache Objects for plugins.
|
117 |
-
*
|
118 |
-
* @package s2Member\No_Cache
|
119 |
-
* @since 111115
|
120 |
-
*
|
121 |
-
* @var bool
|
122 |
-
*/
|
123 |
-
if (!defined ("DONOTCACHEOBJECT"))
|
124 |
-
define ("DONOTCACHEOBJECT", true);
|
125 |
-
/**
|
126 |
-
* No-cache anything for Quick Cache plugin.
|
127 |
-
*
|
128 |
-
* @package s2Member\No_Cache
|
129 |
-
* @since 3.5
|
130 |
-
*
|
131 |
-
* @var bool
|
132 |
-
*/
|
133 |
-
if (!defined ("QUICK_CACHE_ALLOWED"))
|
134 |
-
define ("QUICK_CACHE_ALLOWED", false);
|
135 |
-
|
136 |
-
$once = true; // Only need to set these constants one time.
|
137 |
-
|
138 |
-
c_ws_plugin__s2member_no_cache::$headers = /* Headers required too. */ true;
|
139 |
-
|
140 |
-
do_action ("ws_plugin__s2member_during_no_cache_constants", get_defined_vars ());
|
141 |
-
}
|
142 |
-
|
143 |
-
do_action ("ws_plugin__s2member_after_no_cache_constants", get_defined_vars ());
|
144 |
-
|
145 |
-
return true; // Always return true.
|
146 |
-
}
|
147 |
/**
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
* @return bool This function will always return `true`.
|
164 |
-
*/
|
165 |
-
public static function no_cache_headers ($no_cache = FALSE)
|
166 |
-
{
|
167 |
-
static $once; // We only need to set these headers one time.
|
168 |
-
|
169 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
170 |
-
do_action ("ws_plugin__s2member_before_no_cache_headers", get_defined_vars ());
|
171 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
172 |
-
|
173 |
-
$using_selective_behavior = /* Off by default. */ apply_filters ("ws_plugin__s2member_no_cache_headers_selective", false, get_defined_vars ());
|
174 |
-
|
175 |
-
if (!$once && !headers_sent () && empty ($_GET["qcABC"]) && ($no_cache || !$using_selective_behavior || c_ws_plugin__s2member_no_cache::$headers))
|
176 |
-
if ( /* Give Filters a chance. */!apply_filters ("ws_plugin__s2member_disable_no_cache_headers", false, get_defined_vars ()))
|
177 |
-
{
|
178 |
-
foreach (headers_list () as $header) // No-cache headers already sent? We need to check here.
|
179 |
-
if (stripos ($header, "no-cache") !== false) // No-cache headers already sent?
|
180 |
-
{
|
181 |
-
$no_cache_headers_already_sent = true; // Yep, sent.
|
182 |
-
break; // Break now, no need to continue further.
|
183 |
-
}
|
184 |
-
if (!isset ($no_cache_headers_already_sent)) // Not yet?
|
185 |
-
nocache_headers (); // Only if NOT already sent.
|
186 |
-
|
187 |
-
$once = true; // This is static var. Only send headers once.
|
188 |
-
|
189 |
-
do_action ("ws_plugin__s2member_during_no_cache_headers", get_defined_vars ());
|
190 |
-
}
|
191 |
-
|
192 |
-
do_action ("ws_plugin__s2member_after_no_cache_headers", get_defined_vars ());
|
193 |
-
|
194 |
-
return true; // Always return true.
|
195 |
-
}
|
196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
}
|
198 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* No-cache routines.
|
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\No_Cache
|
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_no_cache'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* No-cache routines.
|
24 |
+
*
|
25 |
+
* @package s2Member\No_Cache
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_no_cache
|
29 |
{
|
30 |
/**
|
31 |
+
* No-cache headers required?
|
32 |
+
*
|
33 |
+
* @package s2Member\No_Cache
|
34 |
+
* @since 111115
|
35 |
+
*
|
36 |
+
* @var null|bool
|
37 |
+
*/
|
38 |
+
public static $headers;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Handles no-cache constants, and no-cache headers.
|
42 |
+
*
|
43 |
+
* @package s2Member\No_Cache
|
44 |
+
* @since 3.5
|
45 |
+
*
|
46 |
+
* @attaches-to ``add_action('init');``
|
47 |
+
* @also-called-by Other routines within s2Member.
|
48 |
+
*
|
49 |
+
* @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible.
|
50 |
+
*
|
51 |
+
* @return bool This function will always return `true`.
|
52 |
+
*/
|
53 |
+
public static function no_cache($no_cache = FALSE)
|
54 |
+
{
|
55 |
+
do_action('ws_plugin__s2member_before_no_cache', get_defined_vars());
|
56 |
+
|
57 |
+
c_ws_plugin__s2member_no_cache::no_cache_constants($no_cache).c_ws_plugin__s2member_no_cache::no_cache_headers($no_cache);
|
58 |
+
|
59 |
+
do_action('ws_plugin__s2member_after_no_cache', get_defined_vars());
|
60 |
+
|
61 |
+
return TRUE; // Always return true.
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Defines no-cache constants for various WordPress plugins.
|
66 |
+
*
|
67 |
+
* This is compatible with Quick Cache, W3 Total Cache, and also with WP Super Cache.
|
68 |
+
* Quick Cache uses: ``QUICK_CACHE_ALLOWED``, and other plugins use: ``DONOTCACHEPAGE``.
|
69 |
+
* W3 Total Cache is also known to be compatible with ``DONOTCACHEOBJECT`` and ``DONOTCACHEDB``.
|
70 |
+
*
|
71 |
+
* Disallow caching if the ``$no_cache`` parameter is passed in as ``true``, by other routines.
|
72 |
+
* In addition, always disallow caching for logged in users, and GET requests with: `/?s2member` Systematics.
|
73 |
+
* For clarity on s2Member Systematics, see: {@link s2Member\Systematics\c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()}.
|
74 |
+
*
|
75 |
+
* However, this routine will ALWAYS obey the `?qcAC` query string parameter.
|
76 |
+
* This Quick Cache parameter explicitly allows caching to occur.
|
77 |
+
*
|
78 |
+
* @package s2Member\No_Cache
|
79 |
+
* @since 3.5
|
80 |
+
*
|
81 |
+
* @also-called-by Other routines within s2Member.
|
82 |
+
*
|
83 |
+
* @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible.
|
84 |
+
*
|
85 |
+
* @return bool This function will always return `true`.
|
86 |
+
*/
|
87 |
+
public static function no_cache_constants($no_cache = FALSE)
|
88 |
+
{
|
89 |
+
static $once; // We only need to set these constants once.
|
90 |
+
|
91 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
92 |
+
do_action('ws_plugin__s2member_before_no_cache_constants', get_defined_vars());
|
93 |
+
unset($__refs, $__v); // Housekeeping.
|
94 |
+
|
95 |
+
if(!$once && (empty($_GET['qcAC']) || !filter_var($_GET['qcAC'], FILTER_VALIDATE_BOOLEAN))
|
96 |
+
&& ($no_cache || (is_user_logged_in() && (!defined('QUICK_CACHE_WHEN_LOGGED_IN') || !QUICK_CACHE_WHEN_LOGGED_IN))
|
97 |
+
|| c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())
|
98 |
+
)
|
99 |
{
|
100 |
/**
|
101 |
+
* No-cache DB queries for plugins.
|
102 |
+
*
|
103 |
+
* @package s2Member\No_Cache
|
104 |
+
* @since 111115
|
105 |
+
*
|
106 |
+
* @var bool
|
107 |
+
*/
|
108 |
+
if(!defined('DONOTCACHEDB'))
|
109 |
+
define ('DONOTCACHEDB', TRUE);
|
110 |
+
|
111 |
/**
|
112 |
+
* No-cache Page for plugins.
|
113 |
+
*
|
114 |
+
* @package s2Member\No_Cache
|
115 |
+
* @since 3.5
|
116 |
+
*
|
117 |
+
* @var bool
|
118 |
+
*/
|
119 |
+
if(!defined('DONOTCACHEPAGE'))
|
120 |
+
define ('DONOTCACHEPAGE', TRUE);
|
121 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
/**
|
123 |
+
* No-cache Objects for plugins.
|
124 |
+
*
|
125 |
+
* @package s2Member\No_Cache
|
126 |
+
* @since 111115
|
127 |
+
*
|
128 |
+
* @var bool
|
129 |
+
*/
|
130 |
+
if(!defined('DONOTCACHEOBJECT'))
|
131 |
+
define ('DONOTCACHEOBJECT', TRUE);
|
132 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
/**
|
134 |
+
* No-cache anything for Quick Cache plugin.
|
135 |
+
*
|
136 |
+
* @package s2Member\No_Cache
|
137 |
+
* @since 3.5
|
138 |
+
*
|
139 |
+
* @var bool
|
140 |
+
*/
|
141 |
+
if(!defined('QUICK_CACHE_ALLOWED'))
|
142 |
+
define ('QUICK_CACHE_ALLOWED', FALSE);
|
143 |
+
|
144 |
+
$once = TRUE; // Set these one time only.
|
145 |
+
|
146 |
+
c_ws_plugin__s2member_no_cache::$headers = TRUE;
|
147 |
+
|
148 |
+
do_action('ws_plugin__s2member_during_no_cache_constants', get_defined_vars());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
+
do_action('ws_plugin__s2member_after_no_cache_constants', get_defined_vars());
|
151 |
+
|
152 |
+
return TRUE; // Always return true.
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Sends Cache-Control (no-cache) headers.
|
157 |
+
*
|
158 |
+
* Disallow browser caching if the ``$no_cache`` parameter is passed in as ``true``, by other routines.
|
159 |
+
* Disallow browser caching when/if no-cache Constants are set by {@link s2Member\No_Cache\c_ws_plugin__s2member_no_cache::no_cache_constants()},
|
160 |
+
* via static variable boolean value for: ``c_ws_plugin__s2member_no_cache::$headers``.
|
161 |
+
*
|
162 |
+
* However, this routine will ALWAYS obey the `?qcABC` query string parameter.
|
163 |
+
* This Quick Cache parameter explicitly allows browser caching to occur.
|
164 |
+
*
|
165 |
+
* @package s2Member\No_Cache
|
166 |
+
* @since 3.5
|
167 |
+
*
|
168 |
+
* @also-called-by Other routines within s2Member.
|
169 |
+
*
|
170 |
+
* @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible.
|
171 |
+
*
|
172 |
+
* @return bool This function will always return `true`.
|
173 |
+
*/
|
174 |
+
public static function no_cache_headers($no_cache = FALSE)
|
175 |
+
{
|
176 |
+
static $once; // We only need to set these headers one time.
|
177 |
+
|
178 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
179 |
+
do_action('ws_plugin__s2member_before_no_cache_headers', get_defined_vars());
|
180 |
+
unset($__refs, $__v); // Housekeeping.
|
181 |
+
|
182 |
+
$using_selective_behavior = apply_filters('ws_plugin__s2member_no_cache_headers_selective', FALSE, get_defined_vars());
|
183 |
+
|
184 |
+
if(!$once && !headers_sent() && (empty($_GET['qcABC']) || !filter_var($_GET['qcABC'], FILTER_VALIDATE_BOOLEAN)) && ($no_cache || !$using_selective_behavior || c_ws_plugin__s2member_no_cache::$headers))
|
185 |
+
if(!apply_filters('ws_plugin__s2member_disable_no_cache_headers', FALSE, get_defined_vars()))
|
186 |
+
{
|
187 |
+
foreach(headers_list() as $header) // No-cache headers already sent? We need to check here.
|
188 |
+
if(stripos($header, 'no-cache') !== FALSE) // No-cache headers already sent?
|
189 |
+
{
|
190 |
+
$no_cache_headers_already_sent = TRUE; // Yep, sent.
|
191 |
+
break; // Break now, no need to continue further.
|
192 |
+
}
|
193 |
+
if(!isset ($no_cache_headers_already_sent)) // Not yet?
|
194 |
+
nocache_headers(); // Only if NOT already sent.
|
195 |
+
|
196 |
+
$once = TRUE; // This is static var. Only send headers once.
|
197 |
+
|
198 |
+
do_action('ws_plugin__s2member_during_no_cache_headers', get_defined_vars());
|
199 |
+
}
|
200 |
+
do_action('ws_plugin__s2member_after_no_cache_headers', get_defined_vars());
|
201 |
+
|
202 |
+
return TRUE; // Always return true.
|
203 |
+
}
|
204 |
}
|
205 |
+
}
|
includes/classes/op-notices.inc.php
CHANGED
@@ -41,7 +41,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
41 |
{
|
42 |
global $pagenow; // Need this global variable.
|
43 |
|
44 |
-
do_action
|
45 |
|
46 |
if (is_blog_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) // Multisite does NOT provide these options.
|
47 |
{
|
@@ -51,12 +51,12 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
51 |
$js .= "jQuery(document).ready(function(\$){ \$('input#users_can_register, select#default_role').attr('disabled', 'disabled'); });";
|
52 |
$js .= '</script>';
|
53 |
|
54 |
-
do_action
|
55 |
|
56 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "blog:" . $pagenow);
|
57 |
}
|
58 |
|
59 |
-
do_action
|
60 |
|
61 |
return /* Return for uniformity. */;
|
62 |
}
|
@@ -74,9 +74,9 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
74 |
{
|
75 |
global $pagenow; // Need this global variable.
|
76 |
|
77 |
-
do_action
|
78 |
|
79 |
-
if (is_multisite () && is_network_admin () && in_array
|
80 |
{
|
81 |
$notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <code>s2Member -› Multisite (Config)</code>.";
|
82 |
|
@@ -84,12 +84,12 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
84 |
$js .= "jQuery(document).ready(function(\$){ \$('input[name=registration], input#add_new_users').attr('disabled', 'disabled'); });";
|
85 |
$js .= '</script>';
|
86 |
|
87 |
-
do_action
|
88 |
|
89 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "network:" . $pagenow);
|
90 |
}
|
91 |
|
92 |
-
do_action
|
93 |
|
94 |
return /* Return for uniformity. */;
|
95 |
}
|
@@ -107,11 +107,11 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
107 |
{
|
108 |
global $pagenow; // Need this global variable.
|
109 |
|
110 |
-
do_action
|
111 |
|
112 |
if (is_blog_admin () && $pagenow === "options-reading.php" && !isset ($_GET["page"]))
|
113 |
{
|
114 |
-
do_action
|
115 |
|
116 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
|
117 |
&& ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Home Page (i.e. static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
|
@@ -130,7 +130,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
|
|
130 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
|
131 |
}
|
132 |
|
133 |
-
do_action
|
134 |
|
135 |
return /* Return for uniformity. */;
|
136 |
}
|
41 |
{
|
42 |
global $pagenow; // Need this global variable.
|
43 |
|
44 |
+
do_action("ws_plugin__s2member_before_general_ops_notice", get_defined_vars ());
|
45 |
|
46 |
if (is_blog_admin () && $pagenow === "options-general.php" && !isset ($_GET["page"]) && !is_multisite ()) // Multisite does NOT provide these options.
|
47 |
{
|
51 |
$js .= "jQuery(document).ready(function(\$){ \$('input#users_can_register, select#default_role').attr('disabled', 'disabled'); });";
|
52 |
$js .= '</script>';
|
53 |
|
54 |
+
do_action("ws_plugin__s2member_during_general_ops_notice", get_defined_vars ());
|
55 |
|
56 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "blog:" . $pagenow);
|
57 |
}
|
58 |
|
59 |
+
do_action("ws_plugin__s2member_after_general_ops_notice", get_defined_vars ());
|
60 |
|
61 |
return /* Return for uniformity. */;
|
62 |
}
|
74 |
{
|
75 |
global $pagenow; // Need this global variable.
|
76 |
|
77 |
+
do_action("ws_plugin__s2member_before_multisite_ops_notice", get_defined_vars ());
|
78 |
|
79 |
+
if (is_multisite () && is_network_admin () && in_array($pagenow, array("settings.php")) && !isset ($_GET["page"]))
|
80 |
{
|
81 |
$notice = "<em>* Note: The s2Member plugin has control over two options on this page.<br /><code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code> and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />Please check: <code>s2Member -› Multisite (Config)</code>.";
|
82 |
|
84 |
$js .= "jQuery(document).ready(function(\$){ \$('input[name=registration], input#add_new_users').attr('disabled', 'disabled'); });";
|
85 |
$js .= '</script>';
|
86 |
|
87 |
+
do_action("ws_plugin__s2member_during_multisite_ops_notice", get_defined_vars ());
|
88 |
|
89 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice . $js, "network:" . $pagenow);
|
90 |
}
|
91 |
|
92 |
+
do_action("ws_plugin__s2member_after_multisite_ops_notice", get_defined_vars ());
|
93 |
|
94 |
return /* Return for uniformity. */;
|
95 |
}
|
107 |
{
|
108 |
global $pagenow; // Need this global variable.
|
109 |
|
110 |
+
do_action("ws_plugin__s2member_before_reading_ops_notice", get_defined_vars ());
|
111 |
|
112 |
if (is_blog_admin () && $pagenow === "options-reading.php" && !isset ($_GET["page"]))
|
113 |
{
|
114 |
+
do_action("ws_plugin__s2member_during_reading_ops_notice", get_defined_vars ()); // Now check for conflicts.
|
115 |
|
116 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && (string)get_option ("page_on_front") === $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]
|
117 |
&& ($notice = '<strong>NOTE:</strong> Your Membership Options Page for s2Member is currently configured as your Home Page (i.e. static page) for WordPress. This causes internal conflicts with s2Member. Your Membership Options Page MUST stand alone. Please correct this.'))
|
130 |
c_ws_plugin__s2member_admin_notices::enqueue_admin_notice ($notice, "blog:" . $pagenow, true);
|
131 |
}
|
132 |
|
133 |
+
do_action("ws_plugin__s2member_after_reading_ops_notice", get_defined_vars ());
|
134 |
|
135 |
return /* Return for uniformity. */;
|
136 |
}
|
includes/classes/option-forces.inc.php
CHANGED
@@ -35,14 +35,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_filter("pre_option_default_role");``
|
37 |
*
|
38 |
-
* @param
|
39 |
-
* @return
|
40 |
*/
|
41 |
public static function force_default_role ($default_role = FALSE)
|
42 |
{
|
43 |
-
do_action
|
44 |
|
45 |
-
return apply_filters
|
46 |
}
|
47 |
/**
|
48 |
* Forces a default Role for new Multisite registrations (on the Main Site) NOT tied to an incoming payment.
|
@@ -52,14 +52,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
52 |
*
|
53 |
* @attaches-to ``add_filter("pre_site_option_default_user_role");``
|
54 |
*
|
55 |
-
* @param
|
56 |
-
* @return
|
57 |
*/
|
58 |
public static function force_mms_default_role ($default_role = FALSE)
|
59 |
{
|
60 |
-
do_action
|
61 |
|
62 |
-
return apply_filters
|
63 |
}
|
64 |
/**
|
65 |
* Forces a specific Role to demote to, whenever a Member is demoted in one way or another.
|
@@ -69,14 +69,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
69 |
* @package s2Member\Option_Forces
|
70 |
* @since 3.5
|
71 |
*
|
72 |
-
* @param
|
73 |
-
* @return
|
74 |
*/
|
75 |
public static function force_demotion_role ($demotion_role = FALSE)
|
76 |
{
|
77 |
-
do_action
|
78 |
|
79 |
-
return apply_filters
|
80 |
}
|
81 |
/**
|
82 |
* Allows new Users to be created on a Multisite Network.
|
@@ -86,14 +86,14 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
86 |
*
|
87 |
* @attaches-to ``add_filter("pre_site_option_add_new_users");``
|
88 |
*
|
89 |
-
* @param int|
|
90 |
-
* @return
|
91 |
*/
|
92 |
public static function mms_allow_new_users ($allow = FALSE)
|
93 |
{
|
94 |
-
do_action
|
95 |
|
96 |
-
return apply_filters
|
97 |
}
|
98 |
/**
|
99 |
* Forces a Multisite Dashboard Blog to be the Main Site.
|
@@ -103,18 +103,18 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
103 |
*
|
104 |
* @attaches-to ``add_filter("pre_site_option_dashboard_blog");``
|
105 |
*
|
106 |
-
* @param int|
|
107 |
* @return int|str Numeric Dashboard Blog ID, as configured by s2Member. Forces to the Main Site.
|
108 |
*/
|
109 |
public static function mms_dashboard_blog ($dashboard_blog = FALSE)
|
110 |
{
|
111 |
global /* For Multisite support. */ $current_site, $current_blog;
|
112 |
|
113 |
-
do_action
|
114 |
|
115 |
$main_site = ((is_multisite ()) ? $current_site->blog_id : "1"); // Forces the Main Site.
|
116 |
|
117 |
-
return apply_filters
|
118 |
}
|
119 |
/**
|
120 |
* Allows access to the Registration Form.
|
@@ -124,32 +124,32 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
124 |
*
|
125 |
* @attaches-to ``add_filter("pre_option_users_can_register");``
|
126 |
*
|
127 |
-
* @param int|
|
128 |
-
* @return
|
129 |
*/
|
130 |
public static function check_register_access ($users_can_register = FALSE)
|
131 |
{
|
132 |
global $wpdb; // Global database object reference
|
133 |
|
134 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
135 |
-
do_action
|
136 |
-
unset
|
137 |
|
138 |
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];
|
139 |
|
140 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site ())
|
141 |
-
return apply_filters
|
142 |
|
143 |
else if (!is_admin () && !$users_can_register) // Do NOT run these security checks on option pages; it's confusing.
|
144 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site () || current_user_can ("create_users") || is_super_admin ())
|
145 |
{
|
146 |
if (current_user_can ("create_users") || (is_multisite () && is_super_admin ()) || c_ws_plugin__s2member_register_access::reg_cookies_ok ())
|
147 |
{
|
148 |
-
return apply_filters
|
149 |
}
|
150 |
}
|
151 |
|
152 |
-
return apply_filters
|
153 |
}
|
154 |
/**
|
155 |
* Allows access to the main Multisite Registration Form.
|
@@ -159,8 +159,8 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
159 |
*
|
160 |
* @attaches-to ``add_filter("pre_site_option_registration");``
|
161 |
*
|
162 |
-
* @param
|
163 |
-
* @return
|
164 |
*/
|
165 |
public static function check_mms_register_access ($users_can_register = FALSE)
|
166 |
{
|
@@ -168,47 +168,47 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
168 |
global /* For Multisite support. */ $current_site, $current_blog;
|
169 |
|
170 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
171 |
-
do_action
|
172 |
-
unset
|
173 |
|
174 |
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
|
175 |
|
176 |
if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && is_multisite () && /* BP Multisite / but NOT offering Blogs? */ !c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
177 |
-
return apply_filters
|
178 |
|
179 |
else if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm ()) // Blog Farm?
|
180 |
-
return apply_filters
|
181 |
|
182 |
else if (!is_network_admin () && $users_can_register !== "all") // Do NOT run these checks on Network option pages; it's confusing.
|
183 |
{
|
184 |
if ((is_main_site () && current_user_can ("create_users")) || is_super_admin ()) // Creates Users on the Main Site?
|
185 |
{
|
186 |
-
return apply_filters
|
187 |
}
|
188 |
|
189 |
else if (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID && is_object ($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID && $user->has_cap ("access_s2member_level1"))
|
190 |
{
|
191 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
192 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
193 |
-
$user_blogs = (is_array
|
194 |
|
195 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
196 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
197 |
|
198 |
if ($user_blogs < $blogs_allowed) // Are they within their limit?
|
199 |
{
|
200 |
-
return apply_filters
|
201 |
}
|
202 |
}
|
203 |
else if (!is_user_logged_in () && is_main_site () && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies))
|
204 |
{
|
205 |
-
if (preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty
|
206 |
{
|
207 |
-
return apply_filters
|
208 |
}
|
209 |
else // Otherwise, we MUST allow them to at least create an account; they paid for it! Defaults to `user`.
|
210 |
{
|
211 |
-
return apply_filters
|
212 |
}
|
213 |
}
|
214 |
}
|
@@ -219,19 +219,19 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
219 |
{
|
220 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
221 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
222 |
-
$user_blogs = (is_array
|
223 |
|
224 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
225 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
226 |
|
227 |
if ($user_blogs >= $blogs_allowed) // Are they at their limit?
|
228 |
{
|
229 |
-
return apply_filters
|
230 |
}
|
231 |
}
|
232 |
}
|
233 |
|
234 |
-
return apply_filters
|
235 |
}
|
236 |
/**
|
237 |
* Register access in BuddyPress, for Multisite compatibility.
|
@@ -252,7 +252,7 @@ if (!class_exists ("c_ws_plugin__s2member_option_forces"))
|
|
252 |
if (is_multisite ()) // Only if Multisite Networking is enabled. Pointless otherwise.
|
253 |
$site_options["registration"] = c_ws_plugin__s2member_option_forces::check_mms_register_access ($site_options["registration"]);
|
254 |
|
255 |
-
return apply_filters
|
256 |
}
|
257 |
}
|
258 |
}
|
35 |
*
|
36 |
* @attaches-to ``add_filter("pre_option_default_role");``
|
37 |
*
|
38 |
+
* @param string $default_role Expects a default Role to be passed by the Filter.
|
39 |
+
* @return string Default Role, as configured by s2Member.
|
40 |
*/
|
41 |
public static function force_default_role ($default_role = FALSE)
|
42 |
{
|
43 |
+
do_action("ws_plugin__s2member_before_force_default_role", get_defined_vars ());
|
44 |
|
45 |
+
return apply_filters("ws_plugin__s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
|
46 |
}
|
47 |
/**
|
48 |
* Forces a default Role for new Multisite registrations (on the Main Site) NOT tied to an incoming payment.
|
52 |
*
|
53 |
* @attaches-to ``add_filter("pre_site_option_default_user_role");``
|
54 |
*
|
55 |
+
* @param string $default_role Expects a default Role to be passed by the Filter.
|
56 |
+
* @return string Default Role, as configured by s2Member.
|
57 |
*/
|
58 |
public static function force_mms_default_role ($default_role = FALSE)
|
59 |
{
|
60 |
+
do_action("ws_plugin__s2member_before_force_mms_default_role", get_defined_vars ());
|
61 |
|
62 |
+
return apply_filters("ws_plugin__s2member_force_mms_default_role", ($default_role = "subscriber"), get_defined_vars ());
|
63 |
}
|
64 |
/**
|
65 |
* Forces a specific Role to demote to, whenever a Member is demoted in one way or another.
|
69 |
* @package s2Member\Option_Forces
|
70 |
* @since 3.5
|
71 |
*
|
72 |
+
* @param string $demotion_role Expects a demotion Role to be passed by the caller.
|
73 |
+
* @return string Demotion Role, as configured by s2Member.
|
74 |
*/
|
75 |
public static function force_demotion_role ($demotion_role = FALSE)
|
76 |
{
|
77 |
+
do_action("ws_plugin__s2member_before_force_demotion_role", get_defined_vars ());
|
78 |
|
79 |
+
return apply_filters("ws_plugin__s2member_force_demotion_role", ($demotion_role = "subscriber"), get_defined_vars ());
|
80 |
}
|
81 |
/**
|
82 |
* Allows new Users to be created on a Multisite Network.
|
86 |
*
|
87 |
* @attaches-to ``add_filter("pre_site_option_add_new_users");``
|
88 |
*
|
89 |
+
* @param int|string $allow Numeric string (`1`) or (`0`), expected by the Filter.
|
90 |
+
* @return string Numeric (`1`) or (`0`) indicating true or false. Forces to (`1`) true.
|
91 |
*/
|
92 |
public static function mms_allow_new_users ($allow = FALSE)
|
93 |
{
|
94 |
+
do_action("ws_plugin__s2member_before_mms_allow_new_users", get_defined_vars ());
|
95 |
|
96 |
+
return apply_filters("ws_plugin__s2member_mms_allow_new_users", ($allow = "1"), get_defined_vars ());
|
97 |
}
|
98 |
/**
|
99 |
* Forces a Multisite Dashboard Blog to be the Main Site.
|
103 |
*
|
104 |
* @attaches-to ``add_filter("pre_site_option_dashboard_blog");``
|
105 |
*
|
106 |
+
* @param int|string $dashboard_blog Numeric Dashboard Blog ID passed through by the Filter.
|
107 |
* @return int|str Numeric Dashboard Blog ID, as configured by s2Member. Forces to the Main Site.
|
108 |
*/
|
109 |
public static function mms_dashboard_blog ($dashboard_blog = FALSE)
|
110 |
{
|
111 |
global /* For Multisite support. */ $current_site, $current_blog;
|
112 |
|
113 |
+
do_action("ws_plugin__s2member_before_mms_dashboard_blog", get_defined_vars ());
|
114 |
|
115 |
$main_site = ((is_multisite ()) ? $current_site->blog_id : "1"); // Forces the Main Site.
|
116 |
|
117 |
+
return apply_filters("ws_plugin__s2member_mms_dashboard_blog", ($dashboard_blog = $main_site), get_defined_vars ());
|
118 |
}
|
119 |
/**
|
120 |
* Allows access to the Registration Form.
|
124 |
*
|
125 |
* @attaches-to ``add_filter("pre_option_users_can_register");``
|
126 |
*
|
127 |
+
* @param int|string $users_can_register Numeric (`1`) or (`0`), indicating true or false; passed through by the Filter.
|
128 |
+
* @return string Numeric value of (`1`) or (`0`), indicating true or false; depending on several factors.
|
129 |
*/
|
130 |
public static function check_register_access ($users_can_register = FALSE)
|
131 |
{
|
132 |
global $wpdb; // Global database object reference
|
133 |
|
134 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
135 |
+
do_action("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
|
136 |
+
unset($__refs, $__v);
|
137 |
|
138 |
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];
|
139 |
|
140 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site ())
|
141 |
+
return apply_filters("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
|
142 |
|
143 |
else if (!is_admin () && !$users_can_register) // Do NOT run these security checks on option pages; it's confusing.
|
144 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || !is_main_site () || current_user_can ("create_users") || is_super_admin ())
|
145 |
{
|
146 |
if (current_user_can ("create_users") || (is_multisite () && is_super_admin ()) || c_ws_plugin__s2member_register_access::reg_cookies_ok ())
|
147 |
{
|
148 |
+
return apply_filters("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
|
149 |
}
|
150 |
}
|
151 |
|
152 |
+
return apply_filters("ws_plugin__s2member_check_register_access", $users_can_register, get_defined_vars ());
|
153 |
}
|
154 |
/**
|
155 |
* Allows access to the main Multisite Registration Form.
|
159 |
*
|
160 |
* @attaches-to ``add_filter("pre_site_option_registration");``
|
161 |
*
|
162 |
+
* @param string $users_can_register Expects *( `none`, `all`, `blog`, `user` )*, passed through by the Filter.
|
163 |
+
* @return string One of `none|all|user`; depending on several factors.
|
164 |
*/
|
165 |
public static function check_mms_register_access ($users_can_register = FALSE)
|
166 |
{
|
168 |
global /* For Multisite support. */ $current_site, $current_blog;
|
169 |
|
170 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
171 |
+
do_action("ws_plugin__s2member_before_check_register_access", get_defined_vars ());
|
172 |
+
unset($__refs, $__v);
|
173 |
|
174 |
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_grants"];
|
175 |
|
176 |
if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && is_multisite () && /* BP Multisite / but NOT offering Blogs? */ !c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
177 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = ((c_ws_plugin__s2member_option_forces::check_register_access ()) ? "user" : "none")), get_defined_vars ());
|
178 |
|
179 |
else if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm ()) // Blog Farm?
|
180 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
|
181 |
|
182 |
else if (!is_network_admin () && $users_can_register !== "all") // Do NOT run these checks on Network option pages; it's confusing.
|
183 |
{
|
184 |
if ((is_main_site () && current_user_can ("create_users")) || is_super_admin ()) // Creates Users on the Main Site?
|
185 |
{
|
186 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
|
187 |
}
|
188 |
|
189 |
else if (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID && is_object ($user = new WP_User ($user->ID, $current_site->blog_id)) && $user->ID && $user->has_cap ("access_s2member_level1"))
|
190 |
{
|
191 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
192 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
193 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
|
194 |
|
195 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
196 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
197 |
|
198 |
if ($user_blogs < $blogs_allowed) // Are they within their limit?
|
199 |
{
|
200 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
|
201 |
}
|
202 |
}
|
203 |
else if (!is_user_logged_in () && is_main_site () && ($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies))
|
204 |
{
|
205 |
+
if (preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $item_number, $m) && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mms_registration_blogs_level" . $m[1]]))
|
206 |
{
|
207 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "all"), get_defined_vars ());
|
208 |
}
|
209 |
else // Otherwise, we MUST allow them to at least create an account; they paid for it! Defaults to `user`.
|
210 |
{
|
211 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "user"), get_defined_vars ());
|
212 |
}
|
213 |
}
|
214 |
}
|
219 |
{
|
220 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
221 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
222 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
|
223 |
|
224 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
225 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
226 |
|
227 |
if ($user_blogs >= $blogs_allowed) // Are they at their limit?
|
228 |
{
|
229 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", ($users_can_register = "none"), get_defined_vars ());
|
230 |
}
|
231 |
}
|
232 |
}
|
233 |
|
234 |
+
return apply_filters("ws_plugin__s2member_check_mms_register_access", $users_can_register, get_defined_vars ());
|
235 |
}
|
236 |
/**
|
237 |
* Register access in BuddyPress, for Multisite compatibility.
|
252 |
if (is_multisite ()) // Only if Multisite Networking is enabled. Pointless otherwise.
|
253 |
$site_options["registration"] = c_ws_plugin__s2member_option_forces::check_mms_register_access ($site_options["registration"]);
|
254 |
|
255 |
+
return apply_filters("ws_plugin__s2member_check_bp_mms_register_access", $site_options, get_defined_vars ());
|
256 |
}
|
257 |
}
|
258 |
}
|
includes/classes/pages-sp.inc.php
CHANGED
@@ -33,17 +33,17 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
|
|
33 |
* @package s2Member\Pages
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param int|
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array
|
39 |
*
|
40 |
-
* @todo Provide more information in the return array
|
41 |
*/
|
42 |
public static function check_specific_page_level_access ($page_id = FALSE, $check_user = TRUE)
|
43 |
{
|
44 |
-
do_action
|
45 |
|
46 |
-
$excluded = apply_filters
|
47 |
|
48 |
if (!$excluded && is_numeric ($page_id) && ($page_id = (int)$page_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
49 |
{
|
@@ -51,29 +51,29 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
|
|
51 |
|
52 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($page_id, $page_uri)) // Do NOT touch WordPress Systematics.
|
53 |
{
|
54 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
55 |
|
56 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
57 |
-
return apply_filters
|
58 |
|
59 |
else 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, "/") . "$/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
60 |
-
return apply_filters
|
61 |
|
62 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
63 |
-
return apply_filters
|
64 |
|
65 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($page_id, $page_uri)) // However, there are 3 exceptions above.
|
66 |
{
|
67 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Page Level restrictions. Go through each Level.
|
68 |
{
|
69 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
70 |
-
return apply_filters
|
71 |
|
72 |
-
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array
|
73 |
-
return apply_filters
|
74 |
|
75 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array
|
76 |
-
return apply_filters
|
77 |
}
|
78 |
|
79 |
if (has_tag ("", $page_id)) // Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also.
|
@@ -81,10 +81,10 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
|
|
81 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions (possibly through Page Tagger). Go through each Level.
|
82 |
{
|
83 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
84 |
-
return apply_filters
|
85 |
|
86 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
87 |
-
return apply_filters
|
88 |
}
|
89 |
}
|
90 |
|
@@ -94,25 +94,25 @@ if (!class_exists ("c_ws_plugin__s2member_pages_sp"))
|
|
94 |
|
95 |
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)
|
96 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
97 |
-
return apply_filters
|
98 |
}
|
99 |
|
100 |
-
if (is_array
|
101 |
{
|
102 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capabilities.
|
103 |
if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
|
104 |
-
return apply_filters
|
105 |
}
|
106 |
|
107 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array
|
108 |
-
return apply_filters
|
109 |
}
|
110 |
|
111 |
-
do_action
|
112 |
}
|
113 |
}
|
114 |
|
115 |
-
return apply_filters
|
116 |
}
|
117 |
}
|
118 |
}
|
33 |
* @package s2Member\Pages
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param int|string $page_id Numeric Page 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 |
+
* @todo Provide more information in the return array(like MOP Vars).
|
41 |
*/
|
42 |
public static function check_specific_page_level_access ($page_id = FALSE, $check_user = TRUE)
|
43 |
{
|
44 |
+
do_action("ws_plugin__s2member_before_check_specific_page_level_access", get_defined_vars ());
|
45 |
|
46 |
+
$excluded = apply_filters("ws_plugin__s2member_check_specific_page_level_access_excluded", false, get_defined_vars ());
|
47 |
|
48 |
if (!$excluded && is_numeric ($page_id) && ($page_id = (int)$page_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
49 |
{
|
51 |
|
52 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($page_id, $page_uri)) // Do NOT touch WordPress Systematics.
|
53 |
{
|
54 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
55 |
|
56 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
57 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
58 |
|
59 |
else 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, "/") . "$/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
60 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
61 |
|
62 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
63 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
64 |
|
65 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($page_id, $page_uri)) // However, there are 3 exceptions above.
|
66 |
{
|
67 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Page Level restrictions. Go through each Level.
|
68 |
{
|
69 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
70 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
71 |
|
72 |
+
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array("all-page", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-pages", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
73 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
74 |
|
75 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
76 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
77 |
}
|
78 |
|
79 |
if (has_tag ("", $page_id)) // Here we take a look to see if this Page has any Tags. If so, we need to run the full set of routines against Tags also.
|
81 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions (possibly through Page Tagger). Go through each Level.
|
82 |
{
|
83 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
84 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
85 |
|
86 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $page_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
87 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
88 |
}
|
89 |
}
|
90 |
|
94 |
|
95 |
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)
|
96 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $page_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
97 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
98 |
}
|
99 |
|
100 |
+
if (is_array($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty($ccaps_req))
|
101 |
{
|
102 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capabilities.
|
103 |
if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
|
104 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_ccap_req" => $ccap), get_defined_vars ());
|
105 |
}
|
106 |
|
107 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($page_id, "read-only")))
|
108 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", array("s2member_sp_req" => $page_id), get_defined_vars ());
|
109 |
}
|
110 |
|
111 |
+
do_action("ws_plugin__s2member_during_check_specific_page_level_access", get_defined_vars ());
|
112 |
}
|
113 |
}
|
114 |
|
115 |
+
return apply_filters("ws_plugin__s2member_check_specific_page_level_access", null, get_defined_vars ());
|
116 |
}
|
117 |
}
|
118 |
}
|
includes/classes/pages.inc.php
CHANGED
@@ -39,15 +39,15 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
|
|
39 |
{
|
40 |
global $post; // ``get_the_ID()`` unavailable outside The Loop.
|
41 |
|
42 |
-
do_action
|
43 |
|
44 |
-
$excluded = apply_filters
|
45 |
|
46 |
-
if (!$excluded && is_page () && is_object ($post) && !empty
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
51 |
|
52 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
53 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
@@ -65,10 +65,10 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
|
|
65 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
66 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
67 |
|
68 |
-
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") && (in_array
|
69 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "post") . exit ();
|
70 |
|
71 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array
|
72 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
73 |
}
|
74 |
|
@@ -93,22 +93,22 @@ if (!class_exists ("c_ws_plugin__s2member_pages"))
|
|
93 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
94 |
}
|
95 |
|
96 |
-
if (is_array
|
97 |
{
|
98 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as an array of Custom Capabilities.
|
99 |
if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)) /* Does this ``$user``, have this Custom Capability? */)
|
100 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "ccap", $ccap, $_SERVER["REQUEST_URI"], "ccap") . exit ();
|
101 |
}
|
102 |
|
103 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array
|
104 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "sp", $page_id, $_SERVER["REQUEST_URI"], "sp") . exit ();
|
105 |
}
|
106 |
|
107 |
-
do_action
|
108 |
}
|
109 |
}
|
110 |
|
111 |
-
do_action
|
112 |
|
113 |
return; // For uniformity.
|
114 |
}
|
39 |
{
|
40 |
global $post; // ``get_the_ID()`` unavailable outside The Loop.
|
41 |
|
42 |
+
do_action("ws_plugin__s2member_before_check_page_level_access", get_defined_vars ());
|
43 |
|
44 |
+
$excluded = apply_filters("ws_plugin__s2member_check_page_level_access_excluded", false, get_defined_vars ());
|
45 |
|
46 |
+
if (!$excluded && is_page () && is_object ($post) && !empty($post->ID) && ($page_id = (int)$post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
51 |
|
52 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $page_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")) && $page_id !== (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
53 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
65 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
66 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
67 |
|
68 |
+
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") && (in_array("all-page", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-pages", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
69 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "post") . exit ();
|
70 |
|
71 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"] && in_array($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_pages"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
72 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
73 |
}
|
74 |
|
93 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
94 |
}
|
95 |
|
96 |
+
if (is_array($ccaps_req = get_post_meta ($page_id, "s2member_ccaps_req", true)) && !empty($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true))
|
97 |
{
|
98 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as an array of Custom Capabilities.
|
99 |
if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)) /* Does this ``$user``, have this Custom Capability? */)
|
100 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "ccap", $ccap, $_SERVER["REQUEST_URI"], "ccap") . exit ();
|
101 |
}
|
102 |
|
103 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($page_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && !c_ws_plugin__s2member_sp_access::sp_access ($page_id))
|
104 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("page", $page_id, "sp", $page_id, $_SERVER["REQUEST_URI"], "sp") . exit ();
|
105 |
}
|
106 |
|
107 |
+
do_action("ws_plugin__s2member_during_check_page_level_access", get_defined_vars ());
|
108 |
}
|
109 |
}
|
110 |
|
111 |
+
do_action("ws_plugin__s2member_after_check_page_level_access", get_defined_vars ());
|
112 |
|
113 |
return; // For uniformity.
|
114 |
}
|
includes/classes/paypal-notify-in-billing-agreement-signup.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_sig
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_sig
|
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Billing Agreement signups on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
@@ -67,13 +67,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_sig
|
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
-
do_action
|
71 |
-
unset
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
else
|
76 |
-
return apply_filters
|
77 |
}
|
78 |
}
|
79 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^mp_signup$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_billing_agreement_signup", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Billing Agreement signups on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_billing_agreement_signup", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_billing_agreement_signup", get_defined_vars ());
|
71 |
+
unset($__refs, $__v);
|
72 |
|
73 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
else
|
76 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_billing_agreement_signup", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
}
|
includes/classes/paypal-notify-in-cart.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
|
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Cart events on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
@@ -67,12 +67,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_cart"))
|
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
-
do_action
|
71 |
-
unset
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
-
else return apply_filters
|
76 |
}
|
77 |
}
|
78 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^cart$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_cart", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Cart events on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_cart", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_cart", get_defined_vars ());
|
71 |
+
unset($__refs, $__v);
|
72 |
|
73 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_cart", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
}
|
includes/classes/paypal-notify-in-express-checkout.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_express_checkout"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_express_checkout"))
|
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Express Checkout events on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
@@ -67,13 +67,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_express_checkout"))
|
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
-
do_action
|
71 |
-
unset
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
else
|
76 |
-
return apply_filters
|
77 |
}
|
78 |
}
|
79 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^express_checkout$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_express_checkout", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Express Checkout events on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_express_checkout", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_express_checkout", get_defined_vars ());
|
71 |
+
unset($__refs, $__v);
|
72 |
|
73 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
else
|
76 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_express_checkout", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
}
|
includes/classes/paypal-notify-in-merch-pmt.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_merch_pmt"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_merch_pmt"))
|
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Merch Pmts on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
@@ -67,13 +67,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_merch_pmt"))
|
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
-
do_action
|
71 |
-
unset
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
else
|
76 |
-
return apply_filters
|
77 |
}
|
78 |
}
|
79 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^merch_pmt$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_merch_pmt", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
56 |
$paypal["s2member_log"][] = "s2Member Pro handles Merch Pmts on-site, with an IPN proxy.";
|
57 |
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_merch_pmt", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
}
|
62 |
else // Else, this is a duplicate IPN. Must stop here.
|
63 |
{
|
67 |
}
|
68 |
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_merch_pmt", get_defined_vars ());
|
71 |
+
unset($__refs, $__v);
|
72 |
|
73 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
else
|
76 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_merch_pmt", false, get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
}
|
includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php
CHANGED
@@ -36,19 +36,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if ((!empty
|
44 |
-
&& ((!empty
|
45 |
-
&& (!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (!empty
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
@@ -60,8 +60,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_
|
|
60 |
$paypal["s2member_log"][] = "s2Member Pro handles this event on-site, with an IPN proxy.";
|
61 |
|
62 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
63 |
-
do_action
|
64 |
-
unset
|
65 |
}
|
66 |
else // Else, this is a duplicate IPN. Must stop here.
|
67 |
{
|
@@ -71,13 +71,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_
|
|
71 |
}
|
72 |
|
73 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
74 |
-
do_action
|
75 |
-
unset
|
76 |
|
77 |
-
return apply_filters
|
78 |
}
|
79 |
else
|
80 |
-
return apply_filters
|
81 |
}
|
82 |
}
|
83 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^recurring_payment_profile_created$/i", $paypal["txn_type"]))
|
44 |
+
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
+
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
+
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"]))))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_recurring_payment_profile_created", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
60 |
$paypal["s2member_log"][] = "s2Member Pro handles this event on-site, with an IPN proxy.";
|
61 |
|
62 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
63 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_recurring_payment_profile_created", get_defined_vars ());
|
64 |
+
unset($__refs, $__v);
|
65 |
}
|
66 |
else // Else, this is a duplicate IPN. Must stop here.
|
67 |
{
|
71 |
}
|
72 |
|
73 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
74 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created", get_defined_vars ());
|
75 |
+
unset($__refs, $__v);
|
76 |
|
77 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", $paypal, get_defined_vars ());
|
78 |
}
|
79 |
else
|
80 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_rec_profile_creation_w_level", false, get_defined_vars ());
|
81 |
}
|
82 |
}
|
83 |
}
|
includes/classes/paypal-notify-in-send-money.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_send_money"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -55,8 +55,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_send_money"))
|
|
55 |
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
|
56 |
|
57 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
58 |
-
do_action
|
59 |
-
unset
|
60 |
}
|
61 |
else // Else, this is a duplicate IPN. Must stop here.
|
62 |
{
|
@@ -66,13 +66,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_send_money"))
|
|
66 |
}
|
67 |
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
-
do_action
|
70 |
-
unset
|
71 |
|
72 |
-
return apply_filters
|
73 |
}
|
74 |
else
|
75 |
-
return apply_filters
|
76 |
}
|
77 |
}
|
78 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^send_money$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_send_money", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
55 |
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
|
56 |
|
57 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
58 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_send_money", get_defined_vars ());
|
59 |
+
unset($__refs, $__v);
|
60 |
}
|
61 |
else // Else, this is a duplicate IPN. Must stop here.
|
62 |
{
|
66 |
}
|
67 |
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_send_money", get_defined_vars ());
|
70 |
+
unset($__refs, $__v);
|
71 |
|
72 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
else
|
75 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_send_money", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
}
|
includes/classes/paypal-notify-in-sp-refund-reversal.inc.php
CHANGED
@@ -38,19 +38,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if (((!empty
|
46 |
-
|| (!empty
|
47 |
-
&& ((!empty
|
48 |
-
&& (!empty
|
49 |
-
&& (!empty
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
-
do_action
|
53 |
-
unset
|
54 |
|
55 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
56 |
{
|
@@ -66,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
66 |
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
|
67 |
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
|
68 |
*/
|
69 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"] && is_array
|
70 |
{
|
71 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url)
|
72 |
|
@@ -84,7 +84,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
84 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
|
85 |
}
|
86 |
|
87 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array
|
88 |
{
|
89 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal";
|
90 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -122,14 +122,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
122 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
123 |
|
124 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"]) as $recipient)
|
125 |
-
wp_mail ($recipient, apply_filters
|
126 |
|
127 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification Emails have been processed.";
|
128 |
}
|
129 |
|
130 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
131 |
-
do_action
|
132 |
-
unset
|
133 |
}
|
134 |
else // Else, this is a duplicate IPN. Must stop here.
|
135 |
{
|
@@ -139,13 +139,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal"))
|
|
139 |
}
|
140 |
|
141 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
142 |
-
do_action
|
143 |
-
unset
|
144 |
|
145 |
-
return apply_filters
|
146 |
}
|
147 |
else
|
148 |
-
return apply_filters
|
149 |
}
|
150 |
}
|
151 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if (((!empty($paypal["txn_type"]) && preg_match ("/^new_case$/i", $paypal["txn_type"]) && !empty($paypal["case_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"]))
|
46 |
+
|| (!empty($paypal["payment_status"]) && preg_match ("/^(refunded|reversed|reversal)$/i", $paypal["payment_status"])) /* The "txn_type" is irrelevant in these special situations. */)
|
47 |
+
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
48 |
+
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)) || ($paypal["item_name"] = $_SERVER["HTTP_HOST"]))
|
49 |
+
&& (!empty($paypal["payer_email"])) && (!empty($paypal["parent_txn_id"])))
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_refund_reversal", get_defined_vars ());
|
53 |
+
unset($__refs, $__v);
|
54 |
|
55 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
56 |
{
|
66 |
Since this routine ignores the processing check, it is *possible* that Refund/Reversal Notification URLs will be contacted more than once.
|
67 |
If you're writing scripts that depend on Refund/Reversal Notifications, please keep this in mind.
|
68 |
*/
|
69 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
70 |
{
|
71 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_urls"]) as $url)
|
72 |
|
84 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification URLs have been processed.";
|
85 |
}
|
86 |
|
87 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
88 |
{
|
89 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Refund/Reversal";
|
90 |
$msg .= "\n\n"; // Spacing in the message body.
|
122 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
123 |
|
124 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_ref_rev_notification_recipients"]) as $recipient)
|
125 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_ref_rev_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
126 |
|
127 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Refund/Reversal Notification Emails have been processed.";
|
128 |
}
|
129 |
|
130 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
131 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_refund_reversal", get_defined_vars ());
|
132 |
+
unset($__refs, $__v);
|
133 |
}
|
134 |
else // Else, this is a duplicate IPN. Must stop here.
|
135 |
{
|
139 |
}
|
140 |
|
141 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
142 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_refund_reversal", get_defined_vars ());
|
143 |
+
unset($__refs, $__v);
|
144 |
|
145 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", $paypal, get_defined_vars ());
|
146 |
}
|
147 |
else
|
148 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_sp_refund_reversal", false, get_defined_vars ());
|
149 |
}
|
150 |
}
|
151 |
}
|
includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php
CHANGED
@@ -38,17 +38,17 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (!empty
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
@@ -77,9 +77,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
77 |
$processing = $modifying = $during = true; // Yes, we ARE processing this.
|
78 |
|
79 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
80 |
-
do_action
|
81 |
-
do_action
|
82 |
-
unset
|
83 |
|
84 |
$fields = get_user_option ("s2member_custom_fields", $user_id); // These will be needed in the routines below.
|
85 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
@@ -87,7 +87,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
87 |
|
88 |
if (is_multisite () && !is_user_member_of_blog ($user_id)) // Must have a Role on this Blog.
|
89 |
{
|
90 |
-
add_existing_user_to_blog(array
|
91 |
$user = new WP_User ($user_id);
|
92 |
}
|
93 |
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
@@ -188,7 +188,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
188 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
189 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
190 |
{
|
191 |
-
if (is_array
|
192 |
{
|
193 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
194 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
@@ -202,12 +202,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
202 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
203 |
}
|
204 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
205 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters
|
206 |
|
207 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
208 |
}
|
209 |
}
|
210 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array
|
211 |
{
|
212 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
213 |
|
@@ -226,7 +226,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
226 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
227 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
228 |
{
|
229 |
-
if (is_array
|
230 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
231 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
232 |
break;
|
@@ -236,7 +236,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
236 |
}
|
237 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
238 |
}
|
239 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array
|
240 |
{
|
241 |
$msg = $sbj = "(s2Member / API Notification Email) - Modification";
|
242 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -262,7 +262,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
262 |
$msg .= "user_ip: %%user_ip%%\n";
|
263 |
$msg .= "user_id: %%user_id%%\n";
|
264 |
|
265 |
-
if (is_array
|
266 |
foreach ($fields as $var => $val)
|
267 |
$msg .= $var . ": %%" . $var . "%%\n";
|
268 |
|
@@ -292,7 +292,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
292 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
293 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
294 |
{
|
295 |
-
if (is_array
|
296 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
297 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
298 |
break;
|
@@ -300,12 +300,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
300 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
301 |
|
302 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
303 |
-
wp_mail ($recipient, apply_filters
|
304 |
}
|
305 |
|
306 |
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
307 |
}
|
308 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array
|
309 |
{
|
310 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
311 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
@@ -322,7 +322,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
322 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
323 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
324 |
{
|
325 |
-
if (is_array
|
326 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
327 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
328 |
break;
|
@@ -336,8 +336,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
336 |
}
|
337 |
}
|
338 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
339 |
-
do_action
|
340 |
-
unset
|
341 |
}
|
342 |
else
|
343 |
$paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
@@ -352,13 +352,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level
|
|
352 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
353 |
}
|
354 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
355 |
-
do_action
|
356 |
-
unset
|
357 |
|
358 |
-
return apply_filters
|
359 |
}
|
360 |
else
|
361 |
-
return apply_filters
|
362 |
}
|
363 |
}
|
364 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^subscr_modify$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
+
&& (!empty($paypal["subscr_id"])) && (!empty($paypal["payer_email"])))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
77 |
$processing = $modifying = $during = true; // Yes, we ARE processing this.
|
78 |
|
79 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
80 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify", get_defined_vars ());
|
81 |
+
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
|
82 |
+
unset($__refs, $__v);
|
83 |
|
84 |
$fields = get_user_option ("s2member_custom_fields", $user_id); // These will be needed in the routines below.
|
85 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
87 |
|
88 |
if (is_multisite () && !is_user_member_of_blog ($user_id)) // Must have a Role on this Blog.
|
89 |
{
|
90 |
+
add_existing_user_to_blog(array("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
|
91 |
$user = new WP_User ($user_id);
|
92 |
}
|
93 |
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
188 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
189 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
190 |
{
|
191 |
+
if (is_array($fields) && !empty($fields)) foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
192 |
{
|
193 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
194 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
202 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
203 |
}
|
204 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
205 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
206 |
|
207 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
208 |
}
|
209 |
}
|
210 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
211 |
{
|
212 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
213 |
|
226 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
227 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
228 |
{
|
229 |
+
if (is_array($fields) && !empty($fields))
|
230 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
231 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
232 |
break;
|
236 |
}
|
237 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
238 |
}
|
239 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
240 |
{
|
241 |
$msg = $sbj = "(s2Member / API Notification Email) - Modification";
|
242 |
$msg .= "\n\n"; // Spacing in the message body.
|
262 |
$msg .= "user_ip: %%user_ip%%\n";
|
263 |
$msg .= "user_id: %%user_id%%\n";
|
264 |
|
265 |
+
if (is_array($fields) && !empty($fields))
|
266 |
foreach ($fields as $var => $val)
|
267 |
$msg .= $var . ": %%" . $var . "%%\n";
|
268 |
|
292 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
293 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
294 |
{
|
295 |
+
if (is_array($fields) && !empty($fields))
|
296 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
297 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
298 |
break;
|
300 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
301 |
|
302 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
303 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
304 |
}
|
305 |
|
306 |
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
307 |
}
|
308 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
309 |
{
|
310 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
311 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
322 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
323 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
324 |
{
|
325 |
+
if (is_array($fields) && !empty($fields))
|
326 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
327 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
328 |
break;
|
336 |
}
|
337 |
}
|
338 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
339 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
|
340 |
+
unset($__refs, $__v);
|
341 |
}
|
342 |
else
|
343 |
$paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
352 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
353 |
}
|
354 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
355 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
|
356 |
+
unset($__refs, $__v);
|
357 |
|
358 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", $paypal, get_defined_vars ());
|
359 |
}
|
360 |
else
|
361 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_modify_w_level", false, get_defined_vars ());
|
362 |
}
|
363 |
}
|
364 |
}
|
includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php
CHANGED
@@ -38,22 +38,22 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& !(preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && !empty
|
47 |
-
&& ((!empty
|
48 |
-
&& (!empty
|
49 |
-
&& (!empty
|
50 |
-
&& (!empty
|
51 |
-
&& (!empty
|
52 |
-
&& (!empty
|
53 |
{
|
54 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
55 |
-
do_action
|
56 |
-
unset
|
57 |
|
58 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
59 |
{
|
@@ -83,13 +83,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
83 |
$paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
-
do_action
|
87 |
-
unset
|
88 |
}
|
89 |
else
|
90 |
$paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
|
91 |
|
92 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"] && is_array
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) // Handle Cancellation Notifications.
|
95 |
|
@@ -102,7 +102,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
102 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
103 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
104 |
{
|
105 |
-
if (is_array
|
106 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
107 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
108 |
break;
|
@@ -114,7 +114,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
114 |
$paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
|
115 |
}
|
116 |
|
117 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"] && is_array
|
118 |
{
|
119 |
$msg = $sbj = "(s2Member / API Notification Email) - Cancellation";
|
120 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -130,7 +130,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
130 |
$msg .= "user_ip: %%user_ip%%\n";
|
131 |
$msg .= "user_id: %%user_id%%\n";
|
132 |
|
133 |
-
if (is_array
|
134 |
foreach ($fields as $var => $val)
|
135 |
$msg .= $var . ": %%" . $var . "%%\n";
|
136 |
|
@@ -154,7 +154,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
154 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
155 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
156 |
{
|
157 |
-
if (is_array
|
158 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
159 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
160 |
break;
|
@@ -162,7 +162,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
162 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
163 |
|
164 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"]) as $recipient)
|
165 |
-
wp_mail ($recipient, apply_filters
|
166 |
}
|
167 |
|
168 |
$paypal["s2member_log"][] = "Cancellation Notification Emails have been processed.";
|
@@ -182,12 +182,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancella
|
|
182 |
}
|
183 |
|
184 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
185 |
-
do_action
|
186 |
-
unset
|
187 |
|
188 |
-
return apply_filters
|
189 |
}
|
190 |
-
else return apply_filters
|
191 |
}
|
192 |
}
|
193 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^(subscr_cancel|recurring_payment_profile_cancel|mp_cancel)$/i", $paypal["txn_type"]))
|
46 |
+
&& !(preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && !empty($paypal["initial_payment_status"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"]))
|
47 |
+
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
48 |
+
&& (!empty($paypal["period1"]) || ($paypal["period1"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period1 ($paypal)) || ($paypal["period1"] = "0 D"))
|
49 |
+
&& (!empty($paypal["period3"]) || ($paypal["period3"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_period3 ($paypal)))
|
50 |
+
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
51 |
+
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
52 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"]))))
|
53 |
{
|
54 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
55 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
|
56 |
+
unset($__refs, $__v);
|
57 |
|
58 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
59 |
{
|
83 |
$paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
|
87 |
+
unset($__refs, $__v);
|
88 |
}
|
89 |
else
|
90 |
$paypal["s2member_log"][] = "Ignoring Cancellation. An Auto-EOT Time is already set for this Member. An s2Member API Notification will still be processed however.";
|
91 |
|
92 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_urls"]) as $url) // Handle Cancellation Notifications.
|
95 |
|
102 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
103 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
104 |
{
|
105 |
+
if (is_array($fields) && !empty($fields))
|
106 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
107 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
108 |
break;
|
114 |
$paypal["s2member_log"][] = "Cancellation Notification URLs have been processed.";
|
115 |
}
|
116 |
|
117 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
118 |
{
|
119 |
$msg = $sbj = "(s2Member / API Notification Email) - Cancellation";
|
120 |
$msg .= "\n\n"; // Spacing in the message body.
|
130 |
$msg .= "user_ip: %%user_ip%%\n";
|
131 |
$msg .= "user_id: %%user_id%%\n";
|
132 |
|
133 |
+
if (is_array($fields) && !empty($fields))
|
134 |
foreach ($fields as $var => $val)
|
135 |
$msg .= $var . ": %%" . $var . "%%\n";
|
136 |
|
154 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
155 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
156 |
{
|
157 |
+
if (is_array($fields) && !empty($fields))
|
158 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
159 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
160 |
break;
|
162 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
163 |
|
164 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["cancellation_notification_recipients"]) as $recipient)
|
165 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_cancellation_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_cancellation_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
166 |
}
|
167 |
|
168 |
$paypal["s2member_log"][] = "Cancellation Notification Emails have been processed.";
|
182 |
}
|
183 |
|
184 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
185 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
|
186 |
+
unset($__refs, $__v);
|
187 |
|
188 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level", $paypal, get_defined_vars ());
|
189 |
}
|
190 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_cancellation_w_level", false, get_defined_vars ());
|
191 |
}
|
192 |
}
|
193 |
}
|
includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php
CHANGED
@@ -55,7 +55,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
55 |
{
|
56 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
57 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars());
|
58 |
-
unset
|
59 |
|
60 |
if(!get_transient($transient_ipn = "s2m_ipn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10))
|
61 |
{
|
@@ -111,7 +111,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
111 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", get_defined_vars());
|
112 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), $eot_del_type, "modification", $demotion_role);
|
113 |
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars(), $eot_del_type, "modification");
|
114 |
-
unset
|
115 |
|
116 |
if($existing_role !== $demotion_role) // Only if NOT the existing Role.
|
117 |
$user->set_role($demotion_role); // Give User the demotion Role.
|
@@ -219,7 +219,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
219 |
}
|
220 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
221 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars());
|
222 |
-
unset
|
223 |
}
|
224 |
else if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
225 |
{
|
@@ -231,7 +231,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
231 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
232 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_delete", get_defined_vars());
|
233 |
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars(), $eot_del_type, "removal-deletion");
|
234 |
-
unset
|
235 |
|
236 |
if(is_multisite()) // Multisite does NOT actually delete; ONLY removes.
|
237 |
{
|
@@ -250,11 +250,11 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
250 |
|
251 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
252 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars());
|
253 |
-
unset
|
254 |
}
|
255 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot", get_defined_vars());
|
257 |
-
unset
|
258 |
}
|
259 |
else // Otherwise, treat this as if it were a cancellation. EOTs are currently disabled.
|
260 |
{
|
@@ -267,7 +267,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
267 |
|
268 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
269 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars());
|
270 |
-
unset
|
271 |
}
|
272 |
}
|
273 |
else
|
@@ -288,7 +288,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delayed", get_defined_vars());
|
291 |
-
unset
|
292 |
}
|
293 |
else
|
294 |
$paypal["s2member_log"][] = "Ignoring Delayed EOT. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
@@ -413,7 +413,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
413 |
}
|
414 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
415 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars());
|
416 |
-
unset
|
417 |
}
|
418 |
}
|
419 |
else // Else, this is a duplicate IPN. Must stop here.
|
@@ -424,7 +424,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_lev
|
|
424 |
}
|
425 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
426 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_eot", get_defined_vars());
|
427 |
-
unset
|
428 |
|
429 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level", $paypal, get_defined_vars());
|
430 |
}
|
55 |
{
|
56 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
57 |
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_eot", get_defined_vars());
|
58 |
+
unset($__refs, $__v);
|
59 |
|
60 |
if(!get_transient($transient_ipn = "s2m_ipn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_ipn, time(), 31556926 * 10))
|
61 |
{
|
111 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_demote", get_defined_vars());
|
112 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), $eot_del_type, "modification", $demotion_role);
|
113 |
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars(), $eot_del_type, "modification");
|
114 |
+
unset($__refs, $__v);
|
115 |
|
116 |
if($existing_role !== $demotion_role) // Only if NOT the existing Role.
|
117 |
$user->set_role($demotion_role); // Give User the demotion Role.
|
219 |
}
|
220 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
221 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars());
|
222 |
+
unset($__refs, $__v);
|
223 |
}
|
224 |
else if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
225 |
{
|
231 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
232 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_before_delete", get_defined_vars());
|
233 |
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars(), $eot_del_type, "removal-deletion");
|
234 |
+
unset($__refs, $__v);
|
235 |
|
236 |
if(is_multisite()) // Multisite does NOT actually delete; ONLY removes.
|
237 |
{
|
250 |
|
251 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
252 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars());
|
253 |
+
unset($__refs, $__v);
|
254 |
}
|
255 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot", get_defined_vars());
|
257 |
+
unset($__refs, $__v);
|
258 |
}
|
259 |
else // Otherwise, treat this as if it were a cancellation. EOTs are currently disabled.
|
260 |
{
|
267 |
|
268 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
269 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars());
|
270 |
+
unset($__refs, $__v);
|
271 |
}
|
272 |
}
|
273 |
else
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_delayed", get_defined_vars());
|
291 |
+
unset($__refs, $__v);
|
292 |
}
|
293 |
else
|
294 |
$paypal["s2member_log"][] = "Ignoring Delayed EOT. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
413 |
}
|
414 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
415 |
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars());
|
416 |
+
unset($__refs, $__v);
|
417 |
}
|
418 |
}
|
419 |
else // Else, this is a duplicate IPN. Must stop here.
|
424 |
}
|
425 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
426 |
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_eot", get_defined_vars());
|
427 |
+
unset($__refs, $__v);
|
428 |
|
429 |
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_eots_w_level", $paypal, get_defined_vars());
|
430 |
}
|
includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php
CHANGED
@@ -36,19 +36,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if ((!empty
|
44 |
-
&& ((!empty
|
45 |
-
&& (!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (!empty
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
@@ -61,8 +61,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
61 |
$paypal["s2member_log"][] = "When multiple consecutive payments fail, a special IPN response will be triggered.";
|
62 |
|
63 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
64 |
-
do_action
|
65 |
-
unset
|
66 |
}
|
67 |
else // Else, this is a duplicate IPN. Must stop here.
|
68 |
{
|
@@ -72,13 +72,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
72 |
}
|
73 |
|
74 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
75 |
-
do_action
|
76 |
-
unset
|
77 |
|
78 |
-
return apply_filters
|
79 |
}
|
80 |
else
|
81 |
-
return apply_filters
|
82 |
}
|
83 |
}
|
84 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^(subscr_failed|recurring_payment_failed|recurring_payment_skipped)$/i", $paypal["txn_type"]))
|
44 |
+
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
45 |
+
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
46 |
+
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
47 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"]))))
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_failed", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
54 |
{
|
61 |
$paypal["s2member_log"][] = "When multiple consecutive payments fail, a special IPN response will be triggered.";
|
62 |
|
63 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
64 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_failed", get_defined_vars ());
|
65 |
+
unset($__refs, $__v);
|
66 |
}
|
67 |
else // Else, this is a duplicate IPN. Must stop here.
|
68 |
{
|
72 |
}
|
73 |
|
74 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
75 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_failed", get_defined_vars ());
|
76 |
+
unset($__refs, $__v);
|
77 |
|
78 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", $paypal, get_defined_vars ());
|
79 |
}
|
80 |
else
|
81 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_failed_w_level", false, get_defined_vars ());
|
82 |
}
|
83 |
}
|
84 |
}
|
includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php
CHANGED
@@ -38,21 +38,21 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& ((!empty
|
47 |
-
&& (!empty
|
48 |
-
&& (empty
|
49 |
-
&& (!empty
|
50 |
-
&& (!empty
|
51 |
-
&& (!empty
|
52 |
{
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
-
do_action
|
55 |
-
unset
|
56 |
|
57 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
58 |
{
|
@@ -89,7 +89,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
89 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
90 |
$user_reg_ip = $paypal["ip"] = ($user_reg_ip) ? $user_reg_ip : $paypal["ip"]; // Now merge conditionally.
|
91 |
|
92 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
95 |
|
@@ -107,7 +107,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
107 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
108 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
109 |
{
|
110 |
-
if (is_array
|
111 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
112 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
113 |
break;
|
@@ -120,7 +120,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
120 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
121 |
}
|
122 |
|
123 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array
|
124 |
{
|
125 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
126 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -143,7 +143,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
143 |
$msg .= "user_ip: %%user_ip%%\n";
|
144 |
$msg .= "user_id: %%user_id%%\n";
|
145 |
|
146 |
-
if (is_array
|
147 |
foreach ($fields as $var => $val)
|
148 |
$msg .= $var . ": %%" . $var . "%%\n";
|
149 |
|
@@ -172,7 +172,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
172 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
173 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
174 |
{
|
175 |
-
if (is_array
|
176 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
177 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
178 |
break;
|
@@ -180,7 +180,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
180 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
181 |
|
182 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
183 |
-
wp_mail ($recipient, apply_filters
|
184 |
}
|
185 |
}
|
186 |
|
@@ -188,17 +188,17 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
188 |
}
|
189 |
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
-
do_action
|
192 |
-
unset
|
193 |
}
|
194 |
else // Otherwise, we need to re-generate/store this IPN into a Transient Queue. Then re-process it on registration.
|
195 |
{
|
196 |
$paypal["s2member_log"][] = "Skipping this IPN response, for now. The Subscr. ID is not associated with a registered Member.";
|
197 |
|
198 |
-
$ipn = array
|
199 |
|
200 |
foreach ($paypal as $var => $val)
|
201 |
-
if (in_array
|
202 |
$ipn[$var] = $val;
|
203 |
|
204 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
@@ -214,13 +214,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_
|
|
214 |
}
|
215 |
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
-
do_action
|
218 |
-
unset
|
219 |
|
220 |
-
return apply_filters
|
221 |
}
|
222 |
else
|
223 |
-
return apply_filters
|
224 |
}
|
225 |
}
|
226 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^(subscr_payment|recurring_payment)$/i", $paypal["txn_type"]))
|
46 |
+
&& ((!empty($paypal["item_number"]) || ($paypal["item_number"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_number ($paypal))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
+
&& (!empty($paypal["subscr_id"]) || ($paypal["subscr_id"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_subscr_id ($paypal)))
|
48 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
49 |
+
&& (!empty($paypal["item_name"]) || ($paypal["item_name"] = c_ws_plugin__s2member_paypal_utilities::paypal_pro_item_name ($paypal)))
|
50 |
+
&& (!empty($paypal["payer_email"]) || ($paypal["payer_email"] = c_ws_plugin__s2member_utils_users::get_user_email_with ($paypal["subscr_id"])))
|
51 |
+
&& (!empty($paypal["txn_id"])) && (!empty($paypal["mc_gross"])))
|
52 |
{
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_payment", get_defined_vars ());
|
55 |
+
unset($__refs, $__v);
|
56 |
|
57 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
58 |
{
|
89 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
90 |
$user_reg_ip = $paypal["ip"] = ($user_reg_ip) ? $user_reg_ip : $paypal["ip"]; // Now merge conditionally.
|
91 |
|
92 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
93 |
{
|
94 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
95 |
|
107 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
108 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
109 |
{
|
110 |
+
if (is_array($fields) && !empty($fields))
|
111 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
112 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
113 |
break;
|
120 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
121 |
}
|
122 |
|
123 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
124 |
{
|
125 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
126 |
$msg .= "\n\n"; // Spacing in the message body.
|
143 |
$msg .= "user_ip: %%user_ip%%\n";
|
144 |
$msg .= "user_id: %%user_id%%\n";
|
145 |
|
146 |
+
if (is_array($fields) && !empty($fields))
|
147 |
foreach ($fields as $var => $val)
|
148 |
$msg .= $var . ": %%" . $var . "%%\n";
|
149 |
|
172 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
173 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
174 |
{
|
175 |
+
if (is_array($fields) && !empty($fields))
|
176 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
177 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
178 |
break;
|
180 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
181 |
|
182 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
183 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
184 |
}
|
185 |
}
|
186 |
|
188 |
}
|
189 |
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
|
192 |
+
unset($__refs, $__v);
|
193 |
}
|
194 |
else // Otherwise, we need to re-generate/store this IPN into a Transient Queue. Then re-process it on registration.
|
195 |
{
|
196 |
$paypal["s2member_log"][] = "Skipping this IPN response, for now. The Subscr. ID is not associated with a registered Member.";
|
197 |
|
198 |
+
$ipn = array("txn_type" => "subscr_payment"); // Create a simulated IPN response for txn_type=subscr_payment.
|
199 |
|
200 |
foreach ($paypal as $var => $val)
|
201 |
+
if (in_array($var, array("subscr_gateway", "subscr_id", "txn_id", "custom", "invoice", "mc_gross", "mc_currency", "tax", "payer_email", "first_name", "last_name", "item_name", "item_number", "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
202 |
$ipn[$var] = $val;
|
203 |
|
204 |
$paypal["s2member_log"][] = "Re-generating. This IPN will go into a Transient Queue; and be re-processed during registration.";
|
214 |
}
|
215 |
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
|
218 |
+
unset($__refs, $__v);
|
219 |
|
220 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", $paypal, get_defined_vars ());
|
221 |
}
|
222 |
else
|
223 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_rp_payment_w_level", false, get_defined_vars ());
|
224 |
}
|
225 |
}
|
226 |
}
|
includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php
CHANGED
@@ -38,19 +38,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (!empty
|
48 |
-
&& (empty
|
49 |
-
&& (!empty
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
-
do_action
|
53 |
-
unset
|
54 |
|
55 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
56 |
{
|
@@ -84,8 +84,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
84 |
// PayPal will not allow the `modify=1|2` parameter to be used in those scenarios, because technically there is no billing to update; only the account.
|
85 |
{
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
-
do_action
|
88 |
-
unset
|
89 |
|
90 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/ update vars.";
|
91 |
|
@@ -96,9 +96,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
96 |
$processing = $modifying = $during = /* Yes, we ARE processing this. */ true;
|
97 |
|
98 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
99 |
-
do_action
|
100 |
-
do_action
|
101 |
-
unset
|
102 |
|
103 |
$fields = /* These will be needed in the routines below. */get_user_option ("s2member_custom_fields", $user_id);
|
104 |
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
@@ -106,7 +106,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
106 |
|
107 |
if (is_multisite () && !is_user_member_of_blog ($user_id) /* Must have a Role on this Blog. */)
|
108 |
{
|
109 |
-
add_existing_user_to_blog (array
|
110 |
$user = new WP_User ($user_id);
|
111 |
}
|
112 |
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
@@ -219,7 +219,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
219 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
220 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
221 |
{
|
222 |
-
if (is_array
|
223 |
{
|
224 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
225 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
@@ -233,12 +233,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
233 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
234 |
}
|
235 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
236 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters
|
237 |
|
238 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
239 |
}
|
240 |
}
|
241 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array
|
242 |
{
|
243 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
244 |
|
@@ -259,7 +259,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
259 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
260 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
261 |
{
|
262 |
-
if (is_array
|
263 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
264 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
265 |
break;
|
@@ -269,7 +269,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
269 |
}
|
270 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
271 |
}
|
272 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array
|
273 |
{
|
274 |
$msg = $sbj = "(s2Member / API Notification Email) - Modification";
|
275 |
$msg .= /* Spacing in the message body. */"\n\n";
|
@@ -299,7 +299,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
299 |
$msg .= "user_ip: %%user_ip%%\n";
|
300 |
$msg .= "user_id: %%user_id%%\n";
|
301 |
|
302 |
-
if (is_array
|
303 |
foreach ($fields as $var => $val)
|
304 |
$msg .= $var . ": %%" . $var . "%%\n";
|
305 |
|
@@ -331,7 +331,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
331 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
332 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
333 |
{
|
334 |
-
if (is_array
|
335 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
336 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
337 |
break;
|
@@ -339,11 +339,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
339 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
340 |
|
341 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
342 |
-
wp_mail ($recipient, apply_filters
|
343 |
}
|
344 |
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
345 |
}
|
346 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array
|
347 |
{
|
348 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
349 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
@@ -362,7 +362,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
362 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
363 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
364 |
{
|
365 |
-
if (is_array
|
366 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
367 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
368 |
break;
|
@@ -375,16 +375,16 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
375 |
}
|
376 |
}
|
377 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
378 |
-
do_action
|
379 |
-
unset
|
380 |
}
|
381 |
else $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
382 |
}
|
383 |
else $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
|
384 |
|
385 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
386 |
-
do_action
|
387 |
-
unset
|
388 |
}
|
389 |
/*
|
390 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
@@ -392,12 +392,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
392 |
else // Else this is a normal Subscription signup, we are not updating anything.
|
393 |
{
|
394 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
395 |
-
do_action
|
396 |
-
unset
|
397 |
|
398 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.";
|
399 |
|
400 |
-
if (($registration_url = c_ws_plugin__s2member_register_access::register_link_gen ($paypal["subscr_gateway"], $paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array
|
401 |
{
|
402 |
$processing = $during = /* Yes, we ARE processing this. */true;
|
403 |
|
@@ -449,11 +449,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
449 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
450 |
}
|
451 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
452 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters
|
453 |
|
454 |
$paypal["s2member_log"][] = "Signup Confirmation Email sent to: " . $rec . ".";
|
455 |
}
|
456 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array
|
457 |
{
|
458 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
|
459 |
|
@@ -472,7 +472,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
472 |
|
473 |
$paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
|
474 |
}
|
475 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"] && is_array
|
476 |
{
|
477 |
$msg = $sbj = "(s2Member / API Notification Email) - Signup";
|
478 |
$msg .= /* Spacing in the message body. */ "\n\n";
|
@@ -519,11 +519,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
519 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
520 |
|
521 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"]) as $recipient)
|
522 |
-
wp_mail ($recipient, apply_filters
|
523 |
|
524 |
$paypal["s2member_log"][] = "Signup Notification Emails have been processed.";
|
525 |
}
|
526 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array
|
527 |
{
|
528 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
529 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
@@ -542,16 +542,16 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
542 |
}
|
543 |
}
|
544 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
545 |
-
do_action
|
546 |
-
unset
|
547 |
}
|
548 |
else $paypal["s2member_log"][] = "Unable to generate Registration URL for Membership Access. Possible data corruption within the IPN response.";
|
549 |
|
550 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
551 |
-
do_action
|
552 |
-
unset
|
553 |
}
|
554 |
-
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array
|
555 |
{
|
556 |
if (($user_id && is_object ($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID))
|
557 |
{
|
@@ -576,7 +576,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
576 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
577 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
578 |
{
|
579 |
-
if (is_array
|
580 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
581 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
582 |
break;
|
@@ -607,7 +607,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
607 |
$fields = /* These will be needed in the routines below. */ get_user_option ("s2member_custom_fields", $user_id);
|
608 |
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
609 |
|
610 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array
|
611 |
{
|
612 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
613 |
|
@@ -627,7 +627,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
627 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
628 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
629 |
{
|
630 |
-
if (is_array
|
631 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
632 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
633 |
break;
|
@@ -637,7 +637,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
637 |
}
|
638 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
639 |
}
|
640 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array
|
641 |
{
|
642 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
643 |
$msg .= /* Spacing in the message body. */"\n\n";
|
@@ -664,7 +664,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
664 |
$msg .= "user_ip: %%user_ip%%\n";
|
665 |
$msg .= "user_id: %%user_id%%\n";
|
666 |
|
667 |
-
if (is_array
|
668 |
foreach ($fields as $var => $val)
|
669 |
$msg .= $var . ": %%" . $var . "%%\n";
|
670 |
|
@@ -695,7 +695,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
695 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
696 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
697 |
{
|
698 |
-
if (is_array
|
699 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
700 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
701 |
break;
|
@@ -703,7 +703,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
703 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
704 |
|
705 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
706 |
-
wp_mail ($recipient, apply_filters
|
707 |
}
|
708 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
709 |
}
|
@@ -713,10 +713,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
713 |
{
|
714 |
$paypal["s2member_log"][] = "Storing `payment` for Subscription via ( `" . ((preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . "` ).";
|
715 |
|
716 |
-
$ipn = /* Create a simulated IPN response for txn_type=subscr_payment. */array
|
717 |
|
718 |
foreach ($paypal as $var => $val)
|
719 |
-
if (in_array
|
720 |
$ipn[$var] = $val;
|
721 |
|
722 |
$paypal["s2member_log"][] = "Creating an IPN response for `subscr_payment`. This will go into a Transient Queue; and be processed during registration.";
|
@@ -744,12 +744,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level"
|
|
744 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
745 |
}
|
746 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
747 |
-
do_action
|
748 |
-
unset
|
749 |
|
750 |
-
return apply_filters
|
751 |
}
|
752 |
-
else return apply_filters
|
753 |
}
|
754 |
}
|
755 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], $paypal["item_number"]))
|
47 |
+
&& (!empty($paypal["subscr_id"]) || (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])))
|
48 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
49 |
+
&& (!empty($paypal["payer_email"])))
|
50 |
{
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_signup", get_defined_vars ());
|
53 |
+
unset($__refs, $__v);
|
54 |
|
55 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
56 |
{
|
84 |
// PayPal will not allow the `modify=1|2` parameter to be used in those scenarios, because technically there is no billing to update; only the account.
|
85 |
{
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars", get_defined_vars ());
|
88 |
+
unset($__refs, $__v);
|
89 |
|
90 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/ update vars.";
|
91 |
|
96 |
$processing = $modifying = $during = /* Yes, we ARE processing this. */ true;
|
97 |
|
98 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
99 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars", get_defined_vars ());
|
100 |
+
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), "ipn-upgrade-downgrade", "modification", "s2member_level" . $paypal["level"]);
|
101 |
+
unset($__refs, $__v);
|
102 |
|
103 |
$fields = /* These will be needed in the routines below. */get_user_option ("s2member_custom_fields", $user_id);
|
104 |
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
106 |
|
107 |
if (is_multisite () && !is_user_member_of_blog ($user_id) /* Must have a Role on this Blog. */)
|
108 |
{
|
109 |
+
add_existing_user_to_blog (array("user_id" => $user_id, "role" => "s2member_level" . $paypal["level"]));
|
110 |
$user = new WP_User ($user_id);
|
111 |
}
|
112 |
$current_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
219 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
220 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
221 |
{
|
222 |
+
if (is_array($fields) && !empty($fields)) foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
223 |
{
|
224 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
225 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
233 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
234 |
}
|
235 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
236 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
237 |
|
238 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to: " . $rec . ".";
|
239 |
}
|
240 |
}
|
241 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
242 |
{
|
243 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_urls"]) as $url)
|
244 |
|
259 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
260 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
261 |
{
|
262 |
+
if (is_array($fields) && !empty($fields))
|
263 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
264 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
265 |
break;
|
269 |
}
|
270 |
$paypal["s2member_log"][] = "Modification Notification URLs have been processed.";
|
271 |
}
|
272 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
273 |
{
|
274 |
$msg = $sbj = "(s2Member / API Notification Email) - Modification";
|
275 |
$msg .= /* Spacing in the message body. */"\n\n";
|
299 |
$msg .= "user_ip: %%user_ip%%\n";
|
300 |
$msg .= "user_id: %%user_id%%\n";
|
301 |
|
302 |
+
if (is_array($fields) && !empty($fields))
|
303 |
foreach ($fields as $var => $val)
|
304 |
$msg .= $var . ": %%" . $var . "%%\n";
|
305 |
|
331 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
332 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
333 |
{
|
334 |
+
if (is_array($fields) && !empty($fields))
|
335 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
336 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
337 |
break;
|
339 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
340 |
|
341 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_notification_recipients"]) as $recipient)
|
342 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_modification_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_modification_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
343 |
}
|
344 |
$paypal["s2member_log"][] = "Modification Notification Emails have been processed.";
|
345 |
}
|
346 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["modification_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
347 |
{
|
348 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
349 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
362 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
363 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
364 |
{
|
365 |
+
if (is_array($fields) && !empty($fields))
|
366 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
367 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
368 |
break;
|
375 |
}
|
376 |
}
|
377 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
378 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
|
379 |
+
unset($__refs, $__v);
|
380 |
}
|
381 |
else $paypal["s2member_log"][] = "Unable to modify Subscription. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
382 |
}
|
383 |
else $paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB. Please check the `on0` and `os0` variables in your Button Code.";
|
384 |
|
385 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
386 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
|
387 |
+
unset($__refs, $__v);
|
388 |
}
|
389 |
/*
|
390 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
392 |
else // Else this is a normal Subscription signup, we are not updating anything.
|
393 |
{
|
394 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
395 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
|
396 |
+
unset($__refs, $__v);
|
397 |
|
398 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup` ) w/o update vars.";
|
399 |
|
400 |
+
if (($registration_url = c_ws_plugin__s2member_register_access::register_link_gen ($paypal["subscr_gateway"], $paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
401 |
{
|
402 |
$processing = $during = /* Yes, we ARE processing this. */true;
|
403 |
|
449 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
450 |
}
|
451 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
452 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_signup_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_signup_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
453 |
|
454 |
$paypal["s2member_log"][] = "Signup Confirmation Email sent to: " . $rec . ".";
|
455 |
}
|
456 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
457 |
{
|
458 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"]) as $url)
|
459 |
|
472 |
|
473 |
$paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
|
474 |
}
|
475 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
476 |
{
|
477 |
$msg = $sbj = "(s2Member / API Notification Email) - Signup";
|
478 |
$msg .= /* Spacing in the message body. */ "\n\n";
|
519 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
520 |
|
521 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_recipients"]) as $recipient)
|
522 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_signup_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_signup_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
523 |
|
524 |
$paypal["s2member_log"][] = "Signup Notification Emails have been processed.";
|
525 |
}
|
526 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
527 |
{
|
528 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
529 |
if (($code = preg_replace ("/%%initial%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["initial"]), $code)) && ($code = preg_replace ("/%%regular%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["regular"]), $code)) && ($code = preg_replace ("/%%recurring%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["recurring"]), $code)))
|
542 |
}
|
543 |
}
|
544 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
545 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
|
546 |
+
unset($__refs, $__v);
|
547 |
}
|
548 |
else $paypal["s2member_log"][] = "Unable to generate Registration URL for Membership Access. Possible data corruption within the IPN response.";
|
549 |
|
550 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
551 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
|
552 |
+
unset($__refs, $__v);
|
553 |
}
|
554 |
+
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
555 |
{
|
556 |
if (($user_id && is_object ($user) && $user->ID) || (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["subscr_id"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID))
|
557 |
{
|
576 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
577 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
578 |
{
|
579 |
+
if (is_array($fields) && !empty($fields))
|
580 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
581 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
582 |
break;
|
607 |
$fields = /* These will be needed in the routines below. */ get_user_option ("s2member_custom_fields", $user_id);
|
608 |
$user_reg_ip = /* Original IP during Registration. */get_user_option ("s2member_registration_ip", $user_id);
|
609 |
|
610 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
611 |
{
|
612 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
613 |
|
627 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
628 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
629 |
{
|
630 |
+
if (is_array($fields) && !empty($fields))
|
631 |
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
632 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
633 |
break;
|
637 |
}
|
638 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
639 |
}
|
640 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
641 |
{
|
642 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
643 |
$msg .= /* Spacing in the message body. */"\n\n";
|
664 |
$msg .= "user_ip: %%user_ip%%\n";
|
665 |
$msg .= "user_id: %%user_id%%\n";
|
666 |
|
667 |
+
if (is_array($fields) && !empty($fields))
|
668 |
foreach ($fields as $var => $val)
|
669 |
$msg .= $var . ": %%" . $var . "%%\n";
|
670 |
|
695 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
696 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
697 |
{
|
698 |
+
if (is_array($fields) && !empty($fields))
|
699 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
700 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
701 |
break;
|
703 |
if /* Still have a ``$sbj`` and a ``$msg``? */($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
704 |
|
705 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
706 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
707 |
}
|
708 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
709 |
}
|
713 |
{
|
714 |
$paypal["s2member_log"][] = "Storing `payment` for Subscription via ( `" . ((preg_match ("/^web_accept$/i", $paypal["txn_type"])) ? "web_accept" : "subscr-signup-as-subscr-payment") . "` ).";
|
715 |
|
716 |
+
$ipn = /* Create a simulated IPN response for txn_type=subscr_payment. */array("txn_type" => "subscr_payment");
|
717 |
|
718 |
foreach ($paypal as $var => $val)
|
719 |
+
if (in_array($var, array("subscr_gateway", "subscr_id", "txn_id", "custom", "invoice", "mc_gross", "mc_currency", "tax", "payer_email", "first_name", "last_name", "item_name", "item_number", "option_name1", "option_selection1", "option_name2", "option_selection2")))
|
720 |
$ipn[$var] = $val;
|
721 |
|
722 |
$paypal["s2member_log"][] = "Creating an IPN response for `subscr_payment`. This will go into a Transient Queue; and be processed during registration.";
|
744 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
745 |
}
|
746 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
747 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
|
748 |
+
unset($__refs, $__v);
|
749 |
|
750 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level", $paypal, get_defined_vars ());
|
751 |
}
|
752 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_subscr_or_wa_w_level", false, get_defined_vars ());
|
753 |
}
|
754 |
}
|
755 |
}
|
includes/classes/paypal-notify-in-virtual-terminal.inc.php
CHANGED
@@ -36,15 +36,15 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function cp ($vars = array
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
-
if (!empty
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
@@ -55,8 +55,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal"))
|
|
55 |
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
|
56 |
|
57 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
58 |
-
do_action
|
59 |
-
unset
|
60 |
}
|
61 |
else // Else, this is a duplicate IPN. Must stop here.
|
62 |
{
|
@@ -66,13 +66,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal"))
|
|
66 |
}
|
67 |
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
-
do_action
|
70 |
-
unset
|
71 |
|
72 |
-
return apply_filters
|
73 |
}
|
74 |
else
|
75 |
-
return apply_filters
|
76 |
}
|
77 |
}
|
78 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_notify_in::paypal_notify()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
40 |
{
|
41 |
extract($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
|
43 |
+
if (!empty($paypal["txn_type"]) && preg_match ("/^virtual_terminal$/i", $paypal["txn_type"]))
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_virtual_terminal", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
50 |
{
|
55 |
$paypal["s2member_log"][] = "The `txn_type` does not require any action on the part of s2Member.";
|
56 |
|
57 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
58 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_virtual_terminal", get_defined_vars ());
|
59 |
+
unset($__refs, $__v);
|
60 |
}
|
61 |
else // Else, this is a duplicate IPN. Must stop here.
|
62 |
{
|
66 |
}
|
67 |
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_virtual_terminal", get_defined_vars ());
|
70 |
+
unset($__refs, $__v);
|
71 |
|
72 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", $paypal, get_defined_vars ());
|
73 |
}
|
74 |
else
|
75 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_virtual_terminal", false, get_defined_vars ());
|
76 |
}
|
77 |
}
|
78 |
}
|
includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php
CHANGED
@@ -38,18 +38,18 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (empty
|
48 |
-
&& (!empty
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
-
do_action
|
52 |
-
unset
|
53 |
|
54 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
55 |
{
|
@@ -69,8 +69,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
69 |
$processing = $during = true; // Yes, we ARE processing this.
|
70 |
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
-
do_action
|
73 |
-
unset
|
74 |
|
75 |
$fields = get_user_option ("s2member_custom_fields", $user_id); // These will be needed in the routines below.
|
76 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
78 |
|
79 |
if (is_multisite () && !is_user_member_of_blog ($user_id)) // Must have a Role on this Blog.
|
80 |
{
|
81 |
-
add_existing_user_to_blog (array
|
82 |
$user = new WP_User ($user_id);
|
83 |
}
|
84 |
if ($paypal["ccaps"] && preg_match ("/^-all/", str_replace ("+", "", $paypal["ccaps"])))
|
@@ -148,7 +148,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
148 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
149 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
150 |
{
|
151 |
-
if (is_array
|
152 |
{
|
153 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
154 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
@@ -162,12 +162,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
162 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
163 |
}
|
164 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
165 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters
|
166 |
|
167 |
$paypal["s2member_log"][] = "Capability Confirmation Email sent to: " . $rec . ".";
|
168 |
}
|
169 |
}
|
170 |
-
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array
|
171 |
{
|
172 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
|
173 |
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["txn_id"])), $url)))
|
@@ -185,7 +185,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
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
|
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;
|
@@ -196,7 +196,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
196 |
}
|
197 |
$paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
|
198 |
}
|
199 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array
|
200 |
{
|
201 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
202 |
|
@@ -216,7 +216,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
216 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
217 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
218 |
{
|
219 |
-
if (is_array
|
220 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
221 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
222 |
break;
|
@@ -226,7 +226,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
226 |
}
|
227 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
228 |
}
|
229 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array
|
230 |
{
|
231 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
232 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -253,7 +253,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
253 |
$msg .= "user_ip: %%user_ip%%\n";
|
254 |
$msg .= "user_id: %%user_id%%\n";
|
255 |
|
256 |
-
if (is_array
|
257 |
foreach ($fields as $var => $val)
|
258 |
$msg .= $var . ": %%" . $var . "%%\n";
|
259 |
|
@@ -284,7 +284,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
284 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
285 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
286 |
{
|
287 |
-
if (is_array
|
288 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
289 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
290 |
break;
|
@@ -292,11 +292,11 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
292 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
293 |
|
294 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
295 |
-
wp_mail ($recipient, apply_filters
|
296 |
}
|
297 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
298 |
}
|
299 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array
|
300 |
{
|
301 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
302 |
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
@@ -314,7 +314,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
314 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
315 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
316 |
{
|
317 |
-
if (is_array
|
318 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
319 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
320 |
break;
|
@@ -327,8 +327,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
327 |
}
|
328 |
}
|
329 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
330 |
-
do_action
|
331 |
-
unset
|
332 |
}
|
333 |
else
|
334 |
$paypal["s2member_log"][] = "Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
@@ -346,12 +346,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level"))
|
|
346 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
347 |
}
|
348 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
349 |
-
do_action
|
350 |
-
unset
|
351 |
|
352 |
-
return apply_filters
|
353 |
}
|
354 |
-
else return apply_filters
|
355 |
}
|
356 |
}
|
357 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
47 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
+
&& (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && (!empty($paypal["payer_email"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_new_ccaps", get_defined_vars ());
|
52 |
+
unset($__refs, $__v);
|
53 |
|
54 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
55 |
{
|
69 |
$processing = $during = true; // Yes, we ARE processing this.
|
70 |
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_before_new_ccaps", get_defined_vars ());
|
73 |
+
unset($__refs, $__v);
|
74 |
|
75 |
$fields = get_user_option ("s2member_custom_fields", $user_id); // These will be needed in the routines below.
|
76 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // Original IP during Registration.
|
78 |
|
79 |
if (is_multisite () && !is_user_member_of_blog ($user_id)) // Must have a Role on this Blog.
|
80 |
{
|
81 |
+
add_existing_user_to_blog (array("user_id" => $user_id, "role" => get_option ("default_role")));
|
82 |
$user = new WP_User ($user_id);
|
83 |
}
|
84 |
if ($paypal["ccaps"] && preg_match ("/^-all/", str_replace ("+", "", $paypal["ccaps"])))
|
148 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
149 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
150 |
{
|
151 |
+
if (is_array($fields) && !empty($fields)) foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
152 |
{
|
153 |
$rec = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $rec);
|
154 |
$sbj = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $sbj);
|
162 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
163 |
}
|
164 |
foreach /* Go through a possible list of recipients. */(c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient)
|
165 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_capabilities_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_capabilities_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
166 |
|
167 |
$paypal["s2member_log"][] = "Capability Confirmation Email sent to: " . $rec . ".";
|
168 |
}
|
169 |
}
|
170 |
+
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
171 |
{
|
172 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["subscr_id"])), $url)))
|
173 |
if (($url = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["mc_gross"])), $url)) && ($url = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($paypal["txn_id"])), $url)))
|
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;
|
196 |
}
|
197 |
$paypal["s2member_log"][] = "Capability Return, a Proxy Return URL is ready.";
|
198 |
}
|
199 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
200 |
{
|
201 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_urls"]) as $url)
|
202 |
|
216 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
217 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
218 |
{
|
219 |
+
if (is_array($fields) && !empty($fields))
|
220 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
221 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
222 |
break;
|
226 |
}
|
227 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
228 |
}
|
229 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
230 |
{
|
231 |
$msg = $sbj = "(s2Member / API Notification Email) - Payment";
|
232 |
$msg .= "\n\n"; // Spacing in the message body.
|
253 |
$msg .= "user_ip: %%user_ip%%\n";
|
254 |
$msg .= "user_id: %%user_id%%\n";
|
255 |
|
256 |
+
if (is_array($fields) && !empty($fields))
|
257 |
foreach ($fields as $var => $val)
|
258 |
$msg .= $var . ": %%" . $var . "%%\n";
|
259 |
|
284 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
285 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
286 |
{
|
287 |
+
if (is_array($fields) && !empty($fields))
|
288 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
289 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
290 |
break;
|
292 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
293 |
|
294 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["payment_notification_recipients"]) as $recipient)
|
295 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_payment_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_payment_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
296 |
}
|
297 |
$paypal["s2member_log"][] = "Payment Notification Emails have been processed.";
|
298 |
}
|
299 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
300 |
{
|
301 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
302 |
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
314 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
315 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
316 |
{
|
317 |
+
if (is_array($fields) && !empty($fields))
|
318 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
319 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
320 |
break;
|
327 |
}
|
328 |
}
|
329 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
330 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_new_ccaps", get_defined_vars ());
|
331 |
+
unset($__refs, $__v);
|
332 |
}
|
333 |
else
|
334 |
$paypal["s2member_log"][] = "Unable to add new Capabilities. The existing User ID is associated with an Administrator. Stopping here. Otherwise, an Administrator could lose access.";
|
346 |
$paypal["s2member_log"][] = "Duplicate IPN. Already processed. This IPN will be ignored.";
|
347 |
}
|
348 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
349 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_new_ccaps", get_defined_vars ());
|
350 |
+
unset($__refs, $__v);
|
351 |
|
352 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", $paypal, get_defined_vars ());
|
353 |
}
|
354 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_notify_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
355 |
}
|
356 |
}
|
357 |
}
|
includes/classes/paypal-notify-in-web-accept-sp.inc.php
CHANGED
@@ -38,18 +38,18 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function cp ($vars = array
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (empty
|
48 |
-
&& (!empty
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
-
do_action
|
52 |
-
unset
|
53 |
|
54 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
55 |
{
|
@@ -60,7 +60,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
60 |
$paypal["ip"] = (preg_match ("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"]) ? $paypal["option_selection2"] : "";
|
61 |
$paypal["ip"] = (!$paypal["ip"] && preg_match ("/^[a-z0-9]+~[0-9\.]+$/i", $paypal["invoice"])) ? preg_replace ("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
|
62 |
|
63 |
-
if (($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"])) && is_array
|
64 |
{
|
65 |
$processing = $during = true; // Yes, we ARE processing this.
|
66 |
|
@@ -68,7 +68,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
68 |
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["option_selection1"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
|
69 |
{
|
70 |
$sp_references = (array)get_user_option ("s2member_sp_references", $user_id);
|
71 |
-
$_sp_reference = array
|
72 |
$sp_references = c_ws_plugin__s2member_utils_arrays::array_unique (array_merge ($sp_references, $_sp_reference));
|
73 |
update_user_option ($user_id, "s2member_sp_references", $sp_references);
|
74 |
|
@@ -119,12 +119,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
119 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
120 |
}
|
121 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient) // Go through a possible list of recipients.
|
122 |
-
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters
|
123 |
|
124 |
$paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . $rec . ".";
|
125 |
}
|
126 |
|
127 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] && is_array
|
128 |
{
|
129 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"]) as $url)
|
130 |
|
@@ -144,7 +144,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
144 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification URLs have been processed.";
|
145 |
}
|
146 |
|
147 |
-
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] && is_array
|
148 |
{
|
149 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Sale";
|
150 |
$msg .= "\n\n"; // Spacing in the message body.
|
@@ -190,12 +190,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
190 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
191 |
|
192 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"]) as $recipient)
|
193 |
-
wp_mail ($recipient, apply_filters
|
194 |
|
195 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification Emails have been processed.";
|
196 |
}
|
197 |
|
198 |
-
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array
|
199 |
{
|
200 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (rawurlencode ($sp_access_url)), $url)))
|
201 |
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")))), $url)))
|
@@ -214,7 +214,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
214 |
$paypal["s2member_log"][] = "Specific Post/Page Return, a Proxy Return URL is ready.";
|
215 |
}
|
216 |
|
217 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array
|
218 |
{
|
219 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
220 |
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
@@ -231,8 +231,8 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
231 |
}
|
232 |
}
|
233 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
234 |
-
do_action
|
235 |
-
unset
|
236 |
}
|
237 |
else
|
238 |
$paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
@@ -245,13 +245,13 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp"))
|
|
245 |
}
|
246 |
|
247 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
248 |
-
do_action
|
249 |
-
unset
|
250 |
|
251 |
-
return apply_filters
|
252 |
}
|
253 |
else
|
254 |
-
return apply_filters
|
255 |
}
|
256 |
}
|
257 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function cp ($vars = array()) // Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
42 |
{
|
43 |
extract ($vars, EXTR_OVERWRITE | EXTR_REFS); // Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``.
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
47 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
+
&& (!empty($paypal["payer_email"])) && (!empty($paypal["txn_id"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
+
do_action("ws_plugin__s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
|
52 |
+
unset($__refs, $__v);
|
53 |
|
54 |
if (!get_transient ($transient_ipn = "s2m_ipn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_ipn, time (), 31556926 * 10))
|
55 |
{
|
60 |
$paypal["ip"] = (preg_match ("/ip address/i", $paypal["option_name2"]) && $paypal["option_selection2"]) ? $paypal["option_selection2"] : "";
|
61 |
$paypal["ip"] = (!$paypal["ip"] && preg_match ("/^[a-z0-9]+~[0-9\.]+$/i", $paypal["invoice"])) ? preg_replace ("/^[a-z0-9]+~/i", "", $paypal["invoice"]) : $paypal["ip"];
|
62 |
|
63 |
+
if (($sp_access_url = c_ws_plugin__s2member_sp_access::sp_access_link_gen ($paypal["sp_ids"], $paypal["hours"])) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
64 |
{
|
65 |
$processing = $during = true; // Yes, we ARE processing this.
|
66 |
|
68 |
if (($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with ($paypal["option_selection1"], $paypal["option_selection1"])) && is_object ($user = new WP_User ($user_id)) && $user->ID)
|
69 |
{
|
70 |
$sp_references = (array)get_user_option ("s2member_sp_references", $user_id);
|
71 |
+
$_sp_reference = array("time" => time (), "ids" => $paypal["sp_ids"], "hours" => $paypal["hours"], "url" => $sp_access_url);
|
72 |
$sp_references = c_ws_plugin__s2member_utils_arrays::array_unique (array_merge ($sp_references, $_sp_reference));
|
73 |
update_user_option ($user_id, "s2member_sp_references", $sp_references);
|
74 |
|
119 |
$msg = c_ws_plugin__s2member_utilities::evl($msg, get_defined_vars());
|
120 |
}
|
121 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($rec) as $recipient) // Go through a possible list of recipients.
|
122 |
+
c_ws_plugin__s2member_email_configs::email_config () . wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_email_msg", $msg, get_defined_vars ()), "From: \"" . preg_replace ('/"/', "'", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]) . "\" <" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"] . ">\r\nContent-Type: text/plain; charset=UTF-8") . c_ws_plugin__s2member_email_configs::email_config_release ();
|
123 |
|
124 |
$paypal["s2member_log"][] = "Specific Post/Page Confirmation Email sent to: " . $rec . ".";
|
125 |
}
|
126 |
|
127 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
128 |
{
|
129 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_urls"]) as $url)
|
130 |
|
144 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification URLs have been processed.";
|
145 |
}
|
146 |
|
147 |
+
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"] && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
148 |
{
|
149 |
$msg = $sbj = "(s2Member / API Notification Email) - Specific Post/Page ~ Sale";
|
150 |
$msg .= "\n\n"; // Spacing in the message body.
|
190 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
191 |
|
192 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_sale_notification_recipients"]) as $recipient)
|
193 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_sp_sale_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_sp_sale_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
194 |
|
195 |
$paypal["s2member_log"][] = "Specific Post/Page ~ Sale Notification Emails have been processed.";
|
196 |
}
|
197 |
|
198 |
+
if ($processing && $_REQUEST["s2member_paypal_proxy"] && ($url = $_REQUEST["s2member_paypal_proxy_return_url"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"]))) // A Proxy is requesting a Return URL?
|
199 |
{
|
200 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (rawurlencode ($sp_access_url)), $url)))
|
201 |
if (($url = preg_replace ("/%%sp_access_exp%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (c_ws_plugin__s2member_utils_time::approx_time_difference (time (), strtotime ("+" . $paypal["hours"] . " hours")))), $url)))
|
214 |
$paypal["s2member_log"][] = "Specific Post/Page Return, a Proxy Return URL is ready.";
|
215 |
}
|
216 |
|
217 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
218 |
{
|
219 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
220 |
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
231 |
}
|
232 |
}
|
233 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
234 |
+
do_action("ws_plugin__s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
|
235 |
+
unset($__refs, $__v);
|
236 |
}
|
237 |
else
|
238 |
$paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
245 |
}
|
246 |
|
247 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
248 |
+
do_action("ws_plugin__s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
|
249 |
+
unset($__refs, $__v);
|
250 |
|
251 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", $paypal, get_defined_vars ());
|
252 |
}
|
253 |
else
|
254 |
+
return apply_filters("c_ws_plugin__s2member_paypal_notify_in_web_accept_sp", false, get_defined_vars ());
|
255 |
}
|
256 |
}
|
257 |
}
|
includes/classes/paypal-notify-in.inc.php
CHANGED
@@ -51,9 +51,9 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
51 |
{
|
52 |
global /* For Multisite support. */ $current_site, $current_blog;
|
53 |
|
54 |
-
do_action
|
55 |
|
56 |
-
if (!empty
|
57 |
{
|
58 |
@ignore_user_abort (true); // Important. Continue processing even if/when the connection is broken by the sending party.
|
59 |
|
@@ -66,14 +66,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
66 |
if(!empty($_REQUEST["s2member_paypal_proxy"]) && in_array($_REQUEST["s2member_paypal_proxy"], array("alipay", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
67 |
${esc_html(trim(stripslashes($_REQUEST["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
68 |
|
69 |
-
if (is_array
|
70 |
{
|
71 |
$paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
|
72 |
-
$paypal["s2member_log"][] = "s2Member POST vars verified " . ((!empty
|
73 |
|
74 |
$payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
|
75 |
|
76 |
-
$paypal["subscr_gateway"] = (!empty
|
77 |
|
78 |
$coupon = (!empty($_REQUEST["s2member_paypal_proxy_coupon"]) && is_array($_REQUEST["s2member_paypal_proxy_coupon"])) ? stripslashes_deep($_REQUEST["s2member_paypal_proxy_coupon"]) : array();
|
79 |
$coupon = (isset($coupon["full_coupon_code"], $coupon["coupon_code"], $coupon["affiliate_id"]) && is_string($coupon["full_coupon_code"]) && is_string($coupon["coupon_code"]) && is_string($coupon["affiliate_id"])) ? $coupon : array("full_coupon_code" => "", "coupon_code" => "", "affiliate_id" => "");
|
@@ -82,20 +82,20 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
82 |
// This is mostly irrelevant, but it helps to keep the logs cleaner.
|
83 |
sleep(5); // Wait for Pro Form procesing to complete.
|
84 |
|
85 |
-
if (empty
|
86 |
$paypal["custom"] = c_ws_plugin__s2member_utils_users::get_user_custom_with ($paypal["recurring_payment_id"]);
|
87 |
|
88 |
-
else if (empty
|
89 |
$paypal["custom"] = c_ws_plugin__s2member_utils_users::get_user_custom_with ($paypal["mp_id"]);
|
90 |
|
91 |
-
if (!empty
|
92 |
{
|
93 |
$paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
|
94 |
|
95 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
96 |
-
if (!apply_filters
|
97 |
{
|
98 |
-
unset
|
99 |
|
100 |
if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_virtual_terminal::cp (get_defined_vars ())))
|
101 |
$paypal = $_paypal_cp;
|
@@ -149,16 +149,16 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
149 |
$paypal["s2member_log"][] = "Ignoring this IPN request. The `txn_type/status` does NOT require any action on the part of s2Member.";
|
150 |
}
|
151 |
else // Else a custom conditional has been applied by Filters.
|
152 |
-
unset
|
153 |
}
|
154 |
|
155 |
-
else if (!empty
|
156 |
{
|
157 |
$paypal["s2member_log"][] = "Transaction type ( `recurring_payment_profile_cancel` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
158 |
$paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
|
159 |
}
|
160 |
|
161 |
-
else if (!empty
|
162 |
$paypal["s2member_log"][] = "Transaction type ( `^recurring_?` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
163 |
|
164 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
@@ -175,22 +175,22 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
175 |
/*
|
176 |
Add IPN proxy (when available) to the ``$paypal`` array.
|
177 |
*/
|
178 |
-
if (!empty
|
179 |
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy"])));
|
180 |
/*
|
181 |
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
182 |
*/
|
183 |
-
if (!empty
|
184 |
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_use"])));
|
185 |
/*
|
186 |
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
|
187 |
*/
|
188 |
-
if (!empty
|
189 |
$paypal["s2member_paypal_proxy_coupon"] = stripslashes_deep((array)$_REQUEST["s2member_paypal_proxy_coupon"]);
|
190 |
/*
|
191 |
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
|
192 |
*/
|
193 |
-
if (!empty
|
194 |
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_verification"])));
|
195 |
/*
|
196 |
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
|
@@ -212,18 +212,18 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify_in"))
|
|
212 |
FILE_APPEND);
|
213 |
|
214 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
215 |
-
do_action
|
216 |
-
unset
|
217 |
|
218 |
status_header (200); // Send a 200 OK status header.
|
219 |
header ("Content-Type: text/plain; charset=UTF-8"); // Content-Type text/plain with UTF-8.
|
220 |
while (@ob_end_clean ()); // Clean any existing output buffers.
|
221 |
|
222 |
-
exit (((!empty
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
-
do_action
|
226 |
-
unset
|
227 |
}
|
228 |
}
|
229 |
}
|
51 |
{
|
52 |
global /* For Multisite support. */ $current_site, $current_blog;
|
53 |
|
54 |
+
do_action("ws_plugin__s2member_before_paypal_notify", get_defined_vars ());
|
55 |
|
56 |
+
if (!empty($_GET["s2member_paypal_notify"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty($_REQUEST["s2member_paypal_proxy"])))
|
57 |
{
|
58 |
@ignore_user_abort (true); // Important. Continue processing even if/when the connection is broken by the sending party.
|
59 |
|
66 |
if(!empty($_REQUEST["s2member_paypal_proxy"]) && in_array($_REQUEST["s2member_paypal_proxy"], array("alipay", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
67 |
${esc_html(trim(stripslashes($_REQUEST["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
68 |
|
69 |
+
if (is_array($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal) && ($_paypal_s = serialize ($_paypal)))
|
70 |
{
|
71 |
$paypal["s2member_log"][] = "IPN received on: " . date ("D M j, Y g:i:s a T");
|
72 |
+
$paypal["s2member_log"][] = "s2Member POST vars verified " . ((!empty($paypal["proxy_verified"])) ? "with a Proxy Key" : "through a POST back to PayPal.");
|
73 |
|
74 |
$payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
|
75 |
|
76 |
+
$paypal["subscr_gateway"] = (!empty($_REQUEST["s2member_paypal_proxy"])) ? esc_html(trim(stripslashes($_REQUEST["s2member_paypal_proxy"]))) : "paypal";
|
77 |
|
78 |
$coupon = (!empty($_REQUEST["s2member_paypal_proxy_coupon"]) && is_array($_REQUEST["s2member_paypal_proxy_coupon"])) ? stripslashes_deep($_REQUEST["s2member_paypal_proxy_coupon"]) : array();
|
79 |
$coupon = (isset($coupon["full_coupon_code"], $coupon["coupon_code"], $coupon["affiliate_id"]) && is_string($coupon["full_coupon_code"]) && is_string($coupon["coupon_code"]) && is_string($coupon["affiliate_id"])) ? $coupon : array("full_coupon_code" => "", "coupon_code" => "", "affiliate_id" => "");
|
82 |
// This is mostly irrelevant, but it helps to keep the logs cleaner.
|
83 |
sleep(5); // Wait for Pro Form procesing to complete.
|
84 |
|
85 |
+
if (empty($paypal["custom"]) && !empty($paypal["recurring_payment_id"])) // Recurring Profile ID.
|
86 |
$paypal["custom"] = c_ws_plugin__s2member_utils_users::get_user_custom_with ($paypal["recurring_payment_id"]);
|
87 |
|
88 |
+
else if (empty($paypal["custom"]) && !empty($paypal["mp_id"])) // Lookup; based on a Billing Agreement ID.
|
89 |
$paypal["custom"] = c_ws_plugin__s2member_utils_users::get_user_custom_with ($paypal["mp_id"]);
|
90 |
|
91 |
+
if (!empty($paypal["custom"]) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", $paypal["custom"]))
|
92 |
{
|
93 |
$paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
|
94 |
|
95 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
96 |
+
if (!apply_filters("ws_plugin__s2member_during_paypal_notify_conditionals", false, get_defined_vars ()))
|
97 |
{
|
98 |
+
unset($__refs, $__v);
|
99 |
|
100 |
if (($_paypal_cp = c_ws_plugin__s2member_paypal_notify_in_virtual_terminal::cp (get_defined_vars ())))
|
101 |
$paypal = $_paypal_cp;
|
149 |
$paypal["s2member_log"][] = "Ignoring this IPN request. The `txn_type/status` does NOT require any action on the part of s2Member.";
|
150 |
}
|
151 |
else // Else a custom conditional has been applied by Filters.
|
152 |
+
unset($__refs, $__v);
|
153 |
}
|
154 |
|
155 |
+
else if (!empty($paypal["txn_type"]) && preg_match("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]))
|
156 |
{
|
157 |
$paypal["s2member_log"][] = "Transaction type ( `recurring_payment_profile_cancel` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
158 |
$paypal["s2member_log"][] = "It's likely this account was just upgraded/downgraded by s2Member Pro; so the Subscr. ID has probably been updated on-site; nothing to worry about here.";
|
159 |
}
|
160 |
|
161 |
+
else if (!empty($paypal["txn_type"]) && preg_match("/^recurring_/i", $paypal["txn_type"])) // Otherwise, is this a ^recurring_ txn_type?
|
162 |
$paypal["s2member_log"][] = "Transaction type ( `^recurring_?` ), but there is no match to an existing account; so verification of `\$_SERVER[\"HTTP_HOST\"]` was not possible.";
|
163 |
|
164 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
175 |
/*
|
176 |
Add IPN proxy (when available) to the ``$paypal`` array.
|
177 |
*/
|
178 |
+
if (!empty($_REQUEST["s2member_paypal_proxy"]))
|
179 |
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy"])));
|
180 |
/*
|
181 |
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
182 |
*/
|
183 |
+
if (!empty($_REQUEST["s2member_paypal_proxy_use"]))
|
184 |
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_use"])));
|
185 |
/*
|
186 |
Add IPN proxy coupon vars (when available) to the ``$paypal`` array.
|
187 |
*/
|
188 |
+
if (!empty($_REQUEST["s2member_paypal_proxy_coupon"]))
|
189 |
$paypal["s2member_paypal_proxy_coupon"] = stripslashes_deep((array)$_REQUEST["s2member_paypal_proxy_coupon"]);
|
190 |
/*
|
191 |
Also add IPN proxy self-verification (when available) to the ``$paypal`` array.
|
192 |
*/
|
193 |
+
if (!empty($_REQUEST["s2member_paypal_proxy_verification"]))
|
194 |
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string)$_REQUEST["s2member_paypal_proxy_verification"])));
|
195 |
/*
|
196 |
If debugging/logging is enabled; we need to append ``$paypal`` to the log file.
|
212 |
FILE_APPEND);
|
213 |
|
214 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
215 |
+
do_action("ws_plugin__s2member_during_paypal_notify", get_defined_vars ());
|
216 |
+
unset($__refs, $__v);
|
217 |
|
218 |
status_header (200); // Send a 200 OK status header.
|
219 |
header ("Content-Type: text/plain; charset=UTF-8"); // Content-Type text/plain with UTF-8.
|
220 |
while (@ob_end_clean ()); // Clean any existing output buffers.
|
221 |
|
222 |
+
exit (((!empty($paypal["s2member_paypal_proxy_return_url"])) ? $paypal["s2member_paypal_proxy_return_url"] : ""));
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
+
do_action("ws_plugin__s2member_after_paypal_notify", get_defined_vars ());
|
226 |
+
unset($__refs, $__v);
|
227 |
}
|
228 |
}
|
229 |
}
|
includes/classes/paypal-notify.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_notify"))
|
|
39 |
*/
|
40 |
public static function paypal_notify ()
|
41 |
{
|
42 |
-
if (!empty
|
43 |
{
|
44 |
return c_ws_plugin__s2member_paypal_notify_in::paypal_notify ();
|
45 |
}
|
39 |
*/
|
40 |
public static function paypal_notify ()
|
41 |
{
|
42 |
+
if (!empty($_GET["s2member_paypal_notify"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_paypal_notify_in::paypal_notify ();
|
45 |
}
|
includes/classes/paypal-return-in-no-tx-data.inc.php
CHANGED
@@ -36,21 +36,21 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_no_tx_data"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action
|
45 |
-
unset
|
46 |
|
47 |
$paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation.";
|
48 |
$paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases.";
|
49 |
$paypal["s2member_log"][] = /* Recording _POST + _GET vars for analysis and debugging. */ var_export ($_REQUEST, true);
|
50 |
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
-
do_action
|
53 |
-
unset
|
54 |
|
55 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
56 |
{
|
@@ -63,14 +63,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_no_tx_data"))
|
|
63 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
|
64 |
|
65 |
echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],
|
66 |
-
_x ('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty
|
67 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
68 |
}
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
-
do_action
|
71 |
-
unset
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
}
|
76 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
+
do_action("ws_plugin__s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
|
45 |
+
unset($__refs, $__v);
|
46 |
|
47 |
$paypal["s2member_log"][] = "No Return-Data. Customer MUST wait for Email Confirmation.";
|
48 |
$paypal["s2member_log"][] = "Note. This can sometimes happen when/if you are offering an Initial/Trial Period. There are times when a Payment Gateway will NOT supply s2Member with any data immediately after checkout. When/if this happens, s2Member must process the transaction via IPN only (i.e. behind-the-scene), and the Customer must wait for Email Confirmation in these cases.";
|
49 |
$paypal["s2member_log"][] = /* Recording _POST + _GET vars for analysis and debugging. */ var_export ($_REQUEST, true);
|
50 |
|
51 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
52 |
+
do_action("ws_plugin__s2member_during_paypal_return_during_no_return_data", get_defined_vars ());
|
53 |
+
unset($__refs, $__v);
|
54 |
|
55 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
56 |
{
|
63 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
|
64 |
|
65 |
echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],
|
66 |
+
_x ('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]))) ? '<br /><br />' . _x ('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''),
|
67 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
68 |
}
|
69 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
70 |
+
do_action("ws_plugin__s2member_during_paypal_return_after_no_return_data", get_defined_vars ());
|
71 |
+
unset($__refs, $__v);
|
72 |
|
73 |
+
return apply_filters("c_ws_plugin__s2member_paypal_return_in_no_tx_data", $paypal, get_defined_vars ());
|
74 |
}
|
75 |
}
|
76 |
}
|
includes/classes/paypal-return-in-proxy-ty-email.inc.php
CHANGED
@@ -36,19 +36,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action
|
45 |
-
unset
|
46 |
|
47 |
$paypal["s2member_log"][] = "Customer MUST wait for Email Confirmation — `proxy_use`: ( `ty-email` ).";
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
54 |
{
|
@@ -61,14 +61,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email"))
|
|
61 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
|
62 |
|
63 |
echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],
|
64 |
-
_x ('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty
|
65 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
66 |
}
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
-
do_action
|
69 |
-
unset
|
70 |
|
71 |
-
return apply_filters
|
72 |
}
|
73 |
}
|
74 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
+
do_action("ws_plugin__s2member_during_paypal_return_before_explicit_ty_email", get_defined_vars ());
|
45 |
+
unset($__refs, $__v);
|
46 |
|
47 |
$paypal["s2member_log"][] = "Customer MUST wait for Email Confirmation — `proxy_use`: ( `ty-email` ).";
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_during_paypal_return_during_explicit_ty_email", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
54 |
{
|
61 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page (after asking Customer to check their email).";
|
62 |
|
63 |
echo c_ws_plugin__s2member_return_templates::return_template ($paypal["subscr_gateway"],
|
64 |
+
_x ('<strong>Thank you! (you MUST check your email before proceeding).</strong><br /><br />* Note: It can take <em>(up to 15 minutes)</em> for Email Confirmation with important details. If you don\'t receive email confirmation in the next 15 minutes, please contact Support.', "s2member-front", "s2member") . (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_" . $paypal["subscr_gateway"] . "_sandbox"]))) ? '<br /><br />' . _x ('<strong>** Sandbox Mode **</strong> You may NOT receive this Email in Sandbox Mode. Sandbox addresses are usually bogus (for testing).', "s2member-front", "s2member") : ''),
|
65 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
66 |
}
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
+
do_action("ws_plugin__s2member_during_paypal_return_after_explicit_ty_email", get_defined_vars ());
|
69 |
+
unset($__refs, $__v);
|
70 |
|
71 |
+
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_ty_email", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
}
|
includes/classes/paypal-return-in-proxy-x-preview.inc.php
CHANGED
@@ -36,19 +36,19 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview"))
|
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action
|
45 |
-
unset
|
46 |
|
47 |
$paypal["s2member_log"][] = "Test preview of Return Page `proxy_use`: ( `x_preview` ).";
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
54 |
{
|
@@ -65,10 +65,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview"))
|
|
65 |
_x ("Continue (Click Here)", "s2member-front", "s2member"), home_url ("/"));
|
66 |
}
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
-
do_action
|
69 |
-
unset
|
70 |
|
71 |
-
return apply_filters
|
72 |
}
|
73 |
}
|
74 |
}
|
36 |
* @param array $vars Required. An array of defined variables passed by {@link s2Member\PayPal\c_ws_plugin__s2member_paypal_return_in::paypal_return()}.
|
37 |
* @return array|bool The original ``$paypal`` array passed in (extracted) from ``$vars``, or false when conditions do NOT apply.
|
38 |
*/
|
39 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
40 |
{
|
41 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
42 |
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
+
do_action("ws_plugin__s2member_during_paypal_return_before_explicit_x_preview", get_defined_vars ());
|
45 |
+
unset($__refs, $__v);
|
46 |
|
47 |
$paypal["s2member_log"][] = "Test preview of Return Page `proxy_use`: ( `x_preview` ).";
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_during_paypal_return_during_explicit_x_preview", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if /* Using a custom success redirection URL? */ ($custom_success_redirection)
|
54 |
{
|
65 |
_x ("Continue (Click Here)", "s2member-front", "s2member"), home_url ("/"));
|
66 |
}
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
+
do_action("ws_plugin__s2member_during_paypal_return_after_explicit_x_preview", get_defined_vars ());
|
69 |
+
unset($__refs, $__v);
|
70 |
|
71 |
+
return apply_filters("c_ws_plugin__s2member_paypal_return_in_proxy_x_preview", $paypal, get_defined_vars ());
|
72 |
}
|
73 |
}
|
74 |
}
|
includes/classes/paypal-return-in-subscr-modify-w-level.inc.php
CHANGED
@@ -48,7 +48,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars());
|
51 |
-
unset
|
52 |
|
53 |
if(!get_transient($transient_rtn = "s2m_rtn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10))
|
54 |
{
|
@@ -86,7 +86,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_modify", get_defined_vars());
|
88 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "rtn-upgrade-downgrade", "modification", "s2member_level".$paypal["level"]);
|
89 |
-
unset
|
90 |
|
91 |
$fields = /* These will be needed in the routines below. */ get_user_option("s2member_custom_fields", $user_id);
|
92 |
$user_reg_ip = /* Original IP during Registration. */ get_user_option("s2member_registration_ip", $user_id);
|
@@ -176,7 +176,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
176 |
}
|
177 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
178 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars());
|
179 |
-
unset
|
180 |
|
181 |
if(($redirection_url_after_modification = apply_filters("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars())))
|
182 |
{
|
@@ -227,7 +227,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level")
|
|
227 |
}
|
228 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
229 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_modify", get_defined_vars());
|
230 |
-
unset
|
231 |
|
232 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level", $paypal, get_defined_vars());
|
233 |
}
|
48 |
{
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_modify", get_defined_vars());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
if(!get_transient($transient_rtn = "s2m_rtn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10))
|
54 |
{
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_modify", get_defined_vars());
|
88 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "rtn-upgrade-downgrade", "modification", "s2member_level".$paypal["level"]);
|
89 |
+
unset($__refs, $__v);
|
90 |
|
91 |
$fields = /* These will be needed in the routines below. */ get_user_option("s2member_custom_fields", $user_id);
|
92 |
$user_reg_ip = /* Original IP during Registration. */ get_user_option("s2member_registration_ip", $user_id);
|
176 |
}
|
177 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
178 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_modify", get_defined_vars());
|
179 |
+
unset($__refs, $__v);
|
180 |
|
181 |
if(($redirection_url_after_modification = apply_filters("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars())))
|
182 |
{
|
227 |
}
|
228 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
229 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_modify", get_defined_vars());
|
230 |
+
unset($__refs, $__v);
|
231 |
|
232 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_modify_w_level", $paypal, get_defined_vars());
|
233 |
}
|
includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php
CHANGED
@@ -49,7 +49,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars());
|
52 |
-
unset
|
53 |
|
54 |
if(!get_transient($transient_rtn = "s2m_rtn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10))
|
55 |
{
|
@@ -111,7 +111,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
111 |
{
|
112 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
113 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars());
|
114 |
-
unset
|
115 |
|
116 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.";
|
117 |
|
@@ -124,7 +124,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
124 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
125 |
do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_signup_w_update_vars", get_defined_vars());
|
126 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "rtn-upgrade-downgrade", "modification", "s2member_level".$paypal["level"]);
|
127 |
-
unset
|
128 |
|
129 |
$fields = /* These will be needed in the routines below. */ get_user_option("s2member_custom_fields", $user_id);
|
130 |
$user_reg_ip = /* Original IP during Registration. */ get_user_option("s2member_registration_ip", $user_id);
|
@@ -223,7 +223,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars());
|
226 |
-
unset
|
227 |
|
228 |
if(($redirection_url_after_modification = apply_filters("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars())))
|
229 |
{
|
@@ -263,7 +263,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
263 |
}
|
264 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
265 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars());
|
266 |
-
unset
|
267 |
}
|
268 |
/*
|
269 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
@@ -272,7 +272,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
272 |
{
|
273 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
274 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars());
|
275 |
-
unset
|
276 |
|
277 |
$processing = $during = /* Yes, we ARE processing this new Subscription request. */ true;
|
278 |
|
@@ -308,7 +308,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
308 |
}
|
309 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
310 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars());
|
311 |
-
unset
|
312 |
|
313 |
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site())
|
314 |
{
|
@@ -358,7 +358,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
358 |
}
|
359 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
360 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars());
|
361 |
-
unset
|
362 |
}
|
363 |
}
|
364 |
else // Page Expired. Duplicate Return-Data.
|
@@ -373,7 +373,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level"))
|
|
373 |
}
|
374 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
375 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup", get_defined_vars());
|
376 |
-
unset
|
377 |
|
378 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level", $paypal, get_defined_vars());
|
379 |
}
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup", get_defined_vars());
|
52 |
+
unset($__refs, $__v);
|
53 |
|
54 |
if(!get_transient($transient_rtn = "s2m_rtn_".md5("s2member_transient_".$_paypal_s)) && set_transient($transient_rtn, time(), 31556926 * 10))
|
55 |
{
|
111 |
{
|
112 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
113 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars());
|
114 |
+
unset($__refs, $__v);
|
115 |
|
116 |
$paypal["s2member_log"][] = "s2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.";
|
117 |
|
124 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
125 |
do_action("ws_plugin__s2member_during_paypal_return_during_before_subscr_signup_w_update_vars", get_defined_vars());
|
126 |
do_action("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars(), "rtn-upgrade-downgrade", "modification", "s2member_level".$paypal["level"]);
|
127 |
+
unset($__refs, $__v);
|
128 |
|
129 |
$fields = /* These will be needed in the routines below. */ get_user_option("s2member_custom_fields", $user_id);
|
130 |
$user_reg_ip = /* Original IP during Registration. */ get_user_option("s2member_registration_ip", $user_id);
|
223 |
}
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars());
|
226 |
+
unset($__refs, $__v);
|
227 |
|
228 |
if(($redirection_url_after_modification = apply_filters("ws_plugin__s2member_redirection_url_after_modification", false, get_defined_vars())))
|
229 |
{
|
263 |
}
|
264 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
265 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars());
|
266 |
+
unset($__refs, $__v);
|
267 |
}
|
268 |
/*
|
269 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
272 |
{
|
273 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
274 |
do_action("ws_plugin__s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars());
|
275 |
+
unset($__refs, $__v);
|
276 |
|
277 |
$processing = $during = /* Yes, we ARE processing this new Subscription request. */ true;
|
278 |
|
308 |
}
|
309 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
310 |
do_action("ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars());
|
311 |
+
unset($__refs, $__v);
|
312 |
|
313 |
if(is_multisite() && c_ws_plugin__s2member_utils_conds::is_multisite_farm() && is_main_site())
|
314 |
{
|
358 |
}
|
359 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
360 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars());
|
361 |
+
unset($__refs, $__v);
|
362 |
}
|
363 |
}
|
364 |
else // Page Expired. Duplicate Return-Data.
|
373 |
}
|
374 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
375 |
do_action("ws_plugin__s2member_during_paypal_return_after_subscr_signup", get_defined_vars());
|
376 |
+
unset($__refs, $__v);
|
377 |
|
378 |
return apply_filters("c_ws_plugin__s2member_paypal_return_in_subscr_or_wa_w_level", $paypal, get_defined_vars());
|
379 |
}
|
includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php
CHANGED
@@ -38,18 +38,18 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
42 |
{
|
43 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (empty
|
48 |
-
&& (!empty
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
-
do_action
|
52 |
-
unset
|
53 |
|
54 |
if (!get_transient ($transient_rtn = "s2m_rtn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_rtn, time (), 31556926 * 10))
|
55 |
{
|
@@ -75,7 +75,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
75 |
|
76 |
if (is_multisite () && !is_user_member_of_blog ($user_id) /* Must have a Role on this Blog. */)
|
77 |
{
|
78 |
-
add_existing_user_to_blog(array
|
79 |
$user = new WP_User ($user_id);
|
80 |
}
|
81 |
if ($paypal["ccaps"] && preg_match ("/^-all/", str_replace ("+", "", $paypal["ccaps"])))
|
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
97 |
|
98 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
|
99 |
|
100 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array
|
101 |
{
|
102 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
103 |
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
@@ -113,7 +113,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
113 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
114 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
115 |
{
|
116 |
-
if (is_array
|
117 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
118 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
119 |
break;
|
@@ -127,10 +127,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
127 |
}
|
128 |
}
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
-
do_action
|
131 |
-
unset
|
132 |
|
133 |
-
if (($redirection_url_after_capabilities = apply_filters
|
134 |
{
|
135 |
$paypal["s2member_log"][] = "Redirecting Customer to a custom URL after Capabilities: " . $redirection_url_after_capabilities;
|
136 |
|
@@ -189,12 +189,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level"))
|
|
189 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
190 |
}
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
-
do_action
|
193 |
-
unset
|
194 |
|
195 |
-
return apply_filters
|
196 |
}
|
197 |
-
else return apply_filters
|
198 |
}
|
199 |
}
|
200 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
42 |
{
|
43 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"], $paypal["item_number"]))
|
47 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
+
&& (!empty($paypal["txn_id"]) && ($paypal["subscr_id"] = $paypal["txn_id"])) && (!empty($paypal["payer_email"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
+
do_action("ws_plugin__s2member_during_paypal_return_before_new_ccaps", get_defined_vars ());
|
52 |
+
unset($__refs, $__v);
|
53 |
|
54 |
if (!get_transient ($transient_rtn = "s2m_rtn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_rtn, time (), 31556926 * 10))
|
55 |
{
|
75 |
|
76 |
if (is_multisite () && !is_user_member_of_blog ($user_id) /* Must have a Role on this Blog. */)
|
77 |
{
|
78 |
+
add_existing_user_to_blog(array("user_id" => $user_id, "role" => get_option ("default_role")));
|
79 |
$user = new WP_User ($user_id);
|
80 |
}
|
81 |
if ($paypal["ccaps"] && preg_match ("/^-all/", str_replace ("+", "", $paypal["ccaps"])))
|
97 |
|
98 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) w/ update vars for Capabilities w/o Level.";
|
99 |
|
100 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["ccap_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
101 |
{
|
102 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["subscr_id"]), $code)))
|
103 |
if (($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
113 |
if (($code = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $code)))
|
114 |
if (($code = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $code)))
|
115 |
{
|
116 |
+
if (is_array($fields) && !empty($fields))
|
117 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
118 |
if (!($code = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $code)))
|
119 |
break;
|
127 |
}
|
128 |
}
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
+
do_action("ws_plugin__s2member_during_paypal_return_during_new_ccaps", get_defined_vars ());
|
131 |
+
unset($__refs, $__v);
|
132 |
|
133 |
+
if (($redirection_url_after_capabilities = apply_filters("ws_plugin__s2member_redirection_url_after_capabilities", false, get_defined_vars ())))
|
134 |
{
|
135 |
$paypal["s2member_log"][] = "Redirecting Customer to a custom URL after Capabilities: " . $redirection_url_after_capabilities;
|
136 |
|
189 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
190 |
}
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
+
do_action("ws_plugin__s2member_during_paypal_return_after_new_ccaps", get_defined_vars ());
|
193 |
+
unset($__refs, $__v);
|
194 |
|
195 |
+
return apply_filters("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level", $paypal, get_defined_vars ());
|
196 |
}
|
197 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_wa_ccaps_wo_level", false, get_defined_vars ());
|
198 |
}
|
199 |
}
|
200 |
}
|
includes/classes/paypal-return-in-web-accept-sp.inc.php
CHANGED
@@ -38,18 +38,18 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
-
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array
|
42 |
{
|
43 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
44 |
|
45 |
-
if ((!empty
|
46 |
-
&& (!empty
|
47 |
-
&& (empty
|
48 |
-
&& (!empty
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
-
do_action
|
52 |
-
unset
|
53 |
|
54 |
if (!get_transient ($transient_rtn = "s2m_rtn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_rtn, time (), 31556926 * 10))
|
55 |
{
|
@@ -69,7 +69,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
69 |
|
70 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) for Specific Post/Page Access.";
|
71 |
|
72 |
-
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array
|
73 |
{
|
74 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
75 |
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
@@ -85,10 +85,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
85 |
}
|
86 |
}
|
87 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
88 |
-
do_action
|
89 |
-
unset
|
90 |
|
91 |
-
if (apply_filters
|
92 |
{
|
93 |
$paypal["s2member_log"][] = "Redirecting Customer immediately to the Specific Post/Page.";
|
94 |
|
@@ -131,12 +131,12 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in_web_accept_sp"))
|
|
131 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
132 |
}
|
133 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
134 |
-
do_action
|
135 |
-
unset
|
136 |
|
137 |
-
return apply_filters
|
138 |
}
|
139 |
-
else return apply_filters
|
140 |
}
|
141 |
}
|
142 |
}
|
38 |
*
|
39 |
* @todo Optimize with ``empty()`` and ``isset()``.
|
40 |
*/
|
41 |
+
public static function /* Conditional phase for ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */ cp ($vars = array())
|
42 |
{
|
43 |
extract /* Extract all vars passed in from: ``c_ws_plugin__s2member_paypal_notify_in::paypal_notify()``. */($vars, EXTR_OVERWRITE | EXTR_REFS);
|
44 |
|
45 |
+
if ((!empty($paypal["txn_type"]) && preg_match ("/^web_accept$/i", $paypal["txn_type"]))
|
46 |
+
&& (!empty($paypal["item_number"]) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"], $paypal["item_number"]))
|
47 |
+
&& (empty($paypal["payment_status"]) || empty($payment_status_issues) || !preg_match ($payment_status_issues, $paypal["payment_status"]))
|
48 |
+
&& (!empty($paypal["txn_id"])))
|
49 |
{
|
50 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
51 |
+
do_action("ws_plugin__s2member_during_paypal_return_before_sp_access", get_defined_vars ());
|
52 |
+
unset($__refs, $__v);
|
53 |
|
54 |
if (!get_transient ($transient_rtn = "s2m_rtn_" . md5 ("s2member_transient_" . $_paypal_s)) && set_transient ($transient_rtn, time (), 31556926 * 10))
|
55 |
{
|
69 |
|
70 |
$paypal["s2member_log"][] = "Transient Tracking Cookie set on ( `web_accept` ) for Specific Post/Page Access.";
|
71 |
|
72 |
+
if ($processing && ($code = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_tracking_codes"]) && is_array($cv = preg_split ("/\|/", $paypal["custom"])))
|
73 |
{
|
74 |
if (($code = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $code)) && ($code = preg_replace ("/%%amount%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["mc_gross"]), $code)) && ($code = preg_replace ("/%%txn_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["txn_id"]), $code)))
|
75 |
if (($code = preg_replace ("/%%item_number%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_number"]), $code)) && ($code = preg_replace ("/%%item_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($paypal["item_name"]), $code)))
|
85 |
}
|
86 |
}
|
87 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
88 |
+
do_action("ws_plugin__s2member_during_paypal_return_during_sp_access", get_defined_vars ());
|
89 |
+
unset($__refs, $__v);
|
90 |
|
91 |
+
if (apply_filters("ws_plugin__s2member_immediate_sp_access_redirection", false, get_defined_vars ()))
|
92 |
{
|
93 |
$paypal["s2member_log"][] = "Redirecting Customer immediately to the Specific Post/Page.";
|
94 |
|
131 |
_x ("Back To Home Page", "s2member-front", "s2member"), home_url ("/"));
|
132 |
}
|
133 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
134 |
+
do_action("ws_plugin__s2member_during_paypal_return_after_sp_access", get_defined_vars ());
|
135 |
+
unset($__refs, $__v);
|
136 |
|
137 |
+
return apply_filters("c_ws_plugin__s2member_paypal_return_in_web_accept_sp", $paypal, get_defined_vars ());
|
138 |
}
|
139 |
+
else return apply_filters("c_ws_plugin__s2member_paypal_return_in_web_accept_sp", false, get_defined_vars ());
|
140 |
}
|
141 |
}
|
142 |
}
|
includes/classes/paypal-return-in.inc.php
CHANGED
@@ -41,36 +41,36 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
41 |
{
|
42 |
global /* For Multisite support. */ $current_site, $current_blog;
|
43 |
|
44 |
-
do_action
|
45 |
|
46 |
-
if (!empty
|
47 |
{
|
48 |
$paypal = array(); // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
|
49 |
if(!empty($_GET["s2member_paypal_proxy"]) && in_array($_GET["s2member_paypal_proxy"], array("alipay", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
50 |
${esc_html(trim(stripslashes($_GET["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
51 |
|
52 |
-
$custom_success_redirection = (!empty
|
53 |
-
$custom_success_redirection = ($custom_success_redirection) ? str_ireplace (array
|
54 |
|
55 |
-
if (is_array
|
56 |
{
|
57 |
$paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
|
58 |
-
$paypal["s2member_log"][] = "s2Member POST vars verified " . ((!empty
|
59 |
|
60 |
-
$paypal["subscr_gateway"] = (!empty
|
61 |
|
62 |
-
if (empty
|
63 |
{
|
64 |
$payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
|
65 |
|
66 |
-
if (!empty
|
67 |
{
|
68 |
$paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
|
69 |
|
70 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
71 |
-
if (!apply_filters
|
72 |
{
|
73 |
-
unset
|
74 |
|
75 |
if (($_paypal_cp = c_ws_plugin__s2member_paypal_return_in_web_accept_sp::cp (get_defined_vars ())))
|
76 |
$paypal = $_paypal_cp;
|
@@ -96,7 +96,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
96 |
}
|
97 |
}
|
98 |
else // Else a custom conditional has been applied by filters.
|
99 |
-
unset
|
100 |
}
|
101 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
102 |
{
|
@@ -115,10 +115,10 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
115 |
else // In this case ... a Proxy has explicitly requested `ty-email` processing.
|
116 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_ty_email::cp (get_defined_vars ());
|
117 |
}
|
118 |
-
else if (!empty
|
119 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_x_preview::cp (get_defined_vars ());
|
120 |
|
121 |
-
else if (empty
|
122 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_no_tx_data::cp (get_defined_vars ());
|
123 |
|
124 |
else // Extensive log reporting here. This is an area where many site owners find trouble. Depending on server configuration; remote HTTPS connections may fail.
|
@@ -140,27 +140,27 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
140 |
/*
|
141 |
Add RTN proxy (when available) to the ``$paypal`` array.
|
142 |
*/
|
143 |
-
if (!empty
|
144 |
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy"])));
|
145 |
/*
|
146 |
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
147 |
*/
|
148 |
-
if (!empty
|
149 |
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy_use"])));
|
150 |
/*
|
151 |
Also add RTN proxy self-verification (when available) to the ``$paypal`` array.
|
152 |
*/
|
153 |
-
if (!empty
|
154 |
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy_verification"])));
|
155 |
/*
|
156 |
Also add RTN success redirection URL (when available) to the ``$paypal`` array.
|
157 |
*/
|
158 |
-
if (!empty
|
159 |
$paypal["s2member_paypal_return_success"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_return_success"])));
|
160 |
/*
|
161 |
Also add RTN t and r Attributes (when available) to the ``$paypal`` array.
|
162 |
*/
|
163 |
-
if (!empty
|
164 |
$paypal["s2member_paypal_return_tra"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_return_tra"])));
|
165 |
/*
|
166 |
If debugging/logging is enabled; we need to append $paypal to the log file.
|
@@ -182,14 +182,14 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return_in"))
|
|
182 |
FILE_APPEND);
|
183 |
|
184 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
185 |
-
do_action
|
186 |
-
unset
|
187 |
|
188 |
exit /* Clean exit. */ ();
|
189 |
}
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
-
do_action
|
192 |
-
unset
|
193 |
}
|
194 |
}
|
195 |
}
|
41 |
{
|
42 |
global /* For Multisite support. */ $current_site, $current_blog;
|
43 |
|
44 |
+
do_action("ws_plugin__s2member_before_paypal_return", get_defined_vars ());
|
45 |
|
46 |
+
if (!empty($_GET["s2member_paypal_return"]) && ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] || !empty($_GET["s2member_paypal_proxy"])))
|
47 |
{
|
48 |
$paypal = array(); // Initialize PayPal array; we also reference this with a variable for a possible proxy handler.
|
49 |
if(!empty($_GET["s2member_paypal_proxy"]) && in_array($_GET["s2member_paypal_proxy"], array("alipay", "authnet", "clickbank", "ccbill", "google"), TRUE))
|
50 |
${esc_html(trim(stripslashes($_GET["s2member_paypal_proxy"])))} = &$paypal; // Internal alias by reference.
|
51 |
|
52 |
+
$custom_success_redirection = (!empty($_GET["s2member_paypal_return_success"])) ? esc_html (trim (stripslashes ($_GET["s2member_paypal_return_success"]))) : false;
|
53 |
+
$custom_success_redirection = ($custom_success_redirection) ? str_ireplace (array("&", "&"), "&", $custom_success_redirection) : $custom_success_redirection;
|
54 |
|
55 |
+
if (is_array($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_postvars ()) && ($_paypal = $paypal) && ($_paypal_s = serialize ($_paypal)))
|
56 |
{
|
57 |
$paypal["s2member_log"][] = "Return-Data received on: " . date ("D M j, Y g:i:s a T");
|
58 |
+
$paypal["s2member_log"][] = "s2Member POST vars verified " . ((!empty($paypal["proxy_verified"])) ? "with a Proxy Key" : "through a POST back to PayPal.");
|
59 |
|
60 |
+
$paypal["subscr_gateway"] = (!empty($_GET["s2member_paypal_proxy"])) ? esc_html (trim (stripslashes ($_GET["s2member_paypal_proxy"]))) : "paypal";
|
61 |
|
62 |
+
if (empty($_GET["s2member_paypal_proxy"]) || empty($_GET["s2member_paypal_proxy_use"]) || !preg_match ("/ty-email/", $_GET["s2member_paypal_proxy_use"]))
|
63 |
{
|
64 |
$payment_status_issues = "/^(failed|denied|expired|refunded|partially_refunded|reversed|reversal|canceled_reversal|voided)$/i";
|
65 |
|
66 |
+
if (!empty($paypal["custom"]) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", $paypal["custom"]))
|
67 |
{
|
68 |
$paypal["s2member_log"][] = "s2Member originating domain ( `\$_SERVER[\"HTTP_HOST\"]` ) validated.";
|
69 |
|
70 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
71 |
+
if (!apply_filters("ws_plugin__s2member_during_paypal_return_conditionals", false, get_defined_vars ()))
|
72 |
{
|
73 |
+
unset($__refs, $__v);
|
74 |
|
75 |
if (($_paypal_cp = c_ws_plugin__s2member_paypal_return_in_web_accept_sp::cp (get_defined_vars ())))
|
76 |
$paypal = $_paypal_cp;
|
96 |
}
|
97 |
}
|
98 |
else // Else a custom conditional has been applied by filters.
|
99 |
+
unset($__refs, $__v);
|
100 |
}
|
101 |
else // Else, use the default ``$_SERVER["HTTP_HOST"]`` error.
|
102 |
{
|
115 |
else // In this case ... a Proxy has explicitly requested `ty-email` processing.
|
116 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_ty_email::cp (get_defined_vars ());
|
117 |
}
|
118 |
+
else if (!empty($_GET["s2member_paypal_proxy"]) && !empty($_GET["s2member_paypal_proxy_use"]) && preg_match ("/x-preview/", $_GET["s2member_paypal_proxy_use"]) && ($paypal["subscr_gateway"] = esc_html (trim (stripslashes ($_GET["s2member_paypal_proxy"])))))
|
119 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_proxy_x_preview::cp (get_defined_vars ());
|
120 |
|
121 |
+
else if (empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"]) && ($paypal["subscr_gateway"] = "paypal"))
|
122 |
$paypal = $_paypal_cp = c_ws_plugin__s2member_paypal_return_in_no_tx_data::cp (get_defined_vars ());
|
123 |
|
124 |
else // Extensive log reporting here. This is an area where many site owners find trouble. Depending on server configuration; remote HTTPS connections may fail.
|
140 |
/*
|
141 |
Add RTN proxy (when available) to the ``$paypal`` array.
|
142 |
*/
|
143 |
+
if (!empty($_GET["s2member_paypal_proxy"]))
|
144 |
$paypal["s2member_paypal_proxy"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy"])));
|
145 |
/*
|
146 |
Add IPN proxy use vars (when available) to the ``$paypal`` array.
|
147 |
*/
|
148 |
+
if (!empty($_GET["s2member_paypal_proxy_use"]))
|
149 |
$paypal["s2member_paypal_proxy_use"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy_use"])));
|
150 |
/*
|
151 |
Also add RTN proxy self-verification (when available) to the ``$paypal`` array.
|
152 |
*/
|
153 |
+
if (!empty($_GET["s2member_paypal_proxy_verification"]))
|
154 |
$paypal["s2member_paypal_proxy_verification"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_proxy_verification"])));
|
155 |
/*
|
156 |
Also add RTN success redirection URL (when available) to the ``$paypal`` array.
|
157 |
*/
|
158 |
+
if (!empty($_GET["s2member_paypal_return_success"]))
|
159 |
$paypal["s2member_paypal_return_success"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_return_success"])));
|
160 |
/*
|
161 |
Also add RTN t and r Attributes (when available) to the ``$paypal`` array.
|
162 |
*/
|
163 |
+
if (!empty($_GET["s2member_paypal_return_tra"]))
|
164 |
$paypal["s2member_paypal_return_tra"] = esc_html(trim(stripslashes((string)$_GET["s2member_paypal_return_tra"])));
|
165 |
/*
|
166 |
If debugging/logging is enabled; we need to append $paypal to the log file.
|
182 |
FILE_APPEND);
|
183 |
|
184 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
185 |
+
do_action("ws_plugin__s2member_during_paypal_return", get_defined_vars ());
|
186 |
+
unset($__refs, $__v);
|
187 |
|
188 |
exit /* Clean exit. */ ();
|
189 |
}
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
+
do_action("ws_plugin__s2member_after_paypal_return", get_defined_vars ());
|
192 |
+
unset($__refs, $__v);
|
193 |
}
|
194 |
}
|
195 |
}
|
includes/classes/paypal-return.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_paypal_return"))
|
|
39 |
*/
|
40 |
public static function paypal_return ()
|
41 |
{
|
42 |
-
if (!empty
|
43 |
{
|
44 |
return c_ws_plugin__s2member_paypal_return_in::paypal_return ();
|
45 |
}
|
39 |
*/
|
40 |
public static function paypal_return ()
|
41 |
{
|
42 |
+
if (!empty($_GET["s2member_paypal_return"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_paypal_return_in::paypal_return ();
|
45 |
}
|
includes/classes/paypal-utilities.inc.php
CHANGED
@@ -39,14 +39,14 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
39 |
{
|
40 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
41 |
do_action("ws_plugin__s2member_before_paypal_postvars", get_defined_vars());
|
42 |
-
unset
|
43 |
/*
|
44 |
Custom conditionals can be applied by filters.
|
45 |
*/
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
if(!($postvars = apply_filters("ws_plugin__s2member_during_paypal_postvars_conditionals", array(), get_defined_vars())))
|
48 |
{
|
49 |
-
unset
|
50 |
|
51 |
if(!empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"]))
|
52 |
{
|
@@ -106,7 +106,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
106 |
}
|
107 |
else // Else a custom conditional has been applied by Filters.
|
108 |
{
|
109 |
-
unset
|
110 |
|
111 |
return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
|
112 |
}
|
@@ -117,7 +117,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
117 |
* @package s2Member\PayPal
|
118 |
* @since 3.5
|
119 |
*
|
120 |
-
* @return
|
121 |
*/
|
122 |
public static function paypal_proxy_key_gen()
|
123 |
{
|
@@ -125,7 +125,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
125 |
|
126 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
127 |
do_action("ws_plugin__s2member_before_paypal_proxy_key_gen", get_defined_vars());
|
128 |
-
unset
|
129 |
|
130 |
if(is_multisite() && !is_main_site())
|
131 |
$key = md5(c_ws_plugin__s2member_utils_encryption::xencrypt($current_blog->domain.$current_blog->path, false, false));
|
@@ -153,7 +153,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
153 |
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
do_action("ws_plugin__s2member_before_paypal_api_response", get_defined_vars());
|
156 |
-
unset
|
157 |
|
158 |
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")."/nvp";
|
159 |
|
@@ -224,7 +224,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
224 |
{
|
225 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
226 |
do_action("_ws_plugin__s2member_before_paypal_api_response_filters", get_defined_vars());
|
227 |
-
unset
|
228 |
|
229 |
if(!empty($response["__error"]) && !empty($response["L_ERRORCODE0"]))
|
230 |
{
|
@@ -276,7 +276,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
276 |
|
277 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
278 |
do_action("ws_plugin__s2member_before_paypal_payflow_api_response", get_defined_vars());
|
279 |
-
unset
|
280 |
|
281 |
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com");
|
282 |
|
@@ -361,7 +361,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
361 |
{
|
362 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
363 |
do_action("_ws_plugin__s2member_before_paypal_payflow_api_response_filters", get_defined_vars());
|
364 |
-
unset
|
365 |
|
366 |
if(!empty($response["__error"]) && !empty($response["HOSTCODE"]))
|
367 |
{
|
@@ -399,14 +399,14 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
399 |
* @package s2Member\PayPal
|
400 |
* @since 3.5
|
401 |
*
|
402 |
-
* @param
|
403 |
* @return bool|str A full singular description of the term *( i.e. `Day|Week|Month|Year` )*, else false.
|
404 |
*/
|
405 |
public static function paypal_pro_term($term = FALSE)
|
406 |
{
|
407 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
408 |
do_action("ws_plugin__s2member_before_paypal_pro_term", get_defined_vars());
|
409 |
-
unset
|
410 |
|
411 |
$paypal_pro_terms = array("D" => "Day", "W" => "Week", "M" => "Month", "Y" => "Year");
|
412 |
|
@@ -420,8 +420,8 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
420 |
* @package s2Member\PayPal
|
421 |
* @since 120514
|
422 |
*
|
423 |
-
* @param
|
424 |
-
* @param
|
425 |
* @return bool|str A full singular description of the term *( i.e. `DAY|WEEK|BIWK|MONT|QTER|SMYR|YEAR` )*, else false.
|
426 |
*
|
427 |
* @note Payflow unfortunately does NOT support daily and/or bi-monthly billing.
|
@@ -430,7 +430,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
430 |
{
|
431 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
432 |
do_action("ws_plugin__s2member_before_paypal_payflow_term", get_defined_vars());
|
433 |
-
unset
|
434 |
|
435 |
$paypal_payflow_terms = array("D" => "DAY", "W" => "WEEK", "M" => "MONT", "Y" => "YEAR");
|
436 |
|
@@ -453,14 +453,14 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
453 |
* @package s2Member\PayPal
|
454 |
* @since 3.5
|
455 |
*
|
456 |
-
* @param
|
457 |
* @return bool|str A term code *( i.e. `D|W|M|Y` )*, else false.
|
458 |
*/
|
459 |
public static function paypal_std_term($term = FALSE)
|
460 |
{
|
461 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
462 |
do_action("ws_plugin__s2member_before_paypal_std_term", get_defined_vars());
|
463 |
-
unset
|
464 |
|
465 |
$paypal_std_terms = array("DAY" => "D", "WEEK" => "W", "MONTH" => "M", "YEAR" => "Y");
|
466 |
|
@@ -474,14 +474,14 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
474 |
* @package s2Member\PayPal
|
475 |
* @since 3.5
|
476 |
*
|
477 |
-
* @param
|
478 |
* @return str|bool A `subscr_id` string if non-empty, else false.
|
479 |
*/
|
480 |
public static function paypal_pro_subscr_id($array_or_string = FALSE)
|
481 |
{
|
482 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
483 |
do_action("ws_plugin__s2member_before_paypal_pro_subscr_id", get_defined_vars());
|
484 |
-
unset
|
485 |
|
486 |
if(is_array($array = $array_or_string) && !empty($array["subscr_id"]))
|
487 |
$subscr_id = trim($array["subscr_id"]);
|
@@ -503,7 +503,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
503 |
* @package s2Member\PayPal
|
504 |
* @since 3.5
|
505 |
*
|
506 |
-
* @param
|
507 |
* If it's a string, we make sure it is a valid `level:ccaps:eotper` or `sp:ids:expiration` combination.
|
508 |
* @return str|bool An `item_number` string if non-empty, else false.
|
509 |
*/
|
@@ -511,7 +511,7 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
511 |
{
|
512 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
513 |
do_action("ws_plugin__s2member_before_paypal_pro_item_number", get_defined_vars());
|
514 |
-
unset
|
515 |
|
516 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
517 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
@@ -545,14 +545,14 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
545 |
* @package s2Member\PayPal
|
546 |
* @since 3.5
|
547 |
*
|
548 |
-
* @param
|
549 |
* @return str|bool An `item_name` string if non-empty, else false.
|
550 |
*/
|
551 |
public static function paypal_pro_item_name($array_or_string = FALSE)
|
552 |
{
|
553 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
554 |
do_action("ws_plugin__s2member_before_paypal_pro_item_name", get_defined_vars());
|
555 |
-
unset
|
556 |
|
557 |
if(is_array($array = $array_or_string) && !empty($array["item_name"]))
|
558 |
$item_name = trim($array["item_name"]);
|
@@ -580,16 +580,16 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
580 |
* @package s2Member\PayPal
|
581 |
* @since 3.5
|
582 |
*
|
583 |
-
* @param
|
584 |
* If it's a string, we make sure it is a valid `period term` combination.
|
585 |
-
* @param
|
586 |
-
* @return
|
587 |
*/
|
588 |
public static function paypal_pro_period1($array_or_string = FALSE, $default = "0 D")
|
589 |
{
|
590 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
591 |
do_action("ws_plugin__s2member_before_paypal_pro_period1", get_defined_vars());
|
592 |
-
unset
|
593 |
|
594 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
595 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
@@ -636,16 +636,16 @@ if(!class_exists("c_ws_plugin__s2member_paypal_utilities"))
|
|
636 |
* @package s2Member\PayPal
|
637 |
* @since 3.5
|
638 |
*
|
639 |
-
* @param
|
640 |
* If it's a string, we make sure it is a valid `period term` combination.
|
641 |
-
* @param
|
642 |
-
* @return
|
643 |
*/
|
644 |
public static function paypal_pro_period3($array_or_string = FALSE, $default = "1 D")
|
645 |
{
|
646 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
647 |
do_action("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars());
|
648 |
-
unset
|
649 |
|
650 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
651 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
39 |
{
|
40 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
41 |
do_action("ws_plugin__s2member_before_paypal_postvars", get_defined_vars());
|
42 |
+
unset($__refs, $__v);
|
43 |
/*
|
44 |
Custom conditionals can be applied by filters.
|
45 |
*/
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
if(!($postvars = apply_filters("ws_plugin__s2member_during_paypal_postvars_conditionals", array(), get_defined_vars())))
|
48 |
{
|
49 |
+
unset($__refs, $__v);
|
50 |
|
51 |
if(!empty($_GET["tx"]) && empty($_GET["s2member_paypal_proxy"]))
|
52 |
{
|
106 |
}
|
107 |
else // Else a custom conditional has been applied by Filters.
|
108 |
{
|
109 |
+
unset($__refs, $__v);
|
110 |
|
111 |
return apply_filters("ws_plugin__s2member_paypal_postvars", $postvars, get_defined_vars());
|
112 |
}
|
117 |
* @package s2Member\PayPal
|
118 |
* @since 3.5
|
119 |
*
|
120 |
+
* @return string A Proxy Key. It's an MD5 Hash, 32 chars, URL-safe.
|
121 |
*/
|
122 |
public static function paypal_proxy_key_gen()
|
123 |
{
|
125 |
|
126 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
127 |
do_action("ws_plugin__s2member_before_paypal_proxy_key_gen", get_defined_vars());
|
128 |
+
unset($__refs, $__v);
|
129 |
|
130 |
if(is_multisite() && !is_main_site())
|
131 |
$key = md5(c_ws_plugin__s2member_utils_encryption::xencrypt($current_blog->domain.$current_blog->path, false, false));
|
153 |
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
do_action("ws_plugin__s2member_before_paypal_api_response", get_defined_vars());
|
156 |
+
unset($__refs, $__v);
|
157 |
|
158 |
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")."/nvp";
|
159 |
|
224 |
{
|
225 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
226 |
do_action("_ws_plugin__s2member_before_paypal_api_response_filters", get_defined_vars());
|
227 |
+
unset($__refs, $__v);
|
228 |
|
229 |
if(!empty($response["__error"]) && !empty($response["L_ERRORCODE0"]))
|
230 |
{
|
276 |
|
277 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
278 |
do_action("ws_plugin__s2member_before_paypal_payflow_api_response", get_defined_vars());
|
279 |
+
unset($__refs, $__v);
|
280 |
|
281 |
$url = "https://".(($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "pilot-payflowpro.paypal.com" : "payflowpro.paypal.com");
|
282 |
|
361 |
{
|
362 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
363 |
do_action("_ws_plugin__s2member_before_paypal_payflow_api_response_filters", get_defined_vars());
|
364 |
+
unset($__refs, $__v);
|
365 |
|
366 |
if(!empty($response["__error"]) && !empty($response["HOSTCODE"]))
|
367 |
{
|
399 |
* @package s2Member\PayPal
|
400 |
* @since 3.5
|
401 |
*
|
402 |
+
* @param string $term Expects one of `D|W|M|Y`.
|
403 |
* @return bool|str A full singular description of the term *( i.e. `Day|Week|Month|Year` )*, else false.
|
404 |
*/
|
405 |
public static function paypal_pro_term($term = FALSE)
|
406 |
{
|
407 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
408 |
do_action("ws_plugin__s2member_before_paypal_pro_term", get_defined_vars());
|
409 |
+
unset($__refs, $__v);
|
410 |
|
411 |
$paypal_pro_terms = array("D" => "Day", "W" => "Week", "M" => "Month", "Y" => "Year");
|
412 |
|
420 |
* @package s2Member\PayPal
|
421 |
* @since 120514
|
422 |
*
|
423 |
+
* @param string $term Expects one of `D|W|M|Y`.
|
424 |
+
* @param string $period Expects a numeric value.
|
425 |
* @return bool|str A full singular description of the term *( i.e. `DAY|WEEK|BIWK|MONT|QTER|SMYR|YEAR` )*, else false.
|
426 |
*
|
427 |
* @note Payflow unfortunately does NOT support daily and/or bi-monthly billing.
|
430 |
{
|
431 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
432 |
do_action("ws_plugin__s2member_before_paypal_payflow_term", get_defined_vars());
|
433 |
+
unset($__refs, $__v);
|
434 |
|
435 |
$paypal_payflow_terms = array("D" => "DAY", "W" => "WEEK", "M" => "MONT", "Y" => "YEAR");
|
436 |
|
453 |
* @package s2Member\PayPal
|
454 |
* @since 3.5
|
455 |
*
|
456 |
+
* @param string $term Expects one of `Day|Week|Month|Year`.
|
457 |
* @return bool|str A term code *( i.e. `D|W|M|Y` )*, else false.
|
458 |
*/
|
459 |
public static function paypal_std_term($term = FALSE)
|
460 |
{
|
461 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
462 |
do_action("ws_plugin__s2member_before_paypal_std_term", get_defined_vars());
|
463 |
+
unset($__refs, $__v);
|
464 |
|
465 |
$paypal_std_terms = array("DAY" => "D", "WEEK" => "W", "MONTH" => "M", "YEAR" => "Y");
|
466 |
|
474 |
* @package s2Member\PayPal
|
475 |
* @since 3.5
|
476 |
*
|
477 |
+
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
|
478 |
* @return str|bool A `subscr_id` string if non-empty, else false.
|
479 |
*/
|
480 |
public static function paypal_pro_subscr_id($array_or_string = FALSE)
|
481 |
{
|
482 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
483 |
do_action("ws_plugin__s2member_before_paypal_pro_subscr_id", get_defined_vars());
|
484 |
+
unset($__refs, $__v);
|
485 |
|
486 |
if(is_array($array = $array_or_string) && !empty($array["subscr_id"]))
|
487 |
$subscr_id = trim($array["subscr_id"]);
|
503 |
* @package s2Member\PayPal
|
504 |
* @since 3.5
|
505 |
*
|
506 |
+
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
|
507 |
* If it's a string, we make sure it is a valid `level:ccaps:eotper` or `sp:ids:expiration` combination.
|
508 |
* @return str|bool An `item_number` string if non-empty, else false.
|
509 |
*/
|
511 |
{
|
512 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
513 |
do_action("ws_plugin__s2member_before_paypal_pro_item_number", get_defined_vars());
|
514 |
+
unset($__refs, $__v);
|
515 |
|
516 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
517 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
545 |
* @package s2Member\PayPal
|
546 |
* @since 3.5
|
547 |
*
|
548 |
+
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
|
549 |
* @return str|bool An `item_name` string if non-empty, else false.
|
550 |
*/
|
551 |
public static function paypal_pro_item_name($array_or_string = FALSE)
|
552 |
{
|
553 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
554 |
do_action("ws_plugin__s2member_before_paypal_pro_item_name", get_defined_vars());
|
555 |
+
unset($__refs, $__v);
|
556 |
|
557 |
if(is_array($array = $array_or_string) && !empty($array["item_name"]))
|
558 |
$item_name = trim($array["item_name"]);
|
580 |
* @package s2Member\PayPal
|
581 |
* @since 3.5
|
582 |
*
|
583 |
+
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
|
584 |
* If it's a string, we make sure it is a valid `period term` combination.
|
585 |
+
* @param string $default Optional. Value if unavailable. Defaults to `0 D`.
|
586 |
+
* @return string A `period1` string if possible, or defaults to `0 D`.
|
587 |
*/
|
588 |
public static function paypal_pro_period1($array_or_string = FALSE, $default = "0 D")
|
589 |
{
|
590 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
591 |
do_action("ws_plugin__s2member_before_paypal_pro_period1", get_defined_vars());
|
592 |
+
unset($__refs, $__v);
|
593 |
|
594 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
595 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
636 |
* @package s2Member\PayPal
|
637 |
* @since 3.5
|
638 |
*
|
639 |
+
* @param string|array $array_or_string Either an array of PayPal post vars, or a string.
|
640 |
* If it's a string, we make sure it is a valid `period term` combination.
|
641 |
+
* @param string $default Optional. Value if unavailable. Defaults to `1 D`.
|
642 |
+
* @return string A `period3` string if possible, or defaults to `1 D`.
|
643 |
*/
|
644 |
public static function paypal_pro_period3($array_or_string = FALSE, $default = "1 D")
|
645 |
{
|
646 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
647 |
do_action("ws_plugin__s2member_before_paypal_pro_period3", get_defined_vars());
|
648 |
+
unset($__refs, $__v);
|
649 |
|
650 |
if(is_array($array_or_string) && isset($array_or_string["PROFILENAME"]) /* Payflow. */)
|
651 |
$array_or_string["PROFILEREFERENCE"] = $array_or_string["PROFILENAME"];
|
includes/classes/posts-sp.inc.php
CHANGED
@@ -33,15 +33,15 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
|
|
33 |
* @package s2Member\Posts
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param int|
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array
|
39 |
*/
|
40 |
public static function check_specific_post_level_access ($post_id = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
-
$excluded = apply_filters
|
45 |
|
46 |
if (!$excluded && is_numeric ($post_id) && ($post_id = (int)$post_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
@@ -49,32 +49,32 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
|
|
49 |
|
50 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($post_id, $post_uri)) // Do NOT touch WordPress Systematics.
|
51 |
{
|
52 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
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, "/") . "$/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
-
return apply_filters
|
56 |
|
57 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($post_id, $post_uri)) // Never restrict Systematics. However, there is 1 exception above.
|
58 |
{
|
59 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Post Level restrictions (including Custom Post Types). Go through each Level.
|
60 |
{
|
61 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
62 |
-
return apply_filters
|
63 |
|
64 |
-
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && ($post_type = get_post_type ($post_id)) && (in_array
|
65 |
-
return apply_filters
|
66 |
|
67 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array
|
68 |
-
return apply_filters
|
69 |
}
|
70 |
|
71 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Category Level Access against this Post. Go through each Level.
|
72 |
{
|
73 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
74 |
-
return apply_filters
|
75 |
|
76 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
77 |
-
return apply_filters
|
78 |
}
|
79 |
|
80 |
if (has_tag ("", $post_id)) // Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also.
|
@@ -82,10 +82,10 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
|
|
82 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions now. Go through each Level.
|
83 |
{
|
84 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
85 |
-
return apply_filters
|
86 |
|
87 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $post_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
88 |
-
return apply_filters
|
89 |
}
|
90 |
}
|
91 |
|
@@ -95,25 +95,25 @@ if (!class_exists ("c_ws_plugin__s2member_posts_sp"))
|
|
95 |
|
96 |
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)
|
97 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
98 |
-
return apply_filters
|
99 |
}
|
100 |
|
101 |
-
if (is_array
|
102 |
{
|
103 |
foreach ($ccaps_req as $ccap) // The $user MUST satisfy ALL Custom Capabilities. Serialized array.
|
104 |
if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
|
105 |
-
return apply_filters
|
106 |
}
|
107 |
|
108 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array
|
109 |
-
return apply_filters
|
110 |
}
|
111 |
|
112 |
-
do_action
|
113 |
}
|
114 |
}
|
115 |
|
116 |
-
return apply_filters
|
117 |
}
|
118 |
}
|
119 |
}
|
33 |
* @package s2Member\Posts
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param int|string $post_id Numeric Post 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_post_level_access ($post_id = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_check_specific_post_level_access", get_defined_vars ());
|
43 |
|
44 |
+
$excluded = apply_filters("ws_plugin__s2member_check_specific_post_level_access_excluded", false, get_defined_vars ());
|
45 |
|
46 |
if (!$excluded && is_numeric ($post_id) && ($post_id = (int)$post_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
49 |
|
50 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page ($post_id, $post_uri)) // Do NOT touch WordPress Systematics.
|
51 |
{
|
52 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
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, "/") . "$/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
56 |
|
57 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page ($post_id, $post_uri)) // Never restrict Systematics. However, there is 1 exception above.
|
58 |
{
|
59 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Post Level restrictions (including Custom Post Types). Go through each Level.
|
60 |
{
|
61 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
62 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
63 |
|
64 |
+
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && ($post_type = get_post_type ($post_id)) && (in_array("all-" . $post_type, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-" . $post_type . "s", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
65 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
66 |
|
67 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
68 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
69 |
}
|
70 |
|
71 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Category Level Access against this Post. Go through each Level.
|
72 |
{
|
73 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
74 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
75 |
|
76 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && (in_category (($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])), $post_id) || c_ws_plugin__s2member_utils_conds::in_descendant_category ($catgs, $post_id)) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
77 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
78 |
}
|
79 |
|
80 |
if (has_tag ("", $post_id)) // Here we take a look to see if this Post has any Tags. If so, we need to run the full set of routines against Tags also.
|
82 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions now. Go through each Level.
|
83 |
{
|
84 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
85 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
86 |
|
87 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && has_tag (preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]), $post_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
88 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
89 |
}
|
90 |
}
|
91 |
|
95 |
|
96 |
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)
|
97 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $post_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
98 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
99 |
}
|
100 |
|
101 |
+
if (is_array($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty($ccaps_req))
|
102 |
{
|
103 |
foreach ($ccaps_req as $ccap) // The $user MUST satisfy ALL Custom Capabilities. Serialized array.
|
104 |
if (strlen ($ccap) && (!$check_user || !$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)))
|
105 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_ccap_req" => $ccap), get_defined_vars ());
|
106 |
}
|
107 |
|
108 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && (!$check_user || !c_ws_plugin__s2member_sp_access::sp_access ($post_id, "read-only")))
|
109 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", array("s2member_sp_req" => $post_id), get_defined_vars ());
|
110 |
}
|
111 |
|
112 |
+
do_action("ws_plugin__s2member_during_check_specific_post_level_access", get_defined_vars ());
|
113 |
}
|
114 |
}
|
115 |
|
116 |
+
return apply_filters("ws_plugin__s2member_check_specific_post_level_access", null, get_defined_vars ());
|
117 |
}
|
118 |
}
|
119 |
}
|
includes/classes/posts.inc.php
CHANGED
@@ -39,15 +39,15 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
|
|
39 |
{
|
40 |
global $post; // ``get_the_ID()`` unavailable outside The Loop.
|
41 |
|
42 |
-
do_action
|
43 |
|
44 |
-
$excluded = apply_filters
|
45 |
|
46 |
-
if (!$excluded && is_single () && is_object ($post) && !empty
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
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, "/") . "$/", $_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. */ ("post", $post_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
@@ -59,10 +59,10 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
|
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "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. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
|
62 |
-
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array
|
63 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
|
65 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array
|
66 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
67 |
}
|
68 |
|
@@ -96,22 +96,22 @@ if (!class_exists ("c_ws_plugin__s2member_posts"))
|
|
96 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
97 |
}
|
98 |
|
99 |
-
if (is_array
|
100 |
{
|
101 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as an array of Custom Capabilities.
|
102 |
if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)) /* Does this ``$user``, have this Custom Capability? */)
|
103 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "ccap", $ccap, $_SERVER["REQUEST_URI"], "ccap") . exit ();
|
104 |
}
|
105 |
|
106 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array
|
107 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "sp", $post_id, $_SERVER["REQUEST_URI"], "sp") . exit ();
|
108 |
}
|
109 |
|
110 |
-
do_action
|
111 |
}
|
112 |
}
|
113 |
|
114 |
-
do_action
|
115 |
|
116 |
return; // For uniformity.
|
117 |
}
|
39 |
{
|
40 |
global $post; // ``get_the_ID()`` unavailable outside The Loop.
|
41 |
|
42 |
+
do_action("ws_plugin__s2member_before_check_post_level_access", get_defined_vars ());
|
43 |
|
44 |
+
$excluded = apply_filters("ws_plugin__s2member_check_post_level_access_excluded", false, get_defined_vars ());
|
45 |
|
46 |
+
if (!$excluded && is_single () && is_object ($post) && !empty($post->ID) && ($post_id = (int)$post->ID) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
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, "/") . "$/", $_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. */ ("post", $post_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] === "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. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
|
62 |
+
else if (strpos ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"], "all-") !== false && (in_array("all-" . $post->post_type, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) || in_array("all-" . $post->post_type . "s", preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"]))) && 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. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
|
65 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"] && in_array($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
66 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
67 |
}
|
68 |
|
96 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
97 |
}
|
98 |
|
99 |
+
if (is_array($ccaps_req = get_post_meta ($post_id, "s2member_ccaps_req", true)) && !empty($ccaps_req) && c_ws_plugin__s2member_no_cache::no_cache_constants (true))
|
100 |
{
|
101 |
foreach ($ccaps_req as $ccap) // The ``$user`` MUST satisfy ALL Custom Capability requirements. Stored as an array of Custom Capabilities.
|
102 |
if (strlen ($ccap) && (!$user || !$user->has_cap ("access_s2member_ccap_" . $ccap)) /* Does this ``$user``, have this Custom Capability? */)
|
103 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "ccap", $ccap, $_SERVER["REQUEST_URI"], "ccap") . exit ();
|
104 |
}
|
105 |
|
106 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && in_array($post_id, preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && !c_ws_plugin__s2member_sp_access::sp_access ($post_id))
|
107 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("post", $post_id, "sp", $post_id, $_SERVER["REQUEST_URI"], "sp") . exit ();
|
108 |
}
|
109 |
|
110 |
+
do_action("ws_plugin__s2member_during_check_post_level_access", get_defined_vars ());
|
111 |
}
|
112 |
}
|
113 |
|
114 |
+
do_action("ws_plugin__s2member_after_check_post_level_access", get_defined_vars ());
|
115 |
|
116 |
return; // For uniformity.
|
117 |
}
|
includes/classes/profile-in.inc.php
CHANGED
@@ -1,284 +1,293 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member Stand-Alone Profile page (inner processing routines).
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
{
|
46 |
-
|
|
|
|
|
47 |
|
48 |
-
|
|
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
{
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
{
|
71 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_username", get_defined_vars ());
|
73 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
74 |
-
|
75 |
-
echo '<tr>' . "\n";
|
76 |
-
echo '<td>' . "\n";
|
77 |
-
echo '<label for="ws-plugin--s2member-profile-login">' . "\n";
|
78 |
-
echo '<strong>' . _x ("Username", "s2member-front", "s2member") . ' *</strong> <small>' . _x ("(cannot be changed)", "s2member-front", "s2member") . '</small><br />' . "\n";
|
79 |
-
echo '<input type="text" aria-required="true" maxlength="60" autocomplete="off" name="ws_plugin__s2member_profile_login" id="ws-plugin--s2member-profile-login" class="ws-plugin--s2member-profile-field form-control" value="' . format_to_edit ($user->user_login) . '" disabled="disabled" />' . "\n";
|
80 |
-
echo '</label>' . "\n";
|
81 |
-
echo '</td>' . "\n";
|
82 |
-
echo '</tr>' . "\n";
|
83 |
-
|
84 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
85 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_username", get_defined_vars ());
|
86 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
87 |
-
}
|
88 |
-
|
89 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_email", true, get_defined_vars ()))
|
90 |
-
{
|
91 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
92 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_email", get_defined_vars ());
|
93 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
94 |
-
|
95 |
-
echo '<tr>' . "\n";
|
96 |
-
echo '<td>' . "\n";
|
97 |
-
echo '<label for="ws-plugin--s2member-profile-email">' . "\n";
|
98 |
-
echo '<strong>' . _x ("Email Address", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
99 |
-
echo '<input type="email" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" class="ws-plugin--s2member-profile-field form-control" value="' . format_to_edit ($user->user_email) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
100 |
-
echo '</label>' . "\n";
|
101 |
-
echo '</td>' . "\n";
|
102 |
-
echo '</tr>' . "\n";
|
103 |
-
|
104 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
105 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_email", get_defined_vars ());
|
106 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
107 |
-
}
|
108 |
-
|
109 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"])
|
110 |
-
{
|
111 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_first_name", true, get_defined_vars ()))
|
112 |
-
{
|
113 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
114 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_first_name", get_defined_vars ());
|
115 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
116 |
-
|
117 |
-
echo '<tr>' . "\n";
|
118 |
-
echo '<td>' . "\n";
|
119 |
-
echo '<label for="ws-plugin--s2member-profile-first-name">' . "\n";
|
120 |
-
echo '<strong>' . _x ("First Name", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
121 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->first_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
122 |
-
echo '</label>' . "\n";
|
123 |
-
echo '</td>' . "\n";
|
124 |
-
echo '</tr>' . "\n";
|
125 |
-
|
126 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
127 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_first_name", get_defined_vars ());
|
128 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
129 |
-
}
|
130 |
-
|
131 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_last_name", true, get_defined_vars ()))
|
132 |
-
{
|
133 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
134 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_last_name", get_defined_vars ());
|
135 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
136 |
-
|
137 |
-
echo '<tr>' . "\n";
|
138 |
-
echo '<td>' . "\n";
|
139 |
-
echo '<label for="ws-plugin--s2member-profile-last-name">' . "\n";
|
140 |
-
echo '<strong>' . _x ("Last Name", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
141 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->last_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
142 |
-
echo '</label>' . "\n";
|
143 |
-
echo '</td>' . "\n";
|
144 |
-
echo '</tr>' . "\n";
|
145 |
-
|
146 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
147 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
|
148 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
149 |
-
}
|
150 |
-
|
151 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_display_name", true, get_defined_vars ()))
|
152 |
-
{
|
153 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
154 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_display_name", get_defined_vars ());
|
155 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
156 |
-
|
157 |
-
echo '<tr>' . "\n";
|
158 |
-
echo '<td>' . "\n";
|
159 |
-
echo '<label for="ws-plugin--s2member-profile-display-name">' . "\n";
|
160 |
-
echo '<strong>' . _x ("Display Name", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
161 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_display_name" id="ws-plugin--s2member-profile-display-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->display_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
162 |
-
echo '</label>' . "\n";
|
163 |
-
echo '</td>' . "\n";
|
164 |
-
echo '</tr>' . "\n";
|
165 |
-
|
166 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
167 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_display_name", get_defined_vars ());
|
168 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_custom_fields", true, get_defined_vars ()))
|
173 |
-
{
|
174 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) // Now, do we have Custom Fields?
|
175 |
-
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
|
176 |
-
{
|
177 |
-
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
178 |
-
|
179 |
-
$tabindex = $tabindex + 9; // Start tabindex at +9 ( +1 below ).
|
180 |
-
|
181 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
182 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_custom_fields", get_defined_vars ());
|
183 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
184 |
-
|
185 |
-
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
186 |
-
{
|
187 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
188 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
|
189 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
190 |
-
|
191 |
-
if (in_array ($field["id"], $fields_applicable)) // Field applicable?
|
192 |
-
{
|
193 |
-
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
194 |
-
$field_id_class = preg_replace ("/_/", "-", $field_var);
|
195 |
-
|
196 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
197 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
|
198 |
-
{
|
199 |
-
if (!empty ($field["section"]) && $field["section"] === "yes") // Starts a new section?
|
200 |
-
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td></tr>';
|
201 |
-
|
202 |
-
echo '<tr>' . "\n";
|
203 |
-
echo '<td>' . "\n";
|
204 |
-
echo '<label for="ws-plugin--s2member-profile-' . esc_attr ($field_id_class) . '">' . "\n";
|
205 |
-
echo '<strong' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</strong></label>' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
|
206 |
-
echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "ws-plugin--s2member-profile-field", "", ($tabindex = $tabindex + 1), "", $fields, $fields[$field_var], "profile");
|
207 |
-
echo '</td>' . "\n";
|
208 |
-
echo '</tr>' . "\n";
|
209 |
-
}
|
210 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
211 |
-
}
|
212 |
-
|
213 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
214 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
|
215 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
216 |
-
}
|
217 |
-
|
218 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
219 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_custom_fields", get_defined_vars ());
|
220 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_password", true, get_defined_vars ()))
|
225 |
-
{
|
226 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
227 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_password", get_defined_vars ());
|
228 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
229 |
-
|
230 |
-
echo '<tr>' . "\n";
|
231 |
-
echo '<td>' . "\n";
|
232 |
-
|
233 |
-
echo '<label for="ws-plugin--s2member-profile-password1" title="' . esc_attr (_x ("Please type your Password twice to confirm.", "s2member-front", "s2member")) . '">' . "\n";
|
234 |
-
echo '<strong>' . _x ("New Password?", "s2member-front", "s2member") . '</strong> <em>' . _x ("(please type it twice)", "s2member-front", "s2member") . '</em><br />' . "\n";
|
235 |
-
echo '<em>' . _x ("Only if changing password, otherwise leave blank.", "s2member-front", "s2member") . '</em><br />' . "\n";
|
236 |
-
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password1" id="ws-plugin--s2member-profile-password1" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
|
237 |
-
echo '</label>' . "\n";
|
238 |
-
|
239 |
-
echo '<label for="ws-plugin--s2member-profile-password2" title="' . esc_attr (_x ("Please type your Password twice to confirm.", "s2member-front", "s2member")) . '">' . "\n";
|
240 |
-
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password2" id="ws-plugin--s2member-profile-password2" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
|
241 |
-
echo '</label>' . "\n";
|
242 |
-
|
243 |
-
echo '<div id="ws-plugin--s2member-profile-password-strength" class="ws-plugin--s2member-password-strength"><em>' . _x ("password strength indicator", "s2member-front", "s2member") . '</em></div>' . "\n";
|
244 |
-
|
245 |
-
echo '</td>' . "\n";
|
246 |
-
echo '</tr>' . "\n";
|
247 |
-
|
248 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
249 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_password", get_defined_vars ());
|
250 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
251 |
-
}
|
252 |
-
|
253 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
254 |
-
do_action ("ws_plugin__s2member_during_profile_after_fields", get_defined_vars ());
|
255 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
256 |
-
|
257 |
-
echo '<tr>' . "\n";
|
258 |
-
echo '<td>' . "\n";
|
259 |
-
echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-save")) . '" />' . "\n";
|
260 |
-
echo '<input type="submit" id="ws-plugin--s2member-profile-submit" class="btn btn-primary" value="' . esc_attr (_x ("Save All Changes", "s2member-front", "s2member")) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
261 |
-
echo '</td>' . "\n";
|
262 |
-
echo '</tr>' . "\n";
|
263 |
-
|
264 |
-
echo '</tbody>' . "\n";
|
265 |
-
echo '</table>' . "\n";
|
266 |
-
|
267 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
268 |
-
do_action ("ws_plugin__s2member_during_profile_after_table", get_defined_vars ());
|
269 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
270 |
-
|
271 |
-
echo '</form>' . "\n";
|
272 |
-
|
273 |
-
echo '</body>' . "\n";
|
274 |
-
echo '</html>';
|
275 |
}
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
278 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
}
|
|
|
|
|
283 |
}
|
284 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member Stand-Alone Profile page (inner processing routines).
|
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\Profiles
|
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_profile_in'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member Stand-Alone Profile page (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Displays a Stand-Alone Profile Modification Form.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action("init");``
|
37 |
+
*/
|
38 |
+
public static function profile()
|
39 |
+
{
|
40 |
+
do_action('ws_plugin__s2member_before_profile', get_defined_vars());
|
41 |
+
|
42 |
+
if(!empty($_GET['s2member_profile'])) // Requesting Profile?
|
43 |
{
|
44 |
+
c_ws_plugin__s2member_no_cache::no_cache_constants(TRUE); // No caching.
|
45 |
+
|
46 |
+
$tabindex = apply_filters('ws_plugin__s2member_sc_profile_tabindex', 0, get_defined_vars());
|
47 |
+
|
48 |
+
if(($user = (is_user_logged_in()) ? wp_get_current_user() : FALSE) && ($user_id = $user->ID))
|
49 |
+
{
|
50 |
+
echo c_ws_plugin__s2member_utils_html::doctype_html_head('My Profile', 'ws_plugin__s2member_during_profile_head');
|
51 |
+
|
52 |
+
echo '<body style="'.esc_attr(apply_filters('ws_plugin__s2member_profile_body_styles', "background:#FFFFFF; color:#333333; font-family:'Verdana', sans-serif; font-size:13px;", get_defined_vars())).'">'."\n";
|
53 |
+
|
54 |
+
echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile" action="'.esc_attr(site_url('/')).'">'."\n";
|
55 |
+
|
56 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
57 |
+
do_action('ws_plugin__s2member_during_profile_before_table', get_defined_vars());
|
58 |
+
unset($__refs, $__v);
|
59 |
+
|
60 |
+
echo '<table cellpadding="0" cellspacing="0">'."\n";
|
61 |
+
echo '<tbody>'."\n";
|
62 |
|
63 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
64 |
+
do_action('ws_plugin__s2member_during_profile_before_fields', get_defined_vars());
|
65 |
+
unset($__refs, $__v);
|
66 |
+
|
67 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_username', TRUE, get_defined_vars()))
|
68 |
+
{
|
69 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
70 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_username', get_defined_vars());
|
71 |
+
unset($__refs, $__v);
|
72 |
+
|
73 |
+
echo '<tr>'."\n";
|
74 |
+
echo '<td>'."\n";
|
75 |
+
echo '<label for="ws-plugin--s2member-profile-login">'."\n";
|
76 |
+
echo '<strong>'._x('Username', 's2member-front', 's2member').' *</strong> <small>'._x('(cannot be changed)', 's2member-front', 's2member').'</small><br />'."\n";
|
77 |
+
echo '<input type="text" aria-required="true" maxlength="60" autocomplete="off" name="ws_plugin__s2member_profile_login" id="ws-plugin--s2member-profile-login" class="ws-plugin--s2member-profile-field form-control" value="'.format_to_edit($user->user_login).'" disabled="disabled" />'."\n";
|
78 |
+
echo '</label>'."\n";
|
79 |
+
echo '</td>'."\n";
|
80 |
+
echo '</tr>'."\n";
|
81 |
+
|
82 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
83 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_username', get_defined_vars());
|
84 |
+
unset($__refs, $__v);
|
85 |
+
}
|
86 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_email', TRUE, get_defined_vars()))
|
87 |
+
{
|
88 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
89 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_email', get_defined_vars());
|
90 |
+
unset($__refs, $__v);
|
91 |
+
|
92 |
+
echo '<tr>'."\n";
|
93 |
+
echo '<td>'."\n";
|
94 |
+
echo '<label for="ws-plugin--s2member-profile-email">'."\n";
|
95 |
+
echo '<strong>'._x('Email Address', 's2member-front', 's2member').' *</strong><br />'."\n";
|
96 |
+
echo '<input type="email" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" class="ws-plugin--s2member-profile-field form-control" value="'.format_to_edit($user->user_email).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
97 |
+
echo '</label>'."\n";
|
98 |
+
echo '</td>'."\n";
|
99 |
+
echo '</tr>'."\n";
|
100 |
+
|
101 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
102 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_email', get_defined_vars());
|
103 |
+
unset($__refs, $__v);
|
104 |
+
}
|
105 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'])
|
106 |
+
{
|
107 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_first_name', TRUE, get_defined_vars()))
|
108 |
+
{
|
109 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
110 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_first_name', get_defined_vars());
|
111 |
+
unset($__refs, $__v);
|
112 |
+
|
113 |
+
echo '<tr>'."\n";
|
114 |
+
echo '<td>'."\n";
|
115 |
+
echo '<label for="ws-plugin--s2member-profile-first-name">'."\n";
|
116 |
+
echo '<strong>'._x('First Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
117 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->first_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
118 |
+
echo '</label>'."\n";
|
119 |
+
echo '</td>'."\n";
|
120 |
+
echo '</tr>'."\n";
|
121 |
+
|
122 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
123 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_first_name', get_defined_vars());
|
124 |
+
unset($__refs, $__v);
|
125 |
+
}
|
126 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_last_name', TRUE, get_defined_vars()))
|
127 |
+
{
|
128 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
129 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_last_name', get_defined_vars());
|
130 |
+
unset($__refs, $__v);
|
131 |
+
|
132 |
+
echo '<tr>'."\n";
|
133 |
+
echo '<td>'."\n";
|
134 |
+
echo '<label for="ws-plugin--s2member-profile-last-name">'."\n";
|
135 |
+
echo '<strong>'._x('Last Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
136 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->last_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
137 |
+
echo '</label>'."\n";
|
138 |
+
echo '</td>'."\n";
|
139 |
+
echo '</tr>'."\n";
|
140 |
+
|
141 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
142 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_last_name', get_defined_vars());
|
143 |
+
unset($__refs, $__v);
|
144 |
+
}
|
145 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_display_name', TRUE, get_defined_vars()))
|
146 |
+
{
|
147 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
148 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_display_name', get_defined_vars());
|
149 |
+
unset($__refs, $__v);
|
150 |
+
|
151 |
+
echo '<tr>'."\n";
|
152 |
+
echo '<td>'."\n";
|
153 |
+
echo '<label for="ws-plugin--s2member-profile-display-name">'."\n";
|
154 |
+
echo '<strong>'._x('Display Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
155 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_display_name" id="ws-plugin--s2member-profile-display-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->display_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
156 |
+
echo '</label>'."\n";
|
157 |
+
echo '</td>'."\n";
|
158 |
+
echo '</tr>'."\n";
|
159 |
+
|
160 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
161 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_display_name', get_defined_vars());
|
162 |
+
unset($__refs, $__v);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_custom_fields', TRUE, get_defined_vars()))
|
166 |
+
{
|
167 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) // Now, do we have Custom Fields?
|
168 |
+
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile'))
|
169 |
{
|
170 |
+
$fields = get_user_option('s2member_custom_fields', $user_id);
|
171 |
+
|
172 |
+
$tabindex = $tabindex + 9; // Start tabindex at +9 ( +1 below ).
|
173 |
|
174 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
175 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_custom_fields', get_defined_vars());
|
176 |
+
unset($__refs, $__v);
|
177 |
|
178 |
+
foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
|
179 |
+
{
|
180 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
181 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before', get_defined_vars());
|
182 |
+
unset($__refs, $__v);
|
183 |
+
|
184 |
+
if(in_array($field['id'], $fields_applicable)) // Field applicable?
|
185 |
{
|
186 |
+
$field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
|
187 |
+
$field_id_class = preg_replace('/_/', '-', $field_var);
|
188 |
+
|
189 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
190 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display', TRUE, get_defined_vars()))
|
191 |
+
{
|
192 |
+
if(!empty($field['section']) && $field['section'] === 'yes') // Starts a new section?
|
193 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section'.((!empty($field['sectitle'])) ? '-title' : '').'">'.((!empty($field['sectitle'])) ? $field['sectitle'] : '').'</div></td></tr>';
|
194 |
+
|
195 |
+
echo '<tr>'."\n";
|
196 |
+
echo '<td>'."\n";
|
197 |
+
echo '<label for="ws-plugin--s2member-profile-'.esc_attr($field_id_class).'">'."\n";
|
198 |
+
echo '<strong'.((preg_match('/^(checkbox|pre_checkbox)$/', $field['type'])) ? ' style="display:none;"' : '').'>'.$field['label'].(($field['required'] === 'yes') ? ' *' : '').'</strong></label>'.((preg_match('/^(checkbox|pre_checkbox)$/', $field['type'])) ? '' : '<br />')."\n";
|
199 |
+
echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_', 'ws-plugin--s2member-profile-', 'ws-plugin--s2member-profile-field', '', ($tabindex = $tabindex + 1), '', $fields, $fields[$field_var], 'profile');
|
200 |
+
echo '</td>'."\n";
|
201 |
+
echo '</tr>'."\n";
|
202 |
+
}
|
203 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
206 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after', get_defined_vars());
|
207 |
+
unset($__refs, $__v);
|
208 |
+
}
|
209 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
210 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_custom_fields', get_defined_vars());
|
211 |
+
unset($__refs, $__v);
|
212 |
}
|
213 |
+
}
|
214 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_password', TRUE, get_defined_vars()))
|
215 |
+
{
|
216 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
217 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_password', get_defined_vars());
|
218 |
+
unset($__refs, $__v);
|
219 |
+
|
220 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section"></div></td></tr>';
|
221 |
|
222 |
+
echo '<tr>'."\n";
|
223 |
+
echo '<td>'."\n";
|
224 |
+
|
225 |
+
echo '<label for="ws-plugin--s2member-profile-password1" title="'.esc_attr(_x('Please type your Password twice to confirm.', 's2member-front', 's2member')).'">'."\n";
|
226 |
+
echo '<strong>'._x('New Password?', 's2member-front', 's2member').'</strong> <em>'._x('(please type it twice)', 's2member-front', 's2member').'</em><br />'."\n";
|
227 |
+
echo '<em>'._x('Only if changing password, otherwise leave blank.', 's2member-front', 's2member').'</em><br />'."\n";
|
228 |
+
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password1" id="ws-plugin--s2member-profile-password1" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'"'.(($user->user_login === 'demo') ? ' disabled="disabled"' : '').' />'."\n";
|
229 |
+
echo '</label>'."\n";
|
230 |
+
|
231 |
+
echo '<label for="ws-plugin--s2member-profile-password2" title="'.esc_attr(_x('Please type your Password twice to confirm.', 's2member-front', 's2member')).'">'."\n";
|
232 |
+
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password2" id="ws-plugin--s2member-profile-password2" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'"'.(($user->user_login === 'demo') ? ' disabled="disabled"' : '').' />'."\n";
|
233 |
+
echo '</label>'."\n";
|
234 |
+
|
235 |
+
echo '<div id="ws-plugin--s2member-profile-password-strength" class="ws-plugin--s2member-password-strength"><em>'._x('password strength indicator', 's2member-front', 's2member').'</em></div>'."\n";
|
236 |
+
|
237 |
+
echo '</td>'."\n";
|
238 |
+
echo '</tr>'."\n";
|
239 |
+
|
240 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
241 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_password', get_defined_vars());
|
242 |
+
unset($__refs, $__v);
|
243 |
+
}
|
244 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
|
245 |
+
{
|
246 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
247 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_opt_in', get_defined_vars());
|
248 |
+
unset($__refs, $__v);
|
249 |
+
|
250 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section"></div></td></tr>';
|
251 |
+
|
252 |
+
echo '<tr>'."\n";
|
253 |
+
echo '<td>'."\n";
|
254 |
+
echo '<label for="ws-plugin--s2member-profile-opt-in">'."\n";
|
255 |
+
echo '<input type="checkbox" name="ws_plugin__s2member_profile_opt_in" id="ws-plugin--s2member-profile-opt-in" class="ws-plugin--s2member-profile-field" value="1"'.((get_user_option('s2member_opt_in', $user_id)) ? ' checked="checked"' : '').' tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
256 |
+
echo $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label']."\n";
|
257 |
+
echo '</label>'."\n";
|
258 |
+
echo '</td>'."\n";
|
259 |
+
echo '</tr>'."\n";
|
260 |
+
|
261 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
262 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_opt_in', get_defined_vars());
|
263 |
+
unset($__refs, $__v);
|
264 |
}
|
265 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
266 |
+
do_action('ws_plugin__s2member_during_profile_after_fields', get_defined_vars());
|
267 |
+
unset($__refs, $__v);
|
268 |
+
|
269 |
+
echo '<tr>'."\n";
|
270 |
+
echo '<td>'."\n";
|
271 |
+
echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="'.esc_attr(wp_create_nonce('ws-plugin--s2member-profile-save')).'" />'."\n";
|
272 |
+
echo '<input type="submit" id="ws-plugin--s2member-profile-submit" class="btn btn-primary" value="'.esc_attr(_x('Save All Changes', 's2member-front', 's2member')).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
273 |
+
echo '</td>'."\n";
|
274 |
+
echo '</tr>'."\n";
|
275 |
+
|
276 |
+
echo '</tbody>'."\n";
|
277 |
+
echo '</table>'."\n";
|
278 |
+
|
279 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
280 |
+
do_action('ws_plugin__s2member_during_profile_after_table', get_defined_vars());
|
281 |
+
unset($__refs, $__v);
|
282 |
+
|
283 |
+
echo '</form>'."\n";
|
284 |
+
|
285 |
+
echo '</body>'."\n";
|
286 |
+
echo '</html>';
|
287 |
+
}
|
288 |
+
exit();
|
289 |
}
|
290 |
+
do_action('ws_plugin__s2member_after_profile', get_defined_vars());
|
291 |
+
}
|
292 |
}
|
293 |
+
}
|
includes/classes/profile-mods-4bp-in.inc.php
CHANGED
@@ -1,121 +1,123 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Profile modifications for BuddyPress (inner processing routines).
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
* @package s2Member\Profiles
|
34 |
-
* @since 3.5
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null After re-configuring the ``$current_user`` object.
|
39 |
-
*/
|
40 |
-
public static function handle_profile_modifications_4bp ()
|
41 |
-
{
|
42 |
-
global $current_user; // We'll need to update this global object.
|
43 |
-
|
44 |
-
$user = &$current_user; // Shorter reference to the ``$current_user`` object.
|
45 |
-
|
46 |
-
do_action ("ws_plugin__s2member_before_handle_profile_modifications_4bp", get_defined_vars ());
|
47 |
-
|
48 |
-
if (!empty ($_POST["ws_plugin__s2member_profile_4bp_save"]) && is_user_logged_in () && is_object ($user) && !empty ($user->ID) && ($user_id = $user->ID))
|
49 |
-
{
|
50 |
-
if (($nonce = $_POST["ws_plugin__s2member_profile_4bp_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-profile-4bp-save"))
|
51 |
-
{
|
52 |
-
$GLOBALS["ws_plugin__s2member_profile_4bp_saved"] = true; // Global flag as having been saved/updated successfully.
|
53 |
|
54 |
-
|
55 |
|
56 |
-
|
57 |
-
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection", "profile"))
|
58 |
-
{
|
59 |
-
$fields = array(); // Initialize the array of fields.
|
60 |
-
$_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
|
|
66 |
|
67 |
-
|
68 |
-
{
|
69 |
-
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
|
70 |
-
$fields[$field_var] = $_existing_fields[$field_var];
|
71 |
-
else // Else ``unset()``.
|
72 |
-
unset($fields[$field_var]);
|
73 |
-
}
|
74 |
-
else if ( // If the field is required but missing; or it was provided but invalid...
|
75 |
-
($field["required"] === "yes" && (!isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])
|
76 |
-
|| (!is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
|
77 |
-
|| (is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
|
78 |
-
|| (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))))
|
79 |
-
|| (isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p["ws_plugin__s2member_profile_4bp_" . $field_var]), array($field)))
|
80 |
-
)
|
81 |
-
{
|
82 |
-
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
|
83 |
-
$fields[$field_var] = $_existing_fields[$field_var];
|
84 |
-
else // Else ``unset()``.
|
85 |
-
unset($fields[$field_var]);
|
86 |
-
}
|
87 |
-
else if (isset ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
|
88 |
-
{
|
89 |
-
if (((is_array ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && !empty ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]))
|
90 |
-
|| (is_string ($_p["ws_plugin__s2member_profile_4bp_" . $field_var]) && strlen ($_p["ws_plugin__s2member_profile_4bp_" . $field_var])))
|
91 |
-
&& !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p["ws_plugin__s2member_profile_4bp_" . $field_var]), array($field)))
|
92 |
-
$fields[$field_var] = $_p["ws_plugin__s2member_profile_4bp_" . $field_var];
|
93 |
-
else // Else ``unset()``.
|
94 |
-
unset($fields[$field_var]);
|
95 |
-
}
|
96 |
-
else // Else ``unset()``.
|
97 |
-
unset($fields[$field_var]);
|
98 |
-
}
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
|
|
|
|
|
|
|
116 |
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
|
|
119 |
}
|
|
|
|
|
120 |
}
|
121 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Profile modifications for BuddyPress (inner processing routines).
|
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\Profiles
|
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_profile_mods_4bp_in'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Profile modifications for BuddyPress (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile_mods_4bp_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Profile modifications for Custom Fields *(created with s2Member)*; integrated with BuddyPress.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('xprofile_updated_profile');``
|
37 |
+
*/
|
38 |
+
public static function handle_profile_modifications_4bp()
|
39 |
+
{
|
40 |
+
global $current_user; // We'll need to update this global object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
$user = & $current_user; // Shorter reference to the ``$current_user`` object.
|
43 |
|
44 |
+
do_action('ws_plugin__s2member_before_handle_profile_modifications_4bp', get_defined_vars());
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
if(!empty($_POST['ws_plugin__s2member_profile_4bp_save']) && is_user_logged_in() && is_object($user) && !empty($user->ID) && ($user_id = $user->ID))
|
47 |
+
{
|
48 |
+
if(($nonce = $_POST['ws_plugin__s2member_profile_4bp_save']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-profile-4bp-save'))
|
49 |
+
{
|
50 |
+
$GLOBALS['ws_plugin__s2member_profile_4bp_saved'] = TRUE; // Global flag as having been saved/updated successfully.
|
51 |
|
52 |
+
$_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)); // Clean ``$_POST`` vars.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'])
|
55 |
+
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile'))
|
56 |
+
{
|
57 |
+
$fields = array(); // Initialize the array of fields.
|
58 |
+
$_existing_fields = get_user_option('s2member_custom_fields', $user_id);
|
59 |
|
60 |
+
foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
|
61 |
+
{
|
62 |
+
$field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
|
63 |
+
$field_id_class = preg_replace('/_/', '-', $field_var);
|
64 |
|
65 |
+
if(!in_array($field['id'], $fields_applicable) || strpos($field['editable'], 'no') === 0)
|
66 |
+
{
|
67 |
+
if(isset ($_existing_fields[$field_var]) && ((is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var])) || (is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))))
|
68 |
+
$fields[$field_var] = $_existing_fields[$field_var];
|
69 |
+
else unset($fields[$field_var]);
|
70 |
+
}
|
71 |
+
else if( // If the field is required but missing; or it was provided but invalid...
|
72 |
+
($field['required'] === 'yes' && (!isset ($_p['ws_plugin__s2member_profile_4bp_'.$field_var])
|
73 |
+
|| (!is_array($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && !is_string($_p['ws_plugin__s2member_profile_4bp_'.$field_var]))
|
74 |
+
|| (is_array($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && empty($_p['ws_plugin__s2member_profile_4bp_'.$field_var]))
|
75 |
+
|| (is_string($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && !strlen($_p['ws_plugin__s2member_profile_4bp_'.$field_var]))))
|
76 |
+
|| (isset ($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_4bp_'.$field_var]), array($field)))
|
77 |
+
)
|
78 |
+
{
|
79 |
+
if(isset ($_existing_fields[$field_var]) && ((is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var])) || (is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))))
|
80 |
+
$fields[$field_var] = $_existing_fields[$field_var];
|
81 |
+
else unset($fields[$field_var]);
|
82 |
+
}
|
83 |
+
else if(isset ($_p['ws_plugin__s2member_profile_4bp_'.$field_var]))
|
84 |
+
{
|
85 |
+
if(((is_array($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && !empty($_p['ws_plugin__s2member_profile_4bp_'.$field_var]))
|
86 |
+
|| (is_string($_p['ws_plugin__s2member_profile_4bp_'.$field_var]) && strlen($_p['ws_plugin__s2member_profile_4bp_'.$field_var])))
|
87 |
+
&& !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_4bp_'.$field_var]), array($field))
|
88 |
+
)
|
89 |
+
$fields[$field_var] = $_p['ws_plugin__s2member_profile_4bp_'.$field_var];
|
90 |
+
else unset($fields[$field_var]);
|
91 |
+
}
|
92 |
+
else unset($fields[$field_var]);
|
93 |
}
|
94 |
+
if(!empty($fields))
|
95 |
+
update_user_option($user_id, 's2member_custom_fields', $fields);
|
96 |
+
else // Else delete their Custom Fields?
|
97 |
+
delete_user_option($user_id, 's2member_custom_fields');
|
98 |
+
}
|
99 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
100 |
+
do_action('ws_plugin__s2member_during_handle_profile_modifications_4bp', get_defined_vars());
|
101 |
+
unset($__refs, $__v);
|
102 |
|
103 |
+
$user = new WP_User($user_id);
|
104 |
+
(function_exists('setup_userdata')) ? setup_userdata() : NULL;
|
105 |
+
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
106 |
+
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
107 |
|
108 |
+
if(!empty($_p['ws_plugin__s2member_profile_4bp_opt_in']) && $role && $level >= 0)
|
109 |
+
{
|
110 |
+
update_user_option($user_id, 's2member_opt_in', '1');
|
111 |
+
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
112 |
+
}
|
113 |
+
else if($role && $level >= 0)
|
114 |
+
{
|
115 |
+
update_user_option($user_id, 's2member_opt_in', '0');
|
116 |
+
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, '', $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
117 |
}
|
118 |
+
}
|
119 |
}
|
120 |
+
do_action('ws_plugin__s2member_after_handle_profile_modifications_4bp', get_defined_vars());
|
121 |
+
}
|
122 |
}
|
123 |
+
}
|
includes/classes/profile-mods-4bp.inc.php
CHANGED
@@ -1,49 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Profile modifications for BuddyPress.
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null|inner Return-value of inner routine.
|
39 |
-
*/
|
40 |
-
public static function handle_profile_modifications_4bp ()
|
41 |
-
{
|
42 |
-
if (!empty ($_POST["ws_plugin__s2member_profile_4bp_save"]))
|
43 |
-
{
|
44 |
-
return c_ws_plugin__s2member_profile_mods_4bp_in::handle_profile_modifications_4bp ();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
}
|
49 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Profile modifications for BuddyPress.
|
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\Profiles
|
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_profile_mods_4bp'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Profile modifications for BuddyPress.
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile_mods_4bp
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Profile modifications for Custom Fields *(created with s2Member)*; integrated with BuddyPress.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('xprofile_updated_profile');``
|
37 |
+
*/
|
38 |
+
public static function handle_profile_modifications_4bp()
|
39 |
+
{
|
40 |
+
if(!empty($_POST['ws_plugin__s2member_profile_4bp_save']))
|
41 |
+
c_ws_plugin__s2member_profile_mods_4bp_in::handle_profile_modifications_4bp();
|
42 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
}
|
includes/classes/profile-mods-in.inc.php
CHANGED
@@ -1,157 +1,159 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member Profile modifications (inner processing routines).
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
{
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
$
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$_existing_fields = get_user_option ("s2member_custom_fields", $user_id);
|
83 |
-
|
84 |
-
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
85 |
-
{
|
86 |
-
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
87 |
-
$field_id_class = preg_replace ("/_/", "-", $field_var);
|
88 |
-
|
89 |
-
if (!in_array ($field["id"], $fields_applicable) || strpos ($field["editable"], "no") === 0)
|
90 |
-
{
|
91 |
-
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
|
92 |
-
$fields[$field_var] = $_existing_fields[$field_var];
|
93 |
-
else // Else ``unset()``.
|
94 |
-
unset($fields[$field_var]);
|
95 |
-
}
|
96 |
-
else if ( // If the field is required but missing; or it was provided but invalid...
|
97 |
-
($field["required"] === "yes" && (!isset ($_p["ws_plugin__s2member_profile_" . $field_var])
|
98 |
-
|| (!is_array ($_p["ws_plugin__s2member_profile_" . $field_var]) && !is_string ($_p["ws_plugin__s2member_profile_" . $field_var]))
|
99 |
-
|| (is_array ($_p["ws_plugin__s2member_profile_" . $field_var]) && empty ($_p["ws_plugin__s2member_profile_" . $field_var]))
|
100 |
-
|| (is_string ($_p["ws_plugin__s2member_profile_" . $field_var]) && !strlen ($_p["ws_plugin__s2member_profile_" . $field_var]))))
|
101 |
-
|| (isset ($_p["ws_plugin__s2member_profile_" . $field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p["ws_plugin__s2member_profile_" . $field_var]), array($field)))
|
102 |
-
)
|
103 |
-
{
|
104 |
-
if (isset ($_existing_fields[$field_var]) && ((is_array ($_existing_fields[$field_var]) && !empty ($_existing_fields[$field_var])) || (is_string ($_existing_fields[$field_var]) && strlen ($_existing_fields[$field_var]))))
|
105 |
-
$fields[$field_var] = $_existing_fields[$field_var];
|
106 |
-
else // Else ``unset()``.
|
107 |
-
unset($fields[$field_var]);
|
108 |
-
}
|
109 |
-
else if (isset ($_p["ws_plugin__s2member_profile_" . $field_var]))
|
110 |
-
{
|
111 |
-
if (((is_array ($_p["ws_plugin__s2member_profile_" . $field_var]) && !empty ($_p["ws_plugin__s2member_profile_" . $field_var]))
|
112 |
-
|| (is_string ($_p["ws_plugin__s2member_profile_" . $field_var]) && strlen ($_p["ws_plugin__s2member_profile_" . $field_var])))
|
113 |
-
&& !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p["ws_plugin__s2member_profile_" . $field_var]), array($field)))
|
114 |
-
$fields[$field_var] = $_p["ws_plugin__s2member_profile_" . $field_var];
|
115 |
-
else // Else ``unset()``.
|
116 |
-
unset($fields[$field_var]);
|
117 |
-
}
|
118 |
-
else // Else ``unset()``.
|
119 |
-
unset($fields[$field_var]);
|
120 |
-
}
|
121 |
-
|
122 |
-
if (!empty ($fields))
|
123 |
-
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
124 |
-
else // Else delete their Custom Fields?
|
125 |
-
delete_user_option ($user_id, "s2member_custom_fields");
|
126 |
-
}
|
127 |
-
|
128 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
129 |
-
do_action ("ws_plugin__s2member_during_handle_profile_modifications", get_defined_vars ());
|
130 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
131 |
-
|
132 |
-
$user = new WP_User ($user_id); // Update the ``WP_User`` object for the current User/Member.
|
133 |
-
(function_exists ("setup_userdata")) ? setup_userdata () : null; // Update global vars.
|
134 |
-
|
135 |
-
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
|
136 |
-
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
|
137 |
-
|
138 |
-
if (empty ($_p["ws_plugin__s2member_sc_profile_save"]))
|
139 |
-
{
|
140 |
-
echo '<script type="text/javascript">' . "\n";
|
141 |
-
echo "if(window.parent && window.parent != window) { window.parent.alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Profile updated successfully.", "s2member-front", "s2member")) . "'); window.parent.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($lwp) . "'; }";
|
142 |
-
echo "else if(window.opener) { window.alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Profile updated successfully.", "s2member-front", "s2member")) . "'); window.opener.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($lwp) . "'; window.close(); }";
|
143 |
-
echo "else { alert('" . c_ws_plugin__s2member_utils_strings::esc_js_sq (_x ("Profile updated successfully.", "s2member-front", "s2member")) . "'); window.location = '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($lwp) . "'; }";
|
144 |
-
echo '</script>' . "\n";
|
145 |
-
|
146 |
-
exit /* Clean exit. */ ();
|
147 |
-
}
|
148 |
-
}
|
149 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
154 |
}
|
|
|
155 |
}
|
|
|
|
|
156 |
}
|
157 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member Profile modifications (inner processing routines).
|
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\Profiles
|
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_profile_mods_in'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member Profile modifications (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile_mods_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Profile modifications.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('init');``
|
37 |
+
*/
|
38 |
+
public static function handle_profile_modifications()
|
39 |
+
{
|
40 |
+
global $current_user; // We'll need to update this global object.
|
41 |
+
|
42 |
+
$user = & $current_user; // Shorter reference to the $current_user object.
|
43 |
+
|
44 |
+
do_action('ws_plugin__s2member_before_handle_profile_modifications', get_defined_vars());
|
45 |
+
|
46 |
+
if(!empty($_POST['ws_plugin__s2member_profile_save']) && is_user_logged_in() && is_object($user) && !empty($user->ID) && ($user_id = $user->ID))
|
47 |
{
|
48 |
+
if(($nonce = $_POST['ws_plugin__s2member_profile_save']) && wp_verify_nonce($nonce, 'ws-plugin--s2member-profile-save'))
|
49 |
+
{
|
50 |
+
$GLOBALS['ws_plugin__s2member_profile_saved'] = TRUE; // Global flag as having been saved/updated successfully.
|
51 |
+
|
52 |
+
$_p = c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)); // Clean ``$_POST`` vars.
|
53 |
+
|
54 |
+
$userdata['ID'] = $user_id; // Needed for database update.
|
55 |
+
|
56 |
+
if(!empty($_p['ws_plugin__s2member_profile_email']))
|
57 |
+
if(is_email($_p['ws_plugin__s2member_profile_email']) && !email_exists($_p['ws_plugin__s2member_profile_email']))
|
58 |
+
{
|
59 |
+
$userdata['user_email'] = $_p['ws_plugin__s2member_profile_email'];
|
60 |
+
if(strcasecmp($userdata['user_email'], $user->user_email) !== 0)
|
61 |
+
$email_change = TRUE;
|
62 |
+
}
|
63 |
+
if(!empty($_p['ws_plugin__s2member_profile_password1']))
|
64 |
+
if($user->user_login !== 'demo') // No pass change on demo!
|
65 |
+
$userdata['user_pass'] = $_p['ws_plugin__s2member_profile_password1'];
|
66 |
+
|
67 |
+
if(!empty($_p['ws_plugin__s2member_profile_first_name']))
|
68 |
+
$userdata['first_name'] = $_p['ws_plugin__s2member_profile_first_name'];
|
69 |
+
|
70 |
+
if(!empty($_p['ws_plugin__s2member_profile_display_name']))
|
71 |
+
$userdata['display_name'] = $_p['ws_plugin__s2member_profile_display_name'];
|
72 |
+
|
73 |
+
if(!empty($_p['ws_plugin__s2member_profile_last_name']))
|
74 |
+
$userdata['last_name'] = $_p['ws_plugin__s2member_profile_last_name'];
|
75 |
|
76 |
+
wp_update_user($userdata); // OK. Now send this array for an update.
|
77 |
|
78 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'])
|
79 |
+
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile'))
|
80 |
+
{
|
81 |
+
$fields = array(); // Initialize the array of fields.
|
82 |
+
$_existing_fields = get_user_option('s2member_custom_fields', $user_id);
|
83 |
|
84 |
+
foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
|
85 |
{
|
86 |
+
$field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
|
87 |
+
$field_id_class = preg_replace('/_/', '-', $field_var);
|
88 |
+
|
89 |
+
if(!in_array($field['id'], $fields_applicable) || strpos($field['editable'], 'no') === 0)
|
90 |
+
{
|
91 |
+
if(isset($_existing_fields[$field_var]) && ((is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var])) || (is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))))
|
92 |
+
$fields[$field_var] = $_existing_fields[$field_var];
|
93 |
+
else unset($fields[$field_var]);
|
94 |
+
}
|
95 |
+
else if( // If the field is required but missing; or it was provided but invalid...
|
96 |
+
($field['required'] === 'yes' && (!isset ($_p['ws_plugin__s2member_profile_'.$field_var])
|
97 |
+
|| (!is_array($_p['ws_plugin__s2member_profile_'.$field_var]) && !is_string($_p['ws_plugin__s2member_profile_'.$field_var]))
|
98 |
+
|| (is_array($_p['ws_plugin__s2member_profile_'.$field_var]) && empty($_p['ws_plugin__s2member_profile_'.$field_var]))
|
99 |
+
|| (is_string($_p['ws_plugin__s2member_profile_'.$field_var]) && !strlen($_p['ws_plugin__s2member_profile_'.$field_var]))))
|
100 |
+
|| (isset($_p['ws_plugin__s2member_profile_'.$field_var]) && c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_'.$field_var]), array($field)))
|
101 |
+
)
|
102 |
+
{
|
103 |
+
if(isset($_existing_fields[$field_var]) && ((is_array($_existing_fields[$field_var]) && !empty($_existing_fields[$field_var])) || (is_string($_existing_fields[$field_var]) && strlen($_existing_fields[$field_var]))))
|
104 |
+
$fields[$field_var] = $_existing_fields[$field_var];
|
105 |
+
else unset($fields[$field_var]);
|
106 |
+
}
|
107 |
+
else if(isset($_p['ws_plugin__s2member_profile_'.$field_var]))
|
108 |
+
{
|
109 |
+
if(((is_array($_p['ws_plugin__s2member_profile_'.$field_var]) && !empty($_p['ws_plugin__s2member_profile_'.$field_var]))
|
110 |
+
|| (is_string($_p['ws_plugin__s2member_profile_'.$field_var]) && strlen($_p['ws_plugin__s2member_profile_'.$field_var])))
|
111 |
+
&& !c_ws_plugin__s2member_custom_reg_fields::validation_errors(array($field_var => $_p['ws_plugin__s2member_profile_'.$field_var]), array($field))
|
112 |
+
)
|
113 |
+
$fields[$field_var] = $_p['ws_plugin__s2member_profile_'.$field_var];
|
114 |
+
else unset($fields[$field_var]);
|
115 |
+
}
|
116 |
+
else unset($fields[$field_var]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
}
|
118 |
+
if(!empty($fields))
|
119 |
+
update_user_option($user_id, 's2member_custom_fields', $fields);
|
120 |
+
else // Else delete their Custom Fields?
|
121 |
+
delete_user_option($user_id, 's2member_custom_fields');
|
122 |
+
}
|
123 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
124 |
+
do_action('ws_plugin__s2member_during_handle_profile_modifications', get_defined_vars());
|
125 |
+
unset($__refs, $__v);
|
126 |
+
|
127 |
+
$user = new WP_User ($user_id);
|
128 |
+
if(function_exists('setup_userdata')) setup_userdata();
|
129 |
+
$role = c_ws_plugin__s2member_user_access::user_access_role($user);
|
130 |
+
$level = c_ws_plugin__s2member_user_access::user_access_role_to_level($role);
|
131 |
+
|
132 |
+
if(!empty($_p['ws_plugin__s2member_profile_opt_in']) && $role && $level >= 0)
|
133 |
+
{
|
134 |
+
update_user_option($user_id, 's2member_opt_in', '1');
|
135 |
+
c_ws_plugin__s2member_list_servers::process_list_servers($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, TRUE, $user_id);
|
136 |
+
}
|
137 |
+
else if($role && $level >= 0)
|
138 |
+
{
|
139 |
+
update_user_option($user_id, 's2member_opt_in', '0');
|
140 |
+
c_ws_plugin__s2member_list_servers::process_list_server_removals($role, $level, $user->user_login, ((!empty($userdata['user_pass'])) ? $userdata['user_pass'] : ''), $user->user_email, $user->first_name, $user->last_name, $_SERVER['REMOTE_ADDR'], TRUE, $user_id);
|
141 |
+
}
|
142 |
+
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url($user);
|
143 |
+
$lwp = (!$lwp) ? get_page_link($GLOBALS['WS_PLUGIN__']['s2member']['o']['login_welcome_page']) : $lwp;
|
144 |
|
145 |
+
if(empty($_p['ws_plugin__s2member_sc_profile_save']))
|
146 |
+
{
|
147 |
+
echo '<script type="text/javascript">'."\n";
|
148 |
+
echo "if(window.parent && window.parent != window) { window.parent.alert('".c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member'))."'); window.parent.location = '".c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp)."'; }";
|
149 |
+
echo "else if(window.opener) { window.alert('".c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member'))."'); window.opener.location = '".c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp)."'; window.close(); }";
|
150 |
+
echo "else { alert('".c_ws_plugin__s2member_utils_strings::esc_js_sq(_x('Profile updated successfully.', 's2member-front', 's2member'))."'); window.location = '".c_ws_plugin__s2member_utils_strings::esc_js_sq($lwp)."'; }";
|
151 |
+
echo '</script>'."\n";
|
152 |
+
exit();
|
153 |
}
|
154 |
+
}
|
155 |
}
|
156 |
+
do_action('ws_plugin__s2member_after_handle_profile_modifications', get_defined_vars());
|
157 |
+
}
|
158 |
}
|
159 |
+
}
|
includes/classes/profile-mods.inc.php
CHANGED
@@ -1,49 +1,44 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member Profile modifications.
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
*
|
36 |
-
* @attaches-to ``add_action("init");``
|
37 |
-
*
|
38 |
-
* @return null|inner Return-value of inner routine.
|
39 |
-
*/
|
40 |
-
public static function handle_profile_modifications ()
|
41 |
-
{
|
42 |
-
if (!empty ($_POST["ws_plugin__s2member_profile_save"]))
|
43 |
-
{
|
44 |
-
return c_ws_plugin__s2member_profile_mods_in::handle_profile_modifications ();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
}
|
49 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member Profile modifications.
|
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\Profiles
|
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_profile_mods'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member Profile modifications.
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile_mods
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Profile modifications.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('init');``
|
37 |
+
*/
|
38 |
+
public static function handle_profile_modifications()
|
39 |
+
{
|
40 |
+
if(!empty($_POST['ws_plugin__s2member_profile_save']))
|
41 |
+
c_ws_plugin__s2member_profile_mods_in::handle_profile_modifications();
|
42 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
+
}
|
includes/classes/profile.inc.php
CHANGED
@@ -1,49 +1,46 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member Stand-Alone Profile page.
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit(
|
19 |
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
*
|
38 |
-
* @return null|inner Return-value of inner routine.
|
39 |
-
*/
|
40 |
-
public static function profile ()
|
41 |
-
{
|
42 |
-
if (!empty ($_GET["s2member_profile"]))
|
43 |
-
{
|
44 |
-
return c_ws_plugin__s2member_profile_in::profile ();
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
}
|
49 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member Stand-Alone Profile page.
|
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\Profiles
|
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_profile'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* s2Member Stand-Alone Profile page.
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_profile
|
29 |
{
|
30 |
/**
|
31 |
+
* Displays a Stand-Alone Profile Modification Form.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_action('init');``
|
37 |
+
*
|
38 |
+
* @return null Return-value of inner routine.
|
39 |
+
*/
|
40 |
+
public static function profile()
|
41 |
+
{
|
42 |
+
if(!empty($_GET['s2member_profile']))
|
43 |
+
c_ws_plugin__s2member_profile_in::profile();
|
44 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
+
}
|
includes/classes/ptags-sp.inc.php
CHANGED
@@ -33,13 +33,13 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
|
|
33 |
* @package s2Member\Tags
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param int|
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array
|
39 |
*/
|
40 |
public static function check_specific_ptag_level_access ($_tag = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
if ($_tag && is_numeric ($_tag) && is_object ($term = get_term_by ("id", $_tag, "post_tag")))
|
45 |
{
|
@@ -60,28 +60,28 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
|
|
60 |
$tag_name = $term->name; // Tag name.
|
61 |
}
|
62 |
|
63 |
-
$excluded = apply_filters
|
64 |
|
65 |
-
if (!$excluded && !empty
|
66 |
{
|
67 |
$tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_tag_link ($tag_id)); // Get a full valid URI for this Tag.
|
68 |
|
69 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $tag_uri)) // Do NOT touch WordPress Systematics.
|
70 |
{
|
71 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
72 |
|
73 |
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, "/") . "$/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
74 |
-
return apply_filters
|
75 |
|
76 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $tag_uri)) // Never restrict Systematics. However, there is 1 exception above.
|
77 |
{
|
78 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions. Go through each Level.
|
79 |
{
|
80 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
81 |
-
return apply_filters
|
82 |
|
83 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (in_array
|
84 |
-
return apply_filters
|
85 |
}
|
86 |
|
87 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // URIs. Go through each Level.
|
@@ -90,15 +90,15 @@ if (!class_exists ("c_ws_plugin__s2member_ptags_sp"))
|
|
90 |
|
91 |
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)
|
92 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
93 |
-
return apply_filters
|
94 |
}
|
95 |
}
|
96 |
|
97 |
-
do_action
|
98 |
}
|
99 |
}
|
100 |
|
101 |
-
return apply_filters
|
102 |
}
|
103 |
}
|
104 |
}
|
33 |
* @package s2Member\Tags
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param int|string $_tag Numeric Tag ID, Tag Slug, or Tag Name.
|
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_ptag_level_access ($_tag = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_check_specific_ptag_level_access", get_defined_vars ());
|
43 |
|
44 |
if ($_tag && is_numeric ($_tag) && is_object ($term = get_term_by ("id", $_tag, "post_tag")))
|
45 |
{
|
60 |
$tag_name = $term->name; // Tag name.
|
61 |
}
|
62 |
|
63 |
+
$excluded = apply_filters("ws_plugin__s2member_check_specific_ptag_level_access_excluded", false, get_defined_vars ());
|
64 |
|
65 |
+
if (!$excluded && !empty($tag_id) && !empty($tag_slug) && !empty($tag_name) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
66 |
{
|
67 |
$tag_uri = c_ws_plugin__s2member_utils_urls::parse_uri (get_tag_link ($tag_id)); // Get a full valid URI for this Tag.
|
68 |
|
69 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $tag_uri)) // Do NOT touch WordPress Systematics.
|
70 |
{
|
71 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
72 |
|
73 |
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, "/") . "$/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
74 |
+
return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
75 |
|
76 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $tag_uri)) // Never restrict Systematics. However, there is 1 exception above.
|
77 |
{
|
78 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // Tag Level restrictions. Go through each Level.
|
79 |
{
|
80 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
81 |
+
return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
82 |
|
83 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (in_array($tag_name, ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"]))) || in_array($tag_slug, $tags)) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
84 |
+
return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
85 |
}
|
86 |
|
87 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) // URIs. Go through each Level.
|
90 |
|
91 |
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)
|
92 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $tag_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
93 |
+
return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
94 |
}
|
95 |
}
|
96 |
|
97 |
+
do_action("ws_plugin__s2member_during_check_specific_ptag_level_access", get_defined_vars ());
|
98 |
}
|
99 |
}
|
100 |
|
101 |
+
return apply_filters("ws_plugin__s2member_check_specific_ptag_level_access", null, get_defined_vars ());
|
102 |
}
|
103 |
}
|
104 |
}
|
includes/classes/ptags.inc.php
CHANGED
@@ -39,15 +39,15 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
|
|
39 |
{
|
40 |
global $wp_query, $post; // ``get_the_ID()`` is NOT available outside The Loop.
|
41 |
|
42 |
-
do_action
|
43 |
|
44 |
-
$excluded = apply_filters
|
45 |
|
46 |
-
if (!$excluded && is_tag () && is_object ($tag = $wp_query->get_queried_object ()) && !empty
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
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, "/") . "$/", $_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. */ ("ptag", $tag_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
@@ -59,7 +59,7 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
|
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "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. */ ("ptag", $tag_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
|
62 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (is_tag ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) || in_array
|
63 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("ptag", $tag_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
}
|
65 |
|
@@ -73,11 +73,11 @@ if (!class_exists ("c_ws_plugin__s2member_ptags"))
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
-
do_action
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
do_action
|
81 |
|
82 |
return; // For uniformity.
|
83 |
}
|
39 |
{
|
40 |
global $wp_query, $post; // ``get_the_ID()`` is NOT available outside The Loop.
|
41 |
|
42 |
+
do_action("ws_plugin__s2member_before_check_ptag_level_access", get_defined_vars ());
|
43 |
|
44 |
+
$excluded = apply_filters("ws_plugin__s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
|
45 |
|
46 |
+
if (!$excluded && is_tag () && is_object ($tag = $wp_query->get_queried_object ()) && !empty($tag->term_id) && ($tag_id = (int)$tag->term_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
49 |
{
|
50 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
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, "/") . "$/", $_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. */ ("ptag", $tag_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] === "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. */ ("ptag", $tag_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
|
62 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"] && (is_tag ($tags = preg_split ("/[\r\n\t;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ptags"])) || in_array($tag_id, $tags)) && 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. */ ("ptag", $tag_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
}
|
65 |
|
73 |
}
|
74 |
}
|
75 |
|
76 |
+
do_action("ws_plugin__s2member_during_check_ptag_level_access", get_defined_vars ());
|
77 |
}
|
78 |
}
|
79 |
|
80 |
+
do_action("ws_plugin__s2member_after_check_ptag_level_access", get_defined_vars ());
|
81 |
|
82 |
return; // For uniformity.
|
83 |
}
|
includes/classes/querys.inc.php
CHANGED
@@ -47,20 +47,20 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
47 |
*
|
48 |
* @attaches-to ``add_action("pre_get_posts");``
|
49 |
*
|
50 |
-
* @param
|
51 |
* @return null
|
52 |
*/
|
53 |
public static function force_query_level_access(&$wp_query = FALSE)
|
54 |
{
|
55 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
do_action("ws_plugin__s2member_before_force_query_level_access", get_defined_vars());
|
57 |
-
unset
|
58 |
|
59 |
c_ws_plugin__s2member_querys::query_level_access($wp_query, true);
|
60 |
|
61 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
62 |
do_action("ws_plugin__s2member_after_force_query_level_access", get_defined_vars());
|
63 |
-
unset
|
64 |
|
65 |
return; // For uniformity.
|
66 |
}
|
@@ -75,7 +75,7 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
75 |
*
|
76 |
* @attaches-to ``add_action("pre_get_posts");``
|
77 |
*
|
78 |
-
* @param
|
79 |
* @param bool $force Optional. Defaults to false. If true, we bypass all standard conditions.
|
80 |
* However, s2Member will NEVER bypass `supress_filters`.
|
81 |
* @return null
|
@@ -93,7 +93,7 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
93 |
|
94 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
95 |
do_action("ws_plugin__s2member_before_query_level_access", get_defined_vars());
|
96 |
-
unset
|
97 |
|
98 |
c_ws_plugin__s2member_querys::_query_level_access_sys($wp_query); // Systematics.
|
99 |
|
@@ -239,14 +239,14 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
239 |
|
240 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
241 |
do_action("ws_plugin__s2member_during_query_level_access", get_defined_vars());
|
242 |
-
unset
|
243 |
}
|
244 |
}
|
245 |
}
|
246 |
|
247 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
248 |
do_action("ws_plugin__s2member_after_query_level_access", get_defined_vars());
|
249 |
-
unset
|
250 |
|
251 |
$initial_query = false; // No longer.
|
252 |
|
@@ -261,7 +261,7 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
261 |
* @package s2Member\Queries
|
262 |
* @since 3.5
|
263 |
*
|
264 |
-
* @param
|
265 |
* @return null
|
266 |
*/
|
267 |
public static function _query_level_access_sys(&$wp_query = FALSE)
|
@@ -270,7 +270,7 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
270 |
|
271 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
272 |
do_action("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars());
|
273 |
-
unset
|
274 |
|
275 |
if(is_object($wpdb) && is_object($wp_query) && !($suppressing_filters = $wp_query->get("suppress_filters")))
|
276 |
if((!is_admin() && ($wp_query->is_search() || $wp_query->is_feed())) || c_ws_plugin__s2member_querys::_is_admin_ajax_search($wp_query))
|
@@ -283,12 +283,12 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
283 |
|
284 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
285 |
do_action("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars());
|
286 |
-
unset
|
287 |
}
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars());
|
291 |
-
unset
|
292 |
|
293 |
return; // For uniformity.
|
294 |
}
|
@@ -337,9 +337,9 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
337 |
*
|
338 |
* @attaches-to ``add_filter("comment_feed_where");``
|
339 |
*
|
340 |
-
* @param
|
341 |
-
* @param
|
342 |
-
* @return
|
343 |
*/
|
344 |
public static function _query_level_access_coms($cwhere = FALSE, &$wp_query = FALSE)
|
345 |
{
|
@@ -363,7 +363,7 @@ if(!class_exists("c_ws_plugin__s2member_querys"))
|
|
363 |
* @package s2Member\Queries
|
364 |
* @since 110912
|
365 |
*
|
366 |
-
* @param
|
367 |
* @return bool True if it's an AJAX search via `admin-ajax.php`, else false.
|
368 |
*/
|
369 |
public static function _is_admin_ajax_search(&$wp_query = FALSE)
|
47 |
*
|
48 |
* @attaches-to ``add_action("pre_get_posts");``
|
49 |
*
|
50 |
+
* @param object $wp_query Expects ``$wp_query`` by reference.
|
51 |
* @return null
|
52 |
*/
|
53 |
public static function force_query_level_access(&$wp_query = FALSE)
|
54 |
{
|
55 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
do_action("ws_plugin__s2member_before_force_query_level_access", get_defined_vars());
|
57 |
+
unset($__refs, $__v);
|
58 |
|
59 |
c_ws_plugin__s2member_querys::query_level_access($wp_query, true);
|
60 |
|
61 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
62 |
do_action("ws_plugin__s2member_after_force_query_level_access", get_defined_vars());
|
63 |
+
unset($__refs, $__v);
|
64 |
|
65 |
return; // For uniformity.
|
66 |
}
|
75 |
*
|
76 |
* @attaches-to ``add_action("pre_get_posts");``
|
77 |
*
|
78 |
+
* @param object $wp_query Expects ``$wp_query`` by reference, from the Filter.
|
79 |
* @param bool $force Optional. Defaults to false. If true, we bypass all standard conditions.
|
80 |
* However, s2Member will NEVER bypass `supress_filters`.
|
81 |
* @return null
|
93 |
|
94 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
95 |
do_action("ws_plugin__s2member_before_query_level_access", get_defined_vars());
|
96 |
+
unset($__refs, $__v);
|
97 |
|
98 |
c_ws_plugin__s2member_querys::_query_level_access_sys($wp_query); // Systematics.
|
99 |
|
239 |
|
240 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
241 |
do_action("ws_plugin__s2member_during_query_level_access", get_defined_vars());
|
242 |
+
unset($__refs, $__v);
|
243 |
}
|
244 |
}
|
245 |
}
|
246 |
|
247 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
248 |
do_action("ws_plugin__s2member_after_query_level_access", get_defined_vars());
|
249 |
+
unset($__refs, $__v);
|
250 |
|
251 |
$initial_query = false; // No longer.
|
252 |
|
261 |
* @package s2Member\Queries
|
262 |
* @since 3.5
|
263 |
*
|
264 |
+
* @param object $wp_query Expects ``$wp_query`` by reference.
|
265 |
* @return null
|
266 |
*/
|
267 |
public static function _query_level_access_sys(&$wp_query = FALSE)
|
270 |
|
271 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
272 |
do_action("_ws_plugin__s2member_before_query_level_access_sys", get_defined_vars());
|
273 |
+
unset($__refs, $__v);
|
274 |
|
275 |
if(is_object($wpdb) && is_object($wp_query) && !($suppressing_filters = $wp_query->get("suppress_filters")))
|
276 |
if((!is_admin() && ($wp_query->is_search() || $wp_query->is_feed())) || c_ws_plugin__s2member_querys::_is_admin_ajax_search($wp_query))
|
283 |
|
284 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
285 |
do_action("_ws_plugin__s2member_during_query_level_access_sys", get_defined_vars());
|
286 |
+
unset($__refs, $__v);
|
287 |
}
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("_ws_plugin__s2member_after_query_level_access_sys", get_defined_vars());
|
291 |
+
unset($__refs, $__v);
|
292 |
|
293 |
return; // For uniformity.
|
294 |
}
|
337 |
*
|
338 |
* @attaches-to ``add_filter("comment_feed_where");``
|
339 |
*
|
340 |
+
* @param string $cwhere Expects the SQL `WHERE` portion to be passed through by the Filter.
|
341 |
+
* @param object $wp_query Expects ``$wp_query`` by reference, from the Filter.
|
342 |
+
* @return string The revised ``$cwhere`` string.
|
343 |
*/
|
344 |
public static function _query_level_access_coms($cwhere = FALSE, &$wp_query = FALSE)
|
345 |
{
|
363 |
* @package s2Member\Queries
|
364 |
* @since 110912
|
365 |
*
|
366 |
+
* @param object $wp_query Expects ``$wp_query`` by reference.
|
367 |
* @return bool True if it's an AJAX search via `admin-ajax.php`, else false.
|
368 |
*/
|
369 |
public static function _is_admin_ajax_search(&$wp_query = FALSE)
|
includes/classes/readmes.inc.php
CHANGED
@@ -33,13 +33,13 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
33 |
* @package s2Member\Readmes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
* When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt.
|
38 |
-
* @param
|
39 |
* @param bool $_blank_targets Optional. Defaults to true. If false, no target attribute is used.
|
40 |
* @param bool $process_wp_syntax Optional. Defaults to false.
|
41 |
* If true, and WP Syntax is installed; it will be used to parse code samples.
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function parse_readme ($specific_path = FALSE, $specific_section = FALSE, $_blank_targets = TRUE, $process_wp_syntax = FALSE)
|
45 |
{
|
@@ -51,8 +51,8 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
51 |
}
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
-
do_action
|
55 |
-
unset
|
56 |
|
57 |
if (file_exists ($path)) // Give hooks a chance.
|
58 |
{
|
@@ -111,7 +111,7 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
111 |
$readme .= $rm . "\n"; // Content.
|
112 |
$readme .= '</div>' . "\n";
|
113 |
|
114 |
-
return apply_filters
|
115 |
}
|
116 |
else // Otherwise, we're going for the entire readme file. Here we have lots of work to do.
|
117 |
{
|
@@ -162,7 +162,7 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
162 |
$readme .= $rm . "\n"; // Content.
|
163 |
$readme .= '</div>' . "\n";
|
164 |
|
165 |
-
return apply_filters
|
166 |
}
|
167 |
}
|
168 |
else // Just in case readme.txt was deleted by the site owner.
|
@@ -176,18 +176,18 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
176 |
* @package s2Member\Readmes
|
177 |
* @since 3.5
|
178 |
*
|
179 |
-
* @param
|
180 |
-
* @return
|
181 |
*/
|
182 |
public static function _parse_readme_specs ($str = FALSE)
|
183 |
{
|
184 |
-
do_action
|
185 |
|
186 |
$str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . ' <code>' . "$5" . '</code></li>' . "$6", $str);
|
187 |
$str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); // Open the list items.
|
188 |
$str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
|
189 |
|
190 |
-
return apply_filters
|
191 |
}
|
192 |
/**
|
193 |
* Parses readme specification keys.
|
@@ -195,14 +195,14 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
195 |
* @package s2Member\Readmes
|
196 |
* @since 3.5
|
197 |
*
|
198 |
-
* @param
|
199 |
-
* @param
|
200 |
* When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt.
|
201 |
* @return str|bool The value of the key, else false if not found.
|
202 |
*/
|
203 |
public static function parse_readme_value ($key = FALSE, $specific_path = FALSE)
|
204 |
{
|
205 |
-
static $readme = array
|
206 |
|
207 |
if (!($path = $specific_path)) // Was a specific path passed in?
|
208 |
{
|
@@ -212,12 +212,12 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
212 |
}
|
213 |
|
214 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
215 |
-
do_action
|
216 |
-
unset
|
217 |
|
218 |
-
if (!empty
|
219 |
{
|
220 |
-
if (empty
|
221 |
{
|
222 |
$readme[$path] = file_get_contents ($path); // Get readme.txt file contents.
|
223 |
$mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($readme[$path], "UTF-8", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"]) : $readme[$path];
|
@@ -226,7 +226,7 @@ if (!class_exists ("c_ws_plugin__s2member_readmes"))
|
|
226 |
|
227 |
preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme[$path], $m);
|
228 |
|
229 |
-
return apply_filters
|
230 |
}
|
231 |
else // Nope.
|
232 |
return false;
|
33 |
* @package s2Member\Readmes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself.
|
37 |
* When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt.
|
38 |
+
* @param string $specific_section Optional. The title of a specific section to parse, instead of the entire file.
|
39 |
* @param bool $_blank_targets Optional. Defaults to true. If false, no target attribute is used.
|
40 |
* @param bool $process_wp_syntax Optional. Defaults to false.
|
41 |
* If true, and WP Syntax is installed; it will be used to parse code samples.
|
42 |
+
* @return string Parsed readme file, or a parsed readme file section; based on parameter configuration.
|
43 |
*/
|
44 |
public static function parse_readme ($specific_path = FALSE, $specific_section = FALSE, $_blank_targets = TRUE, $process_wp_syntax = FALSE)
|
45 |
{
|
51 |
}
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
+
do_action("ws_plugin__s2member_before_parse_readme", get_defined_vars ());
|
55 |
+
unset($__refs, $__v);
|
56 |
|
57 |
if (file_exists ($path)) // Give hooks a chance.
|
58 |
{
|
111 |
$readme .= $rm . "\n"; // Content.
|
112 |
$readme .= '</div>' . "\n";
|
113 |
|
114 |
+
return apply_filters("ws_plugin__s2member_parse_readme", $readme, get_defined_vars ());
|
115 |
}
|
116 |
else // Otherwise, we're going for the entire readme file. Here we have lots of work to do.
|
117 |
{
|
162 |
$readme .= $rm . "\n"; // Content.
|
163 |
$readme .= '</div>' . "\n";
|
164 |
|
165 |
+
return apply_filters("ws_plugin__s2member_parse_readme", $readme, get_defined_vars ());
|
166 |
}
|
167 |
}
|
168 |
else // Just in case readme.txt was deleted by the site owner.
|
176 |
* @package s2Member\Readmes
|
177 |
* @since 3.5
|
178 |
*
|
179 |
+
* @param string $str A string *(i.e. the specs section)*.
|
180 |
+
* @return string Parsed specs. With HTML markup for list item display.
|
181 |
*/
|
182 |
public static function _parse_readme_specs ($str = FALSE)
|
183 |
{
|
184 |
+
do_action("_ws_plugin__s2member_before_parse_readme_specs", get_defined_vars ());
|
185 |
|
186 |
$str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . ' <code>' . "$5" . '</code></li>' . "$6", $str);
|
187 |
$str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); // Open the list items.
|
188 |
$str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
|
189 |
|
190 |
+
return apply_filters("_ws_plugin__s2member_parse_readme_specs", $str, get_defined_vars ());
|
191 |
}
|
192 |
/**
|
193 |
* Parses readme specification keys.
|
195 |
* @package s2Member\Readmes
|
196 |
* @since 3.5
|
197 |
*
|
198 |
+
* @param string $key A key *(within the specs section)*.
|
199 |
+
* @param string $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself.
|
200 |
* When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt.
|
201 |
* @return str|bool The value of the key, else false if not found.
|
202 |
*/
|
203 |
public static function parse_readme_value ($key = FALSE, $specific_path = FALSE)
|
204 |
{
|
205 |
+
static $readme = array(); // For repeated lookups.
|
206 |
|
207 |
if (!($path = $specific_path)) // Was a specific path passed in?
|
208 |
{
|
212 |
}
|
213 |
|
214 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
215 |
+
do_action("ws_plugin__s2member_before_parse_readme_value", get_defined_vars ());
|
216 |
+
unset($__refs, $__v);
|
217 |
|
218 |
+
if (!empty($readme[$path]) || file_exists ($path))
|
219 |
{
|
220 |
+
if (empty($readme[$path])) // If not already opened.
|
221 |
{
|
222 |
$readme[$path] = file_get_contents ($path); // Get readme.txt file contents.
|
223 |
$mb = function_exists ("mb_convert_encoding") ? @mb_convert_encoding ($readme[$path], "UTF-8", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["mb_detection_order"]) : $readme[$path];
|
226 |
|
227 |
preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme[$path], $m);
|
228 |
|
229 |
+
return apply_filters("ws_plugin__s2member_parse_readme_value", ((isset ($m[5]) && strlen ($m[5] = trim ($m[5]))) ? $m[5] : false), get_defined_vars ());
|
230 |
}
|
231 |
else // Nope.
|
232 |
return false;
|
includes/classes/register-access.inc.php
CHANGED
@@ -33,18 +33,18 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
|
|
33 |
* @package s2Member\Registrations
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @param
|
38 |
-
* @param
|
39 |
-
* @param int|
|
40 |
* @param bool $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function register_link_gen ($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if ($subscr_gateway && is_string ($subscr_gateway) && $subscr_id && is_string ($subscr_id) && $custom && is_string ($custom) && $item_number && (is_string ($item_number) || is_numeric ($item_number)))
|
50 |
{
|
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
|
|
56 |
$register_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
|
57 |
}
|
58 |
|
59 |
-
return apply_filters
|
60 |
}
|
61 |
/**
|
62 |
* Generates Registration Access Links via AJAX.
|
@@ -70,7 +70,7 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
|
|
70 |
*/
|
71 |
public static function reg_access_link_via_ajax ()
|
72 |
{
|
73 |
-
do_action
|
74 |
|
75 |
status_header(200); // Send a 200 OK status header.
|
76 |
header("Content-Type: text/plain; charset=UTF-8"); // Content-Type with UTF-8.
|
@@ -78,12 +78,12 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
|
|
78 |
|
79 |
if (current_user_can ("create_users")) // Check privileges as well. Ability to create Users?
|
80 |
|
81 |
-
if (!empty
|
82 |
|
83 |
if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && isset ($_p["s2member_reg_access_link_subscr_gateway"], $_p["s2member_reg_access_link_subscr_id"], $_p["s2member_reg_access_link_custom"], $_p["s2member_reg_access_link_item_number"]))
|
84 |
$register_link = c_ws_plugin__s2member_register_access::register_link_gen ((string)$_p["s2member_reg_access_link_subscr_gateway"], (string)$_p["s2member_reg_access_link_subscr_id"], (string)$_p["s2member_reg_access_link_custom"], (string)$_p["s2member_reg_access_link_item_number"]);
|
85 |
|
86 |
-
exit(apply_filters
|
87 |
}
|
88 |
/**
|
89 |
* Checks registration cookies.
|
@@ -95,15 +95,15 @@ if (!class_exists ("c_ws_plugin__s2member_register_access"))
|
|
95 |
*/
|
96 |
public static function reg_cookies_ok ()
|
97 |
{
|
98 |
-
global
|
99 |
|
100 |
-
do_action
|
101 |
|
102 |
if (isset ($_COOKIE["s2member_subscr_gateway"], $_COOKIE["s2member_subscr_id"], $_COOKIE["s2member_custom"], $_COOKIE["s2member_item_number"]))
|
103 |
if (($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_custom"]))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], ($item_number = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_item_number"]))) && !$wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . esc_sql($subscr_id) . "' LIMIT 1"))
|
104 |
-
$reg_cookies_ok = $reg_cookies = array
|
105 |
|
106 |
-
return apply_filters
|
107 |
}
|
108 |
}
|
109 |
}
|
33 |
* @package s2Member\Registrations
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $subscr_gateway Payment Gateway associated with a Customer.
|
37 |
+
* @param string $subscr_id Unique Subscr. ID associated with Payment Gateway; associated with a Customer.
|
38 |
+
* @param string $custom Custom String value *(as supplied in Shortcode)*; must start with installation domain name.
|
39 |
+
* @param int|string $item_number An s2Member-generated `item_number` *( i.e. `1` for Level 1, or `level|ccaps|fixed-term`, or `sp|ids|expiration` )*.
|
40 |
* @param bool $shrink Optional. Defaults to true. If false, the raw registration link will NOT be reduced in size through the tinyURL API.
|
41 |
+
* @return string|bool A Registration Access Link on success, else false on failure.
|
42 |
*/
|
43 |
public static function register_link_gen ($subscr_gateway = FALSE, $subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_register_link_gen", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if ($subscr_gateway && is_string ($subscr_gateway) && $subscr_id && is_string ($subscr_id) && $custom && is_string ($custom) && $item_number && (is_string ($item_number) || is_numeric ($item_number)))
|
50 |
{
|
56 |
$register_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
|
57 |
}
|
58 |
|
59 |
+
return apply_filters("ws_plugin__s2member_register_link_gen", ((!empty($register_link)) ? $register_link : false), get_defined_vars ());
|
60 |
}
|
61 |
/**
|
62 |
* Generates Registration Access Links via AJAX.
|
70 |
*/
|
71 |
public static function reg_access_link_via_ajax ()
|
72 |
{
|
73 |
+
do_action("ws_plugin__s2member_before_reg_access_link_via_ajax", get_defined_vars ());
|
74 |
|
75 |
status_header(200); // Send a 200 OK status header.
|
76 |
header("Content-Type: text/plain; charset=UTF-8"); // Content-Type with UTF-8.
|
78 |
|
79 |
if (current_user_can ("create_users")) // Check privileges as well. Ability to create Users?
|
80 |
|
81 |
+
if (!empty($_POST["ws_plugin__s2member_reg_access_link_via_ajax"]) && is_string ($nonce = $_POST["ws_plugin__s2member_reg_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-reg-access-link-via-ajax"))
|
82 |
|
83 |
if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && isset ($_p["s2member_reg_access_link_subscr_gateway"], $_p["s2member_reg_access_link_subscr_id"], $_p["s2member_reg_access_link_custom"], $_p["s2member_reg_access_link_item_number"]))
|
84 |
$register_link = c_ws_plugin__s2member_register_access::register_link_gen ((string)$_p["s2member_reg_access_link_subscr_gateway"], (string)$_p["s2member_reg_access_link_subscr_id"], (string)$_p["s2member_reg_access_link_custom"], (string)$_p["s2member_reg_access_link_item_number"]);
|
85 |
|
86 |
+
exit(apply_filters("ws_plugin__s2member_reg_access_link_via_ajax", ((!empty($register_link)) ? $register_link : ""), get_defined_vars ()));
|
87 |
}
|
88 |
/**
|
89 |
* Checks registration cookies.
|
95 |
*/
|
96 |
public static function reg_cookies_ok ()
|
97 |
{
|
98 |
+
global $wpdb; /** @var $wpdb \wpdb */
|
99 |
|
100 |
+
do_action("ws_plugin__s2member_before_reg_cookies_ok", get_defined_vars ());
|
101 |
|
102 |
if (isset ($_COOKIE["s2member_subscr_gateway"], $_COOKIE["s2member_subscr_id"], $_COOKIE["s2member_custom"], $_COOKIE["s2member_item_number"]))
|
103 |
if (($subscr_gateway = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_subscr_gateway"])) && ($subscr_id = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_subscr_id"])) && preg_match ("/^" . preg_quote (preg_replace ("/\:([0-9]+)$/", "", $_SERVER["HTTP_HOST"]), "/") . "/i", ($custom = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_custom"]))) && preg_match ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"], ($item_number = c_ws_plugin__s2member_utils_encryption::decrypt ((string)$_COOKIE["s2member_item_number"]))) && !$wpdb->get_var ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_subscr_id' AND `meta_value` = '" . esc_sql($subscr_id) . "' LIMIT 1"))
|
104 |
+
$reg_cookies_ok = $reg_cookies = array("subscr_gateway" => $subscr_gateway, "subscr_id" => $subscr_id, "custom" => $custom, "item_number" => $item_number);
|
105 |
|
106 |
+
return apply_filters("ws_plugin__s2member_reg_cookies_ok", ((isset ($reg_cookies_ok) && $reg_cookies_ok && !empty($reg_cookies)) ? $reg_cookies : false), get_defined_vars ());
|
107 |
}
|
108 |
}
|
109 |
}
|
includes/classes/register-in.inc.php
CHANGED
@@ -39,19 +39,19 @@ if (!class_exists ("c_ws_plugin__s2member_register_in"))
|
|
39 |
*/
|
40 |
public static function register ()
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
-
if (!empty
|
45 |
{
|
46 |
while (@ob_end_clean ()); // Clean any existing output buffers.
|
47 |
|
48 |
$msg_503 = _x ('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
|
49 |
|
50 |
-
if (is_array
|
51 |
{
|
52 |
if (count ($register) === 6 && $register[0] === "subscr_gateway_subscr_id_custom_item_number_time" /* Does the checksum value match up here? */)
|
53 |
{
|
54 |
-
if (is_numeric ($register[5]) && $register[5] <= strtotime ("now") && $register[5] >= strtotime ("-" . apply_filters
|
55 |
{
|
56 |
$_COOKIE["s2member_subscr_gateway"] = /* For ``reg_cookies_ok ()``. */ c_ws_plugin__s2member_utils_encryption::encrypt ($register[1]);
|
57 |
$_COOKIE["s2member_subscr_id"] = /* For ``reg_cookies_ok ()``. */ c_ws_plugin__s2member_utils_encryption::encrypt ($register[2]);
|
@@ -68,7 +68,7 @@ if (!class_exists ("c_ws_plugin__s2member_register_in"))
|
|
68 |
setcookie ("s2member_custom", $_COOKIE["s2member_custom"], time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_custom", $_COOKIE["s2member_custom"], time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
69 |
setcookie ("s2member_item_number", $_COOKIE["s2member_item_number"], time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_item_number", $_COOKIE["s2member_item_number"], time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
70 |
|
71 |
-
do_action
|
72 |
|
73 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site () && ($location = c_ws_plugin__s2member_utils_urls::wp_signup_url ()))
|
74 |
{
|
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_register_in"))
|
|
97 |
status_header(503) . header ("Content-Type: text/html; charset=UTF-8") . exit ($msg_503);
|
98 |
}
|
99 |
|
100 |
-
do_action
|
101 |
}
|
102 |
}
|
103 |
}
|
39 |
*/
|
40 |
public static function register ()
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_register", get_defined_vars ());
|
43 |
|
44 |
+
if (!empty($_GET["s2member_register"])) // If they're attempting to access the registration system.
|
45 |
{
|
46 |
while (@ob_end_clean ()); // Clean any existing output buffers.
|
47 |
|
48 |
$msg_503 = _x ('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member");
|
49 |
|
50 |
+
if (is_array($register = preg_split ("/\:\.\:\|\:\.\:/", c_ws_plugin__s2member_utils_encryption::decrypt (trim (stripslashes ((string)$_GET["s2member_register"]))))))
|
51 |
{
|
52 |
if (count ($register) === 6 && $register[0] === "subscr_gateway_subscr_id_custom_item_number_time" /* Does the checksum value match up here? */)
|
53 |
{
|
54 |
+
if (is_numeric ($register[5]) && $register[5] <= strtotime ("now") && $register[5] >= strtotime ("-" . apply_filters("ws_plugin__s2member_register_link_exp_time", "2 days", get_defined_vars ())))
|
55 |
{
|
56 |
$_COOKIE["s2member_subscr_gateway"] = /* For ``reg_cookies_ok ()``. */ c_ws_plugin__s2member_utils_encryption::encrypt ($register[1]);
|
57 |
$_COOKIE["s2member_subscr_id"] = /* For ``reg_cookies_ok ()``. */ c_ws_plugin__s2member_utils_encryption::encrypt ($register[2]);
|
68 |
setcookie ("s2member_custom", $_COOKIE["s2member_custom"], time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_custom", $_COOKIE["s2member_custom"], time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
69 |
setcookie ("s2member_item_number", $_COOKIE["s2member_item_number"], time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . setcookie ("s2member_item_number", $_COOKIE["s2member_item_number"], time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
70 |
|
71 |
+
do_action("ws_plugin__s2member_during_register", get_defined_vars ());
|
72 |
|
73 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && is_main_site () && ($location = c_ws_plugin__s2member_utils_urls::wp_signup_url ()))
|
74 |
{
|
97 |
status_header(503) . header ("Content-Type: text/html; charset=UTF-8") . exit ($msg_503);
|
98 |
}
|
99 |
|
100 |
+
do_action("ws_plugin__s2member_after_register", get_defined_vars ());
|
101 |
}
|
102 |
}
|
103 |
}
|
includes/classes/register.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_register"))
|
|
39 |
*/
|
40 |
public static function register ()
|
41 |
{
|
42 |
-
if (!empty
|
43 |
{
|
44 |
return c_ws_plugin__s2member_register_in::register ();
|
45 |
}
|
39 |
*/
|
40 |
public static function register ()
|
41 |
{
|
42 |
+
if (!empty($_GET["s2member_register"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_register_in::register ();
|
45 |
}
|
includes/classes/registration-times.inc.php
CHANGED
@@ -46,11 +46,11 @@ if(!class_exists("c_ws_plugin__s2member_registration_times"))
|
|
46 |
do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
|
47 |
unset($__refs, $__v);
|
48 |
|
49 |
-
if($user_id && is_object($user = new WP_User ($user_id)) && !empty
|
50 |
{
|
51 |
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
|
52 |
-
$pr_times["level"] = (empty
|
53 |
-
$pr_times["level".$level] = (empty
|
54 |
update_user_option($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
55 |
}
|
56 |
}
|
@@ -73,7 +73,7 @@ if(!class_exists("c_ws_plugin__s2member_registration_times"))
|
|
73 |
|
74 |
$user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in()) ? wp_get_current_user() : FALSE);
|
75 |
|
76 |
-
if(is_object($user) && !empty
|
77 |
{
|
78 |
return apply_filters("ws_plugin__s2member_registration_time", strtotime($user->user_registered), get_defined_vars());
|
79 |
}
|
@@ -101,7 +101,7 @@ if(!class_exists("c_ws_plugin__s2member_registration_times"))
|
|
101 |
$level = (!is_numeric($level)) ? "level" : "level".preg_replace("/[^0-9]/", "", (string)$level);
|
102 |
$user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in()) ? wp_get_current_user() : FALSE);
|
103 |
|
104 |
-
if($level && is_object($user) && !empty
|
105 |
{
|
106 |
return apply_filters("ws_plugin__s2member_paid_registration_time", ((isset ($pr_times[$level])) ? (int)$pr_times[$level] : 0), get_defined_vars());
|
107 |
}
|
46 |
do_action("ws_plugin__s2member_before_synchronize_paid_reg_times", get_defined_vars());
|
47 |
unset($__refs, $__v);
|
48 |
|
49 |
+
if($user_id && is_object($user = new WP_User ($user_id)) && !empty($user->ID) && ($level = c_ws_plugin__s2member_user_access::user_access_level($user)) > 0)
|
50 |
{
|
51 |
$pr_times = get_user_option("s2member_paid_registration_times", $user_id);
|
52 |
+
$pr_times["level"] = (empty($pr_times["level"])) ? time() : $pr_times["level"];
|
53 |
+
$pr_times["level".$level] = (empty($pr_times["level".$level])) ? time() : $pr_times["level".$level];
|
54 |
update_user_option($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
55 |
}
|
56 |
}
|
73 |
|
74 |
$user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in()) ? wp_get_current_user() : FALSE);
|
75 |
|
76 |
+
if(is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && $user->user_registered)
|
77 |
{
|
78 |
return apply_filters("ws_plugin__s2member_registration_time", strtotime($user->user_registered), get_defined_vars());
|
79 |
}
|
101 |
$level = (!is_numeric($level)) ? "level" : "level".preg_replace("/[^0-9]/", "", (string)$level);
|
102 |
$user = ($user_id) ? new WP_User ($user_id) : ((is_user_logged_in()) ? wp_get_current_user() : FALSE);
|
103 |
|
104 |
+
if($level && is_object($user) && !empty($user->ID) && ($user_id = $user->ID) && is_array($pr_times = get_user_option("s2member_paid_registration_times", $user_id)))
|
105 |
{
|
106 |
return apply_filters("ws_plugin__s2member_paid_registration_time", ((isset ($pr_times[$level])) ? (int)$pr_times[$level] : 0), get_defined_vars());
|
107 |
}
|
includes/classes/registrations.inc.php
CHANGED
@@ -44,23 +44,23 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
44 |
public static function generate_password ($password = FALSE)
|
45 |
{
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
-
do_action
|
48 |
-
unset
|
49 |
|
50 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
51 |
{
|
52 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && !empty
|
53 |
{
|
54 |
if (($custom = trim (stripslashes ((string)$_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
|
55 |
$password = $custom; // Yes, use s2Member custom Password supplied by User.
|
56 |
}
|
57 |
-
else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty
|
58 |
{
|
59 |
if (($custom = trim (stripslashes ((string)$GLOBALS["ws_plugin__s2member_generate_password_return"]))))
|
60 |
$password = $custom; // Yes, use s2Member custom Password supplied by Remote Op.
|
61 |
}
|
62 |
}
|
63 |
-
return apply_filters
|
64 |
}
|
65 |
|
66 |
/**
|
@@ -84,10 +84,10 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
84 |
{
|
85 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
86 |
do_action("ws_plugin__s2member_before_custom_registration_field_errors", get_defined_vars());
|
87 |
-
unset
|
88 |
|
89 |
if (!is_admin () && preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
90 |
-
if (is_wp_error ($errors) && !empty
|
91 |
{
|
92 |
foreach(c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) as $_key => $_value)
|
93 |
if(strpos($_key, "ws_plugin__s2member_custom_reg_field_") === 0)
|
@@ -100,7 +100,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
100 |
$errors->add("custom_reg_field_".$_field_var, $_error);
|
101 |
unset($_field_var, $_error);
|
102 |
}
|
103 |
-
return apply_filters
|
104 |
}
|
105 |
|
106 |
/**
|
@@ -117,12 +117,12 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
117 |
{
|
118 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
119 |
do_action("ws_plugin__s2member_before_custom_registration_field_errors_4bp", get_defined_vars());
|
120 |
-
unset
|
121 |
|
122 |
if (!is_admin () && c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())
|
123 |
-
if(in_array
|
124 |
-
if(apply_filters
|
125 |
-
if (!empty($GLOBALS["bp"]->signup) && is_object($GLOBALS["bp"]->signup) && !empty
|
126 |
{
|
127 |
foreach(c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) as $_key => $_value)
|
128 |
if(strpos($_key, "ws_plugin__s2member_custom_reg_field_") === 0)
|
@@ -154,24 +154,24 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
154 |
public static function ms_validate_user_signup ($result = FALSE)
|
155 |
{
|
156 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
157 |
-
do_action
|
158 |
-
unset
|
159 |
|
160 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
161 |
-
if (!is_admin () && isset ($result["user_name"], $result["user_email"], $result["errors"]) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty
|
162 |
{
|
163 |
$errors =& $result["errors"]; /** @var $errors WP_Error */
|
164 |
-
if (in_array
|
165 |
if (c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($result["user_name"], $result["user_email"]))
|
166 |
{
|
167 |
unset($errors->errors["user_name"], $errors->errors["user_email"], $errors->errors["user_email_used"]);
|
168 |
unset($errors->error_data["user_name"], $errors->error_data["user_email"], $errors->error_data["user_email_used"]);
|
169 |
}
|
170 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
171 |
-
do_action
|
172 |
-
unset
|
173 |
}
|
174 |
-
return apply_filters
|
175 |
}
|
176 |
/**
|
177 |
* Adds hidden fields for ``$_POST`` vars on signup.
|
@@ -186,19 +186,19 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
186 |
*/
|
187 |
public static function ms_process_signup_hidden_fields ()
|
188 |
{
|
189 |
-
do_action
|
190 |
|
191 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
192 |
-
if (!is_admin () && !empty
|
193 |
{
|
194 |
foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
|
195 |
if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
|
196 |
if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
|
197 |
echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
|
198 |
|
199 |
-
do_action
|
200 |
}
|
201 |
-
do_action
|
202 |
}
|
203 |
/**
|
204 |
* Adds Customs Fields to ``$meta`` on signup.
|
@@ -216,29 +216,29 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
216 |
* @param array $meta Expects an array of meta-data to be passed in by the Filter.
|
217 |
* @return array Full ``$meta`` array with s2Member Custom Fields included.
|
218 |
*/
|
219 |
-
public static function ms_process_signup_meta
|
220 |
{
|
221 |
global /* Multisite Networking. */ $current_site, $current_blog;
|
222 |
global $pagenow; // Need this to detect the current admin page.
|
223 |
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
-
do_action
|
226 |
-
unset
|
227 |
|
228 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
229 |
-
if (!empty
|
230 |
{
|
231 |
c_ws_plugin__s2member_email_configs::email_config (); // Configures `From:` header used in notifications.
|
232 |
|
233 |
-
$meta["add_to_blog"] = (empty
|
234 |
-
$meta["new_role"] = (empty
|
235 |
|
236 |
foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
|
237 |
if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
|
238 |
if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
|
239 |
$meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
|
240 |
}
|
241 |
-
return apply_filters
|
242 |
}
|
243 |
/**
|
244 |
* Intersects with ``wpmu_activate_signup()`` through s2Member's Multisite Networking patch.
|
@@ -262,27 +262,27 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
262 |
public static function ms_activate_existing_user ($_error = FALSE, $vars = FALSE)
|
263 |
{
|
264 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
265 |
-
do_action
|
266 |
-
unset
|
267 |
|
268 |
extract ($vars); // Extract all variables from ``wpmu_activate_signup()`` function.
|
269 |
|
270 |
-
if (is_multisite
|
271 |
-
if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed
|
272 |
{
|
273 |
-
if (!empty
|
274 |
-
if (!empty
|
275 |
{
|
276 |
-
add_user_to_blog
|
277 |
-
wp_update_user
|
278 |
-
wpmu_welcome_user_notification
|
279 |
|
280 |
-
do_action
|
281 |
|
282 |
-
return apply_filters
|
283 |
}
|
284 |
}
|
285 |
-
return apply_filters
|
286 |
}
|
287 |
/**
|
288 |
* Configures new Users on a Multisite Network installation.
|
@@ -305,17 +305,17 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
305 |
global $pagenow; // Detect the current admin page.
|
306 |
|
307 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
308 |
-
do_action
|
309 |
-
unset
|
310 |
|
311 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
312 |
if ((is_blog_admin () && $pagenow === "user-new.php" && isset ($_POST["noconfirmation"])) || (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ()))))
|
313 |
{
|
314 |
-
c_ws_plugin__s2member_registrations::configure_user_registration ($user_id, $password, ((isset ($meta["s2member_ms_signup_meta"]) && is_array
|
315 |
delete_user_meta ($user_id, "s2member_ms_signup_meta");
|
316 |
}
|
317 |
|
318 |
-
do_action
|
319 |
}
|
320 |
/**
|
321 |
* Configures new Users on a Multisite Network installation.
|
@@ -341,17 +341,48 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
341 |
public static function configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
|
342 |
{
|
343 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
344 |
-
do_action
|
345 |
-
unset
|
346 |
|
347 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
348 |
if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ())))
|
349 |
{
|
350 |
-
c_ws_plugin__s2member_registrations::configure_user_registration ($user_id, $password, ((isset ($meta["s2member_ms_signup_meta"]) && is_array
|
351 |
delete_user_meta ($user_id, "s2member_ms_signup_meta");
|
352 |
}
|
353 |
-
do_action
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
|
|
|
|
355 |
/**
|
356 |
* Intersects with ``register_new_user()`` through s2Member's Multisite Networking patch.
|
357 |
*
|
@@ -373,8 +404,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
373 |
public static function ms_register_existing_user ($errors = FALSE, $user_login = FALSE, $user_email = FALSE)
|
374 |
{
|
375 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
376 |
-
do_action
|
377 |
-
unset
|
378 |
|
379 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
380 |
if (!is_admin () && /* `/wp-login.php`? */ preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
@@ -383,20 +414,20 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
383 |
if (($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email)))
|
384 |
{
|
385 |
foreach ($errors->get_error_codes () as $error_code)
|
386 |
-
if (!in_array
|
387 |
$other_important_errors_exist[] = $error_code;
|
388 |
|
389 |
-
if (empty
|
390 |
{
|
391 |
$user_pass = wp_generate_password (); // A new Password for this User/Member will be generated now.
|
392 |
c_ws_plugin__s2member_registrations::ms_create_existing_user ($user_login, $user_email, $user_pass, $user_id);
|
393 |
update_user_option ($user_id, "default_password_nag", true, true); // Setup Password-change nag screen.
|
394 |
wp_new_user_notification ($user_id, $user_pass); // Welcome email, just like ``register_new_user()``.
|
395 |
|
396 |
-
$redirect_to = (!empty
|
397 |
$redirect_to = ($redirect_to) ? $redirect_to : add_query_arg ("checkemail", urlencode ("registered"), wp_login_url ());
|
398 |
|
399 |
-
do_action
|
400 |
|
401 |
wp_safe_redirect ($redirect_to) . exit (); // Safe, like: ``register_new_user()``.
|
402 |
}
|
@@ -405,7 +436,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
405 |
else if (($ms = wpmu_validate_user_signup ($user_login, $user_email)) && isset ($ms["errors"]) && is_wp_error ($ms["errors"]) && $ms["errors"]->get_error_code ())
|
406 |
$errors->add ($ms["errors"]->get_error_code (), $ms["errors"]->get_error_message ());
|
407 |
|
408 |
-
return apply_filters
|
409 |
}
|
410 |
/**
|
411 |
* For Multisite Networks, this function is used to add a User to an existing Blog; and to simulate ``wp_create_user()`` behavior.
|
@@ -426,24 +457,24 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
426 |
public static function ms_create_existing_user ($user_login = FALSE, $user_email = FALSE, $user_pass = FALSE, $user_id = FALSE)
|
427 |
{
|
428 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
429 |
-
do_action
|
430 |
-
unset
|
431 |
|
432 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
433 |
{
|
434 |
if (($user_id || ($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))) && $user_pass)
|
435 |
{
|
436 |
$role = get_option ("default_role"); // Use default Role.
|
437 |
-
add_existing_user_to_blog (array
|
438 |
-
wp_update_user (array
|
439 |
|
440 |
-
do_action
|
441 |
-
do_action
|
442 |
|
443 |
-
return apply_filters
|
444 |
}
|
445 |
}
|
446 |
-
return apply_filters
|
447 |
}
|
448 |
/**
|
449 |
* Configures all new Users.
|
@@ -473,8 +504,8 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
473 |
static $email_config, $processed; // Static vars prevent duplicate processing.
|
474 |
|
475 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
476 |
-
do_action
|
477 |
-
unset
|
478 |
|
479 |
// With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_[user|blog]`.
|
480 |
if (!isset ($email_config) && ($email_config = true)) // Anytime this routine is fired; we configure email.
|
@@ -485,14 +516,14 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
485 |
|
486 |
if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins (or even WordPress itself). */)
|
487 |
|
488 |
-
if ( /* We MUST have at least ONE of these three arrays. Any of these will do in most cases. */is_array
|
489 |
|
490 |
-
if (!(is_multisite () && is_blog_admin () && $pagenow === "user-new.php" && isset ($_p["noconfirmation"]) && is_super_admin () && !is_array
|
491 |
-
if (!(preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && !is_array
|
492 |
-
if (!(c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page () && !is_array
|
493 |
-
if (!(c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !is_array
|
494 |
|
495 |
-
if ($user_id && is_object ($user = new WP_User ($user_id)) && !empty
|
496 |
{
|
497 |
settype /* Force arrays here. */ ($_p, "array") . settype ($meta, "array") . settype ($rvs, "array");
|
498 |
|
@@ -510,7 +541,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
510 |
exit (_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
|
511 |
|
512 |
$_pmr = array_merge ($_p, $meta, $rvs); // Merge all of these arrays together now, in this specific order.
|
513 |
-
unset
|
514 |
|
515 |
$custom_reg_display_name = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_display_name"]; // Can be configured by the site owner.
|
516 |
|
@@ -538,22 +569,22 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
538 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
539 |
|
540 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
|
541 |
-
$opt_in = (!$opt_in && !empty
|
542 |
|
543 |
if (!($fname = $user->first_name))
|
544 |
-
if (!empty
|
545 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
546 |
|
547 |
if (!$fname) // Also try BuddyPress.
|
548 |
-
if (!empty
|
549 |
$fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
|
550 |
|
551 |
if (!($lname = $user->last_name))
|
552 |
-
if (!empty
|
553 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
554 |
|
555 |
if (!$lname) // Also try BuddyPress.
|
556 |
-
if (!empty
|
557 |
$lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
|
558 |
|
559 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
@@ -562,11 +593,11 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
562 |
$name = trim ($fname . " " . $lname); // Both names.
|
563 |
|
564 |
if (!($pass = $password)) // Try s2Member's generator.
|
565 |
-
if (!empty
|
566 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
567 |
|
568 |
if (!$pass) // Also try BuddyPress Password.
|
569 |
-
if (!empty
|
570 |
$pass = (string)$_pmr["signup_password"];
|
571 |
|
572 |
if ($pass) // No Password nag. Update this globally.
|
@@ -591,13 +622,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
591 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
592 |
{
|
593 |
if ($custom_reg_display_name === "full" && $name)
|
594 |
-
wp_update_user (array
|
595 |
else if ($custom_reg_display_name === "first" && $fname)
|
596 |
-
wp_update_user (array
|
597 |
else if ($custom_reg_display_name === "last" && $lname)
|
598 |
-
wp_update_user (array
|
599 |
else if ($custom_reg_display_name === "login" && $login)
|
600 |
-
wp_update_user (array
|
601 |
}
|
602 |
if (is_multisite ()) // Should we handle Main Site permissions and Originating Blog ID#?
|
603 |
{
|
@@ -620,7 +651,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
620 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
621 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
622 |
|
623 |
-
if (!($fields = array
|
624 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
625 |
{
|
626 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
@@ -631,40 +662,45 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
631 |
}
|
632 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
633 |
|
634 |
-
if (!empty
|
635 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
636 |
|
637 |
if ($level > 0) // We ONLY process this if they are higher than Level #0.
|
638 |
{
|
639 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
640 |
-
$pr_times["level"] = (empty
|
641 |
-
$pr_times["level" . $level] = (empty
|
642 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
643 |
}
|
644 |
-
if
|
|
|
|
|
|
|
|
|
|
|
645 |
{
|
646 |
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars); // For future reference.
|
647 |
delete_transient ($transient); // This can be deleted now.
|
648 |
}
|
649 |
-
if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array
|
650 |
{
|
651 |
-
$proxy = array
|
652 |
-
c_ws_plugin__s2member_utils_urls::remote (site_url ("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep ($subscr_payment), $proxy), array
|
653 |
delete_transient ($transient); // This can be deleted now.
|
654 |
}
|
655 |
-
if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array
|
656 |
{
|
657 |
-
$proxy = array
|
658 |
-
c_ws_plugin__s2member_utils_urls::remote (site_url ("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep ($subscr_eot), $proxy), array
|
659 |
delete_transient ($transient); // This can be deleted now.
|
660 |
}
|
661 |
if (!headers_sent ()) // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
|
662 |
@setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($subscr_id)), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
|
663 |
|
664 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
665 |
-
do_action
|
666 |
-
do_action
|
667 |
-
unset
|
668 |
}
|
669 |
else if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
670 |
{ /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
|
@@ -702,22 +738,22 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
702 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
703 |
|
704 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
|
705 |
-
$opt_in = (!$opt_in && !empty
|
706 |
|
707 |
if (!($fname = $user->first_name))
|
708 |
-
if (!empty
|
709 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
710 |
|
711 |
if (!$fname) // Also try BuddyPress.
|
712 |
-
if (!empty
|
713 |
$fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
|
714 |
|
715 |
if (!($lname = $user->last_name))
|
716 |
-
if (!empty
|
717 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
718 |
|
719 |
if (!$lname) // Also try BuddyPress.
|
720 |
-
if (!empty
|
721 |
$lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
|
722 |
|
723 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
@@ -726,11 +762,11 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
726 |
$name = trim ($fname . " " . $lname); // Both names.
|
727 |
|
728 |
if (!($pass = $password)) // Try s2Member's generator.
|
729 |
-
if (!empty
|
730 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
731 |
|
732 |
if (!$pass) // Also try BuddyPress Password.
|
733 |
-
if (!empty
|
734 |
$pass = (string)$_pmr["signup_password"];
|
735 |
|
736 |
if ($pass) // No Password nag. Update this globally.
|
@@ -755,13 +791,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
755 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
756 |
{
|
757 |
if ($custom_reg_display_name === "full" && $name)
|
758 |
-
wp_update_user (array
|
759 |
else if ($custom_reg_display_name === "first" && $fname)
|
760 |
-
wp_update_user (array
|
761 |
else if ($custom_reg_display_name === "last" && $lname)
|
762 |
-
wp_update_user (array
|
763 |
else if ($custom_reg_display_name === "login" && $login)
|
764 |
-
wp_update_user (array
|
765 |
}
|
766 |
if /* Should we handle Main Site permissions and Originating Blog ID#? */(is_multisite ())
|
767 |
{
|
@@ -784,7 +820,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
784 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
785 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
786 |
|
787 |
-
if (!($fields = array
|
788 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
789 |
{
|
790 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
@@ -795,20 +831,25 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
795 |
}
|
796 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
797 |
|
798 |
-
if (!empty
|
799 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
800 |
|
801 |
if ($level > 0) // We ONLY process this if they are higher than Level#0.
|
802 |
{
|
803 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
804 |
-
$pr_times["level"] = (empty
|
805 |
-
$pr_times["level" . $level] = (empty
|
806 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
807 |
}
|
|
|
|
|
|
|
|
|
|
|
808 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
809 |
-
do_action
|
810 |
-
do_action
|
811 |
-
unset
|
812 |
}
|
813 |
else if ((is_blog_admin () && $pagenow === "user-new.php") || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
814 |
{ // Can only be processed through `/user-new.php` in the Admin panel, or through Remote Op: `create_user`.
|
@@ -842,14 +883,14 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
842 |
$auto_eot_time = ($eot = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
|
843 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
844 |
|
845 |
-
$opt_in = (!empty
|
846 |
|
847 |
if (!($fname = $user->first_name)) // `Users -› Add New`.
|
848 |
-
if (!empty
|
849 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
850 |
|
851 |
if (!($lname = $user->last_name)) // `Users -› Add New`.
|
852 |
-
if (!empty
|
853 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
854 |
|
855 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
@@ -858,11 +899,11 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
858 |
$name = trim ($fname . " " . $lname); // Both names.
|
859 |
|
860 |
if (!($pass = $password)) // Try s2Member's generator.
|
861 |
-
if (!empty
|
862 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
863 |
|
864 |
if (!$pass) // Also try the `Users -› Add New` form.
|
865 |
-
if (!empty
|
866 |
$pass = (string)$_pmr["pass1"];
|
867 |
|
868 |
if ($pass) // No Password nag. Update this globally.
|
@@ -887,13 +928,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
887 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
888 |
{
|
889 |
if ($custom_reg_display_name === "full" && $name)
|
890 |
-
wp_update_user (array
|
891 |
else if ($custom_reg_display_name === "first" && $fname)
|
892 |
-
wp_update_user (array
|
893 |
else if ($custom_reg_display_name === "last" && $lname)
|
894 |
-
wp_update_user (array
|
895 |
else if ($custom_reg_display_name === "login" && $login)
|
896 |
-
wp_update_user (array
|
897 |
}
|
898 |
if (is_multisite ()) // Should we handle Main Site permissions and Originating Blog ID#?
|
899 |
{
|
@@ -916,7 +957,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
916 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
917 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
918 |
|
919 |
-
if (!($fields = array
|
920 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
921 |
{
|
922 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
@@ -927,19 +968,19 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
927 |
}
|
928 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
929 |
|
930 |
-
if (!empty
|
931 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
932 |
|
933 |
if ($level > 0) // We ONLY process this if they are higher than Level#0.
|
934 |
{
|
935 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
936 |
-
$pr_times["level"] = (empty
|
937 |
-
$pr_times["level" . $level] = (empty
|
938 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
939 |
}
|
940 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
941 |
-
do_action
|
942 |
-
unset
|
943 |
}
|
944 |
if ($processed === "yes") // If registration was processed by one of the routines above.
|
945 |
{
|
@@ -1026,7 +1067,7 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
1026 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
1027 |
|
1028 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"]) as $recipient)
|
1029 |
-
wp_mail ($recipient, apply_filters
|
1030 |
}
|
1031 |
if ($email_configs_were_on) // Back on?
|
1032 |
c_ws_plugin__s2member_email_configs::email_config ();
|
@@ -1096,13 +1137,13 @@ if (!class_exists ("c_ws_plugin__s2member_registrations"))
|
|
1096 |
unset($logt, $logv, $logm, $log4, $_log4, $log2, $logs_dir, $reg_vars); // Housekeeping.
|
1097 |
|
1098 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
1099 |
-
do_action
|
1100 |
-
unset
|
1101 |
}
|
1102 |
}
|
1103 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
1104 |
-
do_action
|
1105 |
-
unset
|
1106 |
}
|
1107 |
}
|
1108 |
}
|
44 |
public static function generate_password ($password = FALSE)
|
45 |
{
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
+
do_action("ws_plugin__s2member_before_generate_password", get_defined_vars ());
|
48 |
+
unset($__refs, $__v);
|
49 |
|
50 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
51 |
{
|
52 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"] && !empty($_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))
|
53 |
{
|
54 |
if (($custom = trim (stripslashes ((string)$_POST["ws_plugin__s2member_custom_reg_field_user_pass1"]))))
|
55 |
$password = $custom; // Yes, use s2Member custom Password supplied by User.
|
56 |
}
|
57 |
+
else if (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
58 |
{
|
59 |
if (($custom = trim (stripslashes ((string)$GLOBALS["ws_plugin__s2member_generate_password_return"]))))
|
60 |
$password = $custom; // Yes, use s2Member custom Password supplied by Remote Op.
|
61 |
}
|
62 |
}
|
63 |
+
return apply_filters("ws_plugin__s2member_generate_password", ($GLOBALS["ws_plugin__s2member_generate_password_return"] = $password), get_defined_vars ());
|
64 |
}
|
65 |
|
66 |
/**
|
84 |
{
|
85 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
86 |
do_action("ws_plugin__s2member_before_custom_registration_field_errors", get_defined_vars());
|
87 |
+
unset($__refs, $__v);
|
88 |
|
89 |
if (!is_admin () && preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
90 |
+
if (is_wp_error ($errors) && !empty($_POST) && is_array($_POST))
|
91 |
{
|
92 |
foreach(c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) as $_key => $_value)
|
93 |
if(strpos($_key, "ws_plugin__s2member_custom_reg_field_") === 0)
|
100 |
$errors->add("custom_reg_field_".$_field_var, $_error);
|
101 |
unset($_field_var, $_error);
|
102 |
}
|
103 |
+
return apply_filters("ws_plugin__s2member_custom_registration_field_errors", $errors, get_defined_vars ());
|
104 |
}
|
105 |
|
106 |
/**
|
117 |
{
|
118 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
119 |
do_action("ws_plugin__s2member_before_custom_registration_field_errors_4bp", get_defined_vars());
|
120 |
+
unset($__refs, $__v);
|
121 |
|
122 |
if (!is_admin () && c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())
|
123 |
+
if(in_array("registration", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields_4bp"]))
|
124 |
+
if(apply_filters("ws_plugin__s2member_custom_registration_fields_4bp_display", true, get_defined_vars ()))
|
125 |
+
if (!empty($GLOBALS["bp"]->signup) && is_object($GLOBALS["bp"]->signup) && !empty($_POST) && is_array($_POST))
|
126 |
{
|
127 |
foreach(c_ws_plugin__s2member_utils_strings::trim_deep(stripslashes_deep($_POST)) as $_key => $_value)
|
128 |
if(strpos($_key, "ws_plugin__s2member_custom_reg_field_") === 0)
|
154 |
public static function ms_validate_user_signup ($result = FALSE)
|
155 |
{
|
156 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
157 |
+
do_action("ws_plugin__s2member_before_ms_validate_user_signup", get_defined_vars ());
|
158 |
+
unset($__refs, $__v);
|
159 |
|
160 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
161 |
+
if (!is_admin () && isset ($result["user_name"], $result["user_email"], $result["errors"]) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
|
162 |
{
|
163 |
$errors =& $result["errors"]; /** @var $errors WP_Error */
|
164 |
+
if (in_array($errors->get_error_code (), array("user_name", "user_email", "user_email_used")))
|
165 |
if (c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($result["user_name"], $result["user_email"]))
|
166 |
{
|
167 |
unset($errors->errors["user_name"], $errors->errors["user_email"], $errors->errors["user_email_used"]);
|
168 |
unset($errors->error_data["user_name"], $errors->error_data["user_email"], $errors->error_data["user_email_used"]);
|
169 |
}
|
170 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
171 |
+
do_action("ws_plugin__s2member_during_ms_validate_user_signup", get_defined_vars ());
|
172 |
+
unset($__refs, $__v);
|
173 |
}
|
174 |
+
return apply_filters("ws_plugin__s2member_ms_validate_user_signup", $result, get_defined_vars ());
|
175 |
}
|
176 |
/**
|
177 |
* Adds hidden fields for ``$_POST`` vars on signup.
|
186 |
*/
|
187 |
public static function ms_process_signup_hidden_fields ()
|
188 |
{
|
189 |
+
do_action("ws_plugin__s2member_before_ms_process_signup_hidden_fields", get_defined_vars ());
|
190 |
|
191 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
192 |
+
if (!is_admin () && !empty($_POST) && is_array($_POST) && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))
|
193 |
{
|
194 |
foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
|
195 |
if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
|
196 |
if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
|
197 |
echo '<input type="hidden" name="' . esc_attr ($key) . '" value="' . esc_attr (maybe_serialize ($value)) . '" />' . "\n";
|
198 |
|
199 |
+
do_action("ws_plugin__s2member_during_ms_process_signup_hidden_fields", get_defined_vars ());
|
200 |
}
|
201 |
+
do_action("ws_plugin__s2member_after_ms_process_signup_hidden_fields", get_defined_vars ());
|
202 |
}
|
203 |
/**
|
204 |
* Adds Customs Fields to ``$meta`` on signup.
|
216 |
* @param array $meta Expects an array of meta-data to be passed in by the Filter.
|
217 |
* @return array Full ``$meta`` array with s2Member Custom Fields included.
|
218 |
*/
|
219 |
+
public static function ms_process_signup_meta($meta = FALSE)
|
220 |
{
|
221 |
global /* Multisite Networking. */ $current_site, $current_blog;
|
222 |
global $pagenow; // Need this to detect the current admin page.
|
223 |
|
224 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
225 |
+
do_action("ws_plugin__s2member_before_ms_process_signup_meta", get_defined_vars ());
|
226 |
+
unset($__refs, $__v);
|
227 |
|
228 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
229 |
+
if (!empty($_POST) && is_array($_POST) && ((is_blog_admin () && $pagenow === "user-new.php") || (!is_admin () && ((preg_match ("/\/wp-signup\.php/", $_SERVER["REQUEST_URI"]) && !empty($_POST["stage"]) && preg_match ("/^validate-(user|blog)-signup$/", (string)$_POST["stage"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())))))
|
230 |
{
|
231 |
c_ws_plugin__s2member_email_configs::email_config (); // Configures `From:` header used in notifications.
|
232 |
|
233 |
+
$meta["add_to_blog"] = (empty($meta["add_to_blog"])) ? $current_blog->blog_id : $meta["add_to_blog"];
|
234 |
+
$meta["new_role"] = (empty($meta["new_role"])) ? get_option("default_role") : $meta["new_role"];
|
235 |
|
236 |
foreach (c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)) as $key => $value)
|
237 |
if (preg_match ("/^ws_plugin__s2member_(custom_reg_field|user_new)_/", $key))
|
238 |
if ($key = preg_replace ("/_user_new_/", "_custom_reg_field_", $key))
|
239 |
$meta["s2member_ms_signup_meta"][$key] = maybe_unserialize ($value);
|
240 |
}
|
241 |
+
return apply_filters("ws_plugin__s2member_ms_process_signup_meta", $meta, get_defined_vars ());
|
242 |
}
|
243 |
/**
|
244 |
* Intersects with ``wpmu_activate_signup()`` through s2Member's Multisite Networking patch.
|
262 |
public static function ms_activate_existing_user ($_error = FALSE, $vars = FALSE)
|
263 |
{
|
264 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
265 |
+
do_action("ws_plugin__s2member_before_ms_activate_existing_user", get_defined_vars ());
|
266 |
+
unset($__refs, $__v);
|
267 |
|
268 |
extract ($vars); // Extract all variables from ``wpmu_activate_signup()`` function.
|
269 |
|
270 |
+
if (is_multisite()) // This event should ONLY be processed with Multisite Networking.
|
271 |
+
if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed() && bp_is_activation_page())))
|
272 |
{
|
273 |
+
if (!empty($user_id) && !empty($user_login) && !empty($user_email) && !empty($password) && !empty($meta) && !empty($meta["add_to_blog"]) && !empty($meta["new_role"]))
|
274 |
+
if (!empty($user_already_exists) && c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email, $meta["add_to_blog"]))
|
275 |
{
|
276 |
+
add_user_to_blog($meta["add_to_blog"], $user_id, $meta["new_role"]); // Add this User to the specified Blog.
|
277 |
+
wp_update_user(array("ID" => $user_id, "user_pass" => $password)); // Update Password so it's the same as in the following msg.
|
278 |
+
wpmu_welcome_user_notification($user_id, $password, $meta); // Send welcome letter via email just like ``wpmu_activate_signup()`` does.
|
279 |
|
280 |
+
do_action("wpmu_activate_user", $user_id, $password, $meta); // Process Hook that would have been fired inside ``wpmu_activate_signup()``.
|
281 |
|
282 |
+
return apply_filters("ws_plugin__s2member_ms_activate_existing_user", array("user_id" => $user_id, "password" => $password, "meta" => $meta), get_defined_vars ());
|
283 |
}
|
284 |
}
|
285 |
+
return apply_filters("ws_plugin__s2member_ms_activate_existing_user", $_error, get_defined_vars ()); // Else, return the standardized error.
|
286 |
}
|
287 |
/**
|
288 |
* Configures new Users on a Multisite Network installation.
|
305 |
global $pagenow; // Detect the current admin page.
|
306 |
|
307 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
308 |
+
do_action("ws_plugin__s2member_before_configure_user_on_ms_user_activation", get_defined_vars ());
|
309 |
+
unset($__refs, $__v);
|
310 |
|
311 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
312 |
if ((is_blog_admin () && $pagenow === "user-new.php" && isset ($_POST["noconfirmation"])) || (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ()))))
|
313 |
{
|
314 |
+
c_ws_plugin__s2member_registrations::configure_user_registration ($user_id, $password, ((isset ($meta["s2member_ms_signup_meta"]) && is_array($meta["s2member_ms_signup_meta"])) ? $meta["s2member_ms_signup_meta"] : array()));
|
315 |
delete_user_meta ($user_id, "s2member_ms_signup_meta");
|
316 |
}
|
317 |
|
318 |
+
do_action("ws_plugin__s2member_after_configure_user_on_ms_user_activation", get_defined_vars ());
|
319 |
}
|
320 |
/**
|
321 |
* Configures new Users on a Multisite Network installation.
|
341 |
public static function configure_user_on_ms_blog_activation ($blog_id = FALSE, $user_id = FALSE, $password = FALSE, $title = FALSE, $meta = FALSE)
|
342 |
{
|
343 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
344 |
+
do_action("ws_plugin__s2member_before_configure_user_on_ms_blog_activation", get_defined_vars ());
|
345 |
+
unset($__refs, $__v);
|
346 |
|
347 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
348 |
if (!is_admin () && ((preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"])) || (c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page ())))
|
349 |
{
|
350 |
+
c_ws_plugin__s2member_registrations::configure_user_registration ($user_id, $password, ((isset ($meta["s2member_ms_signup_meta"]) && is_array($meta["s2member_ms_signup_meta"])) ? $meta["s2member_ms_signup_meta"] : array()));
|
351 |
delete_user_meta ($user_id, "s2member_ms_signup_meta");
|
352 |
}
|
353 |
+
do_action("ws_plugin__s2member_after_configure_user_on_ms_blog_activation", get_defined_vars ());
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Assigns the proper role/ccaps on BP user activation.
|
358 |
+
*
|
359 |
+
* @attaches-to `bp_core_activated_user`
|
360 |
+
*
|
361 |
+
* @param string|integer $user_id Passed in by hook.
|
362 |
+
*/
|
363 |
+
public static function bp_user_activation($user_id)
|
364 |
+
{
|
365 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
366 |
+
do_action("ws_plugin__s2member_before_bp_user_activation", get_defined_vars ());
|
367 |
+
unset($__refs, $__v);
|
368 |
+
|
369 |
+
if(is_multisite() || !$user_id) return; // Nothing to do.
|
370 |
+
|
371 |
+
$role = get_user_option('s2member_bp_activation_role', $user_id);
|
372 |
+
$ccaps = get_user_option('s2member_bp_activation_ccaps', $user_id);
|
373 |
+
|
374 |
+
delete_user_option($user_id, 's2member_bp_activation_role');
|
375 |
+
delete_user_option($user_id, 's2member_bp_activation_ccaps');
|
376 |
+
|
377 |
+
if($role && ($user = new WP_User($user_id)) && $user->ID)
|
378 |
+
{
|
379 |
+
$user->set_role($role);
|
380 |
+
if($ccaps && is_array($ccaps)) foreach($ccaps as $_ccap)
|
381 |
+
$user->add_cap('access_s2member_ccap_'.$_ccap);
|
382 |
+
unset($_ccap); // Housekeeping.
|
383 |
}
|
384 |
+
}
|
385 |
+
|
386 |
/**
|
387 |
* Intersects with ``register_new_user()`` through s2Member's Multisite Networking patch.
|
388 |
*
|
404 |
public static function ms_register_existing_user ($errors = FALSE, $user_login = FALSE, $user_email = FALSE)
|
405 |
{
|
406 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
407 |
+
do_action("ws_plugin__s2member_before_ms_register_existing_user", get_defined_vars ());
|
408 |
+
unset($__refs, $__v);
|
409 |
|
410 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
411 |
if (!is_admin () && /* `/wp-login.php`? */ preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
414 |
if (($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email)))
|
415 |
{
|
416 |
foreach ($errors->get_error_codes () as $error_code)
|
417 |
+
if (!in_array($error_code, array("username_exists", "email_exists")))
|
418 |
$other_important_errors_exist[] = $error_code;
|
419 |
|
420 |
+
if (empty($other_important_errors_exist)) // Only if/when NO other important errors exist already.
|
421 |
{
|
422 |
$user_pass = wp_generate_password (); // A new Password for this User/Member will be generated now.
|
423 |
c_ws_plugin__s2member_registrations::ms_create_existing_user ($user_login, $user_email, $user_pass, $user_id);
|
424 |
update_user_option ($user_id, "default_password_nag", true, true); // Setup Password-change nag screen.
|
425 |
wp_new_user_notification ($user_id, $user_pass); // Welcome email, just like ``register_new_user()``.
|
426 |
|
427 |
+
$redirect_to = (!empty($_REQUEST["redirect_to"])) ? trim (stripslashes ($_REQUEST["redirect_to"])) : false;
|
428 |
$redirect_to = ($redirect_to) ? $redirect_to : add_query_arg ("checkemail", urlencode ("registered"), wp_login_url ());
|
429 |
|
430 |
+
do_action("ws_plugin__s2member_during_ms_register_existing_user", get_defined_vars ());
|
431 |
|
432 |
wp_safe_redirect ($redirect_to) . exit (); // Safe, like: ``register_new_user()``.
|
433 |
}
|
436 |
else if (($ms = wpmu_validate_user_signup ($user_login, $user_email)) && isset ($ms["errors"]) && is_wp_error ($ms["errors"]) && $ms["errors"]->get_error_code ())
|
437 |
$errors->add ($ms["errors"]->get_error_code (), $ms["errors"]->get_error_message ());
|
438 |
|
439 |
+
return apply_filters("ws_plugin__s2member_ms_register_existing_user", $errors, get_defined_vars ());
|
440 |
}
|
441 |
/**
|
442 |
* For Multisite Networks, this function is used to add a User to an existing Blog; and to simulate ``wp_create_user()`` behavior.
|
457 |
public static function ms_create_existing_user ($user_login = FALSE, $user_email = FALSE, $user_pass = FALSE, $user_id = FALSE)
|
458 |
{
|
459 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
460 |
+
do_action("ws_plugin__s2member_before_ms_create_existing_user", get_defined_vars ());
|
461 |
+
unset($__refs, $__v);
|
462 |
|
463 |
if (is_multisite ()) // This event should ONLY be processed with Multisite Networking.
|
464 |
{
|
465 |
if (($user_id || ($user_id = c_ws_plugin__s2member_utils_users::ms_user_login_email_exists_but_not_on_blog ($user_login, $user_email))) && $user_pass)
|
466 |
{
|
467 |
$role = get_option ("default_role"); // Use default Role.
|
468 |
+
add_existing_user_to_blog (array("user_id" => $user_id, "role" => $role)); // Add User.
|
469 |
+
wp_update_user (array("ID" => $user_id, "user_pass" => $user_pass)); // Update to ``$user_pass``.
|
470 |
|
471 |
+
do_action("ws_plugin__s2member_during_ms_create_existing_user", get_defined_vars ());
|
472 |
+
do_action("user_register", $user_id); // So s2Member knows a User is registering.
|
473 |
|
474 |
+
return apply_filters("ws_plugin__s2member_ms_create_existing_user", $user_id, get_defined_vars ());
|
475 |
}
|
476 |
}
|
477 |
+
return apply_filters("ws_plugin__s2member_ms_create_existing_user", false, get_defined_vars ());
|
478 |
}
|
479 |
/**
|
480 |
* Configures all new Users.
|
504 |
static $email_config, $processed; // Static vars prevent duplicate processing.
|
505 |
|
506 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
507 |
+
do_action("ws_plugin__s2member_before_configure_user_registration", get_defined_vars ());
|
508 |
+
unset($__refs, $__v);
|
509 |
|
510 |
// With Multisite Networking, we need this to run on `user_register` ahead of `wpmu_activate_[user|blog]`.
|
511 |
if (!isset ($email_config) && ($email_config = true)) // Anytime this routine is fired; we configure email.
|
516 |
|
517 |
if (!$processed /* Process only once. Safeguard this routine against duplicate processing via plugins (or even WordPress itself). */)
|
518 |
|
519 |
+
if ( /* We MUST have at least ONE of these three arrays. Any of these will do in most cases. */is_array($_p) || is_array($meta) || is_array($rvs))
|
520 |
|
521 |
+
if (!(is_multisite () && is_blog_admin () && $pagenow === "user-new.php" && isset ($_p["noconfirmation"]) && is_super_admin () && !is_array($meta)))
|
522 |
+
if (!(preg_match ("/\/wp-activate\.php/", $_SERVER["REQUEST_URI"]) && !is_array($meta)) /* If activating; we absolutely MUST have a ``$meta`` array. */)
|
523 |
+
if (!(c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_activation_page () && !is_array($meta)) /* If activating; MUST have ``$meta``. */)
|
524 |
+
if (!(c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user") && !is_array($rvs)))
|
525 |
|
526 |
+
if ($user_id && is_object ($user = new WP_User ($user_id)) && !empty($user->ID) && ($user_id = $user->ID) && ($processed = true))
|
527 |
{
|
528 |
settype /* Force arrays here. */ ($_p, "array") . settype ($meta, "array") . settype ($rvs, "array");
|
529 |
|
541 |
exit (_x ("s2Member security violation. You attempted to POST administrative variables that will NOT be trusted in a NON-administrative zone!", "s2member-front", "s2member"));
|
542 |
|
543 |
$_pmr = array_merge ($_p, $meta, $rvs); // Merge all of these arrays together now, in this specific order.
|
544 |
+
unset($_p, $meta, $rvs); // These variables can all be unset now; we have them all in the ``$_pmr`` array.
|
545 |
|
546 |
$custom_reg_display_name = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_display_name"]; // Can be configured by the site owner.
|
547 |
|
569 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
570 |
|
571 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
|
572 |
+
$opt_in = (!$opt_in && !empty($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : $opt_in;
|
573 |
|
574 |
if (!($fname = $user->first_name))
|
575 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
|
576 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
577 |
|
578 |
if (!$fname) // Also try BuddyPress.
|
579 |
+
if (!empty($_pmr["field_1"])) // BuddyPress?
|
580 |
$fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
|
581 |
|
582 |
if (!($lname = $user->last_name))
|
583 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
|
584 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
585 |
|
586 |
if (!$lname) // Also try BuddyPress.
|
587 |
+
if (!empty($_pmr["field_1"]) && preg_match ("/^(.+?) (.+)$/", (string)$_pmr["field_1"]))
|
588 |
$lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
|
589 |
|
590 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
593 |
$name = trim ($fname . " " . $lname); // Both names.
|
594 |
|
595 |
if (!($pass = $password)) // Try s2Member's generator.
|
596 |
+
if (!empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
597 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
598 |
|
599 |
if (!$pass) // Also try BuddyPress Password.
|
600 |
+
if (!empty($_pmr["signup_password"])) // BuddyPress?
|
601 |
$pass = (string)$_pmr["signup_password"];
|
602 |
|
603 |
if ($pass) // No Password nag. Update this globally.
|
622 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
623 |
{
|
624 |
if ($custom_reg_display_name === "full" && $name)
|
625 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $name));
|
626 |
else if ($custom_reg_display_name === "first" && $fname)
|
627 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $fname));
|
628 |
else if ($custom_reg_display_name === "last" && $lname)
|
629 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $lname));
|
630 |
else if ($custom_reg_display_name === "login" && $login)
|
631 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $login));
|
632 |
}
|
633 |
if (is_multisite ()) // Should we handle Main Site permissions and Originating Blog ID#?
|
634 |
{
|
651 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
652 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
653 |
|
654 |
+
if (!($fields = array()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
|
655 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
656 |
{
|
657 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
662 |
}
|
663 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
664 |
|
665 |
+
if (!empty($fields)) // Only if NOT empty.
|
666 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
667 |
|
668 |
if ($level > 0) // We ONLY process this if they are higher than Level #0.
|
669 |
{
|
670 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
671 |
+
$pr_times["level"] = (empty($pr_times["level"])) ? time () : $pr_times["level"];
|
672 |
+
$pr_times["level" . $level] = (empty($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
|
673 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
674 |
}
|
675 |
+
if(!is_multisite() && c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())
|
676 |
+
{
|
677 |
+
update_user_option($user_id, "s2member_bp_activation_role", $role);
|
678 |
+
update_user_option($user_id, "s2member_bp_activation_ccaps", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
|
679 |
+
}
|
680 |
+
if (($transient = "s2m_" . md5 ("s2member_transient_ipn_signup_vars_" . $subscr_id)) && is_array($ipn_signup_vars = get_transient ($transient)))
|
681 |
{
|
682 |
update_user_option ($user_id, "s2member_ipn_signup_vars", $ipn_signup_vars); // For future reference.
|
683 |
delete_transient ($transient); // This can be deleted now.
|
684 |
}
|
685 |
+
if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_payment_" . $subscr_id)) && is_array($subscr_payment = get_transient ($transient)) && !empty($subscr_payment["subscr_gateway"]))
|
686 |
{
|
687 |
+
$proxy = array("s2member_paypal_proxy" => stripslashes ((string)$subscr_payment["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
|
688 |
+
c_ws_plugin__s2member_utils_urls::remote (site_url ("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep ($subscr_payment), $proxy), array("timeout" => 20));
|
689 |
delete_transient ($transient); // This can be deleted now.
|
690 |
}
|
691 |
+
if (($transient = "s2m_" . md5 ("s2member_transient_ipn_subscr_eot_" . $subscr_id)) && is_array($subscr_eot = get_transient ($transient)) && !empty($subscr_eot["subscr_gateway"]))
|
692 |
{
|
693 |
+
$proxy = array("s2member_paypal_proxy" => stripslashes ((string)$subscr_eot["subscr_gateway"]), "s2member_paypal_proxy_verification" => c_ws_plugin__s2member_paypal_utilities::paypal_proxy_key_gen ());
|
694 |
+
c_ws_plugin__s2member_utils_urls::remote (site_url ("/?s2member_paypal_notify=1"), array_merge(stripslashes_deep ($subscr_eot), $proxy), array("timeout" => 20));
|
695 |
delete_transient ($transient); // This can be deleted now.
|
696 |
}
|
697 |
if (!headers_sent ()) // Only if headers are NOT yet sent. Here we establish both Signup and Payment Tracking Cookies.
|
698 |
@setcookie ("s2member_tracking", ($s2member_tracking = c_ws_plugin__s2member_utils_encryption::encrypt ($subscr_id)), time () + 31556926, COOKIEPATH, COOKIE_DOMAIN) . @setcookie ("s2member_tracking", $s2member_tracking, time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN) . ($_COOKIE["s2member_tracking"] = $s2member_tracking);
|
699 |
|
700 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
701 |
+
do_action("ws_plugin__s2member_during_configure_user_registration_front_side_paid", get_defined_vars ());
|
702 |
+
do_action("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
|
703 |
+
unset($__refs, $__v);
|
704 |
}
|
705 |
else if (!is_admin () && (!c_ws_plugin__s2member_utils_conds::pro_is_installed () || !c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
706 |
{ /* This routine could be processed through `/wp-login.php?action=register`, `/wp-activate.php`, or `/activate` via BuddyPress`.
|
738 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
739 |
|
740 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"]) ? true : false;
|
741 |
+
$opt_in = (!$opt_in && !empty($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : $opt_in;
|
742 |
|
743 |
if (!($fname = $user->first_name))
|
744 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
|
745 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
746 |
|
747 |
if (!$fname) // Also try BuddyPress.
|
748 |
+
if (!empty($_pmr["field_1"])) // BuddyPress?
|
749 |
$fname = trim (preg_replace ("/ (.*)$/", "", (string)$_pmr["field_1"]));
|
750 |
|
751 |
if (!($lname = $user->last_name))
|
752 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
|
753 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
754 |
|
755 |
if (!$lname) // Also try BuddyPress.
|
756 |
+
if (!empty($_pmr["field_1"]) && preg_match ("/^(.+?) (.+)$/", (string)$_pmr["field_1"]))
|
757 |
$lname = trim (preg_replace ("/^(.+?) (.+)$/", "$2", (string)$_pmr["field_1"]));
|
758 |
|
759 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
762 |
$name = trim ($fname . " " . $lname); // Both names.
|
763 |
|
764 |
if (!($pass = $password)) // Try s2Member's generator.
|
765 |
+
if (!empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
766 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
767 |
|
768 |
if (!$pass) // Also try BuddyPress Password.
|
769 |
+
if (!empty($_pmr["signup_password"])) // BuddyPress?
|
770 |
$pass = (string)$_pmr["signup_password"];
|
771 |
|
772 |
if ($pass) // No Password nag. Update this globally.
|
791 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
792 |
{
|
793 |
if ($custom_reg_display_name === "full" && $name)
|
794 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $name));
|
795 |
else if ($custom_reg_display_name === "first" && $fname)
|
796 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $fname));
|
797 |
else if ($custom_reg_display_name === "last" && $lname)
|
798 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $lname));
|
799 |
else if ($custom_reg_display_name === "login" && $login)
|
800 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $login));
|
801 |
}
|
802 |
if /* Should we handle Main Site permissions and Originating Blog ID#? */(is_multisite ())
|
803 |
{
|
820 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
821 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
822 |
|
823 |
+
if (!($fields = array()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
|
824 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
825 |
{
|
826 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
831 |
}
|
832 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
833 |
|
834 |
+
if (!empty($fields)) // Only if NOT empty.
|
835 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
836 |
|
837 |
if ($level > 0) // We ONLY process this if they are higher than Level#0.
|
838 |
{
|
839 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
840 |
+
$pr_times["level"] = (empty($pr_times["level"])) ? time () : $pr_times["level"];
|
841 |
+
$pr_times["level" . $level] = (empty($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
|
842 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
843 |
}
|
844 |
+
if(!is_multisite() && c_ws_plugin__s2member_utils_conds::bp_is_installed () && bp_is_register_page ())
|
845 |
+
{
|
846 |
+
update_user_option($user_id, "s2member_bp_activation_role", $role);
|
847 |
+
update_user_option($user_id, "s2member_bp_activation_ccaps", c_ws_plugin__s2member_user_access::user_access_ccaps($user));
|
848 |
+
}
|
849 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
850 |
+
do_action("ws_plugin__s2member_during_configure_user_registration_front_side_free", get_defined_vars ());
|
851 |
+
do_action("ws_plugin__s2member_during_configure_user_registration_front_side", get_defined_vars ());
|
852 |
+
unset($__refs, $__v);
|
853 |
}
|
854 |
else if ((is_blog_admin () && $pagenow === "user-new.php") || (c_ws_plugin__s2member_utils_conds::pro_is_installed () && c_ws_plugin__s2member_pro_remote_ops::is_remote_op ("create_user")))
|
855 |
{ // Can only be processed through `/user-new.php` in the Admin panel, or through Remote Op: `create_user`.
|
883 |
$auto_eot_time = ($eot = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_auto_eot_time"]) ? strtotime ($eot) : "";
|
884 |
$notes = (string)@$_pmr["ws_plugin__s2member_custom_reg_field_s2member_notes"];
|
885 |
|
886 |
+
$opt_in = (!empty($_pmr["ws_plugin__s2member_custom_reg_field_opt_in"])) ? true : false;
|
887 |
|
888 |
if (!($fname = $user->first_name)) // `Users -› Add New`.
|
889 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_first_name"]))
|
890 |
$fname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_first_name"];
|
891 |
|
892 |
if (!($lname = $user->last_name)) // `Users -› Add New`.
|
893 |
+
if (!empty($_pmr["ws_plugin__s2member_custom_reg_field_last_name"]))
|
894 |
$lname = (string)$_pmr["ws_plugin__s2member_custom_reg_field_last_name"];
|
895 |
|
896 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_names"] && !$fname && $login)
|
899 |
$name = trim ($fname . " " . $lname); // Both names.
|
900 |
|
901 |
if (!($pass = $password)) // Try s2Member's generator.
|
902 |
+
if (!empty($GLOBALS["ws_plugin__s2member_generate_password_return"]))
|
903 |
$pass = (string)$GLOBALS["ws_plugin__s2member_generate_password_return"];
|
904 |
|
905 |
if (!$pass) // Also try the `Users -› Add New` form.
|
906 |
+
if (!empty($_pmr["pass1"])) // Field in `/user-new.php`.
|
907 |
$pass = (string)$_pmr["pass1"];
|
908 |
|
909 |
if ($pass) // No Password nag. Update this globally.
|
928 |
if (!$user->display_name || $user->display_name === $user->user_login)
|
929 |
{
|
930 |
if ($custom_reg_display_name === "full" && $name)
|
931 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $name));
|
932 |
else if ($custom_reg_display_name === "first" && $fname)
|
933 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $fname));
|
934 |
else if ($custom_reg_display_name === "last" && $lname)
|
935 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $lname));
|
936 |
else if ($custom_reg_display_name === "login" && $login)
|
937 |
+
wp_update_user (array("ID" => $user_id, "display_name" => $login));
|
938 |
}
|
939 |
if (is_multisite ()) // Should we handle Main Site permissions and Originating Blog ID#?
|
940 |
{
|
957 |
if (strlen ($ccap = trim (strtolower (preg_replace ("/[^a-z_0-9]/i", "", $ccap)))))
|
958 |
$user->add_cap ("access_s2member_ccap_" . $ccap);
|
959 |
|
960 |
+
if (!($fields = array()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
|
961 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
962 |
{
|
963 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
968 |
}
|
969 |
unset($field, $field_var, $field_id_class); // Housekeeping.
|
970 |
|
971 |
+
if (!empty($fields)) // Only if NOT empty.
|
972 |
update_user_option ($user_id, "s2member_custom_fields", $fields);
|
973 |
|
974 |
if ($level > 0) // We ONLY process this if they are higher than Level#0.
|
975 |
{
|
976 |
$pr_times = get_user_option ("s2member_paid_registration_times", $user_id);
|
977 |
+
$pr_times["level"] = (empty($pr_times["level"])) ? time () : $pr_times["level"];
|
978 |
+
$pr_times["level" . $level] = (empty($pr_times["level" . $level])) ? time () : $pr_times["level" . $level];
|
979 |
update_user_option ($user_id, "s2member_paid_registration_times", $pr_times); // Update now.
|
980 |
}
|
981 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
982 |
+
do_action("ws_plugin__s2member_during_configure_user_registration_admin_side", get_defined_vars ());
|
983 |
+
unset($__refs, $__v);
|
984 |
}
|
985 |
if ($processed === "yes") // If registration was processed by one of the routines above.
|
986 |
{
|
1067 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
1068 |
|
1069 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["registration_notification_recipients"]) as $recipient)
|
1070 |
+
wp_mail ($recipient, apply_filters("ws_plugin__s2member_registration_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters("ws_plugin__s2member_registration_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
1071 |
}
|
1072 |
if ($email_configs_were_on) // Back on?
|
1073 |
c_ws_plugin__s2member_email_configs::email_config ();
|
1137 |
unset($logt, $logv, $logm, $log4, $_log4, $log2, $logs_dir, $reg_vars); // Housekeeping.
|
1138 |
|
1139 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
1140 |
+
do_action("ws_plugin__s2member_during_configure_user_registration", get_defined_vars ());
|
1141 |
+
unset($__refs, $__v);
|
1142 |
}
|
1143 |
}
|
1144 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
1145 |
+
do_action("ws_plugin__s2member_after_configure_user_registration", get_defined_vars ());
|
1146 |
+
unset($__refs, $__v);
|
1147 |
}
|
1148 |
}
|
1149 |
}
|
includes/classes/return-templates.inc.php
CHANGED
@@ -33,17 +33,17 @@ if (!class_exists ("c_ws_plugin__s2member_return_templates"))
|
|
33 |
* @package s2Member\Return_Templates
|
34 |
* @since 110720
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @param
|
38 |
-
* @param
|
39 |
-
* @param
|
40 |
-
* @return
|
41 |
*/
|
42 |
public static function return_template ($template = FALSE, $response = FALSE, $continue_html = FALSE, $continue_link = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
-
do_action
|
46 |
-
unset
|
47 |
|
48 |
$template = ($template) ? $template : "default";
|
49 |
$continue_link = ($continue_link) ? $continue_link : home_url ("/", "http");
|
@@ -68,16 +68,16 @@ if (!class_exists ("c_ws_plugin__s2member_return_templates"))
|
|
68 |
$code = trim (((!$custom_template || !is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? c_ws_plugin__s2member_utilities::evl ($code) : $code));
|
69 |
|
70 |
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head (get_bloginfo ("name"), "ws_plugin__s2member_during_return_template_head_" . (($specific_template) ? basename ($specific_template) : "default-return.php"));
|
71 |
-
$code = preg_replace ("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
72 |
|
73 |
-
$code = preg_replace ("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
74 |
|
75 |
-
$code = preg_replace ("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
76 |
-
$code = preg_replace ("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
77 |
-
$code = preg_replace ("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
78 |
-
$code = preg_replace ("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters
|
79 |
|
80 |
-
return apply_filters
|
81 |
}
|
82 |
}
|
83 |
}
|
33 |
* @package s2Member\Return_Templates
|
34 |
* @since 110720
|
35 |
*
|
36 |
+
* @param string $template Optional A Subscr. Gateway code should be used as the template name, or `default` is a multipurpose template. Defaults to `default`. Used in template selection.
|
37 |
+
* @param string $response Optional. Response message to fill template with, using the Replacement Code `%%response%%` inside the template file. Defaults to: `Thank you. Please click the link below.`.
|
38 |
+
* @param string $continue_html Optional. The HTML value of the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: `Continue`.
|
39 |
+
* @param string $continue_link Optional. The HREF value for the continuation link presented within the template using Replacement Code `%%continue%%`. Defaults to: ``home_url ("/", "http")``.
|
40 |
+
* @return string The full HTML code of the template. All Replacement Codes inside the template file will have already been filled by this routine.
|
41 |
*/
|
42 |
public static function return_template ($template = FALSE, $response = FALSE, $continue_html = FALSE, $continue_link = FALSE)
|
43 |
{
|
44 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
45 |
+
do_action("ws_plugin__s2member_before_return_template", get_defined_vars ());
|
46 |
+
unset($__refs, $__v);
|
47 |
|
48 |
$template = ($template) ? $template : "default";
|
49 |
$continue_link = ($continue_link) ? $continue_link : home_url ("/", "http");
|
68 |
$code = trim (((!$custom_template || !is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ()) ? c_ws_plugin__s2member_utilities::evl ($code) : $code));
|
69 |
|
70 |
$doctype_html_head = c_ws_plugin__s2member_utils_html::doctype_html_head (get_bloginfo ("name"), "ws_plugin__s2member_during_return_template_head_" . (($specific_template) ? basename ($specific_template) : "default-return.php"));
|
71 |
+
$code = preg_replace ("/%%doctype_html_head%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_doctype_html_head", $doctype_html_head, get_defined_vars ())), $code);
|
72 |
|
73 |
+
$code = preg_replace ("/%%header%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_header", sprintf (_x ('[ %s ] <strong><em>says…</em></strong>', "s2member-front", "s2member"), esc_html ($_SERVER["HTTP_HOST"])), get_defined_vars ())), $code);
|
74 |
|
75 |
+
$code = preg_replace ("/%%response%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_response", $response, get_defined_vars ())), $code);
|
76 |
+
$code = preg_replace ("/%%continue%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_continue", '<a href="' . esc_attr ($continue_link) . '">' . $continue_html . '</a>', get_defined_vars ())), $code);
|
77 |
+
$code = preg_replace ("/%%support%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_support", sprintf (_x ('If you need assistance, please <a href="%s" target="_blank">contact support</a>.', "s2member-front", "s2member"), esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_support_link"])), get_defined_vars ())), $code);
|
78 |
+
$code = preg_replace ("/%%tracking%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (apply_filters("ws_plugin__s2member_return_template_tracking", c_ws_plugin__s2member_tracking_codes::generate_all_tracking_codes (), get_defined_vars ())), $code);
|
79 |
|
80 |
+
return apply_filters("ws_plugin__s2member_return_template", $code, get_defined_vars ());
|
81 |
}
|
82 |
}
|
83 |
}
|
includes/classes/ruris-sp.inc.php
CHANGED
@@ -33,26 +33,26 @@ if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
|
|
33 |
* @package s2Member\URIs
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array
|
39 |
*/
|
40 |
public static function check_specific_ruri_level_access ($uri = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
|
45 |
|
46 |
-
$excluded = apply_filters
|
47 |
|
48 |
-
if (!$excluded && !empty
|
49 |
{
|
50 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $uri)) // Do NOT touch WordPress Systematics.
|
51 |
{
|
52 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
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, "/") . "$/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
-
return apply_filters
|
56 |
|
57 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $uri)) // Never restrict Systematics. However, there is 1 exception above.
|
58 |
{
|
@@ -62,15 +62,15 @@ if (!class_exists ("c_ws_plugin__s2member_ruris_sp"))
|
|
62 |
|
63 |
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)
|
64 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
65 |
-
return apply_filters
|
66 |
}
|
67 |
}
|
68 |
|
69 |
-
do_action
|
70 |
}
|
71 |
}
|
72 |
|
73 |
-
return apply_filters
|
74 |
}
|
75 |
}
|
76 |
}
|
33 |
* @package s2Member\URIs
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $uri A URI, or a full URL is also fine.
|
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_ruri_level_access ($uri = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_check_specific_ruri_level_access", get_defined_vars ());
|
43 |
|
44 |
$uri = ($uri && is_string ($uri) && ($uri = c_ws_plugin__s2member_utils_urls::parse_uri ($uri))) ? $uri : false;
|
45 |
|
46 |
+
$excluded = apply_filters("ws_plugin__s2member_check_specific_ruri_level_access_excluded", false, get_defined_vars ());
|
47 |
|
48 |
+
if (!$excluded && !empty($uri) && is_string ($uri) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
49 |
{
|
50 |
if (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $uri)) // Do NOT touch WordPress Systematics.
|
51 |
{
|
52 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
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, "/") . "$/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
+
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => 0), get_defined_vars ());
|
56 |
|
57 |
else if (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $uri)) // Never restrict Systematics. However, there is 1 exception above.
|
58 |
{
|
62 |
|
63 |
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)
|
64 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
65 |
+
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", array("s2member_level_req" => $n), get_defined_vars ());
|
66 |
}
|
67 |
}
|
68 |
|
69 |
+
do_action("ws_plugin__s2member_during_check_specific_ruri_level_access", get_defined_vars ());
|
70 |
}
|
71 |
}
|
72 |
|
73 |
+
return apply_filters("ws_plugin__s2member_check_specific_ruri_level_access", null, get_defined_vars ());
|
74 |
}
|
75 |
}
|
76 |
}
|
includes/classes/ruris.inc.php
CHANGED
@@ -37,15 +37,15 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
|
|
37 |
*/
|
38 |
public static function check_ruri_level_access ()
|
39 |
{
|
40 |
-
do_action
|
41 |
|
42 |
-
$excluded = apply_filters
|
43 |
|
44 |
if (!$excluded && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) // Has it been excluded?
|
45 |
{
|
46 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
47 |
{
|
48 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty
|
49 |
|
50 |
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, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
|
51 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("ruri", $_SERVER["REQUEST_URI"], "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
@@ -62,11 +62,11 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
|
|
62 |
}
|
63 |
}
|
64 |
|
65 |
-
do_action
|
66 |
}
|
67 |
}
|
68 |
|
69 |
-
do_action
|
70 |
|
71 |
return; // For uniformity.
|
72 |
}
|
@@ -76,20 +76,20 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
|
|
76 |
* @package s2Member\URIs
|
77 |
* @since 3.5
|
78 |
*
|
79 |
-
* @param
|
80 |
-
* @param
|
81 |
-
* @return
|
82 |
*/
|
83 |
public static function fill_ruri_level_access_rc_vars ($uris = FALSE, $user = FALSE)
|
84 |
{
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
-
do_action
|
87 |
-
unset
|
88 |
|
89 |
$uris = (string)$uris; // Force ``$uris`` to a string value.
|
90 |
$orig_uris = $uris; // Record the original URIs that were passed in; collectively.
|
91 |
|
92 |
-
$user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty
|
93 |
|
94 |
$user_id = ($user) ? (string)$user->ID : "";
|
95 |
$user_login = ($user) ? (string)strtolower ($user->user_login) : "";
|
@@ -106,7 +106,7 @@ if (!class_exists ("c_ws_plugin__s2member_ruris"))
|
|
106 |
$uris = (strlen ($user_ccaps)) ? preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $uris) : $uris;
|
107 |
$uris = (strlen ($user_logins)) ? preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_logins), $uris) : $uris;
|
108 |
|
109 |
-
return apply_filters
|
110 |
}
|
111 |
}
|
112 |
}
|
37 |
*/
|
38 |
public static function check_ruri_level_access ()
|
39 |
{
|
40 |
+
do_action("ws_plugin__s2member_before_check_ruri_level_access", get_defined_vars ());
|
41 |
|
42 |
+
$excluded = apply_filters("ws_plugin__s2member_check_ruri_level_access_excluded", false, get_defined_vars ());
|
43 |
|
44 |
if (!$excluded && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]) // Has it been excluded?
|
45 |
{
|
46 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ()) // Do NOT touch WordPress Systematics. This excludes all WordPress Systematics.
|
47 |
{
|
48 |
+
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty($user->ID)) ? $user : false; // Current User's object.
|
49 |
|
50 |
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, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
|
51 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("ruri", $_SERVER["REQUEST_URI"], "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
do_action("ws_plugin__s2member_during_check_ruri_level_access", get_defined_vars ());
|
66 |
}
|
67 |
}
|
68 |
|
69 |
+
do_action("ws_plugin__s2member_after_check_ruri_level_access", get_defined_vars ());
|
70 |
|
71 |
return; // For uniformity.
|
72 |
}
|
76 |
* @package s2Member\URIs
|
77 |
* @since 3.5
|
78 |
*
|
79 |
+
* @param string $uris A URI string, or a string of multiple URIs is also fine.
|
80 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User, if logged-in.
|
81 |
+
* @return string Collective string of input URIs, with Replacement Codes having been filled.
|
82 |
*/
|
83 |
public static function fill_ruri_level_access_rc_vars ($uris = FALSE, $user = FALSE)
|
84 |
{
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
+
do_action("ws_plugin__s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
|
87 |
+
unset($__refs, $__v);
|
88 |
|
89 |
$uris = (string)$uris; // Force ``$uris`` to a string value.
|
90 |
$orig_uris = $uris; // Record the original URIs that were passed in; collectively.
|
91 |
|
92 |
+
$user = ((is_object ($user) || is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false)) && !empty($user->ID)) ? $user : false;
|
93 |
|
94 |
$user_id = ($user) ? (string)$user->ID : "";
|
95 |
$user_login = ($user) ? (string)strtolower ($user->user_login) : "";
|
106 |
$uris = (strlen ($user_ccaps)) ? preg_replace ("/%%current_user_ccaps%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_ccaps), $uris) : $uris;
|
107 |
$uris = (strlen ($user_logins)) ? preg_replace ("/%%current_user_logins%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_logins), $uris) : $uris;
|
108 |
|
109 |
+
return apply_filters("ws_plugin__s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
|
110 |
}
|
111 |
}
|
112 |
}
|
includes/classes/s-badge-status-in.inc.php
CHANGED
@@ -39,9 +39,9 @@ if (!class_exists ("c_ws_plugin__s2member_s_badge_status_in"))
|
|
39 |
*/
|
40 |
public static function s_badge_status ()
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
-
if (!empty
|
45 |
{
|
46 |
status_header (200); // Send a 200 OK status.
|
47 |
|
@@ -71,7 +71,7 @@ if (!class_exists ("c_ws_plugin__s2member_s_badge_status_in"))
|
|
71 |
{
|
72 |
if (defined ("DB_USER") && DB_USER && defined ("DB_PASSWORD") && DB_PASSWORD && DB_USER !== DB_PASSWORD)
|
73 |
{
|
74 |
-
if ((!apply_filters
|
75 |
|| ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_simultaneous_logins"]) /* Either of these are acceptable. */)
|
76 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"])
|
77 |
{
|
@@ -92,7 +92,7 @@ if (!class_exists ("c_ws_plugin__s2member_s_badge_status_in"))
|
|
92 |
else exit ("-"); // Else, service NOT enabled.
|
93 |
}
|
94 |
|
95 |
-
do_action
|
96 |
}
|
97 |
}
|
98 |
}
|
39 |
*/
|
40 |
public static function s_badge_status ()
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_s_badge_status", get_defined_vars ());
|
43 |
|
44 |
+
if (!empty($_GET["s2member_s_badge_status"]))
|
45 |
{
|
46 |
status_header (200); // Send a 200 OK status.
|
47 |
|
71 |
{
|
72 |
if (defined ("DB_USER") && DB_USER && defined ("DB_PASSWORD") && DB_PASSWORD && DB_USER !== DB_PASSWORD)
|
73 |
{
|
74 |
+
if ((!apply_filters("ws_plugin__s2member_disable_all_ip_restrictions", false, get_defined_vars ()) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction"])
|
75 |
|| ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_simultaneous_logins"]) /* Either of these are acceptable. */)
|
76 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"])
|
77 |
{
|
92 |
else exit ("-"); // Else, service NOT enabled.
|
93 |
}
|
94 |
|
95 |
+
do_action("ws_plugin__s2member_after_s_badge_status", get_defined_vars ());
|
96 |
}
|
97 |
}
|
98 |
}
|
includes/classes/s-badge-status.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_s_badge_status"))
|
|
39 |
*/
|
40 |
public static function s_badge_status ()
|
41 |
{
|
42 |
-
if (!empty
|
43 |
{
|
44 |
c_ws_plugin__s2member_s_badge_status_in::s_badge_status ();
|
45 |
}
|
39 |
*/
|
40 |
public static function s_badge_status ()
|
41 |
{
|
42 |
+
if (!empty($_GET["s2member_s_badge_status"]))
|
43 |
{
|
44 |
c_ws_plugin__s2member_s_badge_status_in::s_badge_status ();
|
45 |
}
|
includes/classes/sc-files-in.inc.php
CHANGED
@@ -36,15 +36,15 @@ if(!class_exists("c_ws_plugin__s2member_sc_files_in"))
|
|
36 |
* @attaches-to ``add_shortcode("s2File");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
do_action("ws_plugin__s2member_before_sc_get_file", get_defined_vars());
|
47 |
-
unset
|
48 |
|
49 |
$attr = /* Force array; trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr);
|
50 |
|
@@ -52,7 +52,7 @@ if(!class_exists("c_ws_plugin__s2member_sc_files_in"))
|
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
do_action("ws_plugin__s2member_before_sc_get_file_after_shortcode_atts", get_defined_vars());
|
55 |
-
unset
|
56 |
|
57 |
$get_streamer_json = filter_var($attr["get_streamer_json"], FILTER_VALIDATE_BOOLEAN);
|
58 |
$get_streamer_array = filter_var($attr["get_streamer_array"], FILTER_VALIDATE_BOOLEAN);
|
@@ -90,15 +90,15 @@ if(!class_exists("c_ws_plugin__s2member_sc_files_in"))
|
|
90 |
* @attaches-to ``add_shortcode("s2Stream");``
|
91 |
*
|
92 |
* @param array $attr An array of Attributes.
|
93 |
-
* @param
|
94 |
-
* @param
|
95 |
-
* @return
|
96 |
*/
|
97 |
public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
98 |
{
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
do_action("ws_plugin__s2member_before_sc_get_stream", get_defined_vars());
|
101 |
-
unset
|
102 |
|
103 |
$attr = /* Force array; trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr);
|
104 |
|
@@ -107,7 +107,7 @@ if(!class_exists("c_ws_plugin__s2member_sc_files_in"))
|
|
107 |
|
108 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
109 |
do_action("ws_plugin__s2member_before_sc_get_stream_after_shortcode_atts", get_defined_vars());
|
110 |
-
unset
|
111 |
|
112 |
foreach /* Now we need to go through and a `file_` prefix to certain Attribute keys, for compatibility. */($attr as $key => $value)
|
113 |
if(strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base")))
|
36 |
* @attaches-to ``add_shortcode("s2File");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
* @return string Value of requested File Download URL, streamer array element; or null on failure.
|
42 |
*/
|
43 |
public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
do_action("ws_plugin__s2member_before_sc_get_file", get_defined_vars());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
$attr = /* Force array; trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr);
|
50 |
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
do_action("ws_plugin__s2member_before_sc_get_file_after_shortcode_atts", get_defined_vars());
|
55 |
+
unset($__refs, $__v);
|
56 |
|
57 |
$get_streamer_json = filter_var($attr["get_streamer_json"], FILTER_VALIDATE_BOOLEAN);
|
58 |
$get_streamer_array = filter_var($attr["get_streamer_array"], FILTER_VALIDATE_BOOLEAN);
|
90 |
* @attaches-to ``add_shortcode("s2Stream");``
|
91 |
*
|
92 |
* @param array $attr An array of Attributes.
|
93 |
+
* @param string $content Content inside the Shortcode.
|
94 |
+
* @param string $shortcode The actual Shortcode name itself.
|
95 |
+
* @return string HTML markup that produces an audio/video stream for a specific player.
|
96 |
*/
|
97 |
public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
98 |
{
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
do_action("ws_plugin__s2member_before_sc_get_stream", get_defined_vars());
|
101 |
+
unset($__refs, $__v);
|
102 |
|
103 |
$attr = /* Force array; trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr);
|
104 |
|
107 |
|
108 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
109 |
do_action("ws_plugin__s2member_before_sc_get_stream_after_shortcode_atts", get_defined_vars());
|
110 |
+
unset($__refs, $__v);
|
111 |
|
112 |
foreach /* Now we need to go through and a `file_` prefix to certain Attribute keys, for compatibility. */($attr as $key => $value)
|
113 |
if(strlen($value) && in_array($key, array("download", "download_key", "stream", "inline", "storage", "remote", "ssl", "rewrite", "rewrite_base")))
|
includes/classes/sc-files.inc.php
CHANGED
@@ -36,9 +36,9 @@ if(!class_exists("c_ws_plugin__s2member_sc_files"))
|
|
36 |
* @attaches-to ``add_shortcode("s2File");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
@@ -53,9 +53,9 @@ if(!class_exists("c_ws_plugin__s2member_sc_files"))
|
|
53 |
* @attaches-to ``add_shortcode("s2Stream");``
|
54 |
*
|
55 |
* @param array $attr An array of Attributes.
|
56 |
-
* @param
|
57 |
-
* @param
|
58 |
-
* @return
|
59 |
*/
|
60 |
public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
61 |
{
|
36 |
* @attaches-to ``add_shortcode("s2File");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
* @return string Value of the requested File Download URL, or null on failure.
|
42 |
*/
|
43 |
public static function sc_get_file($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
53 |
* @attaches-to ``add_shortcode("s2Stream");``
|
54 |
*
|
55 |
* @param array $attr An array of Attributes.
|
56 |
+
* @param string $content Content inside the Shortcode.
|
57 |
+
* @param string $shortcode The actual Shortcode name itself.
|
58 |
+
* @return string HTML markup that produces an audio/video stream for a specific player.
|
59 |
*/
|
60 |
public static function sc_get_stream($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
61 |
{
|
includes/classes/sc-gets-in.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Get");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return mixed Value of the requested data, or null on failure.
|
42 |
*
|
43 |
* @todo Prevent this routine from potentially returning objects/arrays?
|
@@ -45,16 +45,16 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
|
|
45 |
public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
46 |
{
|
47 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
48 |
-
do_action
|
49 |
-
unset
|
50 |
|
51 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr); // Force array; trim quote entities.
|
52 |
|
53 |
-
$attr = shortcode_atts (array
|
54 |
|
55 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
-
do_action
|
57 |
-
unset
|
58 |
|
59 |
if ($attr["constant"] && defined ($attr["constant"])) // Security check here. It must start with S2MEMBER_ on a Blog Farm.
|
60 |
{
|
@@ -67,7 +67,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets_in"))
|
|
67 |
else if ($attr["user_option"] && (is_user_logged_in () || $attr["user_id"]))
|
68 |
$get = get_user_option ($attr["user_option"], (int)$attr["user_id"]);
|
69 |
|
70 |
-
return apply_filters
|
71 |
}
|
72 |
}
|
73 |
}
|
36 |
* @attaches-to ``add_shortcode("s2Get");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return mixed Value of the requested data, or null on failure.
|
42 |
*
|
43 |
* @todo Prevent this routine from potentially returning objects/arrays?
|
45 |
public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
46 |
{
|
47 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
48 |
+
do_action("ws_plugin__s2member_before_sc_get_details", get_defined_vars ());
|
49 |
+
unset($__refs, $__v);
|
50 |
|
51 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr); // Force array; trim quote entities.
|
52 |
|
53 |
+
$attr = shortcode_atts (array("constant" => "", "user_field" => "", "user_option" => "", "user_id" => ""), $attr);
|
54 |
|
55 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
+
do_action("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars ());
|
57 |
+
unset($__refs, $__v);
|
58 |
|
59 |
if ($attr["constant"] && defined ($attr["constant"])) // Security check here. It must start with S2MEMBER_ on a Blog Farm.
|
60 |
{
|
67 |
else if ($attr["user_option"] && (is_user_logged_in () || $attr["user_id"]))
|
68 |
$get = get_user_option ($attr["user_option"], (int)$attr["user_id"]);
|
69 |
|
70 |
+
return apply_filters("ws_plugin__s2member_sc_get_details", ((isset ($get)) ? $get : null), get_defined_vars ());
|
71 |
}
|
72 |
}
|
73 |
}
|
includes/classes/sc-gets.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_gets"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Get");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
36 |
* @attaches-to ``add_shortcode("s2Get");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_get_details ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/sc-if-conds-in.inc.php
CHANGED
@@ -46,9 +46,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
46 |
* @attaches-to ``add_shortcode("s2If")`` + _s2If, __s2If, ___s2If for nesting.
|
47 |
*
|
48 |
* @param array $attr An array of Attributes.
|
49 |
-
* @param
|
50 |
-
* @param
|
51 |
-
* @return
|
52 |
*
|
53 |
* @todo Add support for nested AND/OR conditionals inside the ONE Shortcode.
|
54 |
* @todo Address possible security issue on sites with multiple editors, some of which should not have access to this feature.
|
@@ -56,11 +56,11 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
56 |
public static function sc_if_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
57 |
{
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
|
62 |
-
$blog_farm_safe = apply_filters
|
63 |
-
array
|
64 |
"user_is", "user_is_not", "user_can", "user_cannot",
|
65 |
"current_user_is", "current_user_is_not", "current_user_can", "current_user_cannot",
|
66 |
"is_admin", "is_blog_admin", "is_user_admin", "is_network_admin",
|
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
97 |
|
98 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
99 |
|
100 |
-
return do_shortcode (apply_filters
|
101 |
}
|
102 |
else if(isset($attr["php"])) // Site owner is trying to use `php`, but it's NOT allowed on this installation.
|
103 |
{
|
@@ -122,16 +122,16 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
122 |
return ""; // Return now; empty string in this case.
|
123 |
}
|
124 |
}
|
125 |
-
if (!empty
|
126 |
{
|
127 |
trigger_error ("s2If, AND/OR malformed conditional logic. It's NOT possible to mix logic using AND/OR combinations. You MUST stick to one type of logic or another. If both types of logic are needed, you MUST use two different Shortcode expressions. Or, use Advanced (PHP) Conditionals instead.", E_USER_ERROR);
|
128 |
return ""; // Return now; empty string in this case.
|
129 |
}
|
130 |
-
$conditional_logic = (!empty
|
131 |
|
132 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
133 |
-
do_action
|
134 |
-
unset
|
135 |
|
136 |
if ($conditional_logic === "AND") // This is the AND variation. This routine analyzes conditionals using AND logic (the default behavior).
|
137 |
{
|
@@ -141,9 +141,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
141 |
{
|
142 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || !(preg_match ("/[\$\(\)]/", $attr_args) || preg_match ("/new[\r\n\t\s]/i", $attr_args)))
|
143 |
{
|
144 |
-
if (is_array
|
145 |
{
|
146 |
-
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || in_array
|
147 |
{
|
148 |
$test = ($exclamation) ? false : true; // If !exclamation (false) otherwise this defaults to true.
|
149 |
|
@@ -160,7 +160,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
160 |
break;
|
161 |
}
|
162 |
}
|
163 |
-
else if (empty
|
164 |
{
|
165 |
if ($test === true && !call_user_func ($conditional))
|
166 |
{
|
@@ -173,12 +173,12 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
173 |
break;
|
174 |
}
|
175 |
}
|
176 |
-
else if ($test === true && !call_user_func_array
|
177 |
{
|
178 |
$condition_failed = true;
|
179 |
break;
|
180 |
}
|
181 |
-
else if ($test === false && call_user_func_array
|
182 |
{
|
183 |
$condition_failed = true;
|
184 |
break;
|
@@ -214,7 +214,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
214 |
|
215 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
216 |
|
217 |
-
return do_shortcode (apply_filters
|
218 |
}
|
219 |
|
220 |
else if ($conditional_logic === "OR") // This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND logic.
|
@@ -225,9 +225,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
225 |
{
|
226 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || !(preg_match ("/[\$\(\)]/", $attr_args) || preg_match ("/new[\r\n\t\s]/i", $attr_args)))
|
227 |
{
|
228 |
-
if (is_array
|
229 |
{
|
230 |
-
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || in_array
|
231 |
{
|
232 |
$test = ($exclamation) ? false : true; // If !exclamation (false) otherwise this defaults to true.
|
233 |
|
@@ -244,7 +244,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
244 |
break;
|
245 |
}
|
246 |
}
|
247 |
-
else if (empty
|
248 |
{
|
249 |
if ($test === true && call_user_func ($conditional))
|
250 |
{
|
@@ -257,12 +257,12 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
257 |
break;
|
258 |
}
|
259 |
}
|
260 |
-
else if ($test === true && call_user_func_array
|
261 |
{
|
262 |
$condition_succeeded = true;
|
263 |
break;
|
264 |
}
|
265 |
-
else if ($test === false && !call_user_func_array
|
266 |
{
|
267 |
$condition_succeeded = true;
|
268 |
break;
|
@@ -298,7 +298,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
298 |
|
299 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
300 |
|
301 |
-
return do_shortcode (apply_filters
|
302 |
}
|
303 |
return ""; // Default return value.
|
304 |
}
|
@@ -308,7 +308,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds_in"))
|
|
308 |
* @package s2Member\s2If
|
309 |
* @since 140326
|
310 |
*
|
311 |
-
* @param
|
312 |
* @return bool TRUE if condition succeed; else FALSE.
|
313 |
*/
|
314 |
public static function evl($expression)
|
46 |
* @attaches-to ``add_shortcode("s2If")`` + _s2If, __s2If, ___s2If for nesting.
|
47 |
*
|
48 |
* @param array $attr An array of Attributes.
|
49 |
+
* @param string $content Content inside the Shortcode.
|
50 |
+
* @param string $shortcode The actual Shortcode name itself.
|
51 |
+
* @return string The ``$content`` if true, else an empty string.
|
52 |
*
|
53 |
* @todo Add support for nested AND/OR conditionals inside the ONE Shortcode.
|
54 |
* @todo Address possible security issue on sites with multiple editors, some of which should not have access to this feature.
|
56 |
public static function sc_if_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
57 |
{
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_before_sc_if_conditionals", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
|
62 |
+
$blog_farm_safe = apply_filters("ws_plugin__s2member_sc_if_conditionals_blog_farm_safe",
|
63 |
+
array("is_user_logged_in", "is_user_not_logged_in",
|
64 |
"user_is", "user_is_not", "user_can", "user_cannot",
|
65 |
"current_user_is", "current_user_is_not", "current_user_can", "current_user_cannot",
|
66 |
"is_admin", "is_blog_admin", "is_user_admin", "is_network_admin",
|
97 |
|
98 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
99 |
|
100 |
+
return do_shortcode (apply_filters("ws_plugin__s2member_sc_if_conditionals", $condition_content, get_defined_vars ()));
|
101 |
}
|
102 |
else if(isset($attr["php"])) // Site owner is trying to use `php`, but it's NOT allowed on this installation.
|
103 |
{
|
122 |
return ""; // Return now; empty string in this case.
|
123 |
}
|
124 |
}
|
125 |
+
if (!empty($logicals) && is_array($logicals) && count (array_unique ($logicals)) > 1)
|
126 |
{
|
127 |
trigger_error ("s2If, AND/OR malformed conditional logic. It's NOT possible to mix logic using AND/OR combinations. You MUST stick to one type of logic or another. If both types of logic are needed, you MUST use two different Shortcode expressions. Or, use Advanced (PHP) Conditionals instead.", E_USER_ERROR);
|
128 |
return ""; // Return now; empty string in this case.
|
129 |
}
|
130 |
+
$conditional_logic = (!empty($logicals) && is_array($logicals) && preg_match ("/^(\|\||OR)$/i", $logicals[0])) ? "OR" : "AND";
|
131 |
|
132 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
133 |
+
do_action("ws_plugin__s2member_before_sc_if_conditionals_after_conditional_logic", get_defined_vars ());
|
134 |
+
unset($__refs, $__v);
|
135 |
|
136 |
if ($conditional_logic === "AND") // This is the AND variation. This routine analyzes conditionals using AND logic (the default behavior).
|
137 |
{
|
141 |
{
|
142 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || !(preg_match ("/[\$\(\)]/", $attr_args) || preg_match ("/new[\r\n\t\s]/i", $attr_args)))
|
143 |
{
|
144 |
+
if (is_array($args = preg_split ("/[;,]+/", $attr_args, 0, PREG_SPLIT_NO_EMPTY))) // Convert all arguments into an array. And take note; possibly into an empty array.
|
145 |
{
|
146 |
+
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || in_array(strtolower ($conditional), $blog_farm_safe))
|
147 |
{
|
148 |
$test = ($exclamation) ? false : true; // If !exclamation (false) otherwise this defaults to true.
|
149 |
|
160 |
break;
|
161 |
}
|
162 |
}
|
163 |
+
else if (empty($args)) // No arguments at all.
|
164 |
{
|
165 |
if ($test === true && !call_user_func ($conditional))
|
166 |
{
|
173 |
break;
|
174 |
}
|
175 |
}
|
176 |
+
else if ($test === true && !call_user_func_array($conditional, $args))
|
177 |
{
|
178 |
$condition_failed = true;
|
179 |
break;
|
180 |
}
|
181 |
+
else if ($test === false && call_user_func_array($conditional, $args))
|
182 |
{
|
183 |
$condition_failed = true;
|
184 |
break;
|
214 |
|
215 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
216 |
|
217 |
+
return do_shortcode (apply_filters("ws_plugin__s2member_sc_if_conditionals", $condition_content, get_defined_vars ()));
|
218 |
}
|
219 |
|
220 |
else if ($conditional_logic === "OR") // This is the OR variation. This routine analyzes conditionals using OR logic, instead of AND logic.
|
225 |
{
|
226 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || !(preg_match ("/[\$\(\)]/", $attr_args) || preg_match ("/new[\r\n\t\s]/i", $attr_args)))
|
227 |
{
|
228 |
+
if (is_array($args = preg_split ("/[;,]+/", $attr_args, 0, PREG_SPLIT_NO_EMPTY))) // Convert all arguments into an array. And take note; possibly into an empty array.
|
229 |
{
|
230 |
+
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site () || in_array(strtolower ($conditional), $blog_farm_safe))
|
231 |
{
|
232 |
$test = ($exclamation) ? false : true; // If !exclamation (false) otherwise this defaults to true.
|
233 |
|
244 |
break;
|
245 |
}
|
246 |
}
|
247 |
+
else if (empty($args)) // No arguments at all.
|
248 |
{
|
249 |
if ($test === true && call_user_func ($conditional))
|
250 |
{
|
257 |
break;
|
258 |
}
|
259 |
}
|
260 |
+
else if ($test === true && call_user_func_array($conditional, $args))
|
261 |
{
|
262 |
$condition_succeeded = true;
|
263 |
break;
|
264 |
}
|
265 |
+
else if ($test === false && !call_user_func_array($conditional, $args))
|
266 |
{
|
267 |
$condition_succeeded = true;
|
268 |
break;
|
298 |
|
299 |
if($condition_content) $condition_content = c_ws_plugin__s2member_utils_strings::trim_html($condition_content);
|
300 |
|
301 |
+
return do_shortcode (apply_filters("ws_plugin__s2member_sc_if_conditionals", $condition_content, get_defined_vars ()));
|
302 |
}
|
303 |
return ""; // Default return value.
|
304 |
}
|
308 |
* @package s2Member\s2If
|
309 |
* @since 140326
|
310 |
*
|
311 |
+
* @param string $expression PHP expression.
|
312 |
* @return bool TRUE if condition succeed; else FALSE.
|
313 |
*/
|
314 |
public static function evl($expression)
|
includes/classes/sc-if-conds.inc.php
CHANGED
@@ -46,8 +46,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_if_conds"))
|
|
46 |
* @attaches-to ``add_shortcode("s2If")`` + _s2If, __s2If, ___s2If for nesting.
|
47 |
*
|
48 |
* @param array $attr An array of Attributes.
|
49 |
-
* @param
|
50 |
-
* @param
|
51 |
* @return inner Return-value of inner routine.
|
52 |
*/
|
53 |
public static function sc_if_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
46 |
* @attaches-to ``add_shortcode("s2If")`` + _s2If, __s2If, ___s2If for nesting.
|
47 |
*
|
48 |
* @param array $attr An array of Attributes.
|
49 |
+
* @param string $content Content inside the Shortcode.
|
50 |
+
* @param string $shortcode The actual Shortcode name itself.
|
51 |
* @return inner Return-value of inner routine.
|
52 |
*/
|
53 |
public static function sc_if_conditionals ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/sc-keys-in.inc.php
CHANGED
@@ -36,28 +36,28 @@ if (!class_exists ("c_ws_plugin__s2member_sc_keys_in"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Key");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_get_key ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
50 |
|
51 |
-
$attr = shortcode_atts (array
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
-
do_action
|
55 |
-
unset
|
56 |
|
57 |
if ($attr["file_download"]) // Requesting a File Download Key?
|
58 |
$get = c_ws_plugin__s2member_files::file_download_key ($attr["file_download"], $attr["directive"]);
|
59 |
|
60 |
-
return apply_filters
|
61 |
}
|
62 |
}
|
63 |
}
|
36 |
* @attaches-to ``add_shortcode("s2Key");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
* @return string Value of the requested key, or null on failure.
|
42 |
*/
|
43 |
public static function sc_get_key ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_sc_get_key", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
50 |
|
51 |
+
$attr = shortcode_atts (array("file_download" => "", "directive" => ""), $attr);
|
52 |
|
53 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
54 |
+
do_action("ws_plugin__s2member_before_sc_get_key_after_shortcode_atts", get_defined_vars ());
|
55 |
+
unset($__refs, $__v);
|
56 |
|
57 |
if ($attr["file_download"]) // Requesting a File Download Key?
|
58 |
$get = c_ws_plugin__s2member_files::file_download_key ($attr["file_download"], $attr["directive"]);
|
59 |
|
60 |
+
return apply_filters("ws_plugin__s2member_sc_get_key", ((isset ($get)) ? $get : null), get_defined_vars ());
|
61 |
}
|
62 |
}
|
63 |
}
|
includes/classes/sc-keys.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_keys"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Key");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_get_key ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
36 |
* @attaches-to ``add_shortcode("s2Key");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_get_key ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/sc-paypal-button-e.inc.php
CHANGED
@@ -36,28 +36,28 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
|
|
36 |
* @package s2Member\PayPal
|
37 |
* @since 3.5
|
38 |
*
|
39 |
-
* @param
|
40 |
* @param array $vars An array of defined variables in the scope of the calling Filter.
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_paypal_button_encryption ($code = FALSE, $vars = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"])
|
50 |
{
|
51 |
-
$cache = /* Are we caching? */ apply_filters
|
52 |
|
53 |
$_code = $vars["_code"]; $attr = $vars["attr"]; // Let's unpack (i.e. use shorter references) to these two important vars.
|
54 |
|
55 |
if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
|
56 |
$code = /* Great, so we can use the cached version here to save processing time. The MD5 hash uses ``$code`` and NOT ``$_code``. */ $cache;
|
57 |
|
58 |
-
else if /* Are we able to parse hidden input variables? */ (is_array
|
59 |
{
|
60 |
-
$paypal = array
|
61 |
|
62 |
$i = 0; // Initialize incremental variable counter. PayPal wants these numbered using L_BUTTONVAR{n}; where {n} starts at zero.
|
63 |
foreach ($inputs as $input => $value) // Now run through each of the input variables that we parsed from the Full Button Code
|
@@ -71,7 +71,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
|
|
71 |
$i++; // Increment variable counter.
|
72 |
}
|
73 |
|
74 |
-
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response ($paypal)) && empty
|
75 |
// Only proceed if we DID get a valid response from the PayPal API. This works as a nice fallback; just in case the API connection fails.
|
76 |
{
|
77 |
$default_image = "https://www.paypal.com/" . (($attr["lang"]) ? $attr["lang"] : _x ("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
|
@@ -84,7 +84,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
|
|
84 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
85 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
86 |
|
87 |
-
($cache && $transient) ? set_transient ($transient, $code, apply_filters
|
88 |
}
|
89 |
}
|
90 |
}
|
36 |
* @package s2Member\PayPal
|
37 |
* @since 3.5
|
38 |
*
|
39 |
+
* @param string $code The PayPal Button Code before encryption.
|
40 |
* @param array $vars An array of defined variables in the scope of the calling Filter.
|
41 |
+
* @return string The Resulting PayPal Button Code *(possibly encrypted, depending on configuration)*.
|
42 |
*/
|
43 |
public static function sc_paypal_button_encryption ($code = FALSE, $vars = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_sc_paypal_button_encryption", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_btn_encryption"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"])
|
50 |
{
|
51 |
+
$cache = /* Are we caching? */ apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache", true, get_defined_vars ());
|
52 |
|
53 |
$_code = $vars["_code"]; $attr = $vars["attr"]; // Let's unpack (i.e. use shorter references) to these two important vars.
|
54 |
|
55 |
if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
|
56 |
$code = /* Great, so we can use the cached version here to save processing time. The MD5 hash uses ``$code`` and NOT ``$_code``. */ $cache;
|
57 |
|
58 |
+
else if /* Are we able to parse hidden input variables? */ (is_array($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array($_code)) && !empty($inputs))
|
59 |
{
|
60 |
+
$paypal = array("METHOD" => "BMCreateButton", "BUTTONCODE" => "ENCRYPTED", "BUTTONTYPE" => (($attr["sp"] || $attr["rr"] === "BN") ? "BUYNOW" : "SUBSCRIBE"));
|
61 |
|
62 |
$i = 0; // Initialize incremental variable counter. PayPal wants these numbered using L_BUTTONVAR{n}; where {n} starts at zero.
|
63 |
foreach ($inputs as $input => $value) // Now run through each of the input variables that we parsed from the Full Button Code
|
71 |
$i++; // Increment variable counter.
|
72 |
}
|
73 |
|
74 |
+
if (($paypal = c_ws_plugin__s2member_paypal_utilities::paypal_api_response ($paypal)) && empty($paypal["__error"]) && !empty($paypal["WEBSITECODE"]) && ($code = $paypal["WEBSITECODE"]))
|
75 |
// Only proceed if we DID get a valid response from the PayPal API. This works as a nice fallback; just in case the API connection fails.
|
76 |
{
|
77 |
$default_image = "https://www.paypal.com/" . (($attr["lang"]) ? $attr["lang"] : _x ("en_US", "s2member-front paypal-button-lang-code", "s2member")) . "/i/btn/btn_xpressCheckout.gif";
|
84 |
$code = ($attr["output"] === "anchor") ? '<a href="' . esc_attr (c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code)) . '"><img src="' . esc_attr (($attr["image"] && $attr["image"] !== "default") ? $attr["image"] : $default_image) . '" style="width:auto; height:auto; border:0;" alt="PayPal" /></a>' : $code;
|
85 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
86 |
|
87 |
+
($cache && $transient) ? set_transient ($transient, $code, apply_filters("ws_plugin__s2member_sc_paypal_button_encryption_cache_exp_time", 3600, get_defined_vars ())) : null; // Caching?
|
88 |
}
|
89 |
}
|
90 |
}
|
includes/classes/sc-paypal-button-in.inc.php
CHANGED
@@ -36,21 +36,21 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Member-PayPal-Button");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
c_ws_plugin__s2member_no_cache::no_cache_constants /* No caching on pages that contain this Payment Button. */ (true);
|
50 |
|
51 |
$attr = /* Force array. Trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
52 |
|
53 |
-
$attr = shortcode_atts (apply_filters
|
54 |
|
55 |
$attr["modify"] = ($attr["modify"] === "1" && (!is_user_logged_in () || !get_user_option ("s2member_subscr_id")) && $attr["tp"]) ? "0" : $attr["modify"];
|
56 |
|
@@ -65,8 +65,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
65 |
$attr["ns"] = /* No shipping directive must be 1 for digital items. After shortcode_atts(). */ ($attr["dg"] === "1") ? "1" : $attr["ns"];
|
66 |
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
-
do_action
|
69 |
-
unset
|
70 |
|
71 |
if /* Cancellation Buttons. */ ($attr["cancel"])
|
72 |
{
|
@@ -89,8 +89,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
89 |
unset /* Just a little housekeeping */ ($href, $url, $m);
|
90 |
|
91 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
92 |
-
do_action
|
93 |
-
unset
|
94 |
}
|
95 |
else if /* Specific Post/Page Buttons. */ ($attr["sp"])
|
96 |
{
|
@@ -107,7 +107,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
107 |
$attr["sp_ids_exp"] = /* Combined "sp:ids:expiration hours". */ "sp:" . $attr["ids"] . ":" . $attr["exp"];
|
108 |
|
109 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered. */ site_url ("/?s2member_paypal_return=1");
|
110 |
-
$success_return_url = apply_filters
|
111 |
|
112 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
|
113 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
@@ -144,8 +144,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
144 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
145 |
|
146 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
147 |
-
do_action
|
148 |
-
unset
|
149 |
}
|
150 |
else if /* Independent Custom Capabilities. */ ($attr["level"] === "*")
|
151 |
{
|
@@ -163,7 +163,7 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
163 |
$attr["level_ccaps_eotper"] = /* Clean any trailing separators from this string. */ rtrim ($attr["level_ccaps_eotper"], ":");
|
164 |
|
165 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered. */ site_url ("/?s2member_paypal_return=1");
|
166 |
-
$success_return_url = apply_filters
|
167 |
|
168 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
|
169 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
@@ -200,8 +200,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
200 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
201 |
|
202 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
203 |
-
do_action
|
204 |
-
unset
|
205 |
}
|
206 |
else // Otherwise, we'll process this Button normally, using Membership routines.
|
207 |
{
|
@@ -220,11 +220,11 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
220 |
$attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
|
221 |
$attr["level_ccaps_eotper"] = /* Clean any trailing separators from this string. */ rtrim ($attr["level_ccaps_eotper"], ":");
|
222 |
|
223 |
-
$success_return_tra = array
|
224 |
|
225 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered (see below). */ site_url ("/?s2member_paypal_return=1");
|
226 |
$success_return_url = add_query_arg ("s2member_paypal_return_tra", urlencode (c_ws_plugin__s2member_utils_encryption::encrypt (serialize ($success_return_tra))), $success_return_url);
|
227 |
-
$success_return_url = apply_filters
|
228 |
|
229 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
|
230 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
@@ -283,12 +283,12 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
|
|
283 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
284 |
|
285 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
286 |
-
($attr["modify"]) ? do_action
|
287 |
-
unset
|
288 |
}
|
289 |
$code = c_ws_plugin__s2member_sc_paypal_button_e::sc_paypal_button_encryption ($code, get_defined_vars ());
|
290 |
|
291 |
-
return apply_filters
|
292 |
}
|
293 |
}
|
294 |
}
|
36 |
* @attaches-to ``add_shortcode("s2Member-PayPal-Button");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
* @return string The resulting PayPal Button Code.
|
42 |
*/
|
43 |
public static function sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_sc_paypal_button", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
c_ws_plugin__s2member_no_cache::no_cache_constants /* No caching on pages that contain this Payment Button. */ (true);
|
50 |
|
51 |
$attr = /* Force array. Trim quote entities. */ c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
52 |
|
53 |
+
$attr = shortcode_atts (apply_filters("ws_plugin__s2member_sc_paypal_button_default_attrs", array("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "lc" => "", "lang" => "", "cc" => "USD", "dg" => "0", "ns" => "1", "custom" => $_SERVER["HTTP_HOST"], "ta" => "0", "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "rrt" => "", "rra" => "1", "modify" => "0", "cancel" => "0", "sp" => "0", "image" => "default", "output" => "button"), get_defined_vars ()), $attr);
|
54 |
|
55 |
$attr["modify"] = ($attr["modify"] === "1" && (!is_user_logged_in () || !get_user_option ("s2member_subscr_id")) && $attr["tp"]) ? "0" : $attr["modify"];
|
56 |
|
65 |
$attr["ns"] = /* No shipping directive must be 1 for digital items. After shortcode_atts(). */ ($attr["dg"] === "1") ? "1" : $attr["ns"];
|
66 |
|
67 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
68 |
+
do_action("ws_plugin__s2member_before_sc_paypal_button_after_shortcode_atts", get_defined_vars ());
|
69 |
+
unset($__refs, $__v);
|
70 |
|
71 |
if /* Cancellation Buttons. */ ($attr["cancel"])
|
72 |
{
|
89 |
unset /* Just a little housekeeping */ ($href, $url, $m);
|
90 |
|
91 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
92 |
+
do_action("ws_plugin__s2member_during_sc_paypal_cancellation_button", get_defined_vars ());
|
93 |
+
unset($__refs, $__v);
|
94 |
}
|
95 |
else if /* Specific Post/Page Buttons. */ ($attr["sp"])
|
96 |
{
|
107 |
$attr["sp_ids_exp"] = /* Combined "sp:ids:expiration hours". */ "sp:" . $attr["ids"] . ":" . $attr["exp"];
|
108 |
|
109 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered. */ site_url ("/?s2member_paypal_return=1");
|
110 |
+
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
111 |
|
112 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-sp-checkout-button.php")));
|
113 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
144 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
145 |
|
146 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
147 |
+
do_action("ws_plugin__s2member_during_sc_paypal_sp_button", get_defined_vars ());
|
148 |
+
unset($__refs, $__v);
|
149 |
}
|
150 |
else if /* Independent Custom Capabilities. */ ($attr["level"] === "*")
|
151 |
{
|
163 |
$attr["level_ccaps_eotper"] = /* Clean any trailing separators from this string. */ rtrim ($attr["level_ccaps_eotper"], ":");
|
164 |
|
165 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered. */ site_url ("/?s2member_paypal_return=1");
|
166 |
+
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
167 |
|
168 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-ccaps-checkout-button.php")));
|
169 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
200 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
201 |
|
202 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
203 |
+
do_action("ws_plugin__s2member_during_sc_paypal_ccaps_button", get_defined_vars ());
|
204 |
+
unset($__refs, $__v);
|
205 |
}
|
206 |
else // Otherwise, we'll process this Button normally, using Membership routines.
|
207 |
{
|
220 |
$attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
|
221 |
$attr["level_ccaps_eotper"] = /* Clean any trailing separators from this string. */ rtrim ($attr["level_ccaps_eotper"], ":");
|
222 |
|
223 |
+
$success_return_tra = array("ta" => $attr["ta"], "tp" => $attr["tp"], "tt" => $attr["tt"], "ra" => $attr["ra"], "rp" => $attr["rp"], "rt" => $attr["rt"], "rr" => $attr["rr"], "rrt" => $attr["rrt"], "rra" => $attr["rra"], "invoice" => $paypal_invoice_input_value, "checksum" => md5 ($paypal_invoice_input_value . $_SERVER["REMOTE_ADDR"] . $attr["level_ccaps_eotper"]));
|
224 |
|
225 |
$success_return_url = /* s2Member handles this all by itself. However, it can be Filtered (see below). */ site_url ("/?s2member_paypal_return=1");
|
226 |
$success_return_url = add_query_arg ("s2member_paypal_return_tra", urlencode (c_ws_plugin__s2member_utils_encryption::encrypt (serialize ($success_return_tra))), $success_return_url);
|
227 |
+
$success_return_url = apply_filters("ws_plugin__s2member_during_sc_paypal_button_success_return_url", $success_return_url, get_defined_vars ());
|
228 |
|
229 |
$code = trim (c_ws_plugin__s2member_utilities::evl (file_get_contents (dirname (dirname (__FILE__)) . "/templates/buttons/paypal-checkout-button.php")));
|
230 |
$code = preg_replace ("/%%images%%/", c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images")), $code);
|
283 |
$code = ($attr["output"] === "url") ? c_ws_plugin__s2member_utils_forms::form_whips_2_url ($code) : $code;
|
284 |
|
285 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
286 |
+
($attr["modify"]) ? do_action("ws_plugin__s2member_during_sc_paypal_modification_button", get_defined_vars ()) : do_action("ws_plugin__s2member_during_sc_paypal_button", get_defined_vars ());
|
287 |
+
unset($__refs, $__v);
|
288 |
}
|
289 |
$code = c_ws_plugin__s2member_sc_paypal_button_e::sc_paypal_button_encryption ($code, get_defined_vars ());
|
290 |
|
291 |
+
return apply_filters("ws_plugin__s2member_sc_paypal_button", $code, get_defined_vars ());
|
292 |
}
|
293 |
}
|
294 |
}
|
includes/classes/sc-paypal-button.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Member-PayPal-Button");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
36 |
* @attaches-to ``add_shortcode("s2Member-PayPal-Button");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/sc-profile-in.inc.php
CHANGED
@@ -1,296 +1,309 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Shortcode for `[s2Member-Profile /]` (inner processing routines).
|
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\Profiles
|
15 |
-
* @since 3.5
|
16 |
-
*/
|
17 |
-
if
|
18 |
-
exit (
|
19 |
-
|
20 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
{
|
45 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]
|
46 |
-
do_action
|
47 |
-
unset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
|
51 |
-
|
|
|
|
|
52 |
|
53 |
-
|
54 |
{
|
55 |
-
|
56 |
-
|
57 |
-
$
|
58 |
-
|
59 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
60 |
-
do_action ("ws_plugin__s2member_before_sc_profile_after_shortcode_atts", get_defined_vars ());
|
61 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
62 |
-
|
63 |
-
ob_start (); // Start buffering. Allows Hooks to echo output like: `/?s2member_profile=1`.
|
64 |
-
|
65 |
-
echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile">' . "\n";
|
66 |
-
|
67 |
-
if (!empty($GLOBALS["ws_plugin__s2member_profile_saved"])) // Respond to successful updates.
|
68 |
-
{
|
69 |
-
echo '<div id="ws-plugin--s2member-profile-saved" class="alert alert-success">' . "\n";
|
70 |
-
echo _x ("Profile updated successfully.", "s2member-front", "s2member") . "\n";
|
71 |
-
echo '</div>' . "\n";
|
72 |
-
}
|
73 |
-
|
74 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
75 |
-
do_action ("ws_plugin__s2member_during_profile_before_table", get_defined_vars ());
|
76 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
77 |
-
|
78 |
-
echo '<table cellpadding="0" cellspacing="0">' . "\n";
|
79 |
-
echo '<tbody>' . "\n";
|
80 |
-
|
81 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
82 |
-
do_action ("ws_plugin__s2member_during_profile_before_fields", get_defined_vars ());
|
83 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
84 |
|
85 |
-
if
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
90 |
-
|
91 |
-
echo '<tr>' . "\n";
|
92 |
-
echo '<td>' . "\n";
|
93 |
-
echo '<label for="ws-plugin--s2member-profile-login">' . "\n";
|
94 |
-
echo '<strong>' . _x ("Username", "s2member-front", "s2member") . ' *</strong> <small>' . _x ("(cannot be changed)", "s2member-front", "s2member") . '</small><br />' . "\n";
|
95 |
-
echo '<input type="text" aria-required="true" maxlength="60" autocomplete="off" name="ws_plugin__s2member_profile_login" id="ws-plugin--s2member-profile-login" class="ws-plugin--s2member-profile-field form-control" value="' . format_to_edit ($user->user_login) . '" disabled="disabled" />' . "\n";
|
96 |
-
echo '</label>' . "\n";
|
97 |
-
echo '</td>' . "\n";
|
98 |
-
echo '</tr>' . "\n";
|
99 |
-
|
100 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
101 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_username", get_defined_vars ());
|
102 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
103 |
-
}
|
104 |
-
|
105 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_email", true, get_defined_vars ()))
|
106 |
-
{
|
107 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
108 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_email", get_defined_vars ());
|
109 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
110 |
-
|
111 |
-
echo '<tr>' . "\n";
|
112 |
-
echo '<td>' . "\n";
|
113 |
-
echo '<label for="ws-plugin--s2member-profile-email">' . "\n";
|
114 |
-
echo '<strong>' . _x ("Email Address", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
115 |
-
echo '<input type="email" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" class="ws-plugin--s2member-profile-field form-control" value="' . format_to_edit ($user->user_email) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
116 |
-
echo '</label>' . "\n";
|
117 |
-
echo '</td>' . "\n";
|
118 |
-
echo '</tr>' . "\n";
|
119 |
-
|
120 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
121 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_email", get_defined_vars ());
|
122 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
123 |
-
}
|
124 |
|
125 |
-
|
|
|
126 |
{
|
127 |
-
if
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->first_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
138 |
-
echo '</label>' . "\n";
|
139 |
-
echo '</td>' . "\n";
|
140 |
-
echo '</tr>' . "\n";
|
141 |
-
|
142 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
143 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_first_name", get_defined_vars ());
|
144 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
145 |
-
}
|
146 |
-
|
147 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_last_name", true, get_defined_vars ()))
|
148 |
-
{
|
149 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
150 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_last_name", get_defined_vars ());
|
151 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
152 |
-
|
153 |
-
echo '<tr>' . "\n";
|
154 |
-
echo '<td>' . "\n";
|
155 |
-
echo '<label for="ws-plugin--s2member-profile-last-name">' . "\n";
|
156 |
-
echo '<strong>' . _x ("Last Name", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
157 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->last_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
158 |
-
echo '</label>' . "\n";
|
159 |
-
echo '</td>' . "\n";
|
160 |
-
echo '</tr>' . "\n";
|
161 |
-
|
162 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
163 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_last_name", get_defined_vars ());
|
164 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
165 |
-
}
|
166 |
-
|
167 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_display_name", true, get_defined_vars ()))
|
168 |
-
{
|
169 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
170 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_display_name", get_defined_vars ());
|
171 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
172 |
-
|
173 |
-
echo '<tr>' . "\n";
|
174 |
-
echo '<td>' . "\n";
|
175 |
-
echo '<label for="ws-plugin--s2member-profile-display-name">' . "\n";
|
176 |
-
echo '<strong>' . _x ("Display Name", "s2member-front", "s2member") . ' *</strong><br />' . "\n";
|
177 |
-
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_display_name" id="ws-plugin--s2member-profile-display-name" class="ws-plugin--s2member-profile-field form-control" value="' . esc_attr ($user->display_name) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
178 |
-
echo '</label>' . "\n";
|
179 |
-
echo '</td>' . "\n";
|
180 |
-
echo '</tr>' . "\n";
|
181 |
-
|
182 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
183 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_display_name", get_defined_vars ());
|
184 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
185 |
-
}
|
186 |
}
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
{
|
193 |
-
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
194 |
-
|
195 |
-
$tabindex = $tabindex + 9; // Start tabindex at +9 ( +1 below ).
|
196 |
-
|
197 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
198 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_custom_fields", get_defined_vars ());
|
199 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
200 |
-
|
201 |
-
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
202 |
-
{
|
203 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
204 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before", get_defined_vars ());
|
205 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
206 |
-
|
207 |
-
if (in_array ($field["id"], $fields_applicable)) // Field applicable?
|
208 |
-
{
|
209 |
-
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
210 |
-
$field_id_class = preg_replace ("/_/", "-", $field_var);
|
211 |
-
|
212 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
213 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display", true, get_defined_vars ()))
|
214 |
-
{
|
215 |
-
if (!empty ($field["section"]) && $field["section"] === "yes") // Starts a new section?
|
216 |
-
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section' . ((!empty ($field["sectitle"])) ? '-title' : '') . '">' . ((!empty ($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td></tr>';
|
217 |
-
|
218 |
-
echo '<tr>' . "\n";
|
219 |
-
echo '<td>' . "\n";
|
220 |
-
echo '<label for="ws-plugin--s2member-profile-' . esc_attr ($field_id_class) . '">' . "\n";
|
221 |
-
echo '<strong' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ' style="display:none;"' : '') . '>' . $field["label"] . (($field["required"] === "yes") ? ' *' : '') . '</strong></label>' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? '' : '<br />') . "\n";
|
222 |
-
echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "ws-plugin--s2member-profile-field", "", ($tabindex = $tabindex + 1), "", $fields, @$fields[$field_var], "profile");
|
223 |
-
echo '</td>' . "\n";
|
224 |
-
echo '</tr>' . "\n";
|
225 |
-
}
|
226 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
227 |
-
}
|
228 |
-
|
229 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
230 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after", get_defined_vars ());
|
231 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
232 |
-
}
|
233 |
-
|
234 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
235 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_custom_fields", get_defined_vars ());
|
236 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
if (apply_filters ("ws_plugin__s2member_during_profile_during_fields_display_password", true, get_defined_vars ()))
|
241 |
-
{
|
242 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
243 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_before_password", get_defined_vars ());
|
244 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
245 |
-
|
246 |
-
echo '<tr>' . "\n";
|
247 |
-
echo '<td>' . "\n";
|
248 |
-
|
249 |
-
echo '<label for="ws-plugin--s2member-profile-password1" title="' . esc_attr (_x ("Please type your Password twice to confirm.", "s2member-front", "s2member")) . '">' . "\n";
|
250 |
-
echo '<strong>' . _x ("New Password?", "s2member-front", "s2member") . '</strong> <em>' . _x ("(please type it twice)", "s2member-front", "s2member") . '</em><br />' . "\n";
|
251 |
-
echo '<em>' . _x ("Only if changing password, otherwise leave blank.", "s2member-front", "s2member") . '</em><br />' . "\n";
|
252 |
-
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password1" id="ws-plugin--s2member-profile-password1" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
|
253 |
-
echo '</label>' . "\n";
|
254 |
-
|
255 |
-
echo '<label for="ws-plugin--s2member-profile-password2" title="' . esc_attr (_x ("Please type your Password twice to confirm.", "s2member-front", "s2member")) . '">' . "\n";
|
256 |
-
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password2" id="ws-plugin--s2member-profile-password2" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '"' . (($user->user_login === "demo") ? ' disabled="disabled"' : '') . ' />' . "\n";
|
257 |
-
echo '</label>' . "\n";
|
258 |
-
|
259 |
-
echo '<div id="ws-plugin--s2member-profile-password-strength" class="ws-plugin--s2member-password-strength"><em>' . _x ("password strength indicator", "s2member-front", "s2member") . '</em></div>' . "\n";
|
260 |
-
|
261 |
-
echo '</td>' . "\n";
|
262 |
-
echo '</tr>' . "\n";
|
263 |
-
|
264 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
265 |
-
do_action ("ws_plugin__s2member_during_profile_during_fields_after_password", get_defined_vars ());
|
266 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
267 |
-
}
|
268 |
-
|
269 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
270 |
-
do_action ("ws_plugin__s2member_during_profile_after_fields", get_defined_vars ());
|
271 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
272 |
-
|
273 |
-
echo '<tr>' . "\n";
|
274 |
-
echo '<td>' . "\n";
|
275 |
-
echo '<input type="hidden" name="ws_plugin__s2member_sc_profile_save" id="ws-plugin--s2member-sc-profile-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-sc-profile-save")) . '" />' . "\n";
|
276 |
-
echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="' . esc_attr (wp_create_nonce ("ws-plugin--s2member-profile-save")) . '" />' . "\n";
|
277 |
-
echo '<input type="submit" id="ws-plugin--s2member-profile-submit" class="btn btn-primary" value="' . esc_attr (_x ("Save All Changes", "s2member-front", "s2member")) . '" tabindex="' . esc_attr (($tabindex = $tabindex + 10)) . '" />' . "\n";
|
278 |
-
echo '</td>' . "\n";
|
279 |
-
echo '</tr>' . "\n";
|
280 |
-
|
281 |
-
echo '</tbody>' . "\n";
|
282 |
-
echo '</table>' . "\n";
|
283 |
-
|
284 |
-
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
285 |
-
do_action ("ws_plugin__s2member_during_profile_after_table", get_defined_vars ());
|
286 |
-
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
287 |
-
|
288 |
-
echo '</form>' . "\n";
|
289 |
-
|
290 |
-
$code = ob_get_clean ();
|
291 |
}
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
|
|
|
|
295 |
}
|
296 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Shortcode for `[s2Member-Profile /]` (inner processing routines).
|
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\Profiles
|
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_sc_profile_in'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Shortcode for `[s2Member-Profile /]` (inner processing routines).
|
24 |
+
*
|
25 |
+
* @package s2Member\Profiles
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_sc_profile_in
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles the Shortcode for: `[s2Member-Profile /]`.
|
32 |
+
*
|
33 |
+
* @package s2Member\Profiles
|
34 |
+
* @since 3.5
|
35 |
+
*
|
36 |
+
* @attaches-to ``add_shortcode('s2Member-Profile');``
|
37 |
+
*
|
38 |
+
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
*
|
42 |
+
* @return string|null The resulting Profile Modifiation Form *(inline)*, or null if not logged-in.
|
43 |
+
*/
|
44 |
+
public static function sc_profile($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
45 |
+
{
|
46 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
47 |
+
do_action('ws_plugin__s2member_before_sc_profile', get_defined_vars());
|
48 |
+
unset($__refs, $__v);
|
49 |
+
|
50 |
+
c_ws_plugin__s2member_no_cache::no_cache_constants(TRUE); // No caching.
|
51 |
+
|
52 |
+
$tabindex = apply_filters('ws_plugin__s2member_sc_profile_tabindex', 0, get_defined_vars());
|
53 |
+
|
54 |
+
if(($user = (is_user_logged_in()) ? wp_get_current_user() : FALSE) && ($user_id = $user->ID))
|
55 |
{
|
56 |
+
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr);
|
57 |
+
|
58 |
+
$attr = shortcode_atts(array(), $attr); // Possible Attributes. None.
|
59 |
+
|
60 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
61 |
+
do_action('ws_plugin__s2member_before_sc_profile_after_shortcode_atts', get_defined_vars());
|
62 |
+
unset($__refs, $__v);
|
63 |
+
|
64 |
+
ob_start(); // Start buffering. Allows Hooks to echo output like: `/?s2member_profile=1`.
|
65 |
+
|
66 |
+
echo '<form method="post" name="ws_plugin__s2member_profile" id="ws-plugin--s2member-profile">'."\n";
|
67 |
+
|
68 |
+
if(!empty($GLOBALS['ws_plugin__s2member_profile_saved'])) // Respond to successful updates.
|
69 |
+
{
|
70 |
+
echo '<div id="ws-plugin--s2member-profile-saved" class="alert alert-success">'."\n";
|
71 |
+
echo _x('Profile updated successfully.', 's2member-front', 's2member')."\n";
|
72 |
+
echo '</div>'."\n";
|
73 |
+
}
|
74 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
75 |
+
do_action('ws_plugin__s2member_during_profile_before_table', get_defined_vars());
|
76 |
+
unset($__refs, $__v);
|
77 |
+
|
78 |
+
echo '<table cellpadding="0" cellspacing="0">'."\n";
|
79 |
+
echo '<tbody>'."\n";
|
80 |
+
|
81 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
82 |
+
do_action('ws_plugin__s2member_during_profile_before_fields', get_defined_vars());
|
83 |
+
unset($__refs, $__v);
|
84 |
+
|
85 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_username', TRUE, get_defined_vars()))
|
86 |
+
{
|
87 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
88 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_username', get_defined_vars());
|
89 |
+
unset($__refs, $__v);
|
90 |
+
|
91 |
+
echo '<tr>'."\n";
|
92 |
+
echo '<td>'."\n";
|
93 |
+
echo '<label for="ws-plugin--s2member-profile-login">'."\n";
|
94 |
+
echo '<strong>'._x('Username', 's2member-front', 's2member').' *</strong> <small>'._x('(cannot be changed)', 's2member-front', 's2member').'</small><br />'."\n";
|
95 |
+
echo '<input type="text" aria-required="true" maxlength="60" autocomplete="off" name="ws_plugin__s2member_profile_login" id="ws-plugin--s2member-profile-login" class="ws-plugin--s2member-profile-field form-control" value="'.format_to_edit($user->user_login).'" disabled="disabled" />'."\n";
|
96 |
+
echo '</label>'."\n";
|
97 |
+
echo '</td>'."\n";
|
98 |
+
echo '</tr>'."\n";
|
99 |
+
|
100 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
101 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_username', get_defined_vars());
|
102 |
+
unset($__refs, $__v);
|
103 |
+
}
|
104 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_email', TRUE, get_defined_vars()))
|
105 |
+
{
|
106 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
107 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_email', get_defined_vars());
|
108 |
+
unset($__refs, $__v);
|
109 |
+
|
110 |
+
echo '<tr>'."\n";
|
111 |
+
echo '<td>'."\n";
|
112 |
+
echo '<label for="ws-plugin--s2member-profile-email">'."\n";
|
113 |
+
echo '<strong>'._x('Email Address', 's2member-front', 's2member').' *</strong><br />'."\n";
|
114 |
+
echo '<input type="email" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_email" id="ws-plugin--s2member-profile-email" class="ws-plugin--s2member-profile-field form-control" value="'.format_to_edit($user->user_email).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
115 |
+
echo '</label>'."\n";
|
116 |
+
echo '</td>'."\n";
|
117 |
+
echo '</tr>'."\n";
|
118 |
+
|
119 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
120 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_email', get_defined_vars());
|
121 |
+
unset($__refs, $__v);
|
122 |
+
}
|
123 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'])
|
124 |
+
{
|
125 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_first_name', TRUE, get_defined_vars()))
|
126 |
{
|
127 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
128 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_first_name', get_defined_vars());
|
129 |
+
unset($__refs, $__v);
|
130 |
+
|
131 |
+
echo '<tr>'."\n";
|
132 |
+
echo '<td>'."\n";
|
133 |
+
echo '<label for="ws-plugin--s2member-profile-first-name">'."\n";
|
134 |
+
echo '<strong>'._x('First Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
135 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_first_name" id="ws-plugin--s2member-profile-first-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->first_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
136 |
+
echo '</label>'."\n";
|
137 |
+
echo '</td>'."\n";
|
138 |
+
echo '</tr>'."\n";
|
139 |
+
|
140 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
141 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_first_name', get_defined_vars());
|
142 |
+
unset($__refs, $__v);
|
143 |
+
}
|
144 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_last_name', TRUE, get_defined_vars()))
|
145 |
+
{
|
146 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
147 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_last_name', get_defined_vars());
|
148 |
+
unset($__refs, $__v);
|
149 |
+
|
150 |
+
echo '<tr>'."\n";
|
151 |
+
echo '<td>'."\n";
|
152 |
+
echo '<label for="ws-plugin--s2member-profile-last-name">'."\n";
|
153 |
+
echo '<strong>'._x('Last Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
154 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_last_name" id="ws-plugin--s2member-profile-last-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->last_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
155 |
+
echo '</label>'."\n";
|
156 |
+
echo '</td>'."\n";
|
157 |
+
echo '</tr>'."\n";
|
158 |
+
|
159 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
160 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_last_name', get_defined_vars());
|
161 |
+
unset($__refs, $__v);
|
162 |
+
}
|
163 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_display_name', TRUE, get_defined_vars()))
|
164 |
+
{
|
165 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
166 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_display_name', get_defined_vars());
|
167 |
+
unset($__refs, $__v);
|
168 |
+
|
169 |
+
echo '<tr>'."\n";
|
170 |
+
echo '<td>'."\n";
|
171 |
+
echo '<label for="ws-plugin--s2member-profile-display-name">'."\n";
|
172 |
+
echo '<strong>'._x('Display Name', 's2member-front', 's2member').' *</strong><br />'."\n";
|
173 |
+
echo '<input type="text" aria-required="true" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_display_name" id="ws-plugin--s2member-profile-display-name" class="ws-plugin--s2member-profile-field form-control" value="'.esc_attr($user->display_name).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
174 |
+
echo '</label>'."\n";
|
175 |
+
echo '</td>'."\n";
|
176 |
+
echo '</tr>'."\n";
|
177 |
+
|
178 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
179 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_display_name', get_defined_vars());
|
180 |
+
unset($__refs, $__v);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_custom_fields', TRUE, get_defined_vars()))
|
184 |
+
{
|
185 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields']) // Now, do we have Custom Fields?
|
186 |
+
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level('auto-detection', 'profile'))
|
187 |
+
{
|
188 |
+
$fields = get_user_option('s2member_custom_fields', $user_id);
|
189 |
|
190 |
+
$tabindex = $tabindex + 9; // Start tabindex at +9 ( +1 below ).
|
191 |
|
192 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
193 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_custom_fields', get_defined_vars());
|
194 |
+
unset($__refs, $__v);
|
195 |
|
196 |
+
foreach(json_decode($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_fields'], TRUE) as $field)
|
197 |
{
|
198 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
199 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_before', get_defined_vars());
|
200 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
|
202 |
+
if(in_array($field['id'], $fields_applicable)) // Field applicable?
|
203 |
+
{
|
204 |
+
$field_var = preg_replace('/[^a-z0-9]/i', '_', strtolower($field['id']));
|
205 |
+
$field_id_class = preg_replace('/_/', '-', $field_var);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
|
207 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
208 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_display', TRUE, get_defined_vars()))
|
209 |
{
|
210 |
+
if(!empty($field['section']) && $field['section'] === 'yes') // Starts a new section?
|
211 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section'.((!empty($field['sectitle'])) ? '-title' : '').'">'.((!empty($field['sectitle'])) ? $field['sectitle'] : '').'</div></td></tr>';
|
212 |
+
|
213 |
+
echo '<tr>'."\n";
|
214 |
+
echo '<td>'."\n";
|
215 |
+
echo '<label for="ws-plugin--s2member-profile-'.esc_attr($field_id_class).'">'."\n";
|
216 |
+
echo '<strong'.((preg_match('/^(checkbox|pre_checkbox)$/', $field['type'])) ? ' style="display:none;"' : '').'>'.$field['label'].(($field['required'] === 'yes') ? ' *' : '').'</strong></label>'.((preg_match('/^(checkbox|pre_checkbox)$/', $field['type'])) ? '' : '<br />')."\n";
|
217 |
+
echo c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, 'ws_plugin__s2member_profile_', 'ws-plugin--s2member-profile-', 'ws-plugin--s2member-profile-field', '', ($tabindex = $tabindex + 1), '', $fields, @$fields[$field_var], 'profile');
|
218 |
+
echo '</td>'."\n";
|
219 |
+
echo '</tr>'."\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
+
unset($__refs, $__v);
|
222 |
+
}
|
223 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
224 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_during_custom_fields_after', get_defined_vars());
|
225 |
+
unset($__refs, $__v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
228 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_custom_fields', get_defined_vars());
|
229 |
+
unset($__refs, $__v);
|
230 |
+
}
|
231 |
+
}
|
232 |
+
if(apply_filters('ws_plugin__s2member_during_profile_during_fields_display_password', TRUE, get_defined_vars()))
|
233 |
+
{
|
234 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
235 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_password', get_defined_vars());
|
236 |
+
unset($__refs, $__v);
|
237 |
+
|
238 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section"></div></td></tr>';
|
239 |
+
|
240 |
+
echo '<tr>'."\n";
|
241 |
+
echo '<td>'."\n";
|
242 |
+
|
243 |
+
echo '<label for="ws-plugin--s2member-profile-password1" title="'.esc_attr(_x('Please type your Password twice to confirm.', 's2member-front', 's2member')).'">'."\n";
|
244 |
+
echo '<strong>'._x('New Password?', 's2member-front', 's2member').'</strong> <em>'._x('(please type it twice)', 's2member-front', 's2member').'</em><br />'."\n";
|
245 |
+
echo '<em>'._x('Only if changing password, otherwise leave blank.', 's2member-front', 's2member').'</em><br />'."\n";
|
246 |
+
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password1" id="ws-plugin--s2member-profile-password1" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'"'.(($user->user_login === 'demo') ? ' disabled="disabled"' : '').' />'."\n";
|
247 |
+
echo '</label>'."\n";
|
248 |
+
|
249 |
+
echo '<label for="ws-plugin--s2member-profile-password2" title="'.esc_attr(_x('Please type your Password twice to confirm.', 's2member-front', 's2member')).'">'."\n";
|
250 |
+
echo '<input type="password" maxlength="100" autocomplete="off" name="ws_plugin__s2member_profile_password2" id="ws-plugin--s2member-profile-password2" class="ws-plugin--s2member-profile-field form-control" value="" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'"'.(($user->user_login === 'demo') ? ' disabled="disabled"' : '').' />'."\n";
|
251 |
+
echo '</label>'."\n";
|
252 |
+
|
253 |
+
echo '<div id="ws-plugin--s2member-profile-password-strength" class="ws-plugin--s2member-password-strength"><em>'._x('password strength indicator', 's2member-front', 's2member').'</em></div>'."\n";
|
254 |
+
|
255 |
+
echo '</td>'."\n";
|
256 |
+
echo '</tr>'."\n";
|
257 |
+
|
258 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
259 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_password', get_defined_vars());
|
260 |
+
unset($__refs, $__v);
|
261 |
+
}
|
262 |
+
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in'] && c_ws_plugin__s2member_list_servers::list_servers_integrated())
|
263 |
+
{
|
264 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
265 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_before_opt_in', get_defined_vars());
|
266 |
+
unset($__refs, $__v);
|
267 |
+
|
268 |
+
echo '<tr><td><div class="ws-plugin--s2member-profile-field-divider-section"></div></td></tr>';
|
269 |
+
|
270 |
+
echo '<tr>'."\n";
|
271 |
+
echo '<td>'."\n";
|
272 |
+
echo '<label for="ws-plugin--s2member-profile-opt-in">'."\n";
|
273 |
+
echo '<input type="checkbox" name="ws_plugin__s2member_profile_opt_in" id="ws-plugin--s2member-profile-opt-in" class="ws-plugin--s2member-profile-field" value="1"'.((get_user_option('s2member_opt_in', $user_id)) ? ' checked="checked"' : '').' tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
274 |
+
echo $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_opt_in_label']."\n";
|
275 |
+
echo '</label>'."\n";
|
276 |
+
echo '</td>'."\n";
|
277 |
+
echo '</tr>'."\n";
|
278 |
+
|
279 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
280 |
+
do_action('ws_plugin__s2member_during_profile_during_fields_after_opt_in', get_defined_vars());
|
281 |
+
unset($__refs, $__v);
|
282 |
+
}
|
283 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
284 |
+
do_action('ws_plugin__s2member_during_profile_after_fields', get_defined_vars());
|
285 |
+
unset($__refs, $__v);
|
286 |
+
|
287 |
+
echo '<tr>'."\n";
|
288 |
+
echo '<td>'."\n";
|
289 |
+
echo '<input type="hidden" name="ws_plugin__s2member_sc_profile_save" id="ws-plugin--s2member-sc-profile-save" value="'.esc_attr(wp_create_nonce('ws-plugin--s2member-sc-profile-save')).'" />'."\n";
|
290 |
+
echo '<input type="hidden" name="ws_plugin__s2member_profile_save" id="ws-plugin--s2member-profile-save" value="'.esc_attr(wp_create_nonce('ws-plugin--s2member-profile-save')).'" />'."\n";
|
291 |
+
echo '<input type="submit" id="ws-plugin--s2member-profile-submit" class="btn btn-primary" value="'.esc_attr(_x('Save All Changes', 's2member-front', 's2member')).'" tabindex="'.esc_attr(($tabindex = $tabindex + 10)).'" />'."\n";
|
292 |
+
echo '</td>'."\n";
|
293 |
+
echo '</tr>'."\n";
|
294 |
+
|
295 |
+
echo '</tbody>'."\n";
|
296 |
+
echo '</table>'."\n";
|
297 |
+
|
298 |
+
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v;
|
299 |
+
do_action('ws_plugin__s2member_during_profile_after_table', get_defined_vars());
|
300 |
+
unset($__refs, $__v);
|
301 |
+
|
302 |
+
echo '</form>'."\n";
|
303 |
+
|
304 |
+
$code = ob_get_clean();
|
305 |
}
|
306 |
+
return apply_filters('ws_plugin__s2member_sc_profile', ((!empty($code)) ? $code : NULL), get_defined_vars());
|
307 |
+
}
|
308 |
}
|
309 |
+
}
|
includes/classes/sc-profile.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_profile"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Member-Profile");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_profile ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
36 |
* @attaches-to ``add_shortcode("s2Member-Profile");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_profile ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/sc-s-badge-in.inc.php
CHANGED
@@ -36,23 +36,23 @@ if (!class_exists ("c_ws_plugin__s2member_sc_s_badge_in"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Member-Security-Badge");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
-
* @return
|
42 |
*/
|
43 |
public static function sc_s_badge ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
-
do_action
|
47 |
-
unset
|
48 |
|
49 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
50 |
|
51 |
-
$attr = shortcode_atts (array
|
52 |
|
53 |
$code = c_ws_plugin__s2member_utilities::s_badge_gen ($attr["v"], false, false);
|
54 |
|
55 |
-
return apply_filters
|
56 |
}
|
57 |
}
|
58 |
}
|
36 |
* @attaches-to ``add_shortcode("s2Member-Security-Badge");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
+
* @return string Resulting Security Badge code; HTML markup.
|
42 |
*/
|
43 |
public static function sc_s_badge ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
44 |
{
|
45 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
+
do_action("ws_plugin__s2member_before_sc_s_badge", get_defined_vars ());
|
47 |
+
unset($__refs, $__v);
|
48 |
|
49 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep ((array)$attr);
|
50 |
|
51 |
+
$attr = shortcode_atts (array("v" => "1"), $attr); // One attribute.
|
52 |
|
53 |
$code = c_ws_plugin__s2member_utilities::s_badge_gen ($attr["v"], false, false);
|
54 |
|
55 |
+
return apply_filters("ws_plugin__s2member_sc_s_badge", $code, get_defined_vars ());
|
56 |
}
|
57 |
}
|
58 |
}
|
includes/classes/sc-s-badge.inc.php
CHANGED
@@ -36,8 +36,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_s_badge"))
|
|
36 |
* @attaches-to ``add_shortcode("s2Member-Security-Badge");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
-
* @param
|
40 |
-
* @param
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_s_badge ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
36 |
* @attaches-to ``add_shortcode("s2Member-Security-Badge");``
|
37 |
*
|
38 |
* @param array $attr An array of Attributes.
|
39 |
+
* @param string $content Content inside the Shortcode.
|
40 |
+
* @param string $shortcode The actual Shortcode name itself.
|
41 |
* @return inner Return-value of inner routine.
|
42 |
*/
|
43 |
public static function sc_s_badge ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
includes/classes/security.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_security"))
|
|
39 |
*/
|
40 |
public static function security_gate () // s2Member's Security Gate.
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
if (is_category ()) // Categories & other inclusives.
|
45 |
c_ws_plugin__s2member_catgs::check_catg_level_access ();
|
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_security"))
|
|
56 |
else // Else, we simply look at URIs & other inclusives.
|
57 |
c_ws_plugin__s2member_ruris::check_ruri_level_access ();
|
58 |
|
59 |
-
do_action
|
60 |
|
61 |
return /* Return for uniformity. */;
|
62 |
}
|
@@ -68,16 +68,16 @@ if (!class_exists ("c_ws_plugin__s2member_security"))
|
|
68 |
*
|
69 |
* @attaches-to ``add_action("pre_get_posts");``
|
70 |
*
|
71 |
-
* @param
|
72 |
* @return null May filter WordPress queries, by hiding protected content which is NOT available to the current User/Member.
|
73 |
*/
|
74 |
public static function security_gate_query (&$wp_query = FALSE) // s2Member's Security Gate.
|
75 |
{
|
76 |
-
do_action
|
77 |
|
78 |
c_ws_plugin__s2member_querys::query_level_access ($wp_query); // By reference.
|
79 |
|
80 |
-
do_action
|
81 |
|
82 |
return /* Return for uniformity. */;
|
83 |
}
|
39 |
*/
|
40 |
public static function security_gate () // s2Member's Security Gate.
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_security_gate", get_defined_vars ());
|
43 |
|
44 |
if (is_category ()) // Categories & other inclusives.
|
45 |
c_ws_plugin__s2member_catgs::check_catg_level_access ();
|
56 |
else // Else, we simply look at URIs & other inclusives.
|
57 |
c_ws_plugin__s2member_ruris::check_ruri_level_access ();
|
58 |
|
59 |
+
do_action("ws_plugin__s2member_after_security_gate", get_defined_vars ());
|
60 |
|
61 |
return /* Return for uniformity. */;
|
62 |
}
|
68 |
*
|
69 |
* @attaches-to ``add_action("pre_get_posts");``
|
70 |
*
|
71 |
+
* @param object $wp_query Global ``$wp_query``, by reference.
|
72 |
* @return null May filter WordPress queries, by hiding protected content which is NOT available to the current User/Member.
|
73 |
*/
|
74 |
public static function security_gate_query (&$wp_query = FALSE) // s2Member's Security Gate.
|
75 |
{
|
76 |
+
do_action("ws_plugin__s2member_before_security_gate_query", get_defined_vars ());
|
77 |
|
78 |
c_ws_plugin__s2member_querys::query_level_access ($wp_query); // By reference.
|
79 |
|
80 |
+
do_action("ws_plugin__s2member_after_security_gate_query", get_defined_vars ());
|
81 |
|
82 |
return /* Return for uniformity. */;
|
83 |
}
|
includes/classes/sp-access.inc.php
CHANGED
@@ -33,16 +33,16 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
33 |
* @package s2Member\SP_Access
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @param int|
|
38 |
* @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API.
|
39 |
* @return str|bool A Specific Post/Page Access Link, or false on failure.
|
40 |
*/
|
41 |
public static function sp_access_link_gen ($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
|
42 |
{
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
-
do_action
|
45 |
-
unset
|
46 |
|
47 |
if ((is_string ($sp_ids) || is_numeric ($sp_ids)) && ($sp_ids = preg_replace ("/[^0-9;,]/", "", $sp_ids)) && ($leading_id = preg_replace ("/^([0-9]+).*$/", "$1", $sp_ids)) && is_numeric ($hours))
|
48 |
{
|
@@ -53,7 +53,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
53 |
if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten ($sp_access_link)))
|
54 |
$sp_access_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
|
55 |
}
|
56 |
-
return apply_filters
|
57 |
}
|
58 |
/**
|
59 |
* Generates Specific Post/Page Access links via AJAX.
|
@@ -67,7 +67,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
67 |
*/
|
68 |
public static function sp_access_link_via_ajax ()
|
69 |
{
|
70 |
-
do_action
|
71 |
|
72 |
status_header (200); // Send a 200 OK status header.
|
73 |
header ("Content-Type: text/plain; charset=UTF-8"); // Content-Type with UTF-8.
|
@@ -75,12 +75,12 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
75 |
|
76 |
if (current_user_can ("create_users")) // Check privileges as well. Ability to create Users?
|
77 |
|
78 |
-
if (!empty
|
79 |
|
80 |
if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && isset ($_p["s2member_sp_access_link_ids"], $_p["s2member_sp_access_link_hours"]))
|
81 |
$sp_access_link = c_ws_plugin__s2member_sp_access::sp_access_link_gen ((string)$_p["s2member_sp_access_link_ids"], (string)$_p["s2member_sp_access_link_hours"]);
|
82 |
|
83 |
-
exit (apply_filters
|
84 |
}
|
85 |
/**
|
86 |
* Handles Specific Post/Page Access authentication.
|
@@ -88,7 +88,7 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
88 |
* @package s2Member\SP_Access
|
89 |
* @since 3.5
|
90 |
*
|
91 |
-
* @param int|
|
92 |
* @param bool $read_only Optional. Defaults to false. If ``$read_only = true``,
|
93 |
* no session cookies are set, no IP Restrictions are checked, and script execution is not exited on Link failure.
|
94 |
* In other words, with ``$read_only = true``, this function will simply return true or false.
|
@@ -97,34 +97,34 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
97 |
*/
|
98 |
public static function sp_access ($sp_id = FALSE, $read_only = FALSE)
|
99 |
{
|
100 |
-
do_action
|
101 |
|
102 |
-
$excluded = apply_filters
|
103 |
|
104 |
-
if ($excluded || current_user_can (apply_filters
|
105 |
-
return apply_filters
|
106 |
|
107 |
-
else if ($sp_id && is_numeric ($sp_id) && ((!empty
|
108 |
{
|
109 |
foreach ($sp_access_values as $sp_access_value) // Supports multiple access values in a session. We go through each of them.
|
110 |
{
|
111 |
-
if (is_array
|
112 |
{
|
113 |
-
if (count ($sp_access) === 4 && $sp_access[0] === "sp_time_hours" && in_array
|
114 |
{
|
115 |
if (is_numeric ($sp_access[2]) && is_numeric ($sp_access[3]) && $sp_access[2] <= strtotime ("now") && ($sp_access[2] + ($sp_access[3] * 3600)) >= strtotime ("now"))
|
116 |
{
|
117 |
-
if (!$read_only && !empty
|
118 |
c_ws_plugin__s2member_sp_access::sp_access_session ($_g["s2member_sp_access"]);
|
119 |
|
120 |
if ($read_only || c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
|
121 |
-
return apply_filters
|
122 |
}
|
123 |
}
|
124 |
}
|
125 |
}
|
126 |
// Otherwise, authentication was NOT possible via link or session.
|
127 |
-
if (!$read_only && /* A Specific Post/Page Access Link? */ !empty
|
128 |
{
|
129 |
status_header (503);
|
130 |
header ("Content-Type: text/html; charset=UTF-8");
|
@@ -132,11 +132,11 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
132 |
exit (_x ('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member"));
|
133 |
}
|
134 |
else // Else return false here.
|
135 |
-
return apply_filters
|
136 |
}
|
137 |
|
138 |
else // Else return false here.
|
139 |
-
return apply_filters
|
140 |
}
|
141 |
/**
|
142 |
* Handles Specific Post/Page sessions, by writing access values into a cookie.
|
@@ -146,16 +146,16 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
146 |
* @package s2Member\SP_Access
|
147 |
* @since 3.5
|
148 |
*
|
149 |
-
* @param
|
150 |
* @return array Array of Specific Post/Page Access values.
|
151 |
*/
|
152 |
public static function sp_access_session ($add_sp_access_value = FALSE)
|
153 |
{
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
-
do_action
|
156 |
-
unset
|
157 |
|
158 |
-
$sp_access_values = (!empty
|
159 |
|
160 |
if ($add_sp_access_value && is_string ($add_sp_access_value) && !in_array /* Not in session? */ ($add_sp_access_value, $sp_access_values))
|
161 |
{
|
@@ -170,10 +170,10 @@ if (!class_exists ("c_ws_plugin__s2member_sp_access"))
|
|
170 |
$_COOKIE["s2member_sp_access"] = $cookie; // Real-time cookie updates.
|
171 |
|
172 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
173 |
-
do_action
|
174 |
-
unset
|
175 |
}
|
176 |
-
return apply_filters
|
177 |
}
|
178 |
}
|
179 |
}
|
33 |
* @package s2Member\SP_Access
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string|int $sp_ids Comma-delimited list of Specific Post/Page IDs *(numerical)*.
|
37 |
+
* @param int|string $hours Optional. A numeric expiration time for this link, in hours. Defaults to `72`.
|
38 |
* @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API.
|
39 |
* @return str|bool A Specific Post/Page Access Link, or false on failure.
|
40 |
*/
|
41 |
public static function sp_access_link_gen ($sp_ids = FALSE, $hours = 72, $shrink = TRUE)
|
42 |
{
|
43 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
44 |
+
do_action("ws_plugin__s2member_before_sp_access_link_gen", get_defined_vars ());
|
45 |
+
unset($__refs, $__v);
|
46 |
|
47 |
if ((is_string ($sp_ids) || is_numeric ($sp_ids)) && ($sp_ids = preg_replace ("/[^0-9;,]/", "", $sp_ids)) && ($leading_id = preg_replace ("/^([0-9]+).*$/", "$1", $sp_ids)) && is_numeric ($hours))
|
48 |
{
|
53 |
if ($shrink && ($shorter_url = c_ws_plugin__s2member_utils_urls::shorten ($sp_access_link)))
|
54 |
$sp_access_link = $shorter_url . "#" . $_SERVER["HTTP_HOST"];
|
55 |
}
|
56 |
+
return apply_filters("ws_plugin__s2member_sp_access_link_gen", ((!empty($sp_access_link)) ? $sp_access_link : false), get_defined_vars ());
|
57 |
}
|
58 |
/**
|
59 |
* Generates Specific Post/Page Access links via AJAX.
|
67 |
*/
|
68 |
public static function sp_access_link_via_ajax ()
|
69 |
{
|
70 |
+
do_action("ws_plugin__s2member_before_sp_access_link_via_ajax", get_defined_vars ());
|
71 |
|
72 |
status_header (200); // Send a 200 OK status header.
|
73 |
header ("Content-Type: text/plain; charset=UTF-8"); // Content-Type with UTF-8.
|
75 |
|
76 |
if (current_user_can ("create_users")) // Check privileges as well. Ability to create Users?
|
77 |
|
78 |
+
if (!empty($_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && is_string ($nonce = $_POST["ws_plugin__s2member_sp_access_link_via_ajax"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link-via-ajax"))
|
79 |
|
80 |
if (($_p = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST))) && isset ($_p["s2member_sp_access_link_ids"], $_p["s2member_sp_access_link_hours"]))
|
81 |
$sp_access_link = c_ws_plugin__s2member_sp_access::sp_access_link_gen ((string)$_p["s2member_sp_access_link_ids"], (string)$_p["s2member_sp_access_link_hours"]);
|
82 |
|
83 |
+
exit (apply_filters("ws_plugin__s2member_sp_access_link_via_ajax", ((!empty($sp_access_link)) ? $sp_access_link : ""), get_defined_vars ()));
|
84 |
}
|
85 |
/**
|
86 |
* Handles Specific Post/Page Access authentication.
|
88 |
* @package s2Member\SP_Access
|
89 |
* @since 3.5
|
90 |
*
|
91 |
+
* @param int|string $sp_id Numeric Post/Page ID in WordPress.
|
92 |
* @param bool $read_only Optional. Defaults to false. If ``$read_only = true``,
|
93 |
* no session cookies are set, no IP Restrictions are checked, and script execution is not exited on Link failure.
|
94 |
* In other words, with ``$read_only = true``, this function will simply return true or false.
|
97 |
*/
|
98 |
public static function sp_access ($sp_id = FALSE, $read_only = FALSE)
|
99 |
{
|
100 |
+
do_action("ws_plugin__s2member_before_sp_access", get_defined_vars ());
|
101 |
|
102 |
+
$excluded = apply_filters("ws_plugin__s2member_sp_access_excluded", false, get_defined_vars ());
|
103 |
|
104 |
+
if ($excluded || current_user_can (apply_filters("ws_plugin__s2member_sp_access_excluded_cap", "edit_posts", get_defined_vars ())))
|
105 |
+
return apply_filters("ws_plugin__s2member_sp_access", true, get_defined_vars (), "auth-via-exclusion");
|
106 |
|
107 |
+
else if ($sp_id && is_numeric ($sp_id) && ((!empty($_GET["s2member_sp_access"]) && ($_g["s2member_sp_access"] = trim (stripslashes ((string)$_GET["s2member_sp_access"]))) && is_array($sp_access_values = array($_g["s2member_sp_access"]))) || is_array($sp_access_values = c_ws_plugin__s2member_sp_access::sp_access_session ())) && !empty($sp_access_values))
|
108 |
{
|
109 |
foreach ($sp_access_values as $sp_access_value) // Supports multiple access values in a session. We go through each of them.
|
110 |
{
|
111 |
+
if (is_array($sp_access = preg_split ("/\:\.\:\|\:\.\:/", c_ws_plugin__s2member_utils_encryption::decrypt ($sp_access_value))))
|
112 |
{
|
113 |
+
if (count ($sp_access) === 4 && $sp_access[0] === "sp_time_hours" && in_array($sp_id, preg_split ("/[\r\n\t\s;,]+/", $sp_access[1])))
|
114 |
{
|
115 |
if (is_numeric ($sp_access[2]) && is_numeric ($sp_access[3]) && $sp_access[2] <= strtotime ("now") && ($sp_access[2] + ($sp_access[3] * 3600)) >= strtotime ("now"))
|
116 |
{
|
117 |
+
if (!$read_only && !empty($_g["s2member_sp_access"])) // Add to session?
|
118 |
c_ws_plugin__s2member_sp_access::sp_access_session ($_g["s2member_sp_access"]);
|
119 |
|
120 |
if ($read_only || c_ws_plugin__s2member_ip_restrictions::ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
|
121 |
+
return apply_filters("ws_plugin__s2member_sp_access", true, get_defined_vars (), "auth-via-link-session");
|
122 |
}
|
123 |
}
|
124 |
}
|
125 |
}
|
126 |
// Otherwise, authentication was NOT possible via link or session.
|
127 |
+
if (!$read_only && /* A Specific Post/Page Access Link? */ !empty($_g["s2member_sp_access"]))
|
128 |
{
|
129 |
status_header (503);
|
130 |
header ("Content-Type: text/html; charset=UTF-8");
|
132 |
exit (_x ('<strong>Your Link Expired:</strong><br />Please contact Support if you need assistance.', "s2member-front", "s2member"));
|
133 |
}
|
134 |
else // Else return false here.
|
135 |
+
return apply_filters("ws_plugin__s2member_sp_access", false, get_defined_vars (), "no-auth-via-link-session");
|
136 |
}
|
137 |
|
138 |
else // Else return false here.
|
139 |
+
return apply_filters("ws_plugin__s2member_sp_access", false, get_defined_vars (), "no-auth-no-link-session");
|
140 |
}
|
141 |
/**
|
142 |
* Handles Specific Post/Page sessions, by writing access values into a cookie.
|
146 |
* @package s2Member\SP_Access
|
147 |
* @since 3.5
|
148 |
*
|
149 |
+
* @param string $add_sp_access_value Encrypted Specific Post/Page Access value.
|
150 |
* @return array Array of Specific Post/Page Access values.
|
151 |
*/
|
152 |
public static function sp_access_session ($add_sp_access_value = FALSE)
|
153 |
{
|
154 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
155 |
+
do_action("ws_plugin__s2member_before_sp_access_session", get_defined_vars ());
|
156 |
+
unset($__refs, $__v);
|
157 |
|
158 |
+
$sp_access_values = (!empty($_COOKIE["s2member_sp_access"])) ? preg_split ("/\:\.\:\|\:\.\:/", (string)$_COOKIE["s2member_sp_access"]) : array();
|
159 |
|
160 |
if ($add_sp_access_value && is_string ($add_sp_access_value) && !in_array /* Not in session? */ ($add_sp_access_value, $sp_access_values))
|
161 |
{
|
170 |
$_COOKIE["s2member_sp_access"] = $cookie; // Real-time cookie updates.
|
171 |
|
172 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
173 |
+
do_action("ws_plugin__s2member_during_sp_access_session", get_defined_vars ());
|
174 |
+
unset($__refs, $__v);
|
175 |
}
|
176 |
+
return apply_filters("ws_plugin__s2member_sp_access_session", $sp_access_values, get_defined_vars ());
|
177 |
}
|
178 |
}
|
179 |
}
|
includes/classes/ssl.inc.php
CHANGED
@@ -47,21 +47,21 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
|
|
47 |
static $forced = false; // Only force SSL once.
|
48 |
global $post; // We need this global reference to ``$post``.
|
49 |
|
50 |
-
do_action
|
51 |
|
52 |
if (!$forced) // Only force SSL here once. We definitely do NOT need to run this particular routine more than ONE time.
|
53 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page () /* NOT on WordPress Systematics. */)
|
54 |
{
|
55 |
-
$s2_ssl_gv = apply_filters
|
56 |
$_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|off|false)$/i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
|
57 |
-
$force_ssl = apply_filters
|
58 |
|
59 |
if ($force_ssl || ( /* Conditionals will work? */did_action ("wp") && is_singular () && is_object ($post) && ($force_ssl = get_post_meta ($post->ID, "s2member_force_ssl", true))))
|
60 |
if (!preg_match ("/^(0|no|off|false)$/i", (string)$force_ssl) && ($forced = true)) // Make sure it's NOT a negative variation.
|
61 |
c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); // Call inner routine now.
|
62 |
}
|
63 |
|
64 |
-
do_action
|
65 |
|
66 |
return /* Return for uniformity. */;
|
67 |
}
|
47 |
static $forced = false; // Only force SSL once.
|
48 |
global $post; // We need this global reference to ``$post``.
|
49 |
|
50 |
+
do_action("ws_plugin__s2member_before_check_force_ssl", get_defined_vars ());
|
51 |
|
52 |
if (!$forced) // Only force SSL here once. We definitely do NOT need to run this particular routine more than ONE time.
|
53 |
if (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page () /* NOT on WordPress Systematics. */)
|
54 |
{
|
55 |
+
$s2_ssl_gv = apply_filters("ws_plugin__s2member_check_force_ssl_get_var_name", "s2-ssl", get_defined_vars ());
|
56 |
$_g_s2_ssl = (isset ($_GET[$s2_ssl_gv]) && (!strlen ($_GET[$s2_ssl_gv]) || !preg_match ("/^(0|no|off|false)$/i", $_GET[$s2_ssl_gv]))) ? ((!strlen ($_GET[$s2_ssl_gv])) ? true : $_GET[$s2_ssl_gv]) : false;
|
57 |
+
$force_ssl = apply_filters("ws_plugin__s2member_check_force_ssl", $_g_s2_ssl, get_defined_vars ());
|
58 |
|
59 |
if ($force_ssl || ( /* Conditionals will work? */did_action ("wp") && is_singular () && is_object ($post) && ($force_ssl = get_post_meta ($post->ID, "s2member_force_ssl", true))))
|
60 |
if (!preg_match ("/^(0|no|off|false)$/i", (string)$force_ssl) && ($forced = true)) // Make sure it's NOT a negative variation.
|
61 |
c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); // Call inner routine now.
|
62 |
}
|
63 |
|
64 |
+
do_action("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
|
65 |
|
66 |
return /* Return for uniformity. */;
|
67 |
}
|
includes/classes/systematics-sp.inc.php
CHANGED
@@ -33,8 +33,8 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
33 |
* @package s2Member\Systematics
|
34 |
* @since 111115
|
35 |
*
|
36 |
-
* @param int|
|
37 |
-
* @param
|
38 |
* @return bool True if s2Member Systematic, else false.
|
39 |
*/
|
40 |
public static function is_s2_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
|
@@ -44,10 +44,10 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
44 |
|
45 |
if ($uri && ($_q = c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_QUERY)) && preg_match ("/[\?&]s2member/", $_q) && c_ws_plugin__s2member_utils_conds::is_site_root ($uri))
|
46 |
{
|
47 |
-
return ($is_s2_systematic = apply_filters
|
48 |
}
|
49 |
else // Otherwise, we return false (i.e. it's NOT an s2Member Systematic Use Page).
|
50 |
-
return ($is_s2_systematic = apply_filters
|
51 |
}
|
52 |
/**
|
53 |
* Determines if a specific Post/Page ID, or URI, is WordPress Systematic.
|
@@ -55,8 +55,8 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
55 |
* @package s2Member\Systematics
|
56 |
* @since 111002
|
57 |
*
|
58 |
-
* @param int|
|
59 |
-
* @param
|
60 |
* @return bool True if WordPress Systematic, else false.
|
61 |
*/
|
62 |
public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
|
@@ -66,14 +66,14 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
66 |
|
67 |
if ($uri && preg_match ("/\/wp-admin(?:\/|\?|$)/", $uri)) // Inside a WordPress administrative area?
|
68 |
{
|
69 |
-
return ($is_wp_systematic = apply_filters
|
70 |
}
|
71 |
else if ($uri && preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_PATH)))
|
72 |
{
|
73 |
-
return ($is_wp_systematic = apply_filters
|
74 |
}
|
75 |
else // Otherwise, we return false (i.e. it's NOT a WordPress Systematic Use Page).
|
76 |
-
return ($is_wp_systematic = apply_filters
|
77 |
}
|
78 |
/**
|
79 |
* Determines if a specific Post/Page ID, or URI, is Systematic in any way.
|
@@ -81,8 +81,8 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
81 |
* @package s2Member\Systematics
|
82 |
* @since 3.5
|
83 |
*
|
84 |
-
* @param int|
|
85 |
-
* @param
|
86 |
* @return bool True if Systematic, else false.
|
87 |
*
|
88 |
* @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
|
@@ -97,38 +97,38 @@ if (!class_exists ("c_ws_plugin__s2member_systematics_sp"))
|
|
97 |
|
98 |
if (c_ws_plugin__s2member_systematics_sp::is_s2_systematic_use_specific_page /* An s2Member Systematic Use Page? */ ($singular_id, $uri))
|
99 |
{
|
100 |
-
return ($is_systematic = apply_filters
|
101 |
}
|
102 |
else if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page /* A WordPress Systematic Use Page? */ ($singular_id, $uri))
|
103 |
{
|
104 |
-
return ($is_systematic = apply_filters
|
105 |
}
|
106 |
else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(?:" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(?:\/|\?|$)/", $uri))
|
107 |
{
|
108 |
-
return ($is_systematic = apply_filters
|
109 |
}
|
110 |
-
else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty
|
111 |
{
|
112 |
-
return ($is_systematic = apply_filters
|
113 |
}
|
114 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
|
115 |
{
|
116 |
-
return ($is_systematic = apply_filters
|
117 |
}
|
118 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
119 |
{
|
120 |
-
return ($is_systematic = apply_filters
|
121 |
}
|
122 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
|
123 |
{
|
124 |
-
return ($is_systematic = apply_filters
|
125 |
}
|
126 |
else if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($_lro, "/") . "$/", $uri))
|
127 |
{
|
128 |
-
return ($is_systematic = apply_filters
|
129 |
}
|
130 |
else // Otherwise, we return false (i.e. it's NOT a Systematic Use Page in any way).
|
131 |
-
return ($is_systematic = apply_filters
|
132 |
}
|
133 |
}
|
134 |
}
|
33 |
* @package s2Member\Systematics
|
34 |
* @since 111115
|
35 |
*
|
36 |
+
* @param int|string $singular_id Optional. A numeric Post/Page ID in WordPress.
|
37 |
+
* @param string $uri Optional. A request URI to test against.
|
38 |
* @return bool True if s2Member Systematic, else false.
|
39 |
*/
|
40 |
public static function is_s2_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
|
44 |
|
45 |
if ($uri && ($_q = c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_QUERY)) && preg_match ("/[\?&]s2member/", $_q) && c_ws_plugin__s2member_utils_conds::is_site_root ($uri))
|
46 |
{
|
47 |
+
return ($is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_specific_page", true, get_defined_vars ()));
|
48 |
}
|
49 |
else // Otherwise, we return false (i.e. it's NOT an s2Member Systematic Use Page).
|
50 |
+
return ($is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_specific_page", false, get_defined_vars ()));
|
51 |
}
|
52 |
/**
|
53 |
* Determines if a specific Post/Page ID, or URI, is WordPress Systematic.
|
55 |
* @package s2Member\Systematics
|
56 |
* @since 111002
|
57 |
*
|
58 |
+
* @param int|string $singular_id Optional. A numeric Post/Page ID in WordPress.
|
59 |
+
* @param string $uri Optional. A request URI to test against.
|
60 |
* @return bool True if WordPress Systematic, else false.
|
61 |
*/
|
62 |
public static function is_wp_systematic_use_specific_page ($singular_id = FALSE, $uri = FALSE)
|
66 |
|
67 |
if ($uri && preg_match ("/\/wp-admin(?:\/|\?|$)/", $uri)) // Inside a WordPress administrative area?
|
68 |
{
|
69 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
|
70 |
}
|
71 |
else if ($uri && preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($uri, PHP_URL_PATH)))
|
72 |
{
|
73 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_specific_page", true, get_defined_vars ()));
|
74 |
}
|
75 |
else // Otherwise, we return false (i.e. it's NOT a WordPress Systematic Use Page).
|
76 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_specific_page", false, get_defined_vars ()));
|
77 |
}
|
78 |
/**
|
79 |
* Determines if a specific Post/Page ID, or URI, is Systematic in any way.
|
81 |
* @package s2Member\Systematics
|
82 |
* @since 3.5
|
83 |
*
|
84 |
+
* @param int|string $singular_id Optional. A numeric Post/Page ID in WordPress.
|
85 |
+
* @param string $uri Optional. A request URI to test against.
|
86 |
* @return bool True if Systematic, else false.
|
87 |
*
|
88 |
* @todo Test URIs against formulated links for Systematic Pages like the Membership Options Page?
|
97 |
|
98 |
if (c_ws_plugin__s2member_systematics_sp::is_s2_systematic_use_specific_page /* An s2Member Systematic Use Page? */ ($singular_id, $uri))
|
99 |
{
|
100 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
101 |
}
|
102 |
else if (c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page /* A WordPress Systematic Use Page? */ ($singular_id, $uri))
|
103 |
{
|
104 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
105 |
}
|
106 |
else if ($uri && c_ws_plugin__s2member_utils_conds::bp_is_installed () && preg_match ("/\/(?:" . preg_quote (trim (((function_exists ("bp_get_signup_slug")) ? bp_get_signup_slug () : BP_REGISTER_SLUG), "/"), "/") . "|" . preg_quote (trim (((function_exists ("bp_get_activate_slug")) ? bp_get_activate_slug () : BP_ACTIVATION_SLUG), "/"), "/") . ")(?:\/|\?|$)/", $uri))
|
107 |
{
|
108 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
109 |
}
|
110 |
+
else if ($singular_id && c_ws_plugin__s2member_utils_conds::bp_is_installed () && ((!empty($bp->pages->register->id) && $singular_id === (int)$bp->pages->register->id) || (!empty($bp->pages->activate->id) && $singular_id === (int)$bp->pages->activate->id)))
|
111 |
{
|
112 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
113 |
}
|
114 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])
|
115 |
{
|
116 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
117 |
}
|
118 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
119 |
{
|
120 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
121 |
}
|
122 |
else if ($singular_id && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && $singular_id === (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"])
|
123 |
{
|
124 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
125 |
}
|
126 |
else if ($uri && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($_lro, "/") . "$/", $uri))
|
127 |
{
|
128 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", true, get_defined_vars ()));
|
129 |
}
|
130 |
else // Otherwise, we return false (i.e. it's NOT a Systematic Use Page in any way).
|
131 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_specific_page", false, get_defined_vars ()));
|
132 |
}
|
133 |
}
|
134 |
}
|
includes/classes/systematics.inc.php
CHANGED
@@ -46,12 +46,12 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
|
|
46 |
{
|
47 |
return $is_s2_systematic; // Filters will have already been applied here.
|
48 |
}
|
49 |
-
else if (!empty
|
50 |
{
|
51 |
-
return ($is_s2_systematic = apply_filters
|
52 |
}
|
53 |
else // Otherwise, we return false (it's NOT an s2Member Systematic Use Page).
|
54 |
-
return ($is_s2_systematic = apply_filters
|
55 |
}
|
56 |
/**
|
57 |
* Determines if the current page is WordPress Systematic.
|
@@ -74,30 +74,30 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
|
|
74 |
}
|
75 |
else if (is_admin ()) // In the admin area? All administrational pages are considered Systematic.
|
76 |
{
|
77 |
-
return ($is_wp_systematic = apply_filters
|
78 |
}
|
79 |
else if (defined ("WP_INSTALLING") && WP_INSTALLING) // Installing? All WordPress installs are considered Systematic.
|
80 |
{
|
81 |
-
return ($is_wp_systematic = apply_filters
|
82 |
}
|
83 |
else if (defined ("APP_REQUEST") && APP_REQUEST) // App request? All WordPress app requests are considered Systematic.
|
84 |
{
|
85 |
-
return ($is_wp_systematic = apply_filters
|
86 |
}
|
87 |
else if (defined ("XMLRPC_REQUEST") && XMLRPC_REQUEST) // An XML-RPC request? All of these are considered Systematic too.
|
88 |
{
|
89 |
-
return ($is_wp_systematic = apply_filters
|
90 |
}
|
91 |
else if ((defined ("DOING_CRON") && DOING_CRON) || strcasecmp (PHP_SAPI, "CLI") === 0) // CLI or CRON job.
|
92 |
{
|
93 |
-
return ($is_wp_systematic = apply_filters
|
94 |
}
|
95 |
else if (preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH)))
|
96 |
{
|
97 |
-
return ($is_wp_systematic = apply_filters
|
98 |
}
|
99 |
else // Otherwise, we return false (it's NOT a WordPress Systematic Use Page).
|
100 |
-
return ($is_wp_systematic = apply_filters
|
101 |
}
|
102 |
/**
|
103 |
* Determines if the current page is Systematic in any way.
|
@@ -120,34 +120,34 @@ if (!class_exists ("c_ws_plugin__s2member_systematics"))
|
|
120 |
}
|
121 |
else if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page /* An s2Member Systematic Use Page? */ ())
|
122 |
{
|
123 |
-
return ($is_systematic = apply_filters
|
124 |
}
|
125 |
else if (c_ws_plugin__s2member_systematics::is_wp_systematic_use_page /* A WordPress Systematic Use Page? */ ())
|
126 |
{
|
127 |
-
return ($is_systematic = apply_filters
|
128 |
}
|
129 |
else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ()))
|
130 |
{
|
131 |
-
return ($is_systematic = apply_filters
|
132 |
}
|
133 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
|
134 |
{
|
135 |
-
return ($is_systematic = apply_filters
|
136 |
}
|
137 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
|
138 |
{
|
139 |
-
return ($is_systematic = apply_filters
|
140 |
}
|
141 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
|
142 |
{
|
143 |
-
return ($is_systematic = apply_filters
|
144 |
}
|
145 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($_lro, "/") . "$/", $_SERVER["REQUEST_URI"]))
|
146 |
{
|
147 |
-
return ($is_systematic = apply_filters
|
148 |
}
|
149 |
else // Otherwise, we return false (it's NOT a Systematic Use Page in any way).
|
150 |
-
return ($is_systematic = apply_filters
|
151 |
}
|
152 |
}
|
153 |
}
|
46 |
{
|
47 |
return $is_s2_systematic; // Filters will have already been applied here.
|
48 |
}
|
49 |
+
else if (!empty($_SERVER["QUERY_STRING"]) && preg_match ("/[\?&]s2member/", $_SERVER["QUERY_STRING"]) && c_ws_plugin__s2member_utils_conds::is_site_root ($_SERVER["REQUEST_URI"]))
|
50 |
{
|
51 |
+
return ($is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_page", true, get_defined_vars ()));
|
52 |
}
|
53 |
else // Otherwise, we return false (it's NOT an s2Member Systematic Use Page).
|
54 |
+
return ($is_s2_systematic = apply_filters("ws_plugin__s2member_is_s2_systematic_use_page", false, get_defined_vars ()));
|
55 |
}
|
56 |
/**
|
57 |
* Determines if the current page is WordPress Systematic.
|
74 |
}
|
75 |
else if (is_admin ()) // In the admin area? All administrational pages are considered Systematic.
|
76 |
{
|
77 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
78 |
}
|
79 |
else if (defined ("WP_INSTALLING") && WP_INSTALLING) // Installing? All WordPress installs are considered Systematic.
|
80 |
{
|
81 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
82 |
}
|
83 |
else if (defined ("APP_REQUEST") && APP_REQUEST) // App request? All WordPress app requests are considered Systematic.
|
84 |
{
|
85 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
86 |
}
|
87 |
else if (defined ("XMLRPC_REQUEST") && XMLRPC_REQUEST) // An XML-RPC request? All of these are considered Systematic too.
|
88 |
{
|
89 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
90 |
}
|
91 |
else if ((defined ("DOING_CRON") && DOING_CRON) || strcasecmp (PHP_SAPI, "CLI") === 0) // CLI or CRON job.
|
92 |
{
|
93 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
94 |
}
|
95 |
else if (preg_match ("/^\/(?:wp-.+?|xmlrpc)\.php$/", c_ws_plugin__s2member_utils_urls::parse_url ($_SERVER["REQUEST_URI"], PHP_URL_PATH)))
|
96 |
{
|
97 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", true, get_defined_vars ()));
|
98 |
}
|
99 |
else // Otherwise, we return false (it's NOT a WordPress Systematic Use Page).
|
100 |
+
return ($is_wp_systematic = apply_filters("ws_plugin__s2member_is_wp_systematic_use_page", false, get_defined_vars ()));
|
101 |
}
|
102 |
/**
|
103 |
* Determines if the current page is Systematic in any way.
|
120 |
}
|
121 |
else if (c_ws_plugin__s2member_systematics::is_s2_systematic_use_page /* An s2Member Systematic Use Page? */ ())
|
122 |
{
|
123 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
124 |
}
|
125 |
else if (c_ws_plugin__s2member_systematics::is_wp_systematic_use_page /* A WordPress Systematic Use Page? */ ())
|
126 |
{
|
127 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
128 |
}
|
129 |
else if (c_ws_plugin__s2member_utils_conds::bp_is_installed () && (bp_is_register_page () || bp_is_activation_page ()))
|
130 |
{
|
131 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
132 |
}
|
133 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
|
134 |
{
|
135 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
136 |
}
|
137 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
|
138 |
{
|
139 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
140 |
}
|
141 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
|
142 |
{
|
143 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
144 |
}
|
145 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__s2member_login_redirects::login_redirection_uri (false, "root-returns-false")) && preg_match ("/^" . preg_quote ($_lro, "/") . "$/", $_SERVER["REQUEST_URI"]))
|
146 |
{
|
147 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", true, get_defined_vars ()));
|
148 |
}
|
149 |
else // Otherwise, we return false (it's NOT a Systematic Use Page in any way).
|
150 |
+
return ($is_systematic = apply_filters("ws_plugin__s2member_is_systematic_use_page", false, get_defined_vars ()));
|
151 |
}
|
152 |
}
|
153 |
}
|
includes/classes/tracking-codes.inc.php
CHANGED
@@ -51,9 +51,9 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
51 |
*/
|
52 |
public static function display_signup_tracking_codes ()
|
53 |
{
|
54 |
-
do_action
|
55 |
|
56 |
-
if ((!empty
|
57 |
{
|
58 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_or_txn_id))))
|
59 |
{
|
@@ -62,8 +62,8 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
62 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
63 |
|
64 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
65 |
-
do_action
|
66 |
-
unset
|
67 |
|
68 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
69 |
{
|
@@ -76,7 +76,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
76 |
}
|
77 |
}
|
78 |
|
79 |
-
do_action
|
80 |
|
81 |
return /* Return for uniformity. */;
|
82 |
}
|
@@ -103,9 +103,9 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
103 |
*/
|
104 |
public static function display_modification_tracking_codes ()
|
105 |
{
|
106 |
-
do_action
|
107 |
|
108 |
-
if ((!empty
|
109 |
{
|
110 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_modification_tracking_codes_" . $subscr_or_txn_id))))
|
111 |
{
|
@@ -114,8 +114,8 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
114 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
115 |
|
116 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
-
do_action
|
118 |
-
unset
|
119 |
|
120 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
121 |
{
|
@@ -128,7 +128,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
128 |
}
|
129 |
}
|
130 |
|
131 |
-
do_action
|
132 |
|
133 |
return /* Return for uniformity. */;
|
134 |
}
|
@@ -155,9 +155,9 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
155 |
*/
|
156 |
public static function display_ccap_tracking_codes ()
|
157 |
{
|
158 |
-
do_action
|
159 |
|
160 |
-
if ((!empty
|
161 |
{
|
162 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_ccap_tracking_codes_" . $subscr_or_txn_id))))
|
163 |
{
|
@@ -166,8 +166,8 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
166 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
167 |
|
168 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
169 |
-
do_action
|
170 |
-
unset
|
171 |
|
172 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
173 |
{
|
@@ -180,7 +180,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
180 |
}
|
181 |
}
|
182 |
|
183 |
-
do_action
|
184 |
|
185 |
return /* Return for uniformity. */;
|
186 |
}
|
@@ -203,9 +203,9 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
203 |
*/
|
204 |
public static function display_sp_tracking_codes ()
|
205 |
{
|
206 |
-
do_action
|
207 |
|
208 |
-
if (!empty
|
209 |
{
|
210 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
|
211 |
{
|
@@ -214,8 +214,8 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
214 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_sp_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
215 |
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
-
do_action
|
218 |
-
unset
|
219 |
|
220 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
221 |
{
|
@@ -228,7 +228,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
228 |
}
|
229 |
}
|
230 |
|
231 |
-
do_action
|
232 |
|
233 |
return /* Return for uniformity. */;
|
234 |
}
|
@@ -240,7 +240,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
240 |
* @package s2Member\Tracking
|
241 |
* @since 110720
|
242 |
*
|
243 |
-
* @return
|
244 |
*/
|
245 |
public static function generate_all_tracking_codes ()
|
246 |
{
|
@@ -251,7 +251,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_codes"))
|
|
251 |
c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes ();
|
252 |
c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes ();
|
253 |
|
254 |
-
return apply_filters
|
255 |
}
|
256 |
}
|
257 |
}
|
51 |
*/
|
52 |
public static function display_signup_tracking_codes ()
|
53 |
{
|
54 |
+
do_action("ws_plugin__s2member_before_display_signup_tracking_codes", get_defined_vars ());
|
55 |
|
56 |
+
if ((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
57 |
{
|
58 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_signup_tracking_codes_" . $subscr_or_txn_id))))
|
59 |
{
|
62 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
63 |
|
64 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
65 |
+
do_action("ws_plugin__s2member_during_display_signup_tracking_codes", get_defined_vars ());
|
66 |
+
unset($__refs, $__v);
|
67 |
|
68 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
69 |
{
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
do_action("ws_plugin__s2member_after_display_signup_tracking_codes", get_defined_vars ());
|
80 |
|
81 |
return /* Return for uniformity. */;
|
82 |
}
|
103 |
*/
|
104 |
public static function display_modification_tracking_codes ()
|
105 |
{
|
106 |
+
do_action("ws_plugin__s2member_before_display_modification_tracking_codes", get_defined_vars ());
|
107 |
|
108 |
+
if ((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
109 |
{
|
110 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_modification_tracking_codes_" . $subscr_or_txn_id))))
|
111 |
{
|
114 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
115 |
|
116 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
+
do_action("ws_plugin__s2member_during_display_modification_tracking_codes", get_defined_vars ());
|
118 |
+
unset($__refs, $__v);
|
119 |
|
120 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
121 |
{
|
128 |
}
|
129 |
}
|
130 |
|
131 |
+
do_action("ws_plugin__s2member_after_display_modification_tracking_codes", get_defined_vars ());
|
132 |
|
133 |
return /* Return for uniformity. */;
|
134 |
}
|
155 |
*/
|
156 |
public static function display_ccap_tracking_codes ()
|
157 |
{
|
158 |
+
do_action("ws_plugin__s2member_before_display_ccap_tracking_codes", get_defined_vars ());
|
159 |
|
160 |
+
if ((!empty($_COOKIE["s2member_tracking"]) && ($subscr_or_txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_tracking"]))) || (($reg_cookies = c_ws_plugin__s2member_register_access::reg_cookies_ok ()) && extract ($reg_cookies) && ($subscr_or_txn_id = $subscr_id)))
|
161 |
{
|
162 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_ccap_tracking_codes_" . $subscr_or_txn_id))))
|
163 |
{
|
166 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
167 |
|
168 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
169 |
+
do_action("ws_plugin__s2member_during_display_ccap_tracking_codes", get_defined_vars ());
|
170 |
+
unset($__refs, $__v);
|
171 |
|
172 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
173 |
{
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
do_action("ws_plugin__s2member_after_display_ccap_tracking_codes", get_defined_vars ());
|
184 |
|
185 |
return /* Return for uniformity. */;
|
186 |
}
|
203 |
*/
|
204 |
public static function display_sp_tracking_codes ()
|
205 |
{
|
206 |
+
do_action("ws_plugin__s2member_before_display_sp_tracking_codes", get_defined_vars ());
|
207 |
|
208 |
+
if (!empty($_COOKIE["s2member_sp_tracking"]) && ($txn_id = c_ws_plugin__s2member_utils_encryption::decrypt ($_COOKIE["s2member_sp_tracking"])))
|
209 |
{
|
210 |
if (($code = get_transient ($transient = "s2m_" . md5 ("s2member_transient_sp_tracking_codes_" . $txn_id))))
|
211 |
{
|
214 |
echo '<img src="' . esc_attr (site_url ("/?s2member_delete_sp_tracking_cookie=1")) . '" alt="." style="width:1px; height:1px; border:0;" />' . "\n";
|
215 |
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
+
do_action("ws_plugin__s2member_during_display_sp_tracking_codes", get_defined_vars ());
|
218 |
+
unset($__refs, $__v);
|
219 |
|
220 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && !is_main_site ())
|
221 |
{
|
228 |
}
|
229 |
}
|
230 |
|
231 |
+
do_action("ws_plugin__s2member_after_display_sp_tracking_codes", get_defined_vars ());
|
232 |
|
233 |
return /* Return for uniformity. */;
|
234 |
}
|
240 |
* @package s2Member\Tracking
|
241 |
* @since 110720
|
242 |
*
|
243 |
+
* @return string HTML output for all Tracking Codes integrated with s2Member.
|
244 |
*/
|
245 |
public static function generate_all_tracking_codes ()
|
246 |
{
|
251 |
c_ws_plugin__s2member_tracking_codes::display_ccap_tracking_codes ();
|
252 |
c_ws_plugin__s2member_tracking_codes::display_sp_tracking_codes ();
|
253 |
|
254 |
+
return apply_filters("ws_plugin__s2member_generate_all_tracking_codes", ob_get_clean (), get_defined_vars ());
|
255 |
}
|
256 |
}
|
257 |
}
|
includes/classes/tracking-cookies-in.inc.php
CHANGED
@@ -39,14 +39,14 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies_in"))
|
|
39 |
*/
|
40 |
public static function delete_tracking_cookie ()
|
41 |
{
|
42 |
-
do_action
|
43 |
|
44 |
-
if (!empty
|
45 |
{
|
46 |
setcookie ("s2member_tracking", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
47 |
setcookie ("s2member_tracking", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
48 |
|
49 |
-
do_action
|
50 |
|
51 |
@ini_set ("zlib.output_compression", 0);
|
52 |
if(function_exists("apache_setenv"))
|
@@ -61,7 +61,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies_in"))
|
|
61 |
exit (file_get_contents (dirname (dirname (dirname (__FILE__))) . "/images/trans-1px.png"));
|
62 |
}
|
63 |
|
64 |
-
do_action
|
65 |
}
|
66 |
/**
|
67 |
* Deletes s2Member's temporary tracking cookie.
|
@@ -75,14 +75,14 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies_in"))
|
|
75 |
*/
|
76 |
public static function delete_sp_tracking_cookie ()
|
77 |
{
|
78 |
-
do_action
|
79 |
|
80 |
-
if (!empty
|
81 |
{
|
82 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
83 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
84 |
|
85 |
-
do_action
|
86 |
|
87 |
@ini_set ("zlib.output_compression", 0);
|
88 |
if(function_exists("apache_setenv"))
|
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies_in"))
|
|
97 |
exit (file_get_contents (dirname (dirname (dirname (__FILE__))) . "/images/trans-1px.png"));
|
98 |
}
|
99 |
|
100 |
-
do_action
|
101 |
}
|
102 |
}
|
103 |
}
|
39 |
*/
|
40 |
public static function delete_tracking_cookie ()
|
41 |
{
|
42 |
+
do_action("ws_plugin__s2member_before_delete_tracking_cookie", get_defined_vars ());
|
43 |
|
44 |
+
if (!empty($_GET["s2member_delete_tracking_cookie"])) // Deletes cookie.
|
45 |
{
|
46 |
setcookie ("s2member_tracking", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
47 |
setcookie ("s2member_tracking", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
48 |
|
49 |
+
do_action("ws_plugin__s2member_during_delete_tracking_cookie", get_defined_vars ());
|
50 |
|
51 |
@ini_set ("zlib.output_compression", 0);
|
52 |
if(function_exists("apache_setenv"))
|
61 |
exit (file_get_contents (dirname (dirname (dirname (__FILE__))) . "/images/trans-1px.png"));
|
62 |
}
|
63 |
|
64 |
+
do_action("ws_plugin__s2member_after_delete_tracking_cookie", get_defined_vars ());
|
65 |
}
|
66 |
/**
|
67 |
* Deletes s2Member's temporary tracking cookie.
|
75 |
*/
|
76 |
public static function delete_sp_tracking_cookie ()
|
77 |
{
|
78 |
+
do_action("ws_plugin__s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
|
79 |
|
80 |
+
if (!empty($_GET["s2member_delete_sp_tracking_cookie"])) // Deletes cookie.
|
81 |
{
|
82 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, COOKIEPATH, COOKIE_DOMAIN);
|
83 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, SITECOOKIEPATH, COOKIE_DOMAIN);
|
84 |
|
85 |
+
do_action("ws_plugin__s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
|
86 |
|
87 |
@ini_set ("zlib.output_compression", 0);
|
88 |
if(function_exists("apache_setenv"))
|
97 |
exit (file_get_contents (dirname (dirname (dirname (__FILE__))) . "/images/trans-1px.png"));
|
98 |
}
|
99 |
|
100 |
+
do_action("ws_plugin__s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
|
101 |
}
|
102 |
}
|
103 |
}
|
includes/classes/tracking-cookies.inc.php
CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies"))
|
|
39 |
*/
|
40 |
public static function delete_tracking_cookie ()
|
41 |
{
|
42 |
-
if (!empty
|
43 |
{
|
44 |
return c_ws_plugin__s2member_tracking_cookies_in::delete_tracking_cookie ();
|
45 |
}
|
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_tracking_cookies"))
|
|
56 |
*/
|
57 |
public static function delete_sp_tracking_cookie ()
|
58 |
{
|
59 |
-
if (!empty
|
60 |
{
|
61 |
return c_ws_plugin__s2member_tracking_cookies_in::delete_sp_tracking_cookie ();
|
62 |
}
|
39 |
*/
|
40 |
public static function delete_tracking_cookie ()
|
41 |
{
|
42 |
+
if (!empty($_GET["s2member_delete_tracking_cookie"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_tracking_cookies_in::delete_tracking_cookie ();
|
45 |
}
|
56 |
*/
|
57 |
public static function delete_sp_tracking_cookie ()
|
58 |
{
|
59 |
+
if (!empty($_GET["s2member_delete_sp_tracking_cookie"]))
|
60 |
{
|
61 |
return c_ws_plugin__s2member_tracking_cookies_in::delete_sp_tracking_cookie ();
|
62 |
}
|
includes/classes/translations.inc.php
CHANGED
@@ -42,7 +42,7 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
42 |
load_plugin_textdomain ("s2member", false, c_ws_plugin__s2member_utils_dirs::rel_path (WP_PLUGIN_DIR, dirname (dirname (__FILE__)) . "/translations"));
|
43 |
load_plugin_textdomain ("s2member"); // Allows `.mo` file to be loaded from the `/wp-content/plugins/s2member-[locale].mo`.
|
44 |
|
45 |
-
do_action
|
46 |
|
47 |
add_filter ("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
|
48 |
|
@@ -62,57 +62,57 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
62 |
*
|
63 |
* @attaches-to ``add_filter("gettext");``
|
64 |
*
|
65 |
-
* @param
|
66 |
-
* @param
|
67 |
-
* @param
|
68 |
-
* @return
|
69 |
*/
|
70 |
public static function translation_mangler ($translated = FALSE, $original = FALSE, $domain = FALSE)
|
71 |
{
|
72 |
global $current_site, $current_blog; // In support of Multisite Networking.
|
73 |
-
static $s = array
|
74 |
|
75 |
-
if ((isset ($s["is_wp_login"]) && $s["is_wp_login"]) || (!isset ($s["is_wp_login"]) && ($s["is_wp_login"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty
|
76 |
{
|
77 |
if ($original === "Username") // Give Filters a chance here.
|
78 |
{
|
79 |
-
$translated = apply_filters
|
80 |
}
|
81 |
else if ($original === "Password") // Give Filters a chance here.
|
82 |
{
|
83 |
-
$translated = apply_filters
|
84 |
}
|
85 |
}
|
86 |
|
87 |
-
else if ((isset ($s["is_wp_login_register"]) && $s["is_wp_login_register"]) || (!isset ($s["is_wp_login_register"]) && ($s["is_wp_login_register"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && !empty
|
88 |
{
|
89 |
if ($original === "Username") // Give Filters a chance here.
|
90 |
{
|
91 |
-
$translated = apply_filters
|
92 |
}
|
93 |
else if ($original === "Password") // Give Filters a chance here.
|
94 |
{
|
95 |
-
$translated = apply_filters
|
96 |
}
|
97 |
else if ($original === "E-mail") // Give Filters a chance here.
|
98 |
{
|
99 |
-
$translated = apply_filters
|
100 |
}
|
101 |
}
|
102 |
|
103 |
-
else if ((isset ($s["is_wp_login_checkemail"]) && $s["is_wp_login_checkemail"]) || (!isset ($s["is_wp_login_checkemail"]) && ($s["is_wp_login_checkemail"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty
|
104 |
{
|
105 |
if ($original === "Registration complete. Please check your e-mail." && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
106 |
{
|
107 |
-
$translated = apply_filters
|
108 |
}
|
109 |
}
|
110 |
|
111 |
else if ((isset ($s["is_user_new"]) && $s["is_user_new"]) || (!isset ($s["is_user_new"]) && ($s["is_user_new"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-admin/user-new.php") !== false) ? true : false)))
|
112 |
{
|
113 |
-
if ($original === "Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n" && !empty
|
114 |
{
|
115 |
-
$translated = apply_filters
|
116 |
}
|
117 |
}
|
118 |
|
@@ -120,7 +120,7 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
120 |
{
|
121 |
if ($original === 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>')
|
122 |
{
|
123 |
-
$translated = apply_filters
|
124 |
}
|
125 |
}
|
126 |
|
@@ -128,7 +128,7 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
128 |
{
|
129 |
if ($original === "If you’re not going to use a great site domain, leave it for a new user. Now have at it!")
|
130 |
{
|
131 |
-
$translated = apply_filters
|
132 |
}
|
133 |
else if ($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!")
|
134 |
{
|
@@ -136,12 +136,12 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
136 |
{
|
137 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
138 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
139 |
-
$user_blogs = (is_array
|
140 |
|
141 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
142 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
143 |
|
144 |
-
$translated = apply_filters
|
145 |
}
|
146 |
}
|
147 |
}
|
@@ -150,7 +150,7 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
150 |
{
|
151 |
if ($original === "If you’re not going to use a great domain, leave it for a new user. Now have at it!")
|
152 |
{
|
153 |
-
$translated = apply_filters
|
154 |
}
|
155 |
else if ($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!")
|
156 |
{
|
@@ -158,12 +158,12 @@ if (!class_exists ("c_ws_plugin__s2member_translations"))
|
|
158 |
{
|
159 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
160 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
161 |
-
$user_blogs = (is_array
|
162 |
|
163 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
164 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
165 |
|
166 |
-
$translated = apply_filters
|
167 |
}
|
168 |
}
|
169 |
}
|
42 |
load_plugin_textdomain ("s2member", false, c_ws_plugin__s2member_utils_dirs::rel_path (WP_PLUGIN_DIR, dirname (dirname (__FILE__)) . "/translations"));
|
43 |
load_plugin_textdomain ("s2member"); // Allows `.mo` file to be loaded from the `/wp-content/plugins/s2member-[locale].mo`.
|
44 |
|
45 |
+
do_action("ws_plugin__s2member_during_translations_load", get_defined_vars ());
|
46 |
|
47 |
add_filter ("gettext", "c_ws_plugin__s2member_translations::translation_mangler", 10, 3);
|
48 |
|
62 |
*
|
63 |
* @attaches-to ``add_filter("gettext");``
|
64 |
*
|
65 |
+
* @param string $translated Expects already-translated string passed in by Filter.
|
66 |
+
* @param string $original Expects original text string passed in by Filter.
|
67 |
+
* @param string $domain Expects translation domain passed in by Filter.
|
68 |
+
* @return string Translated string, possibly modified by this routine.
|
69 |
*/
|
70 |
public static function translation_mangler ($translated = FALSE, $original = FALSE, $domain = FALSE)
|
71 |
{
|
72 |
global $current_site, $current_blog; // In support of Multisite Networking.
|
73 |
+
static $s = array(); // This static array optimizes all of these routines.
|
74 |
|
75 |
+
if ((isset ($s["is_wp_login"]) && $s["is_wp_login"]) || (!isset ($s["is_wp_login"]) && ($s["is_wp_login"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty($_REQUEST["action"]) && empty($_REQUEST["checkemail"])) ? true : false)))
|
76 |
{
|
77 |
if ($original === "Username") // Give Filters a chance here.
|
78 |
{
|
79 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Username:", "s2member-front", "s2member"), get_defined_vars ());
|
80 |
}
|
81 |
else if ($original === "Password") // Give Filters a chance here.
|
82 |
{
|
83 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("My Password:", "s2member-front", "s2member"), get_defined_vars ());
|
84 |
}
|
85 |
}
|
86 |
|
87 |
+
else if ((isset ($s["is_wp_login_register"]) && $s["is_wp_login_register"]) || (!isset ($s["is_wp_login_register"]) && ($s["is_wp_login_register"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && !empty($_REQUEST["action"]) && $_REQUEST["action"] === "register") ? true : false)))
|
88 |
{
|
89 |
if ($original === "Username") // Give Filters a chance here.
|
90 |
{
|
91 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Username *", "s2member-front", "s2member"), get_defined_vars ());
|
92 |
}
|
93 |
else if ($original === "Password") // Give Filters a chance here.
|
94 |
{
|
95 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Password *", "s2member-front", "s2member"), get_defined_vars ());
|
96 |
}
|
97 |
else if ($original === "E-mail") // Give Filters a chance here.
|
98 |
{
|
99 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Email Address *", "s2member-front", "s2member"), get_defined_vars ());
|
100 |
}
|
101 |
}
|
102 |
|
103 |
+
else if ((isset ($s["is_wp_login_checkemail"]) && $s["is_wp_login_checkemail"]) || (!isset ($s["is_wp_login_checkemail"]) && ($s["is_wp_login_checkemail"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-login.php") !== false && empty($_REQUEST["action"]) && !empty($_REQUEST["checkemail"]) && $_REQUEST["checkemail"] === "registered") ? true : false)))
|
104 |
{
|
105 |
if ($original === "Registration complete. Please check your e-mail." && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
106 |
{
|
107 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("Registration complete. Please log in.", "s2member-front", "s2member"), get_defined_vars ());
|
108 |
}
|
109 |
}
|
110 |
|
111 |
else if ((isset ($s["is_user_new"]) && $s["is_user_new"]) || (!isset ($s["is_user_new"]) && ($s["is_user_new"] = (strpos ($_SERVER["REQUEST_URI"], "/wp-admin/user-new.php") !== false) ? true : false)))
|
112 |
{
|
113 |
+
if ($original === "Hi,\n\nYou have been invited to join '%s' at\n%s as a %s.\nPlease click the following link to confirm the invite:\n%s\n" && !empty($_REQUEST["role"]) && preg_match ("/^(subscriber|s2member_level[0-9]+)$/", $_REQUEST["role"]))
|
114 |
{
|
115 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ("You have been invited to join `%1\$s` at\n%2\$s as a Member.\nPlease click the following link to confirm the invite:\n%4\$s\n", "s2member-front", "s2member"), get_defined_vars ());
|
116 |
}
|
117 |
}
|
118 |
|
120 |
{
|
121 |
if ($original === 'Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>')
|
122 |
{
|
123 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ('Your account is now active. <a href="%1$s">Visit site</a> or <a href="%2$s">Log in</a>.', "s2member-front", "s2member"), get_defined_vars ());
|
124 |
}
|
125 |
}
|
126 |
|
128 |
{
|
129 |
if ($original === "If you’re not going to use a great site domain, leave it for a new user. Now have at it!")
|
130 |
{
|
131 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars ());
|
132 |
}
|
133 |
else if ($original === "Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!")
|
134 |
{
|
136 |
{
|
137 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
138 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
139 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
|
140 |
|
141 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
142 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
143 |
|
144 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . (($blogs_allowed > 1) ? '<br />' . sprintf (_nx ('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars ());
|
145 |
}
|
146 |
}
|
147 |
}
|
150 |
{
|
151 |
if ($original === "If you’re not going to use a great domain, leave it for a new user. Now have at it!")
|
152 |
{
|
153 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", "", get_defined_vars ());
|
154 |
}
|
155 |
else if ($original === "By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!")
|
156 |
{
|
158 |
{
|
159 |
$mms_options = c_ws_plugin__s2member_utilities::mms_options ();
|
160 |
$blogs_allowed = (int)@$mms_options["mms_registration_blogs_level" . c_ws_plugin__s2member_user_access::user_access_level ($user)];
|
161 |
+
$user_blogs = (is_array($blogs = get_blogs_of_user ($user->ID))) ? count ($blogs) - 1 : 0;
|
162 |
|
163 |
$user_blogs = ($user_blogs >= 0) ? $user_blogs : 0; // NOT less than zero.
|
164 |
$blogs_allowed = ($blogs_allowed >= 0) ? $blogs_allowed : 0;
|
165 |
|
166 |
+
$translated = apply_filters("ws_plugin__s2member_translation_mangler", _x ('By filling out the form below, you can <strong>add a site to your account</strong>.', "s2member-front", "s2member") . (($blogs_allowed > 1) ? '<br />' . sprintf (_nx ('You may create up to <strong>%s</strong> site.', 'You may create up to <strong>%s</strong> sites.', $blogs_allowed, "s2member-front", "s2member"), $blogs_allowed) : ''), get_defined_vars ());
|
167 |
}
|
168 |
}
|
169 |
}
|
includes/classes/user-access.inc.php
CHANGED
@@ -37,18 +37,18 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
37 |
* @package s2Member\User_Access
|
38 |
* @since 3.5
|
39 |
*
|
40 |
-
* @param
|
41 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function user_access_role ($user = FALSE)
|
45 |
{
|
46 |
-
if ((func_num_args () && (!is_object ($user) || empty
|
47 |
{
|
48 |
-
return apply_filters
|
49 |
}
|
50 |
else // Else we return the first Role in their array of assigned WordPress Roles.
|
51 |
-
return apply_filters
|
52 |
}
|
53 |
/**
|
54 |
* Determines Custom Capabilities of a User/Member.
|
@@ -60,25 +60,25 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
60 |
* @package s2Member\User_Access
|
61 |
* @since 3.5
|
62 |
*
|
63 |
-
* @param
|
64 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
65 |
* @return array Array of Custom Capabilities, or an empty array if they have no Custom Capabilities, or if ``$user`` does not exist, or if no User is currently logged-in.
|
66 |
*/
|
67 |
public static function user_access_ccaps ($user = FALSE)
|
68 |
{
|
69 |
-
if ((func_num_args () && (!is_object ($user) || empty
|
70 |
{
|
71 |
-
return apply_filters
|
72 |
}
|
73 |
else // Otherwise, we DO have the $user object available.
|
74 |
{
|
75 |
-
$ccaps = array
|
76 |
|
77 |
foreach ($user->allcaps as $cap => $cap_enabled)
|
78 |
if (preg_match ("/^access_s2member_ccap_/", $cap) && $cap_enabled)
|
79 |
$ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
|
80 |
|
81 |
-
return apply_filters
|
82 |
}
|
83 |
}
|
84 |
/**
|
@@ -91,26 +91,26 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
91 |
* @package s2Member\User_Access
|
92 |
* @since 3.5
|
93 |
*
|
94 |
-
* @param
|
95 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
96 |
* @return int Access Level#, `-1` if ``$user`` does not exist, or if no User is currently logged-in.
|
97 |
*/
|
98 |
public static function user_access_level ($user = FALSE)
|
99 |
{
|
100 |
-
if ((func_num_args () && (!is_object ($user) || empty
|
101 |
{
|
102 |
-
return apply_filters
|
103 |
}
|
104 |
|
105 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
106 |
{
|
107 |
if ($user->has_cap ("access_s2member_level" . $n)) // Testing for Membership Level Access.
|
108 |
{
|
109 |
-
return apply_filters
|
110 |
}
|
111 |
}
|
112 |
// Else we assume this is a "User" ( a Free Subscriber with an Access Level of 0. ).
|
113 |
-
return apply_filters
|
114 |
}
|
115 |
/**
|
116 |
* Determines Access Level of a specific Role.
|
@@ -118,29 +118,29 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
118 |
* @package s2Member\User_Access
|
119 |
* @since 3.5
|
120 |
*
|
121 |
-
* @param
|
122 |
* @return int Access Level#, `-1` if ``$role`` is empty.
|
123 |
*/
|
124 |
public static function user_access_role_to_level ($role = FALSE)
|
125 |
{
|
126 |
if (!($role = strtolower ($role))) // No ``$role`` provided. Default value of -1.
|
127 |
{
|
128 |
-
return apply_filters
|
129 |
}
|
130 |
-
else if (in_array
|
131 |
{
|
132 |
-
return apply_filters
|
133 |
}
|
134 |
else if (preg_match ("/^s2member_level([0-9]+)$/i", $role, $m) && $m[1] >= 1) // Test for s2Member Roles.
|
135 |
{
|
136 |
-
return apply_filters
|
137 |
}
|
138 |
else if ($role === "subscriber") // Testing for Free Subscriber Role.
|
139 |
{
|
140 |
-
return apply_filters
|
141 |
}
|
142 |
else // Else we assume this is a "User" ( a Free Subscriber with an Access Level of 0. ).
|
143 |
-
return apply_filters
|
144 |
}
|
145 |
/**
|
146 |
* Determines Access Label for a User/Member.
|
@@ -151,22 +151,22 @@ if (!class_exists ("c_ws_plugin__s2member_user_access"))
|
|
151 |
* @package s2Member\User_Access
|
152 |
* @since 3.5
|
153 |
*
|
154 |
-
* @param
|
155 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
156 |
-
* @return
|
157 |
*/
|
158 |
public static function user_access_label ($user = FALSE)
|
159 |
{
|
160 |
-
if ((func_num_args () && (!is_object ($user) || empty
|
161 |
{
|
162 |
-
return apply_filters
|
163 |
}
|
164 |
-
else if (($level = c_ws_plugin__s2member_user_access::user_access_level ($user)) >= 0 && !empty
|
165 |
{
|
166 |
-
return apply_filters
|
167 |
}
|
168 |
else // Else there is no Label configured for this User/Member. Return empty string.
|
169 |
-
return apply_filters
|
170 |
}
|
171 |
}
|
172 |
}
|
37 |
* @package s2Member\User_Access
|
38 |
* @since 3.5
|
39 |
*
|
40 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User.
|
41 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
42 |
+
* @return string Role ID/Name, or an empty string if they have no Role, or if ``$user`` does not exist, or if no User is currently logged-in.
|
43 |
*/
|
44 |
public static function user_access_role ($user = FALSE)
|
45 |
{
|
46 |
+
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
47 |
{
|
48 |
+
return apply_filters("ws_plugin__s2member_user_access_role", "", get_defined_vars ());
|
49 |
}
|
50 |
else // Else we return the first Role in their array of assigned WordPress Roles.
|
51 |
+
return apply_filters("ws_plugin__s2member_user_access_role", reset ($user->roles), get_defined_vars ());
|
52 |
}
|
53 |
/**
|
54 |
* Determines Custom Capabilities of a User/Member.
|
60 |
* @package s2Member\User_Access
|
61 |
* @since 3.5
|
62 |
*
|
63 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User.
|
64 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
65 |
* @return array Array of Custom Capabilities, or an empty array if they have no Custom Capabilities, or if ``$user`` does not exist, or if no User is currently logged-in.
|
66 |
*/
|
67 |
public static function user_access_ccaps ($user = FALSE)
|
68 |
{
|
69 |
+
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
70 |
{
|
71 |
+
return apply_filters("ws_plugin__s2member_user_access_ccaps", array(), get_defined_vars ());
|
72 |
}
|
73 |
else // Otherwise, we DO have the $user object available.
|
74 |
{
|
75 |
+
$ccaps = array(); // Initializes $ccaps array.
|
76 |
|
77 |
foreach ($user->allcaps as $cap => $cap_enabled)
|
78 |
if (preg_match ("/^access_s2member_ccap_/", $cap) && $cap_enabled)
|
79 |
$ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
|
80 |
|
81 |
+
return apply_filters("ws_plugin__s2member_user_access_ccaps", $ccaps, get_defined_vars ());
|
82 |
}
|
83 |
}
|
84 |
/**
|
91 |
* @package s2Member\User_Access
|
92 |
* @since 3.5
|
93 |
*
|
94 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User.
|
95 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
96 |
* @return int Access Level#, `-1` if ``$user`` does not exist, or if no User is currently logged-in.
|
97 |
*/
|
98 |
public static function user_access_level ($user = FALSE)
|
99 |
{
|
100 |
+
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
101 |
{
|
102 |
+
return apply_filters("ws_plugin__s2member_user_access_level", -1, get_defined_vars ()); // No $user, or NOT logged in.
|
103 |
}
|
104 |
|
105 |
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
106 |
{
|
107 |
if ($user->has_cap ("access_s2member_level" . $n)) // Testing for Membership Level Access.
|
108 |
{
|
109 |
+
return apply_filters("ws_plugin__s2member_user_access_level", $n, get_defined_vars ());
|
110 |
}
|
111 |
}
|
112 |
// Else we assume this is a "User" ( a Free Subscriber with an Access Level of 0. ).
|
113 |
+
return apply_filters("ws_plugin__s2member_user_access_level", 0, get_defined_vars ());
|
114 |
}
|
115 |
/**
|
116 |
* Determines Access Level of a specific Role.
|
118 |
* @package s2Member\User_Access
|
119 |
* @since 3.5
|
120 |
*
|
121 |
+
* @param string $role A WordPress Role ID/Name.
|
122 |
* @return int Access Level#, `-1` if ``$role`` is empty.
|
123 |
*/
|
124 |
public static function user_access_role_to_level ($role = FALSE)
|
125 |
{
|
126 |
if (!($role = strtolower ($role))) // No ``$role`` provided. Default value of -1.
|
127 |
{
|
128 |
+
return apply_filters("ws_plugin__s2member_user_access_role_to_level", -1, get_defined_vars ());
|
129 |
}
|
130 |
+
else if (in_array($role, array("administrator", "editor", "author", "contributor", "bbp_moderator")))
|
131 |
{
|
132 |
+
return apply_filters("ws_plugin__s2member_user_access_role_to_level", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"], get_defined_vars ());
|
133 |
}
|
134 |
else if (preg_match ("/^s2member_level([0-9]+)$/i", $role, $m) && $m[1] >= 1) // Test for s2Member Roles.
|
135 |
{
|
136 |
+
return apply_filters("ws_plugin__s2member_user_access_role_to_level", (int)$m[1], get_defined_vars ());
|
137 |
}
|
138 |
else if ($role === "subscriber") // Testing for Free Subscriber Role.
|
139 |
{
|
140 |
+
return apply_filters("ws_plugin__s2member_user_access_role_to_level", 0, get_defined_vars ());
|
141 |
}
|
142 |
else // Else we assume this is a "User" ( a Free Subscriber with an Access Level of 0. ).
|
143 |
+
return apply_filters("ws_plugin__s2member_user_access_role_to_level", 0, get_defined_vars ());
|
144 |
}
|
145 |
/**
|
146 |
* Determines Access Label for a User/Member.
|
151 |
* @package s2Member\User_Access
|
152 |
* @since 3.5
|
153 |
*
|
154 |
+
* @param object $user Optional. A `WP_User` object. Defaults to the current User.
|
155 |
* In order to check the current User, you must call this function with no arguments/parameters.
|
156 |
+
* @return string Access Level Label, empty string if ``$user`` does not exist, or if no User is currently logged-in.
|
157 |
*/
|
158 |
public static function user_access_label ($user = FALSE)
|
159 |
{
|
160 |
+
if ((func_num_args () && (!is_object ($user) || empty($user->ID))) || (!func_num_args () && !$user && (!is_object ($user = (is_user_logged_in ()) ? wp_get_current_user () : false) || empty($user->ID))))
|
161 |
{
|
162 |
+
return apply_filters("ws_plugin__s2member_user_access_label", "", get_defined_vars ()); // No $user, or NOT logged in.
|
163 |
}
|
164 |
+
else if (($level = c_ws_plugin__s2member_user_access::user_access_level ($user)) >= 0 && !empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]))
|
165 |
{
|
166 |
+
return apply_filters("ws_plugin__s2member_user_access_label", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"], get_defined_vars ());
|
167 |
}
|
168 |
else // Else there is no Label configured for this User/Member. Return empty string.
|
169 |
+
return apply_filters("ws_plugin__s2member_user_access_label", "", get_defined_vars ());
|
170 |
}
|
171 |
}
|
172 |
}
|
includes/classes/user-deletions.inc.php
CHANGED
@@ -35,41 +35,41 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
35 |
*
|
36 |
* @attaches-to ``add_action("remove_user_from_blog");``
|
37 |
*
|
38 |
-
* @param int|
|
39 |
-
* @param int|
|
40 |
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
|
41 |
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
|
42 |
* @return null
|
43 |
*/
|
44 |
public static function handle_ms_user_deletions ($user_id = FALSE, $blog_id = FALSE, $s2says = FALSE)
|
45 |
{
|
46 |
-
static $processed = array
|
47 |
global $pagenow; // Need this to detect the current admin page.
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
-
do_action
|
51 |
-
unset
|
52 |
|
53 |
-
if (is_multisite () && empty
|
54 |
{
|
55 |
if (($s2says || (is_blog_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true))
|
56 |
// Do NOT react on this globally. There are many routines that remove Users for different/minor reasons.
|
57 |
{
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
-
do_action
|
60 |
-
unset
|
61 |
|
62 |
c_ws_plugin__s2member_user_deletions::handle_user_deletions ($user_id); // Hand this over.
|
63 |
|
64 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
65 |
-
do_action
|
66 |
-
unset
|
67 |
}
|
68 |
}
|
69 |
|
70 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
71 |
-
do_action
|
72 |
-
unset
|
73 |
|
74 |
return /* Return for uniformity. */;
|
75 |
}
|
@@ -82,21 +82,21 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
82 |
* @attaches-to ``add_action("delete_user");``
|
83 |
* @attaches-to ``add_action("wpmu_delete_user");``
|
84 |
*
|
85 |
-
* @param int|
|
86 |
* @return null
|
87 |
*/
|
88 |
public static function handle_user_deletions ($user_id = FALSE)
|
89 |
{
|
90 |
-
static $processed = array
|
91 |
|
92 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
93 |
-
do_action
|
94 |
-
unset
|
95 |
|
96 |
-
if (empty
|
97 |
{
|
98 |
$eot_del_type = // Configure EOT/Del type (possibly through a global variable made available in other routines).
|
99 |
-
(!empty
|
100 |
$GLOBALS["ws_plugin__s2member_eot_del_type"] : "user-removal-deletion"; // Else use default.
|
101 |
|
102 |
$custom = get_user_option ("s2member_custom", $user_id); // An EOT Notification is triggered, EVEN if empty.
|
@@ -105,9 +105,9 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
105 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // In API Notifications.
|
106 |
|
107 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
108 |
-
do_action
|
109 |
-
do_action
|
110 |
-
unset
|
111 |
|
112 |
delete_user_option ($user_id, "s2member_custom"); // Remove User options (for this Blog).
|
113 |
delete_user_option ($user_id, "s2member_subscr_id");
|
@@ -132,7 +132,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
132 |
delete_user_option ($user_id, "s2member_login_counter");
|
133 |
delete_user_option ($user_id, "s2member_notes");
|
134 |
|
135 |
-
if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array
|
136 |
{
|
137 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications on user deletion.
|
138 |
|
@@ -144,7 +144,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
144 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
145 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
146 |
{
|
147 |
-
if (is_array
|
148 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
149 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
150 |
break;
|
@@ -154,7 +154,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
154 |
}
|
155 |
}
|
156 |
|
157 |
-
if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array
|
158 |
{
|
159 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
160 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
@@ -172,7 +172,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
172 |
$msg .= "user_ip: %%user_ip%%\n";
|
173 |
$msg .= "user_id: %%user_id%%\n";
|
174 |
|
175 |
-
if (is_array
|
176 |
foreach ($fields as $var => $val)
|
177 |
$msg .= $var . ": %%" . $var . "%%\n";
|
178 |
|
@@ -195,7 +195,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
195 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
196 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
197 |
{
|
198 |
-
if (is_array
|
199 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
200 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
201 |
break;
|
@@ -203,7 +203,7 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
203 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
204 |
|
205 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
206 |
-
wp_mail ($recipient, apply_filters
|
207 |
}
|
208 |
|
209 |
if ($email_configs_were_on) // Back on?
|
@@ -211,13 +211,13 @@ if (!class_exists ("c_ws_plugin__s2member_user_deletions"))
|
|
211 |
}
|
212 |
|
213 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
214 |
-
do_action
|
215 |
-
unset
|
216 |
}
|
217 |
|
218 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
219 |
-
do_action
|
220 |
-
unset
|
221 |
|
222 |
return /* Return for uniformity. */;
|
223 |
}
|
35 |
*
|
36 |
* @attaches-to ``add_action("remove_user_from_blog");``
|
37 |
*
|
38 |
+
* @param int|string $user_id Numeric WordPress User ID.
|
39 |
+
* @param int|string $blog_id Numeric WordPress Blog ID.
|
40 |
* @param bool $s2says Optional. Defaults to false. If true, it's definitely OK to process this deletion?
|
41 |
* The ``$s2says`` flag can be used when/if the routine is called directly for whatever reason.
|
42 |
* @return null
|
43 |
*/
|
44 |
public static function handle_ms_user_deletions ($user_id = FALSE, $blog_id = FALSE, $s2says = FALSE)
|
45 |
{
|
46 |
+
static $processed = array(); // No duplicate processing.
|
47 |
global $pagenow; // Need this to detect the current admin page.
|
48 |
|
49 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
50 |
+
do_action("ws_plugin__s2member_before_handle_ms_user_deletions", get_defined_vars ());
|
51 |
+
unset($__refs, $__v);
|
52 |
|
53 |
+
if (is_multisite () && empty($processed[$user_id])) // Safeguard this routine against duplicate processing.
|
54 |
{
|
55 |
if (($s2says || (is_blog_admin () && $pagenow === "users.php")) && ($processed[$user_id] = true))
|
56 |
// Do NOT react on this globally. There are many routines that remove Users for different/minor reasons.
|
57 |
{
|
58 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
59 |
+
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_before", get_defined_vars ());
|
60 |
+
unset($__refs, $__v);
|
61 |
|
62 |
c_ws_plugin__s2member_user_deletions::handle_user_deletions ($user_id); // Hand this over.
|
63 |
|
64 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
65 |
+
do_action("ws_plugin__s2member_during_handle_ms_user_deletions_after", get_defined_vars ());
|
66 |
+
unset($__refs, $__v);
|
67 |
}
|
68 |
}
|
69 |
|
70 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
71 |
+
do_action("ws_plugin__s2member_after_handle_ms_user_deletions", get_defined_vars ());
|
72 |
+
unset($__refs, $__v);
|
73 |
|
74 |
return /* Return for uniformity. */;
|
75 |
}
|
82 |
* @attaches-to ``add_action("delete_user");``
|
83 |
* @attaches-to ``add_action("wpmu_delete_user");``
|
84 |
*
|
85 |
+
* @param int|string $user_id Numeric WordPress User ID.
|
86 |
* @return null
|
87 |
*/
|
88 |
public static function handle_user_deletions ($user_id = FALSE)
|
89 |
{
|
90 |
+
static $processed = array(); // No duplicate processing.
|
91 |
|
92 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
93 |
+
do_action("ws_plugin__s2member_before_handle_user_deletions", get_defined_vars ());
|
94 |
+
unset($__refs, $__v);
|
95 |
|
96 |
+
if (empty($processed[$user_id]) && ($processed[$user_id] = true)) // Safeguard this routine against duplicate processing.
|
97 |
{
|
98 |
$eot_del_type = // Configure EOT/Del type (possibly through a global variable made available in other routines).
|
99 |
+
(!empty($GLOBALS["ws_plugin__s2member_eot_del_type"])) ? // Is the global available for use?
|
100 |
$GLOBALS["ws_plugin__s2member_eot_del_type"] : "user-removal-deletion"; // Else use default.
|
101 |
|
102 |
$custom = get_user_option ("s2member_custom", $user_id); // An EOT Notification is triggered, EVEN if empty.
|
105 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id); // In API Notifications.
|
106 |
|
107 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
108 |
+
do_action("ws_plugin__s2member_during_handle_user_before_deletions", get_defined_vars ());
|
109 |
+
do_action("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
|
110 |
+
unset($__refs, $__v);
|
111 |
|
112 |
delete_user_option ($user_id, "s2member_custom"); // Remove User options (for this Blog).
|
113 |
delete_user_option ($user_id, "s2member_subscr_id");
|
132 |
delete_user_option ($user_id, "s2member_login_counter");
|
133 |
delete_user_option ($user_id, "s2member_notes");
|
134 |
|
135 |
+
if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array($cv = preg_split ("/\|/", $custom)))
|
136 |
{
|
137 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications on user deletion.
|
138 |
|
144 |
if (($url = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_reg_ip)), $url)))
|
145 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
146 |
{
|
147 |
+
if (is_array($fields) && !empty($fields))
|
148 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
149 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
150 |
break;
|
154 |
}
|
155 |
}
|
156 |
|
157 |
+
if (is_object ($user = new WP_User ($user_id)) && $user->ID && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array($cv = preg_split ("/\|/", $custom)))
|
158 |
{
|
159 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
160 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
172 |
$msg .= "user_ip: %%user_ip%%\n";
|
173 |
$msg .= "user_id: %%user_id%%\n";
|
174 |
|
175 |
+
if (is_array($fields) && !empty($fields))
|
176 |
foreach ($fields as $var => $val)
|
177 |
$msg .= $var . ": %%" . $var . "%%\n";
|
178 |
|
195 |
if (($msg = preg_replace ("/%%user_ip%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_reg_ip), $msg)))
|
196 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
197 |
{
|
198 |
+
if (is_array($fields) && !empty($fields))
|
199 |
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
200 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
201 |
break;
|
203 |
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg)))) // Still have a ``$sbj`` and a ``$msg``?
|
204 |
|
205 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
206 |
+
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");
|
207 |
}
|
208 |
|
209 |
if ($email_configs_were_on) // Back on?
|
211 |
}
|
212 |
|
213 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
214 |
+
do_action("ws_plugin__s2member_during_handle_user_deletions", get_defined_vars ());
|
215 |
+
unset($__refs, $__v);
|
216 |
}
|
217 |
|
218 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
219 |
+
do_action("ws_plugin__s2member_after_handle_user_deletions", get_defined_vars ());
|
220 |
+
unset($__refs, $__v);
|
221 |
|
222 |
return /* Return for uniformity. */;
|
223 |
}
|
includes/classes/user-drip-access.inc.php
DELETED
@@ -1,147 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* User drip access routines.
|
4 |
-
*
|
5 |
-
* Copyright: © 2009-2014 (coded in the USA)
|
6 |
-
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
*
|
8 |
-
* Released under the terms of the GNU General Public License.
|
9 |
-
* You should have received a copy of the GNU General Public License,
|
10 |
-
* along with this software. In the main directory, see: /licensing/
|
11 |
-
* If not, see: {@link http://www.gnu.org/licenses/}.
|
12 |
-
*
|
13 |
-
* @package s2Member\User_Drip_Access
|
14 |
-
* @since 140514
|
15 |
-
*/
|
16 |
-
if(realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']))
|
17 |
-
exit ('Do not access this file directly.');
|
18 |
-
|
19 |
-
if(!class_exists('c_ws_plugin__s2member_user_drip_access'))
|
20 |
-
{
|
21 |
-
/**
|
22 |
-
* User drip access routines.
|
23 |
-
*
|
24 |
-
* @package s2Member\User_Drip_Access
|
25 |
-
* @since 140514
|
26 |
-
*
|
27 |
-
* @note MUST use `self::` instead of `static::` for PHP v5.2 compat.
|
28 |
-
*/
|
29 |
-
class c_ws_plugin__s2member_user_drip_access
|
30 |
-
{
|
31 |
-
/**
|
32 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
33 |
-
* @var integer Current `$from_day`; used by callback.
|
34 |
-
*/
|
35 |
-
protected static $from_day = 0;
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
39 |
-
* @var integer Current `$to_day`; used by callback.
|
40 |
-
*/
|
41 |
-
protected static $to_day = 0;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
45 |
-
* @var integer Current `$user_id`; used by callback.
|
46 |
-
*/
|
47 |
-
protected static $user_id = 0;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
51 |
-
* @var array Current array of paid times for {@link $user_id}.
|
52 |
-
*/
|
53 |
-
protected static $all_paid_reg_times = array();
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
57 |
-
* @var array Current array of access capability times for {@link $user_id}.
|
58 |
-
*/
|
59 |
-
protected static $all_access_cap_times = array();
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Conditional check for drip access.
|
63 |
-
*
|
64 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
65 |
-
*
|
66 |
-
* @param string $access Required; conditional expression with access_s2member_ capabilities
|
67 |
-
* (i.e. leveln, ccap_name), e.g. `level2` or `level3 and (ccap_music or ccap_videos)`.
|
68 |
-
* Note that `and`, `or` MUST be used in place of `&&`, `||` due to sanitation routines.
|
69 |
-
* The `$access` string may contain only `[A-Za-z0-9 _()]`.
|
70 |
-
*
|
71 |
-
* @param integer $from_day Optional. Defaults to `0`. Any value greater than or equal to `0`.
|
72 |
-
* @param integer $to_day Optional. Defaults to `0`. Any value greater than or equal to `0`.
|
73 |
-
*
|
74 |
-
* @param null|integer $user_id Optional. A `NULL` value indicates the current user.
|
75 |
-
*
|
76 |
-
* @return boolean `TRUE` if user can `$access`; and dripping should occur; based on `$from_day` & `$to_day`.
|
77 |
-
*
|
78 |
-
* @triggers `E_USER_ERROR` if an invalid `$access` syntax is detected; with invalid chars.
|
79 |
-
* @triggers `E_USER_ERROR` if an invalid `$access` syntax is detected; without any word chars.
|
80 |
-
*/
|
81 |
-
public static function user_can_access_drip($access, $from_day = 0, $to_day = 0, $user_id = NULL)
|
82 |
-
{
|
83 |
-
$drip = FALSE;
|
84 |
-
$access = trim((string)$access);
|
85 |
-
$from_day = self::$from_day = (integer)$from_day;
|
86 |
-
$to_day = self::$to_day = (integer)$to_day;
|
87 |
-
|
88 |
-
if(!isset($user_id))
|
89 |
-
$user_id = get_current_user_id();
|
90 |
-
$user_id = self::$user_id = (integer)$user_id;
|
91 |
-
|
92 |
-
if(user_can($user_id, 'administrator'))
|
93 |
-
$drip = TRUE;
|
94 |
-
|
95 |
-
else if($access && $user_id)
|
96 |
-
{
|
97 |
-
if(!is_array($all_access_cap_times = self::$all_access_cap_times = c_ws_plugin__s2member_access_cap_times::get_access_cap_times($user_id)))
|
98 |
-
$all_access_cap_times = self::$all_access_cap_times = array();
|
99 |
-
|
100 |
-
$access_expression = strtolower($access); // e.g. 'level1 and ccap_music'
|
101 |
-
$access_expression = trim(preg_replace('/[^a-z0-9 _()]/', '', $access_expression, -1, $invalid_chars));
|
102 |
-
$access_expression = str_replace(array(' and ', ' or '), array(' && ', ' || '), $access_expression);
|
103 |
-
|
104 |
-
if($invalid_chars)
|
105 |
-
trigger_error('Syntax error: invalid chars. Please use only `A-Za-z0-9 _()` in the `access` parameter of s2Drip.', E_USER_ERROR);
|
106 |
-
|
107 |
-
if(!$access_expression || !preg_match('/\w+/', $access_expression))
|
108 |
-
trigger_error('Syntax error: no word chars in `access` parameter of s2Drip. Valid example: `level1 and ccap_music`.', E_USER_ERROR);
|
109 |
-
|
110 |
-
$access_expression = preg_replace_callback('/\w+/', 'self::_user_can_access_drip_cb', $access_expression);
|
111 |
-
$drip = eval('return ('.$access_expression.');');
|
112 |
-
}
|
113 |
-
return apply_filters('ws_plugin__s2member_user_can_access_drip', $drip, get_defined_vars());
|
114 |
-
}
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Conditional check for drip access (callback).
|
118 |
-
*
|
119 |
-
* @since 140514 Enhancing `[s2Drip]` shortcode.
|
120 |
-
*
|
121 |
-
* @param array $cap Regex matches passed via {@link \preg_replace_callback()}.
|
122 |
-
*
|
123 |
-
* @return string One of `TRUE` or `FALSE`; as a string value.
|
124 |
-
*/
|
125 |
-
protected static function _user_can_access_drip_cb($cap)
|
126 |
-
{
|
127 |
-
$drip = 'FALSE';
|
128 |
-
$cap = (string)$cap[0];
|
129 |
-
|
130 |
-
if($cap && user_can(self::$user_id, 'access_s2member_'.$cap))
|
131 |
-
{
|
132 |
-
$time = time();
|
133 |
-
$cap_times = array_keys(self::$all_access_cap_times, $cap, TRUE);
|
134 |
-
$cap_time_latest = $cap_times ? max($cap_times) : 0;
|
135 |
-
|
136 |
-
if($cap_time_latest && $time > ($cap_time_latest + (max(0, (self::$from_day - 1)) * 86400)))
|
137 |
-
{
|
138 |
-
$drip = 'TRUE'; // At/after $from_day.
|
139 |
-
if(self::$to_day > 0 && $time > ($cap_time_latest + (self::$to_day * 86400)))
|
140 |
-
$drip = 'FALSE'; // After $to_day.
|
141 |
-
}
|
142 |
-
}
|
143 |
-
|
144 |
-
return apply_filters('ws_plugin__s2member_user_can_access_drip_cb', $drip, get_defined_vars());
|
145 |
-
}
|
146 |
-
}
|
147 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/user-new-in.inc.php
CHANGED
@@ -37,15 +37,15 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
37 |
*
|
38 |
* @attaches-to ``ob_start("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");``
|
39 |
*
|
40 |
-
* @return
|
41 |
*/
|
42 |
public static function _admin_user_new_fields ($buffer = FALSE)
|
43 |
{
|
44 |
global $pagenow; // The current admin page file name.
|
45 |
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
-
do_action
|
48 |
-
unset
|
49 |
|
50 |
if (is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
|
51 |
{
|
@@ -58,14 +58,14 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
58 |
$unfs .= '<table class="form-table">' . "\n";
|
59 |
|
60 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
61 |
-
do_action
|
62 |
-
unset
|
63 |
|
64 |
if (is_multisite ()) // Multisite Networking is currently lacking these fields; we pop them in.
|
65 |
{
|
66 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
67 |
-
do_action
|
68 |
-
unset
|
69 |
|
70 |
$unfs .= '<tr>' . "\n";
|
71 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-first-name">First Name:</label></th>' . "\n";
|
@@ -73,12 +73,12 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
73 |
$unfs .= '</tr>' . "\n";
|
74 |
|
75 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
76 |
-
do_action
|
77 |
-
unset
|
78 |
|
79 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
80 |
-
do_action
|
81 |
-
unset
|
82 |
|
83 |
$unfs .= '<tr>' . "\n";
|
84 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-last-name">Last Name:</label></th>' . "\n";
|
@@ -86,30 +86,30 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
86 |
$unfs .= '</tr>' . "\n";
|
87 |
|
88 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
89 |
-
do_action
|
90 |
-
unset
|
91 |
}
|
92 |
|
93 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
94 |
-
do_action
|
95 |
-
unset
|
96 |
|
97 |
$unfs .= '<tr>' . "\n";
|
98 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
99 |
$unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:25em;"><option value=""></option>' . "\n";
|
100 |
-
foreach (apply_filters
|
101 |
$unfs .= '<option value="' . esc_attr ($gateway) . '"' . (($gateway === $_p["ws_plugin__s2member_user_new_s2member_subscr_gateway"]) ? ' selected="selected"' : '') . '>' . esc_html ($gateway_name) . '</option>' . "\n";
|
102 |
$unfs .= '</select>' . "\n";
|
103 |
$unfs .= '</td>' . "\n";
|
104 |
$unfs .= '</tr>' . "\n";
|
105 |
|
106 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
107 |
-
do_action
|
108 |
-
unset
|
109 |
|
110 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
111 |
-
do_action
|
112 |
-
unset
|
113 |
|
114 |
$unfs .= '<tr>' . "\n";
|
115 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... if there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
@@ -117,12 +117,12 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
117 |
$unfs .= '</tr>' . "\n";
|
118 |
|
119 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
120 |
-
do_action
|
121 |
-
unset
|
122 |
|
123 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
124 |
-
do_action
|
125 |
-
unset
|
126 |
|
127 |
$unfs .= '<tr>' . "\n";
|
128 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-custom">Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
@@ -130,12 +130,12 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
130 |
$unfs .= '</tr>' . "\n";
|
131 |
|
132 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
133 |
-
do_action
|
134 |
-
unset
|
135 |
|
136 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
137 |
-
do_action
|
138 |
-
unset
|
139 |
|
140 |
$unfs .= '<tr>' . "\n";
|
141 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-registration-ip">Registration IP:</label> <a href="#" onclick="alert(\'This is the IP Address the User had at the time of registration. If you don\\\'t know the User\\\'s IP Address, just leave this blank. If this is left empty, s2Member will make attempts in the future to grab the User\\\'s IP Address.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
@@ -143,15 +143,15 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
143 |
$unfs .= '</tr>' . "\n";
|
144 |
|
145 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
146 |
-
do_action
|
147 |
-
unset
|
148 |
|
149 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
150 |
// ^ Will change once Custom Capabilities are compatible with a Blog Farm.
|
151 |
{
|
152 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
153 |
-
do_action
|
154 |
-
unset
|
155 |
|
156 |
$unfs .= '<tr>' . "\n";
|
157 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-ccaps">Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -› API Scripting -› Custom Capabilities.' . ((is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
@@ -159,13 +159,13 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
159 |
$unfs .= '</tr>' . "\n";
|
160 |
|
161 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
162 |
-
do_action
|
163 |
-
unset
|
164 |
}
|
165 |
|
166 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
167 |
-
do_action
|
168 |
-
unset
|
169 |
|
170 |
$unfs .= '<tr>' . "\n";
|
171 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-auto-eot-time">Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>(<a href="http://www.world-time-zones.org/zones/greenwich-mean-time.htm" target="_blank" rel="external">Universal Time / GMT</a>)</small>' : '') . '</th>' . "\n";
|
@@ -173,14 +173,14 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
173 |
$unfs .= '</tr>' . "\n";
|
174 |
|
175 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
176 |
-
do_action
|
177 |
-
unset
|
178 |
|
179 |
if (c_ws_plugin__s2member_list_servers::list_servers_integrated ()) // Only if integrated with s2Member.
|
180 |
{
|
181 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
182 |
-
do_action
|
183 |
-
unset
|
184 |
|
185 |
$unfs .= '<tr>' . "\n";
|
186 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-opt-in">Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box unchecked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
@@ -188,8 +188,8 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
188 |
$unfs .= '</tr>' . "\n";
|
189 |
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
-
do_action
|
192 |
-
unset
|
193 |
}
|
194 |
|
195 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) // Now, do we have Custom Fields?
|
@@ -202,42 +202,42 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
202 |
$unfs .= '</tr>' . "\n";
|
203 |
|
204 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
205 |
-
do_action
|
206 |
-
unset
|
207 |
|
208 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
209 |
{
|
210 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
211 |
-
do_action
|
212 |
-
unset
|
213 |
|
214 |
-
if (in_array
|
215 |
{
|
216 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
217 |
$field_id_class = preg_replace ("/_/", "-", $field_var);
|
218 |
|
219 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
220 |
-
if (apply_filters
|
221 |
{
|
222 |
-
if (!empty
|
223 |
-
$unfs .= '<tr><td colspan="2"><div class="ws-plugin--s2member-user-new-divider-section' . ((!empty
|
224 |
|
225 |
$unfs .= '<tr>' . "\n";
|
226 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-' . esc_attr ($field_id_class) . '">' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
|
227 |
$unfs .= '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_user_new_", "ws-plugin--s2member-user-new-", "", ((preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $_p, $_p["ws_plugin__s2member_user_new_" . $field_var], "administrative") . '</td>' . "\n";
|
228 |
$unfs .= '</tr>' . "\n";
|
229 |
}
|
230 |
-
unset
|
231 |
}
|
232 |
|
233 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
234 |
-
do_action
|
235 |
-
unset
|
236 |
}
|
237 |
|
238 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
239 |
-
do_action
|
240 |
-
unset
|
241 |
|
242 |
$unfs .= '<tr>' . "\n";
|
243 |
$unfs .= '<td colspan="2">' . "\n";
|
@@ -247,8 +247,8 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
247 |
}
|
248 |
|
249 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
250 |
-
do_action
|
251 |
-
unset
|
252 |
|
253 |
$unfs .= '<tr>' . "\n";
|
254 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-notes">Administrative Notes:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occasionally, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a><br /><br /><small>These Notations are private; Users/Members will never see any of these notes.</small></th>' . "\n";
|
@@ -256,12 +256,12 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
256 |
$unfs .= '</tr>' . "\n";
|
257 |
|
258 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
259 |
-
do_action
|
260 |
-
unset
|
261 |
|
262 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
263 |
-
do_action
|
264 |
-
unset
|
265 |
|
266 |
$unfs .= '</table>' . "\n";
|
267 |
|
@@ -271,10 +271,10 @@ if (!class_exists ("c_ws_plugin__s2member_user_new_in"))
|
|
271 |
}
|
272 |
|
273 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
274 |
-
do_action
|
275 |
-
unset
|
276 |
|
277 |
-
return apply_filters
|
278 |
}
|
279 |
}
|
280 |
}
|
37 |
*
|
38 |
* @attaches-to ``ob_start("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");``
|
39 |
*
|
40 |
+
* @return string Output buffer.
|
41 |
*/
|
42 |
public static function _admin_user_new_fields ($buffer = FALSE)
|
43 |
{
|
44 |
global $pagenow; // The current admin page file name.
|
45 |
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
+
do_action("_ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
|
48 |
+
unset($__refs, $__v);
|
49 |
|
50 |
if (is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
|
51 |
{
|
58 |
$unfs .= '<table class="form-table">' . "\n";
|
59 |
|
60 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
61 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before", get_defined_vars ());
|
62 |
+
unset($__refs, $__v);
|
63 |
|
64 |
if (is_multisite ()) // Multisite Networking is currently lacking these fields; we pop them in.
|
65 |
{
|
66 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
67 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_first_name", get_defined_vars ());
|
68 |
+
unset($__refs, $__v);
|
69 |
|
70 |
$unfs .= '<tr>' . "\n";
|
71 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-first-name">First Name:</label></th>' . "\n";
|
73 |
$unfs .= '</tr>' . "\n";
|
74 |
|
75 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
76 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_first_name", get_defined_vars ());
|
77 |
+
unset($__refs, $__v);
|
78 |
|
79 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
80 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_last_name", get_defined_vars ());
|
81 |
+
unset($__refs, $__v);
|
82 |
|
83 |
$unfs .= '<tr>' . "\n";
|
84 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-last-name">Last Name:</label></th>' . "\n";
|
86 |
$unfs .= '</tr>' . "\n";
|
87 |
|
88 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
89 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_last_name", get_defined_vars ());
|
90 |
+
unset($__refs, $__v);
|
91 |
}
|
92 |
|
93 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
94 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_gateway", get_defined_vars ());
|
95 |
+
unset($__refs, $__v);
|
96 |
|
97 |
$unfs .= '<tr>' . "\n";
|
98 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
99 |
$unfs .= '<td><select name="ws_plugin__s2member_user_new_s2member_subscr_gateway" id="ws-plugin--s2member-user-new-s2member-subscr-gateway" style="width:25em;"><option value=""></option>' . "\n";
|
100 |
+
foreach (apply_filters("ws_plugin__s2member_profile_s2member_subscr_gateways", array("paypal" => "PayPal (code: paypal)"), get_defined_vars ()) as $gateway => $gateway_name)
|
101 |
$unfs .= '<option value="' . esc_attr ($gateway) . '"' . (($gateway === $_p["ws_plugin__s2member_user_new_s2member_subscr_gateway"]) ? ' selected="selected"' : '') . '>' . esc_html ($gateway_name) . '</option>' . "\n";
|
102 |
$unfs .= '</select>' . "\n";
|
103 |
$unfs .= '</td>' . "\n";
|
104 |
$unfs .= '</tr>' . "\n";
|
105 |
|
106 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
107 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_gateway", get_defined_vars ());
|
108 |
+
unset($__refs, $__v);
|
109 |
|
110 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
111 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_subscr_id", get_defined_vars ());
|
112 |
+
unset($__refs, $__v);
|
113 |
|
114 |
$unfs .= '<tr>' . "\n";
|
115 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). Under normal circumstances, this is filled automatically by s2Member. This field is ONLY here for Customer Service purposes; just in case you ever need to enter a Paid Subscr. Gateway/ID manually. This field will be empty for Free Subscribers, and/or anyone who is NOT paying you.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... if there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
117 |
$unfs .= '</tr>' . "\n";
|
118 |
|
119 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
120 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_subscr_id", get_defined_vars ());
|
121 |
+
unset($__refs, $__v);
|
122 |
|
123 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
124 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_custom", get_defined_vars ());
|
125 |
+
unset($__refs, $__v);
|
126 |
|
127 |
$unfs .= '<tr>' . "\n";
|
128 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-custom">Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\'' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n' . c_ws_plugin__s2member_utils_strings::esc_js_sq (esc_attr ($_SERVER["HTTP_HOST"]), 3) . '|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
130 |
$unfs .= '</tr>' . "\n";
|
131 |
|
132 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
133 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_custom", get_defined_vars ());
|
134 |
+
unset($__refs, $__v);
|
135 |
|
136 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
137 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_registration_ip", get_defined_vars ());
|
138 |
+
unset($__refs, $__v);
|
139 |
|
140 |
$unfs .= '<tr>' . "\n";
|
141 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-registration-ip">Registration IP:</label> <a href="#" onclick="alert(\'This is the IP Address the User had at the time of registration. If you don\\\'t know the User\\\'s IP Address, just leave this blank. If this is left empty, s2Member will make attempts in the future to grab the User\\\'s IP Address.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
143 |
$unfs .= '</tr>' . "\n";
|
144 |
|
145 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
146 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_registration_ip", get_defined_vars ());
|
147 |
+
unset($__refs, $__v);
|
148 |
|
149 |
if (!is_multisite () || !c_ws_plugin__s2member_utils_conds::is_multisite_farm () || is_main_site ())
|
150 |
// ^ Will change once Custom Capabilities are compatible with a Blog Farm.
|
151 |
{
|
152 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
153 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_ccaps", get_defined_vars ());
|
154 |
+
unset($__refs, $__v);
|
155 |
|
156 |
$unfs .= '<tr>' . "\n";
|
157 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-ccaps">Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -› API Scripting -› Custom Capabilities.' . ((is_multisite ()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '') . '\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
159 |
$unfs .= '</tr>' . "\n";
|
160 |
|
161 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
162 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_ccaps", get_defined_vars ());
|
163 |
+
unset($__refs, $__v);
|
164 |
}
|
165 |
|
166 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
167 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_auto_eot_time", get_defined_vars ());
|
168 |
+
unset($__refs, $__v);
|
169 |
|
170 |
$unfs .= '<tr>' . "\n";
|
171 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-auto-eot-time">Automatic EOT Time:</label> <a href="#" onclick="alert(\'EOT = End Of Term. ( i.e. Account Expiration / Termination. ).\\n\\nIf you leave this empty, s2Member will configure an EOT Time automatically, based on the paid Subscription associated with this account. In other words, if a paid Subscription expires, is cancelled, terminated, refunded, reversed, or charged back to you; s2Member will deal with the EOT automatically.\\n\\nThat being said, if you would rather take control over this, you can. If you type in a date manually, s2Member will obey the Auto-EOT Time that you\\\'ve given, no matter what. In other words, you can force certain Members to expire automatically, at a time that you specify. s2Member will obey.\\n\\nValid formats for Automatic EOT Time:\\n\\nmm/dd/yyyy\\nyyyy-mm-dd\\n+1 year\\n+2 weeks\\n+2 months\\n+10 minutes\\nnext thursday\\ntomorrow\\ntoday\\n\\n* anything compatible with PHP\\\'s strtotime() function.\'); return false;" tabindex="-1">[?]</a>' . (($auto_eot_time) ? '<br /><small>(<a href="http://www.world-time-zones.org/zones/greenwich-mean-time.htm" target="_blank" rel="external">Universal Time / GMT</a>)</small>' : '') . '</th>' . "\n";
|
173 |
$unfs .= '</tr>' . "\n";
|
174 |
|
175 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
176 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_auto_eot_time", get_defined_vars ());
|
177 |
+
unset($__refs, $__v);
|
178 |
|
179 |
if (c_ws_plugin__s2member_list_servers::list_servers_integrated ()) // Only if integrated with s2Member.
|
180 |
{
|
181 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
182 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_opt_in", get_defined_vars ());
|
183 |
+
unset($__refs, $__v);
|
184 |
|
185 |
$unfs .= '<tr>' . "\n";
|
186 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-opt-in">Process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to process a confirmation request for this new User? If not, just leave the box unchecked.\'); return false;" tabindex="-1">[?]</a></th>' . "\n";
|
188 |
$unfs .= '</tr>' . "\n";
|
189 |
|
190 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
191 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_opt_in", get_defined_vars ());
|
192 |
+
unset($__refs, $__v);
|
193 |
}
|
194 |
|
195 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) // Now, do we have Custom Fields?
|
202 |
$unfs .= '</tr>' . "\n";
|
203 |
|
204 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
205 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_custom_fields", get_defined_vars ());
|
206 |
+
unset($__refs, $__v);
|
207 |
|
208 |
foreach (json_decode ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
209 |
{
|
210 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
211 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_before", get_defined_vars ());
|
212 |
+
unset($__refs, $__v);
|
213 |
|
214 |
+
if (in_array($field["id"], $fields_applicable)) // Field applicable?
|
215 |
{
|
216 |
$field_var = preg_replace ("/[^a-z0-9]/i", "_", strtolower ($field["id"]));
|
217 |
$field_id_class = preg_replace ("/_/", "-", $field_var);
|
218 |
|
219 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
220 |
+
if (apply_filters("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_display", true, get_defined_vars ()))
|
221 |
{
|
222 |
+
if (!empty($field["section"]) && $field["section"] === "yes") // Starts a new section?
|
223 |
+
$unfs .= '<tr><td colspan="2"><div class="ws-plugin--s2member-user-new-divider-section' . ((!empty($field["sectitle"])) ? '-title' : '') . '">' . ((!empty($field["sectitle"])) ? $field["sectitle"] : '') . '</div></td></tr>';
|
224 |
|
225 |
$unfs .= '<tr>' . "\n";
|
226 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-' . esc_attr ($field_id_class) . '">' . ((preg_match ("/^(checkbox|pre_checkbox)$/", $field["type"])) ? ucwords (preg_replace ("/_/", " ", $field_var)) : $field["label"]) . ':</label></th>' . "\n";
|
227 |
$unfs .= '<td>' . c_ws_plugin__s2member_custom_reg_fields::custom_field_gen (__FUNCTION__, $field, "ws_plugin__s2member_user_new_", "ws-plugin--s2member-user-new-", "", ((preg_match ("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $_p, $_p["ws_plugin__s2member_user_new_" . $field_var], "administrative") . '</td>' . "\n";
|
228 |
$unfs .= '</tr>' . "\n";
|
229 |
}
|
230 |
+
unset($__refs, $__v);
|
231 |
}
|
232 |
|
233 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
234 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_during_custom_fields_after", get_defined_vars ());
|
235 |
+
unset($__refs, $__v);
|
236 |
}
|
237 |
|
238 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
239 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_custom_fields", get_defined_vars ());
|
240 |
+
unset($__refs, $__v);
|
241 |
|
242 |
$unfs .= '<tr>' . "\n";
|
243 |
$unfs .= '<td colspan="2">' . "\n";
|
247 |
}
|
248 |
|
249 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
250 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_before_notes", get_defined_vars ());
|
251 |
+
unset($__refs, $__v);
|
252 |
|
253 |
$unfs .= '<tr>' . "\n";
|
254 |
$unfs .= '<th><label for="ws-plugin--s2member-user-new-s2member-notes">Administrative Notes:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occasionally, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a><br /><br /><small>These Notations are private; Users/Members will never see any of these notes.</small></th>' . "\n";
|
256 |
$unfs .= '</tr>' . "\n";
|
257 |
|
258 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
259 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after_notes", get_defined_vars ());
|
260 |
+
unset($__refs, $__v);
|
261 |
|
262 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
263 |
+
do_action("_ws_plugin__s2member_during_admin_user_new_fields_after", get_defined_vars ());
|
264 |
+
unset($__refs, $__v);
|
265 |
|
266 |
$unfs .= '</table>' . "\n";
|
267 |
|
271 |
}
|
272 |
|
273 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
274 |
+
do_action("_ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
|
275 |
+
unset($__refs, $__v);
|
276 |
|
277 |
+
return apply_filters("_ws_plugin__s2member_admin_user_new_fields", $buffer, get_defined_vars ());
|
278 |
}
|
279 |
}
|
280 |
}
|
includes/classes/user-new.inc.php
CHANGED
@@ -43,16 +43,16 @@ if (!class_exists ("c_ws_plugin__s2member_user_new"))
|
|
43 |
{
|
44 |
global $pagenow; // The current admin page file name.
|
45 |
|
46 |
-
do_action
|
47 |
|
48 |
if (is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
|
49 |
{
|
50 |
ob_start ("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");
|
51 |
|
52 |
-
do_action
|
53 |
}
|
54 |
|
55 |
-
do_action
|
56 |
|
57 |
return /* Return for uniformity. */;
|
58 |
}
|
43 |
{
|
44 |
global $pagenow; // The current admin page file name.
|
45 |
|
46 |
+
do_action("ws_plugin__s2member_before_admin_user_new_fields", get_defined_vars ());
|
47 |
|
48 |
if (is_blog_admin () && $pagenow === "user-new.php" && current_user_can ("create_users"))
|
49 |
{
|
50 |
ob_start ("c_ws_plugin__s2member_user_new_in::_admin_user_new_fields");
|
51 |
|
52 |
+
do_action("ws_plugin__s2member_during_admin_user_new_fields", get_defined_vars ());
|
53 |
}
|
54 |
|
55 |
+
do_action("ws_plugin__s2member_after_admin_user_new_fields", get_defined_vars ());
|
56 |
|
57 |
return /* Return for uniformity. */;
|
58 |
}
|
includes/classes/user-notes.inc.php
CHANGED
@@ -33,28 +33,28 @@ if (!class_exists ("c_ws_plugin__s2member_user_notes"))
|
|
33 |
* @package s2Member\Admin_Notes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param int|
|
37 |
-
* @param
|
38 |
-
* @return
|
39 |
*/
|
40 |
public static function append_user_notes ($user_id = FALSE, $notes = FALSE)
|
41 |
{
|
42 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
43 |
-
do_action
|
44 |
-
unset
|
45 |
|
46 |
if ($user_id && $notes && is_string ($notes)) // Must have these.
|
47 |
{
|
48 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
49 |
-
do_action
|
50 |
-
unset
|
51 |
|
52 |
$notes = trim (get_user_option ("s2member_notes", $user_id) . "\n" . $notes);
|
53 |
|
54 |
update_user_option ($user_id, "s2member_notes", $notes);
|
55 |
}
|
56 |
|
57 |
-
return apply_filters
|
58 |
}
|
59 |
/**
|
60 |
* Clear specific notes from a User/Member's account; based on line-by-line regex.
|
@@ -62,17 +62,17 @@ if (!class_exists ("c_ws_plugin__s2member_user_notes"))
|
|
62 |
* @package s2Member\Admin_Notes
|
63 |
* @since 3.5
|
64 |
*
|
65 |
-
* @param int|
|
66 |
-
* @param
|
67 |
-
* @return
|
68 |
*/
|
69 |
public static function clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
|
70 |
{
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
-
do_action
|
73 |
-
unset
|
74 |
|
75 |
-
if ($user_id && $regex && is_string ($regex) && ($lines = array
|
76 |
{
|
77 |
// Careful here to preserve empty lines.
|
78 |
$notes = trim (get_user_option ("s2member_notes", $user_id));
|
@@ -83,13 +83,13 @@ if (!class_exists ("c_ws_plugin__s2member_user_notes"))
|
|
83 |
$notes = trim (implode ("\n", $lines));
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
-
do_action
|
87 |
-
unset
|
88 |
|
89 |
update_user_option ($user_id, "s2member_notes", $notes);
|
90 |
}
|
91 |
|
92 |
-
return apply_filters
|
93 |
}
|
94 |
}
|
95 |
}
|
33 |
* @package s2Member\Admin_Notes
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param int|string $user_id A numeric WordPress User ID.
|
37 |
+
* @param string $notes The string of notes to append. One note, or many.
|
38 |
+
* @return string The full set of notes, including appendage.
|
39 |
*/
|
40 |
public static function append_user_notes ($user_id = FALSE, $notes = FALSE)
|
41 |
{
|
42 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
43 |
+
do_action("ws_plugin__s2member_before_append_user_notes", get_defined_vars ());
|
44 |
+
unset($__refs, $__v);
|
45 |
|
46 |
if ($user_id && $notes && is_string ($notes)) // Must have these.
|
47 |
{
|
48 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
49 |
+
do_action("ws_plugin__s2member_during_append_user_notes", get_defined_vars ());
|
50 |
+
unset($__refs, $__v);
|
51 |
|
52 |
$notes = trim (get_user_option ("s2member_notes", $user_id) . "\n" . $notes);
|
53 |
|
54 |
update_user_option ($user_id, "s2member_notes", $notes);
|
55 |
}
|
56 |
|
57 |
+
return apply_filters("ws_plugin__s2member_append_user_notes", ((!empty($notes)) ? $notes : ""), get_defined_vars ());
|
58 |
}
|
59 |
/**
|
60 |
* Clear specific notes from a User/Member's account; based on line-by-line regex.
|
62 |
* @package s2Member\Admin_Notes
|
63 |
* @since 3.5
|
64 |
*
|
65 |
+
* @param int|string $user_id A numeric WordPress User ID.
|
66 |
+
* @param string $regex A regular expression to match against each line.
|
67 |
+
* @return string The full set of notes, after clearing.
|
68 |
*/
|
69 |
public static function clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
|
70 |
{
|
71 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
72 |
+
do_action("ws_plugin__s2member_before_clear_user_note_lines", get_defined_vars ());
|
73 |
+
unset($__refs, $__v);
|
74 |
|
75 |
+
if ($user_id && $regex && is_string ($regex) && ($lines = array()))
|
76 |
{
|
77 |
// Careful here to preserve empty lines.
|
78 |
$notes = trim (get_user_option ("s2member_notes", $user_id));
|
83 |
$notes = trim (implode ("\n", $lines));
|
84 |
|
85 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
86 |
+
do_action("ws_plugin__s2member_during_clear_user_note_lines", get_defined_vars ());
|
87 |
+
unset($__refs, $__v);
|
88 |
|
89 |
update_user_option ($user_id, "s2member_notes", $notes);
|
90 |
}
|
91 |
|
92 |
+
return apply_filters("ws_plugin__s2member_clear_user_note_lines", ((!empty($notes)) ? $notes : ""), get_defined_vars ());
|
93 |
}
|
94 |
}
|
95 |
}
|
includes/classes/user-securities.inc.php
CHANGED
@@ -66,20 +66,20 @@ if (!class_exists ("c_ws_plugin__s2member_user_securities"))
|
|
66 |
public static function user_capabilities ($capabilities = FALSE, $caps_map = FALSE, $args = FALSE)
|
67 |
{
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
-
do_action
|
70 |
-
unset
|
71 |
|
72 |
-
if (!empty
|
73 |
-
$capabilities = array_merge ((array)$capabilities, array
|
74 |
|
75 |
-
else if (!is_multisite () && !empty
|
76 |
-
$capabilities = array_merge ((array)$capabilities, array
|
77 |
|
78 |
-
else if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && (is_super_admin () || !empty
|
79 |
-
if ($args[0] === "edit_users" || ($args[0] === "edit_user" && !empty
|
80 |
-
$capabilities = array_merge ((array)$capabilities, array
|
81 |
|
82 |
-
return apply_filters
|
83 |
}
|
84 |
/**
|
85 |
* Alters this Filter inside `/wp-admin/user-edit.php`.
|
@@ -97,14 +97,14 @@ if (!class_exists ("c_ws_plugin__s2member_user_securities"))
|
|
97 |
global $user_id; // Available inside `/wp-admin/user-edit.php`.
|
98 |
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
-
do_action
|
101 |
-
unset
|
102 |
|
103 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
104 |
if (is_super_admin () || (current_user_can ("administrator") && $user_id && is_user_member_of_blog ($user_id)))
|
105 |
$allow = true; // Yes, allow Administrators to edit User Profiles.
|
106 |
|
107 |
-
return apply_filters
|
108 |
}
|
109 |
/**
|
110 |
* Hides Password fields for Demo Users; and deals with Password fields on Multisite Blog Farms.
|
@@ -119,24 +119,24 @@ if (!class_exists ("c_ws_plugin__s2member_user_securities"))
|
|
119 |
* @attaches-to ``add_filter("show_password_fields");``
|
120 |
*
|
121 |
* @param bool $show Expects boolean value passed through by the Filter.
|
122 |
-
* @param
|
123 |
* @return bool False if the Password is locked for this User, else existing value.
|
124 |
*/
|
125 |
public static function hide_password_fields ($show = TRUE, $user = FALSE)
|
126 |
{
|
127 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
128 |
-
do_action
|
129 |
-
unset
|
130 |
|
131 |
if ($show && is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
132 |
-
if (!is_super_admin () && is_object ($user) && !empty
|
133 |
if ($user->ID !== $current_user->ID)
|
134 |
$show = false;
|
135 |
|
136 |
-
if ($show && is_object ($user) && !empty
|
137 |
$show = false; // Lock Password on Demos.
|
138 |
|
139 |
-
return apply_filters
|
140 |
}
|
141 |
}
|
142 |
}
|
66 |
public static function user_capabilities ($capabilities = FALSE, $caps_map = FALSE, $args = FALSE)
|
67 |
{
|
68 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
69 |
+
do_action("ws_plugin__s2member_before_user_capabilities", get_defined_vars ());
|
70 |
+
unset($__refs, $__v);
|
71 |
|
72 |
+
if (!empty($capabilities["access_s2member_ccap_all_ccaps"]) && !empty($args[0]) && preg_match ("/^access_s2member_ccap_/i", $args[0]) && apply_filters("ws_plugin__s2member_all_ccaps_enable", true, get_defined_vars ()))
|
73 |
+
$capabilities = array_merge ((array)$capabilities, array($args[0] => 1));
|
74 |
|
75 |
+
else if (!is_multisite () && !empty($capabilities["administrator"]) && !empty($args[0]) && preg_match ("/^access_s2member_ccap_/i", $args[0]) && apply_filters("ws_plugin__s2member_admins_have_all_ccaps", true, get_defined_vars ()))
|
76 |
+
$capabilities = array_merge ((array)$capabilities, array($args[0] => 1));
|
77 |
|
78 |
+
else if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm () && (is_super_admin () || !empty($capabilities["administrator"])) && !empty($args[0]) && ($args[0] === "edit_user" || $args[0] === "edit_users"))
|
79 |
+
if ($args[0] === "edit_users" || ($args[0] === "edit_user" && !empty($args[2]) && ((!empty($args[1]) && (int)$args[1] === (int)$args[2]) || is_user_member_of_blog ($args[2]))))
|
80 |
+
$capabilities = array_merge ((array)$capabilities, array("edit_users" => 1));
|
81 |
|
82 |
+
return apply_filters("ws_plugin__s2member_user_capabilities", $capabilities, get_defined_vars ());
|
83 |
}
|
84 |
/**
|
85 |
* Alters this Filter inside `/wp-admin/user-edit.php`.
|
97 |
global $user_id; // Available inside `/wp-admin/user-edit.php`.
|
98 |
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
+
do_action("ws_plugin__s2member_before_ms_allow_edits", get_defined_vars ());
|
101 |
+
unset($__refs, $__v);
|
102 |
|
103 |
if (is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
104 |
if (is_super_admin () || (current_user_can ("administrator") && $user_id && is_user_member_of_blog ($user_id)))
|
105 |
$allow = true; // Yes, allow Administrators to edit User Profiles.
|
106 |
|
107 |
+
return apply_filters("ws_plugin__s2member_ms_allow_edits", $allow, get_defined_vars ());
|
108 |
}
|
109 |
/**
|
110 |
* Hides Password fields for Demo Users; and deals with Password fields on Multisite Blog Farms.
|
119 |
* @attaches-to ``add_filter("show_password_fields");``
|
120 |
*
|
121 |
* @param bool $show Expects boolean value passed through by the Filter.
|
122 |
+
* @param object $user Expects a `WP_User` object passed through by the Filter.
|
123 |
* @return bool False if the Password is locked for this User, else existing value.
|
124 |
*/
|
125 |
public static function hide_password_fields ($show = TRUE, $user = FALSE)
|
126 |
{
|
127 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
128 |
+
do_action("ws_plugin__s2member_before_hide_password_fields", get_defined_vars ());
|
129 |
+
unset($__refs, $__v);
|
130 |
|
131 |
if ($show && is_multisite () && c_ws_plugin__s2member_utils_conds::is_multisite_farm ())
|
132 |
+
if (!is_super_admin () && is_object ($user) && !empty($user->ID) && is_object ($current_user = wp_get_current_user ()) && !empty($current_user->ID))
|
133 |
if ($user->ID !== $current_user->ID)
|
134 |
$show = false;
|
135 |
|
136 |
+
if ($show && is_object ($user) && !empty($user->ID) && $user->user_login === "demo")
|
137 |
$show = false; // Lock Password on Demos.
|
138 |
|
139 |
+
return apply_filters("ws_plugin__s2member_hide_password_fields", $show, get_defined_vars ());
|
140 |
}
|
141 |
}
|
142 |
}
|
includes/classes/users-list-in.inc.php
CHANGED
@@ -36,7 +36,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
36 |
* @attaches-to ``add_action("edit_user_profile");``
|
37 |
* @attaches-to ``add_action("show_user_profile");``
|
38 |
*
|
39 |
-
* @param
|
40 |
* @return null
|
41 |
*/
|
42 |
public static function users_list_edit_cols($user = FALSE)
|
@@ -45,7 +45,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
45 |
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
do_action("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars());
|
48 |
-
unset
|
49 |
|
50 |
$current_user = (is_user_logged_in()) ? wp_get_current_user() : false; // Current User.
|
51 |
|
@@ -64,14 +64,14 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
64 |
|
65 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
66 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
|
67 |
-
unset
|
68 |
|
69 |
if(is_multisite() && is_super_admin()) // MUST be a Super Admin.
|
70 |
// On a Multisite Network, the Super Administrator can ALWAYS edit this.
|
71 |
{
|
72 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
73 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog", get_defined_vars());
|
74 |
-
unset
|
75 |
|
76 |
echo '<tr>'."\n";
|
77 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-originating-blog">Originating Blog ID#:</label> <a href="#" onclick="alert(\'On a Multisite Network, this is how s2Member keeps track of which Blog each User/Member originated from. So this ID#, is automatically associated with a Blog in your Network, matching the User\\\'s point of origin. ~ ONLY a Super Admin can modify this.\\n\\nOn a Multisite Blog Farm, the Originating Blog ID# for your own Customers, will ALWAYS be associated with your (Main Site). It is NOT likely that you\\\'ll need to modify this manually, but s2Member makes it available; just in case.\\n\\n*Tip* - If you add Users (and/or Blogs) with the `Super Admin` Network Administration panel inside WordPress, then you WILL need to set everything manually. s2Member does NOT tamper with automation routines whenever YOU (as a Super Administrator) are working in that area.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -80,12 +80,12 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
80 |
|
81 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
82 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog", get_defined_vars());
|
83 |
-
unset
|
84 |
}
|
85 |
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_gateway", get_defined_vars());
|
88 |
-
unset
|
89 |
|
90 |
echo '<tr>'."\n";
|
91 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -98,11 +98,11 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
98 |
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_gateway", get_defined_vars());
|
101 |
-
unset
|
102 |
|
103 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
104 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars());
|
105 |
-
unset
|
106 |
|
107 |
echo '<tr>'."\n";
|
108 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -111,11 +111,11 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
111 |
|
112 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
113 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars());
|
114 |
-
unset
|
115 |
|
116 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars());
|
118 |
-
unset
|
119 |
|
120 |
echo '<tr>'."\n";
|
121 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-custom">Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\''.c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3).'\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n'.c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3).'|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -124,11 +124,11 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
124 |
|
125 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
126 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom", get_defined_vars());
|
127 |
-
unset
|
128 |
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_registration_ip", get_defined_vars());
|
131 |
-
unset
|
132 |
|
133 |
echo '<tr>'."\n";
|
134 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-registration-ip">Registration IP:</label> <a href="#" onclick="alert(\'This is the IP Address the User had at the time of registration. If you don\\\'t know the User\\\'s IP Address, just leave this blank. If this is left empty, s2Member will make attempts in the future to grab the User\\\'s IP Address.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -137,7 +137,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
137 |
|
138 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
139 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_registration_ip", get_defined_vars());
|
140 |
-
unset
|
141 |
|
142 |
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
|
143 |
// ^ Will change once Custom Capabilities are compatible with a Blog Farm.
|
@@ -148,7 +148,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
148 |
|
149 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
150 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars());
|
151 |
-
unset
|
152 |
|
153 |
echo '<tr>'."\n";
|
154 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-ccaps">Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -› API Scripting -› Custom Capabilities.'.((is_multisite()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '').'\'); return false;" tabindex="-1">[?]</a>'.((is_multisite()) ? '<br /><small>(for this Blog)</small>' : '').'</th>'."\n";
|
@@ -157,14 +157,14 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
157 |
|
158 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
159 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars());
|
160 |
-
unset
|
161 |
}
|
162 |
|
163 |
if(!$user->has_cap("administrator")) // Do NOT present these details for Administrator accounts.
|
164 |
{
|
165 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
166 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars());
|
167 |
-
unset
|
168 |
|
169 |
echo '<tr>'."\n";
|
170 |
$auto_eot_time = get_user_option("s2member_auto_eot_time", $user_id);
|
@@ -175,13 +175,13 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
175 |
|
176 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
177 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars());
|
178 |
-
unset
|
179 |
|
180 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
181 |
{
|
182 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
183 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_reset_pass_resend", get_defined_vars());
|
184 |
-
unset
|
185 |
|
186 |
echo '<tr>'."\n";
|
187 |
echo '<th><label for="ws-plugin--s2member-profile-reset-pass-resend">Reset Password & Resend Welcome Email Message:</label> <a href="#" onclick="alert(\'Checking this box will tell s2Member to reset this User\\\'s password and then reprocess the New User Email Notification message against this User\\\'s account. This way they\\\'ll get an email message with their Username/Password.\\n\\nThis can be helpful in cases where a User/Member missed the original email message for some reason.\\n\\nThe User\\\'s password is reset to a new auto-generated password by default. However, you can provide a custom password by entering a new password of your choosing in the field above — provided by WordPress itself.\\n\\nIt is also possible to customize the New User Email Notification message with s2Member. Please see: `Dashboard -› s2Member -› General Options -› Email Configuration -› New User Notifications`.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -190,7 +190,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
190 |
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_reset_pass_resend", get_defined_vars());
|
193 |
-
unset
|
194 |
}
|
195 |
}
|
196 |
|
@@ -198,7 +198,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
198 |
{
|
199 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
200 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_opt_in", get_defined_vars());
|
201 |
-
unset
|
202 |
|
203 |
echo '<tr>'."\n";
|
204 |
echo '<th><label for="ws-plugin--s2member-profile-opt-in">Re-process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to re-process a confirmation request for this User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -207,7 +207,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
207 |
|
208 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
209 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_opt_in", get_defined_vars());
|
210 |
-
unset
|
211 |
|
212 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"])
|
213 |
if(($custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "$/i")))
|
@@ -215,7 +215,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
215 |
{
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_opt_out_transitions", get_defined_vars());
|
218 |
-
unset
|
219 |
|
220 |
echo '<tr>'."\n";
|
221 |
echo '<th><label for="ws-plugin--s2member-custom-reg-auto-opt-out-transitions">Allow List Transitioning:</label> <a href="#" onclick="alert(\'You\\\'ve configured s2Member with List Transitions enabled. By leaving this box checked, s2Member will Transition the User\\\'s mailing list subscription(s) automatically. For example, if a Member is demoted from Level #2, down to Level #1; s2Member will add them to the Level #1 List(s) after it removes them from the Level #2 List(s).\\n\\nDepending on your configuration of s2Member, a transition may ONLY occur if s2Member IS able to successfully remove them from an existing List. In other words, if they are currently NOT subscribed to any List(s), s2Member may NOT transition them to any new Lists (depending on your configuration).\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -224,13 +224,13 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
224 |
|
225 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
226 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_opt_out_transitions", get_defined_vars());
|
227 |
-
unset
|
228 |
}
|
229 |
}
|
230 |
|
231 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
232 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ip_restrictions", get_defined_vars());
|
233 |
-
unset
|
234 |
|
235 |
echo '<tr>'."\n";
|
236 |
echo '<th><label for="ws-plugin--s2member-profile-ip-restrictions">Reset IP Restrictions:</label> <a href="#" onclick="alert(\'A single Username is only valid for a certain number of unique IP addresses (as configured in your s2Member -› General Options). Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban (preventing access).\\n\\nIf you have spoken to a legitimate Customer that is receiving an error upon logging in (ex: 503 / too many IP addresses), you can remove this temporary ban by checking the box below. If the abusive behavior continues, s2Member will automatically re-instate IP Restrictions in the future. If you would like to gain further control over IP Restrictions, please check your General Options panel for s2Member.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
@@ -239,7 +239,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
239 |
|
240 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
241 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ip_restrictions", get_defined_vars());
|
242 |
-
unset
|
243 |
|
244 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) // Only if configured.
|
245 |
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "administrative"))
|
@@ -254,13 +254,13 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
254 |
|
255 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
|
257 |
-
unset
|
258 |
|
259 |
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
260 |
{
|
261 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
262 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
|
263 |
-
unset
|
264 |
|
265 |
if(in_array($field["id"], $fields_applicable)) // Field applicable?
|
266 |
{
|
@@ -278,17 +278,17 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
278 |
echo '<td>'.c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ((preg_match("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var], "administrative").'</td>'."\n";
|
279 |
echo '</tr>'."\n";
|
280 |
}
|
281 |
-
unset
|
282 |
}
|
283 |
|
284 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
285 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
|
286 |
-
unset
|
287 |
}
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
|
291 |
-
unset
|
292 |
|
293 |
echo '<tr>'."\n";
|
294 |
echo '<td colspan="2">'."\n";
|
@@ -299,7 +299,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
299 |
|
300 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
301 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars());
|
302 |
-
unset
|
303 |
|
304 |
echo '<tr>'."\n";
|
305 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-notes">Administrative Notes:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occasionally, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a><br /><br /><small>These Notations are private; Users/Members will never see any of these notes.</small></th>'."\n";
|
@@ -308,11 +308,11 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
308 |
|
309 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
310 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars());
|
311 |
-
unset
|
312 |
|
313 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
314 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
|
315 |
-
unset
|
316 |
|
317 |
echo '</table>'."\n";
|
318 |
|
@@ -332,19 +332,19 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
332 |
|
333 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
334 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
|
335 |
-
unset
|
336 |
|
337 |
$fields = get_user_option("s2member_custom_fields", $user_id); // Existing fields.
|
338 |
|
339 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
340 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
|
341 |
-
unset
|
342 |
|
343 |
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
344 |
{
|
345 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
346 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
|
347 |
-
unset
|
348 |
|
349 |
if(in_array($field["id"], $fields_applicable)) // Field applicable?
|
350 |
{
|
@@ -362,21 +362,21 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
362 |
echo '<td>'.c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ((preg_match("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var], "profile").'</td>'."\n";
|
363 |
echo '</tr>'."\n";
|
364 |
}
|
365 |
-
unset
|
366 |
}
|
367 |
|
368 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
369 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
|
370 |
-
unset
|
371 |
}
|
372 |
|
373 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
374 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
|
375 |
-
unset
|
376 |
|
377 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
378 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
|
379 |
-
unset
|
380 |
|
381 |
echo '</table>'."\n";
|
382 |
|
@@ -387,7 +387,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
387 |
|
388 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
389 |
do_action("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars());
|
390 |
-
unset
|
391 |
|
392 |
return /* Return for uniformity. */;
|
393 |
}
|
@@ -400,7 +400,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
400 |
* @attaches-to ``add_action("edit_user_profile_update");``
|
401 |
* @attaches-to ``add_action("personal_options_update");``
|
402 |
*
|
403 |
-
* @param int|
|
404 |
* @return null
|
405 |
*/
|
406 |
public static function users_list_update_cols($user_id = FALSE)
|
@@ -409,7 +409,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
409 |
|
410 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
411 |
do_action("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars());
|
412 |
-
unset
|
413 |
|
414 |
$user = /* We need both of these objects. $user and $current_user. */ new WP_User($user_id);
|
415 |
$current_user = /* Current User. */ (is_user_logged_in()) ? wp_get_current_user() : false;
|
@@ -506,7 +506,7 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
506 |
|
507 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
508 |
do_action("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars());
|
509 |
-
unset
|
510 |
}
|
511 |
}
|
512 |
else if /* Otherwise, a User can always edit their own Profile. */($current_user->ID === $user->ID)
|
@@ -554,13 +554,13 @@ if(!class_exists("c_ws_plugin__s2member_users_list_in"))
|
|
554 |
}
|
555 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
556 |
do_action("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars());
|
557 |
-
unset
|
558 |
}
|
559 |
}
|
560 |
}
|
561 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
562 |
do_action("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars());
|
563 |
-
unset
|
564 |
|
565 |
return /* Return for uniformity. */;
|
566 |
}
|
36 |
* @attaches-to ``add_action("edit_user_profile");``
|
37 |
* @attaches-to ``add_action("show_user_profile");``
|
38 |
*
|
39 |
+
* @param object $user Expects a `WP_User` object passed in by the Action Hook.
|
40 |
* @return null
|
41 |
*/
|
42 |
public static function users_list_edit_cols($user = FALSE)
|
45 |
|
46 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
do_action("ws_plugin__s2member_before_users_list_edit_cols", get_defined_vars());
|
48 |
+
unset($__refs, $__v);
|
49 |
|
50 |
$current_user = (is_user_logged_in()) ? wp_get_current_user() : false; // Current User.
|
51 |
|
64 |
|
65 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
66 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
|
67 |
+
unset($__refs, $__v);
|
68 |
|
69 |
if(is_multisite() && is_super_admin()) // MUST be a Super Admin.
|
70 |
// On a Multisite Network, the Super Administrator can ALWAYS edit this.
|
71 |
{
|
72 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
73 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_originating_blog", get_defined_vars());
|
74 |
+
unset($__refs, $__v);
|
75 |
|
76 |
echo '<tr>'."\n";
|
77 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-originating-blog">Originating Blog ID#:</label> <a href="#" onclick="alert(\'On a Multisite Network, this is how s2Member keeps track of which Blog each User/Member originated from. So this ID#, is automatically associated with a Blog in your Network, matching the User\\\'s point of origin. ~ ONLY a Super Admin can modify this.\\n\\nOn a Multisite Blog Farm, the Originating Blog ID# for your own Customers, will ALWAYS be associated with your (Main Site). It is NOT likely that you\\\'ll need to modify this manually, but s2Member makes it available; just in case.\\n\\n*Tip* - If you add Users (and/or Blogs) with the `Super Admin` Network Administration panel inside WordPress, then you WILL need to set everything manually. s2Member does NOT tamper with automation routines whenever YOU (as a Super Administrator) are working in that area.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
80 |
|
81 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
82 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_originating_blog", get_defined_vars());
|
83 |
+
unset($__refs, $__v);
|
84 |
}
|
85 |
|
86 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
87 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_gateway", get_defined_vars());
|
88 |
+
unset($__refs, $__v);
|
89 |
|
90 |
echo '<tr>'."\n";
|
91 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-gateway">Paid Subscr. Gateway:</label> <a href="#" onclick="alert(\'A Payment Gateway code is associated with the Paid Subscr. ID below. A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
98 |
|
99 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
100 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_gateway", get_defined_vars());
|
101 |
+
unset($__refs, $__v);
|
102 |
|
103 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
104 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_subscr_id", get_defined_vars());
|
105 |
+
unset($__refs, $__v);
|
106 |
|
107 |
echo '<tr>'."\n";
|
108 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-subscr-id">Paid Subscr. ID:</label> <a href="#" onclick="alert(\'A Paid Subscription ID (or a Buy Now Transaction ID) is only valid for paid Members. Also known as (a Recurring Profile ID, a ClickBank Receipt #, a Google Order ID, an AliPay Trade No.). This will be filled automatically by s2Member.\\n\\nThis field will be empty for Free Subscribers, and/or anyone who is NOT paying you. This field is only editable for Customer Service purposes; just in case you ever need to update the Paid Subscr. Gateway/ID manually.\\n\\nThe value of Paid Subscr. ID, can be a PayPal Standard `Subscription ID`, or a PayPal Pro `Recurring Profile ID`, or a PayPal `Transaction ID`; depending on the type of sale. Your PayPal account will supply this information. If you\\\'re using Google Wallet, use the Google Order ID. ClickBank provides a Receipt #, ccBill provides a Subscription ID, Authorize.Net provides a Subscription ID, and AliPay provides a Transaction ID. The general rule is... IF there\\\'s a Subscription ID, use that! If there\\\'s NOT, use the Transaction ID.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
111 |
|
112 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
113 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_subscr_id", get_defined_vars());
|
114 |
+
unset($__refs, $__v);
|
115 |
|
116 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
117 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom", get_defined_vars());
|
118 |
+
unset($__refs, $__v);
|
119 |
|
120 |
echo '<tr>'."\n";
|
121 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-custom">Custom Value:</label> <a href="#" onclick="alert(\'A Paid Subscription is always associated with a Custom String that is passed through the custom=\\\'\\\''.c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3).'\\\'\\\' attribute of your Shortcode. This Custom Value, MUST always start with your domain name. However, you can also pipe delimit additional values after your domain, if you need to.\\n\\nFor example:\n'.c_ws_plugin__s2member_utils_strings::esc_js_sq(esc_attr($_SERVER["HTTP_HOST"]), 3).'|cv1|cv2|cv3\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
124 |
|
125 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
126 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom", get_defined_vars());
|
127 |
+
unset($__refs, $__v);
|
128 |
|
129 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
130 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_registration_ip", get_defined_vars());
|
131 |
+
unset($__refs, $__v);
|
132 |
|
133 |
echo '<tr>'."\n";
|
134 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-registration-ip">Registration IP:</label> <a href="#" onclick="alert(\'This is the IP Address the User had at the time of registration. If you don\\\'t know the User\\\'s IP Address, just leave this blank. If this is left empty, s2Member will make attempts in the future to grab the User\\\'s IP Address.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
137 |
|
138 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
139 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_registration_ip", get_defined_vars());
|
140 |
+
unset($__refs, $__v);
|
141 |
|
142 |
if(!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site())
|
143 |
// ^ Will change once Custom Capabilities are compatible with a Blog Farm.
|
148 |
|
149 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
150 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ccaps", get_defined_vars());
|
151 |
+
unset($__refs, $__v);
|
152 |
|
153 |
echo '<tr>'."\n";
|
154 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-ccaps">Custom Capabilities:</label> <a href="#" onclick="alert(\'Optional. This is VERY advanced.\\nSee: s2Member -› API Scripting -› Custom Capabilities.'.((is_multisite()) ? '\\n\\nCustom Capabilities are assigned on a per-Blog basis. So having a set of Custom Capabilities for one Blog, and having NO Custom Capabilities on another Blog - is very common. This is how permissions are designed to work.' : '').'\'); return false;" tabindex="-1">[?]</a>'.((is_multisite()) ? '<br /><small>(for this Blog)</small>' : '').'</th>'."\n";
|
157 |
|
158 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
159 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ccaps", get_defined_vars());
|
160 |
+
unset($__refs, $__v);
|
161 |
}
|
162 |
|
163 |
if(!$user->has_cap("administrator")) // Do NOT present these details for Administrator accounts.
|
164 |
{
|
165 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
166 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_eot_time", get_defined_vars());
|
167 |
+
unset($__refs, $__v);
|
168 |
|
169 |
echo '<tr>'."\n";
|
170 |
$auto_eot_time = get_user_option("s2member_auto_eot_time", $user_id);
|
175 |
|
176 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
177 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_eot_time", get_defined_vars());
|
178 |
+
unset($__refs, $__v);
|
179 |
|
180 |
if(c_ws_plugin__s2member_utils_conds::pro_is_installed())
|
181 |
{
|
182 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
183 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_reset_pass_resend", get_defined_vars());
|
184 |
+
unset($__refs, $__v);
|
185 |
|
186 |
echo '<tr>'."\n";
|
187 |
echo '<th><label for="ws-plugin--s2member-profile-reset-pass-resend">Reset Password & Resend Welcome Email Message:</label> <a href="#" onclick="alert(\'Checking this box will tell s2Member to reset this User\\\'s password and then reprocess the New User Email Notification message against this User\\\'s account. This way they\\\'ll get an email message with their Username/Password.\\n\\nThis can be helpful in cases where a User/Member missed the original email message for some reason.\\n\\nThe User\\\'s password is reset to a new auto-generated password by default. However, you can provide a custom password by entering a new password of your choosing in the field above — provided by WordPress itself.\\n\\nIt is also possible to customize the New User Email Notification message with s2Member. Please see: `Dashboard -› s2Member -› General Options -› Email Configuration -› New User Notifications`.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
190 |
|
191 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
192 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_reset_pass_resend", get_defined_vars());
|
193 |
+
unset($__refs, $__v);
|
194 |
}
|
195 |
}
|
196 |
|
198 |
{
|
199 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
200 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_opt_in", get_defined_vars());
|
201 |
+
unset($__refs, $__v);
|
202 |
|
203 |
echo '<tr>'."\n";
|
204 |
echo '<th><label for="ws-plugin--s2member-profile-opt-in">Re-process List Servers:</label> <a href="#" onclick="alert(\'You have at least one List Server integrated with s2Member. Would you like to re-process a confirmation request for this User? If not, just leave the box un-checked.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
207 |
|
208 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
209 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_opt_in", get_defined_vars());
|
210 |
+
unset($__refs, $__v);
|
211 |
|
212 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_out_transitions"])
|
213 |
if(($custom_reg_auto_op_outs = c_ws_plugin__s2member_utils_strings::wrap_deep($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_auto_opt_outs"], "/^", "$/i")))
|
215 |
{
|
216 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
217 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_auto_opt_out_transitions", get_defined_vars());
|
218 |
+
unset($__refs, $__v);
|
219 |
|
220 |
echo '<tr>'."\n";
|
221 |
echo '<th><label for="ws-plugin--s2member-custom-reg-auto-opt-out-transitions">Allow List Transitioning:</label> <a href="#" onclick="alert(\'You\\\'ve configured s2Member with List Transitions enabled. By leaving this box checked, s2Member will Transition the User\\\'s mailing list subscription(s) automatically. For example, if a Member is demoted from Level #2, down to Level #1; s2Member will add them to the Level #1 List(s) after it removes them from the Level #2 List(s).\\n\\nDepending on your configuration of s2Member, a transition may ONLY occur if s2Member IS able to successfully remove them from an existing List. In other words, if they are currently NOT subscribed to any List(s), s2Member may NOT transition them to any new Lists (depending on your configuration).\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
224 |
|
225 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
226 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_auto_opt_out_transitions", get_defined_vars());
|
227 |
+
unset($__refs, $__v);
|
228 |
}
|
229 |
}
|
230 |
|
231 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
232 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_ip_restrictions", get_defined_vars());
|
233 |
+
unset($__refs, $__v);
|
234 |
|
235 |
echo '<tr>'."\n";
|
236 |
echo '<th><label for="ws-plugin--s2member-profile-ip-restrictions">Reset IP Restrictions:</label> <a href="#" onclick="alert(\'A single Username is only valid for a certain number of unique IP addresses (as configured in your s2Member -› General Options). Once that limit is reached, s2Member assumes there has been a security breach. At that time, s2Member will place a temporary ban (preventing access).\\n\\nIf you have spoken to a legitimate Customer that is receiving an error upon logging in (ex: 503 / too many IP addresses), you can remove this temporary ban by checking the box below. If the abusive behavior continues, s2Member will automatically re-instate IP Restrictions in the future. If you would like to gain further control over IP Restrictions, please check your General Options panel for s2Member.\'); return false;" tabindex="-1">[?]</a></th>'."\n";
|
239 |
|
240 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
241 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_ip_restrictions", get_defined_vars());
|
242 |
+
unset($__refs, $__v);
|
243 |
|
244 |
if($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"]) // Only if configured.
|
245 |
if($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($level, "administrative"))
|
254 |
|
255 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
|
257 |
+
unset($__refs, $__v);
|
258 |
|
259 |
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
260 |
{
|
261 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
262 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
|
263 |
+
unset($__refs, $__v);
|
264 |
|
265 |
if(in_array($field["id"], $fields_applicable)) // Field applicable?
|
266 |
{
|
278 |
echo '<td>'.c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ((preg_match("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var], "administrative").'</td>'."\n";
|
279 |
echo '</tr>'."\n";
|
280 |
}
|
281 |
+
unset($__refs, $__v);
|
282 |
}
|
283 |
|
284 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
285 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
|
286 |
+
unset($__refs, $__v);
|
287 |
}
|
288 |
|
289 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
290 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
|
291 |
+
unset($__refs, $__v);
|
292 |
|
293 |
echo '<tr>'."\n";
|
294 |
echo '<td colspan="2">'."\n";
|
299 |
|
300 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
301 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_notes", get_defined_vars());
|
302 |
+
unset($__refs, $__v);
|
303 |
|
304 |
echo '<tr>'."\n";
|
305 |
echo '<th><label for="ws-plugin--s2member-profile-s2member-notes">Administrative Notes:</label> <a href="#" onclick="alert(\'This is for Administrative purposes. You can keep a list of Notations about this account. These Notations are private; Users/Members will never see these.\\n\\n*Note* The s2Member software may `append` Notes to this field occasionally, under special circumstances. For example, when/if s2Member demotes a paid Member to a Free Subscriber, s2Member will leave a Note in this field.\'); return false;" tabindex="-1">[?]</a><br /><br /><small>These Notations are private; Users/Members will never see any of these notes.</small></th>'."\n";
|
308 |
|
309 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
310 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_notes", get_defined_vars());
|
311 |
+
unset($__refs, $__v);
|
312 |
|
313 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
314 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
|
315 |
+
unset($__refs, $__v);
|
316 |
|
317 |
echo '</table>'."\n";
|
318 |
|
332 |
|
333 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
334 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before", get_defined_vars());
|
335 |
+
unset($__refs, $__v);
|
336 |
|
337 |
$fields = get_user_option("s2member_custom_fields", $user_id); // Existing fields.
|
338 |
|
339 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
340 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_before_custom_fields", get_defined_vars());
|
341 |
+
unset($__refs, $__v);
|
342 |
|
343 |
foreach(json_decode($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"], true) as $field)
|
344 |
{
|
345 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
346 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_before", get_defined_vars());
|
347 |
+
unset($__refs, $__v);
|
348 |
|
349 |
if(in_array($field["id"], $fields_applicable)) // Field applicable?
|
350 |
{
|
362 |
echo '<td>'.c_ws_plugin__s2member_custom_reg_fields::custom_field_gen(__FUNCTION__, $field, "ws_plugin__s2member_profile_", "ws-plugin--s2member-profile-", "", ((preg_match("/^(text|textarea|select|selects)$/", $field["type"])) ? "width:99%;" : ""), "", "", $fields, $fields[$field_var], "profile").'</td>'."\n";
|
363 |
echo '</tr>'."\n";
|
364 |
}
|
365 |
+
unset($__refs, $__v);
|
366 |
}
|
367 |
|
368 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
369 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_during_custom_fields_after", get_defined_vars());
|
370 |
+
unset($__refs, $__v);
|
371 |
}
|
372 |
|
373 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
374 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after_custom_fields", get_defined_vars());
|
375 |
+
unset($__refs, $__v);
|
376 |
|
377 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
378 |
do_action("ws_plugin__s2member_during_users_list_edit_cols_after", get_defined_vars());
|
379 |
+
unset($__refs, $__v);
|
380 |
|
381 |
echo '</table>'."\n";
|
382 |
|
387 |
|
388 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
389 |
do_action("ws_plugin__s2member_after_users_list_edit_cols", get_defined_vars());
|
390 |
+
unset($__refs, $__v);
|
391 |
|
392 |
return /* Return for uniformity. */;
|
393 |
}
|
400 |
* @attaches-to ``add_action("edit_user_profile_update");``
|
401 |
* @attaches-to ``add_action("personal_options_update");``
|
402 |
*
|
403 |
+
* @param int|string $user_id Expects a numeric WordPress User ID passed in by the Action Hook.
|
404 |
* @return null
|
405 |
*/
|
406 |
public static function users_list_update_cols($user_id = FALSE)
|
409 |
|
410 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
411 |
do_action("ws_plugin__s2member_before_users_list_update_cols", get_defined_vars());
|
412 |
+
unset($__refs, $__v);
|
413 |
|
414 |
$user = /* We need both of these objects. $user and $current_user. */ new WP_User($user_id);
|
415 |
$current_user = /* Current User. */ (is_user_logged_in()) ? wp_get_current_user() : false;
|
506 |
|
507 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
508 |
do_action("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars());
|
509 |
+
unset($__refs, $__v);
|
510 |
}
|
511 |
}
|
512 |
else if /* Otherwise, a User can always edit their own Profile. */($current_user->ID === $user->ID)
|
554 |
}
|
555 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
556 |
do_action("ws_plugin__s2member_during_users_list_update_cols", get_defined_vars());
|
557 |
+
unset($__refs, $__v);
|
558 |
}
|
559 |
}
|
560 |
}
|
561 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
562 |
do_action("ws_plugin__s2member_after_users_list_update_cols", get_defined_vars());
|
563 |
+
unset($__refs, $__v);
|
564 |
|
565 |
return /* Return for uniformity. */;
|
566 |
}
|
includes/classes/users-list.inc.php
CHANGED
@@ -76,17 +76,17 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
76 |
global $wpdb; /** @var $wpdb wpdb */
|
77 |
|
78 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
79 |
-
do_action
|
80 |
-
unset
|
81 |
|
82 |
if (is_admin() && !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] === 'users.php')
|
83 |
if(isset ($query->query_vars) && !is_network_admin ()) // NOT in Network admin panels.
|
84 |
-
if (is_array
|
85 |
{
|
86 |
$query->query_fields = "SQL_CALC_FOUND_ROWS DISTINCT(`" . $wpdb->users . "`.`ID`)";
|
87 |
$query->query_from = " FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "`"; // Include meta table also.
|
88 |
$query->query_where = " WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id`"; // Join w/ meta table.
|
89 |
-
$query->query_where .= " AND (" . apply_filters
|
90 |
$query->query_where .= " (`" . $wpdb->users . "`.`user_login` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_nicename` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`display_name` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_email` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_url` LIKE '" . $s . "')";
|
91 |
$query->query_where .= " OR ((`" . $wpdb->usermeta . "`.`meta_key` = 'first_name' OR `" . $wpdb->usermeta . "`.`meta_key` = 'last_name') AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
92 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_subscr_id' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
@@ -94,17 +94,17 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
94 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_custom_fields' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
95 |
if(apply_filters("ws_plugin__s2member_users_list_search_admin_notes", false, get_defined_vars())) // Off by default; this can get very slow on large sites.
|
96 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_notes' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
97 |
-
$query->query_where .= apply_filters
|
98 |
|
99 |
if(is_multisite()) // On a Multisite Network we need to make sure we're searching only users w/ capabilities on this blog.
|
100 |
$query->query_where .= " AND `" . $wpdb->users . "`.`ID` IN(SELECT DISTINCT(`user_id`) FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "capabilities')";
|
101 |
|
102 |
-
$query->query_from = apply_filters
|
103 |
-
$query->query_where = apply_filters
|
104 |
}
|
105 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
106 |
-
do_action
|
107 |
-
unset
|
108 |
}
|
109 |
/**
|
110 |
* Adds columns to the list of Users.
|
@@ -120,12 +120,12 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
120 |
public static function users_list_cols ($cols = FALSE)
|
121 |
{
|
122 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
123 |
-
do_action
|
124 |
-
unset
|
125 |
|
126 |
$cols["s2member_registration_time"] = "Registration Date";
|
127 |
|
128 |
-
if (apply_filters
|
129 |
$cols["s2member_paid_registration_times"] = "Paid Registr. Date";
|
130 |
|
131 |
$cols["s2member_subscr_id"] = "Paid Subscr. ID";
|
@@ -149,10 +149,10 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
149 |
$cols["s2member_last_login_time"] = "Last Login Time";
|
150 |
|
151 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
152 |
-
do_action
|
153 |
-
unset
|
154 |
|
155 |
-
return apply_filters
|
156 |
}
|
157 |
/**
|
158 |
* Displays column data in the row of details.
|
@@ -173,8 +173,8 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
173 |
static $fields, $last_fields_id; // Used for optimization.
|
174 |
|
175 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
176 |
-
do_action
|
177 |
-
unset
|
178 |
|
179 |
$user = (is_object ($user) && $user_id === $last_user_id) ? $user : new WP_User ($user_id);
|
180 |
|
@@ -184,7 +184,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
184 |
else if ($col === "s2member_paid_registration_times")
|
185 |
{
|
186 |
$val = ""; // Initialize $val before we begin.
|
187 |
-
if (is_array
|
188 |
foreach ($v as $level => $time) // Go through each Paid Registration Time.
|
189 |
{
|
190 |
$time = strtotime (get_date_from_gmt (date ("Y-m-d H:i:s", $time)));
|
@@ -204,7 +204,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
204 |
if (preg_match ("/^access_s2member_ccap_/", $cap))
|
205 |
$ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
|
206 |
|
207 |
-
$val = (!empty
|
208 |
}
|
209 |
else if($col === "s2member_auto_eot_time")
|
210 |
$val = ($v = get_user_option ("s2member_auto_eot_time", $user_id)) ? date("D M jS, Y", (integer)$v) . "<br /><small>@ precisely " . date ("g:i a", (integer)$v)."</small>" : "—";
|
@@ -219,7 +219,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
219 |
if (isset ($fields[$field_var]) && is_string ($fields[$field_var]) && preg_match ("/^http(s?)\:/i", $fields[$field_var]))
|
220 |
$val = '<a href="' . esc_attr ($fields[$field_var]) . '" target="_blank">' . esc_html (substr ($fields[$field_var], strpos ($fields[$field_var], ":") + 3, 25) . "...") . '</a>';
|
221 |
|
222 |
-
else if (isset ($fields[$field_var]) && is_array
|
223 |
$val = preg_replace ("/-\|br\|-/", "<br />", esc_html (implode ("-|br|-", $fields[$field_var])));
|
224 |
|
225 |
else if (isset ($fields[$field_var]) && is_string ($fields[$field_var]) && strlen ($fields[$field_var]))
|
@@ -241,7 +241,7 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
241 |
}
|
242 |
$last_user_id = $user_id; // Record this for internal optimizations.
|
243 |
|
244 |
-
return apply_filters
|
245 |
}
|
246 |
|
247 |
/**
|
@@ -286,17 +286,23 @@ if (!class_exists ("c_ws_plugin__s2member_users_list"))
|
|
286 |
|
287 |
switch($vars['orderby'])
|
288 |
{
|
|
|
289 |
case 's2member_registration_time':
|
290 |
-
$query->query_orderby = "ORDER BY `user_registered` " . $vars['order'];
|
291 |
-
|
292 |
|
|
|
293 |
case 's2member_subscr_id':
|
|
|
|
|
|
|
|
|
294 |
case 's2member_auto_eot_time':
|
295 |
case 's2member_login_counter':
|
296 |
case 's2member_last_login_time':
|
297 |
-
$query->query_from .= " LEFT JOIN `" . $wpdb->usermeta . "` `m` ON (" . $wpdb->users . "
|
298 |
-
$query->query_orderby = "ORDER BY `m`.`meta_value` " . $vars['order'];
|
299 |
-
|
300 |
}
|
301 |
}
|
302 |
}
|
76 |
global $wpdb; /** @var $wpdb wpdb */
|
77 |
|
78 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
79 |
+
do_action("ws_plugin__s2member_before_users_list_search", get_defined_vars ());
|
80 |
+
unset($__refs, $__v);
|
81 |
|
82 |
if (is_admin() && !empty($GLOBALS['pagenow']) && $GLOBALS['pagenow'] === 'users.php')
|
83 |
if(isset ($query->query_vars) && !is_network_admin ()) // NOT in Network admin panels.
|
84 |
+
if (is_array($qv = $query->query_vars) && ($s = trim ($qv["search"], "* \t\n\r\0\x0B")) && ($s = "%" . esc_sql (like_escape ($s)) . "%"))
|
85 |
{
|
86 |
$query->query_fields = "SQL_CALC_FOUND_ROWS DISTINCT(`" . $wpdb->users . "`.`ID`)";
|
87 |
$query->query_from = " FROM `" . $wpdb->users . "`, `" . $wpdb->usermeta . "`"; // Include meta table also.
|
88 |
$query->query_where = " WHERE `" . $wpdb->users . "`.`ID` = `" . $wpdb->usermeta . "`.`user_id`"; // Join w/ meta table.
|
89 |
+
$query->query_where .= " AND (" . apply_filters("ws_plugin__s2member_before_users_list_search_where_or_before", "", get_defined_vars ());
|
90 |
$query->query_where .= " (`" . $wpdb->users . "`.`user_login` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_nicename` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`display_name` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_email` LIKE '" . $s . "' OR `" . $wpdb->users . "`.`user_url` LIKE '" . $s . "')";
|
91 |
$query->query_where .= " OR ((`" . $wpdb->usermeta . "`.`meta_key` = 'first_name' OR `" . $wpdb->usermeta . "`.`meta_key` = 'last_name') AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
92 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_subscr_id' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
94 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_custom_fields' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
95 |
if(apply_filters("ws_plugin__s2member_users_list_search_admin_notes", false, get_defined_vars())) // Off by default; this can get very slow on large sites.
|
96 |
$query->query_where .= " OR (`" . $wpdb->usermeta . "`.`meta_key` = '" . $wpdb->base_prefix . "s2member_notes' AND `" . $wpdb->usermeta . "`.`meta_value` LIKE '" . $s . "')";
|
97 |
+
$query->query_where .= apply_filters("ws_plugin__s2member_before_users_list_search_where_or_after", "", get_defined_vars ()) . ")"; // Leaving room for additional searches here.
|
98 |
|
99 |
if(is_multisite()) // On a Multisite Network we need to make sure we're searching only users w/ capabilities on this blog.
|
100 |
$query->query_where .= " AND `" . $wpdb->users . "`.`ID` IN(SELECT DISTINCT(`user_id`) FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "capabilities')";
|
101 |
|
102 |
+
$query->query_from = apply_filters("ws_plugin__s2member_before_users_list_search_from", $query->query_from, get_defined_vars ());
|
103 |
+
$query->query_where = apply_filters("ws_plugin__s2member_before_users_list_search_where", $query->query_where, get_defined_vars ());
|
104 |
}
|
105 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
106 |
+
do_action("ws_plugin__s2member_after_users_list_search", get_defined_vars ());
|
107 |
+
unset($__refs, $__v);
|
108 |
}
|
109 |
/**
|
110 |
* Adds columns to the list of Users.
|
120 |
public static function users_list_cols ($cols = FALSE)
|
121 |
{
|
122 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
123 |
+
do_action("ws_plugin__s2member_before_users_list_cols", get_defined_vars ());
|
124 |
+
unset($__refs, $__v);
|
125 |
|
126 |
$cols["s2member_registration_time"] = "Registration Date";
|
127 |
|
128 |
+
if (apply_filters("ws_plugin__s2member_users_list_cols_display_paid_registration_times", false))
|
129 |
$cols["s2member_paid_registration_times"] = "Paid Registr. Date";
|
130 |
|
131 |
$cols["s2member_subscr_id"] = "Paid Subscr. ID";
|
149 |
$cols["s2member_last_login_time"] = "Last Login Time";
|
150 |
|
151 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
152 |
+
do_action("ws_plugin__s2member_during_users_list_cols", get_defined_vars ());
|
153 |
+
unset($__refs, $__v);
|
154 |
|
155 |
+
return apply_filters("ws_plugin__s2member_users_list_cols", $cols, get_defined_vars ());
|
156 |
}
|
157 |
/**
|
158 |
* Displays column data in the row of details.
|
173 |
static $fields, $last_fields_id; // Used for optimization.
|
174 |
|
175 |
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
176 |
+
do_action("ws_plugin__s2member_before_users_list_display_cols", get_defined_vars ());
|
177 |
+
unset($__refs, $__v);
|
178 |
|
179 |
$user = (is_object ($user) && $user_id === $last_user_id) ? $user : new WP_User ($user_id);
|
180 |
|
184 |
else if ($col === "s2member_paid_registration_times")
|
185 |
{
|
186 |
$val = ""; // Initialize $val before we begin.
|
187 |
+
if (is_array($v = get_user_option ("s2member_paid_registration_times", $user_id)))
|
188 |
foreach ($v as $level => $time) // Go through each Paid Registration Time.
|
189 |
{
|
190 |
$time = strtotime (get_date_from_gmt (date ("Y-m-d H:i:s", $time)));
|
204 |
if (preg_match ("/^access_s2member_ccap_/", $cap))
|
205 |
$ccaps[] = preg_replace ("/^access_s2member_ccap_/", "", $cap);
|
206 |
|
207 |
+
$val = (!empty($ccaps)) ? implode ("<br />", $ccaps) : "—";
|
208 |
}
|
209 |
else if($col === "s2member_auto_eot_time")
|
210 |
$val = ($v = get_user_option ("s2member_auto_eot_time", $user_id)) ? date("D M jS, Y", (integer)$v) . "<br /><small>@ precisely " . date ("g:i a", (integer)$v)."</small>" : "—";
|
219 |
if (isset ($fields[$field_var]) && is_string ($fields[$field_var]) && preg_match ("/^http(s?)\:/i", $fields[$field_var]))
|
220 |
$val = '<a href="' . esc_attr ($fields[$field_var]) . '" target="_blank">' . esc_html (substr ($fields[$field_var], strpos ($fields[$field_var], ":") + 3, 25) . "...") . '</a>';
|
221 |
|
222 |
+
else if (isset ($fields[$field_var]) && is_array($fields[$field_var]) && !empty($fields[$field_var]))
|
223 |
$val = preg_replace ("/-\|br\|-/", "<br />", esc_html (implode ("-|br|-", $fields[$field_var])));
|
224 |
|
225 |
else if (isset ($fields[$field_var]) && is_string ($fields[$field_var]) && strlen ($fields[$field_var]))
|
241 |
}
|
242 |
$last_user_id = $user_id; // Record this for internal optimizations.
|
243 |
|
244 |
+
return apply_filters("ws_plugin__s2member_users_list_display_cols", ((strlen ($val)) ? $val : "—"), get_defined_vars ());
|
245 |
}
|
246 |
|
247 |
/**
|
286 |
|
287 |
switch($vars['orderby'])
|
288 |
{
|
289 |
+
// This isn't a usermeta value, so we don't need to `LEFT JOIN` here.
|
290 |
case 's2member_registration_time':
|
291 |
+
$query->query_orderby = "ORDER BY CAST(`user_registered` AS UNSIGNED) " . $vars['order'];
|
292 |
+
break;
|
293 |
|
294 |
+
// s2Member Subscription ID can contain non-integer characters. We don't `CAST` this value as `UNSIGNED`
|
295 |
case 's2member_subscr_id':
|
296 |
+
$query->query_from .= " LEFT JOIN `" . $wpdb->usermeta . "` `m` ON (`" . $wpdb->users . "`.`ID` = `m`.`user_id` AND `m`.`meta_key` = '" . esc_sql($wpdb->prefix . $vars['orderby']) . "')";
|
297 |
+
$query->query_orderby = "ORDER BY `m`.`meta_value` " . $vars['order'];
|
298 |
+
break;
|
299 |
+
|
300 |
case 's2member_auto_eot_time':
|
301 |
case 's2member_login_counter':
|
302 |
case 's2member_last_login_time':
|
303 |
+
$query->query_from .= " LEFT JOIN `" . $wpdb->usermeta . "` `m` ON (`" . $wpdb->users . "`.`ID` = `m`.`user_id` AND `m`.`meta_key` = '" . esc_sql($wpdb->prefix . $vars['orderby']) . "')";
|
304 |
+
$query->query_orderby = "ORDER BY CAST(`m`.`meta_value` AS UNSIGNED) " . $vars['order'];
|
305 |
+
break;
|
306 |
}
|
307 |
}
|
308 |
}
|
includes/classes/utilities.inc.php
CHANGED
@@ -33,8 +33,8 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @return
|
38 |
*/
|
39 |
public static function evl ($code = FALSE, $vars = array())
|
40 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 3.5
|
58 |
*
|
59 |
-
* @param
|
60 |
-
* @return
|
61 |
* Any output is buffered and returned.
|
62 |
*/
|
63 |
public static function get ($function = FALSE)
|
@@ -69,9 +69,9 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
69 |
{
|
70 |
ob_start ();
|
71 |
|
72 |
-
if (is_array
|
73 |
{
|
74 |
-
$return = call_user_func_array
|
75 |
}
|
76 |
else // There are no additional arguments to pass.
|
77 |
{
|
@@ -91,7 +91,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
91 |
* @package s2Member\Utilities
|
92 |
* @since 3.5
|
93 |
*
|
94 |
-
* @return
|
95 |
*/
|
96 |
public static function ver_checksum ()
|
97 |
{
|
@@ -107,7 +107,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
107 |
* @package s2Member\Utilities
|
108 |
* @since 130210
|
109 |
*
|
110 |
-
* @return
|
111 |
*/
|
112 |
public static function time_details ()
|
113 |
{
|
@@ -122,7 +122,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
122 |
* @package s2Member\Utilities
|
123 |
* @since 3.5
|
124 |
*
|
125 |
-
* @return
|
126 |
*/
|
127 |
public static function ver_details ()
|
128 |
{
|
@@ -137,10 +137,10 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
137 |
* @package s2Member\Utilities
|
138 |
* @since 3.5
|
139 |
*
|
140 |
-
* @param
|
141 |
* @param bool $no_cache Defaults to false. If true, the HTML markup will contain query string params that prevent caching.
|
142 |
* @param bool $display_on_failure. Defaults to false. True if we need to display the "NOT yet verified" version inside admin panels.
|
143 |
-
* @return
|
144 |
*/
|
145 |
public static function s_badge_gen ($v = "1", $no_cache = FALSE, $display_on_failure = FALSE)
|
146 |
{
|
@@ -152,7 +152,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
152 |
$badge = preg_replace ("/%%display_on_failure%%/i", (($display_on_failure) ? "&display_on_failure=1" : ""), $badge);
|
153 |
}
|
154 |
|
155 |
-
return (!empty
|
156 |
}
|
157 |
/**
|
158 |
* Acquires information about memory usage.
|
@@ -160,7 +160,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
160 |
* @package s2Member\Utilities
|
161 |
* @since 110815
|
162 |
*
|
163 |
-
* @return
|
164 |
*/
|
165 |
public static function mem_details ()
|
166 |
{
|
@@ -183,7 +183,7 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
183 |
*/
|
184 |
public static function mms_options ()
|
185 |
{
|
186 |
-
return (is_multisite ()) ? (array)get_site_option ("ws_plugin__s2member_options") : array
|
187 |
}
|
188 |
/**
|
189 |
* Builds an array of backtrace callers.
|
@@ -196,8 +196,8 @@ if (!class_exists ("c_ws_plugin__s2member_utilities"))
|
|
196 |
*/
|
197 |
public static function callers ($debug_backtrace = FALSE)
|
198 |
{
|
199 |
-
$callers = array
|
200 |
-
foreach (($debug_backtrace = (is_array
|
201 |
if (isset ($caller["class"], $caller["function"]) || (!isset ($caller["class"]) && isset ($caller["function"])))
|
202 |
$callers[] = (isset ($caller["class"])) ? $caller["class"] . "::" . $caller["function"] : $caller["function"];
|
203 |
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $code A string of data, possibly with embedded PHP code.
|
37 |
+
* @return string Output after PHP evaluation.
|
38 |
*/
|
39 |
public static function evl ($code = FALSE, $vars = array())
|
40 |
{
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 3.5
|
58 |
*
|
59 |
+
* @param string $function Name of a function to call upon.
|
60 |
+
* @return string Output after call to function.
|
61 |
* Any output is buffered and returned.
|
62 |
*/
|
63 |
public static function get ($function = FALSE)
|
69 |
{
|
70 |
ob_start ();
|
71 |
|
72 |
+
if (is_array($args) && !empty($args))
|
73 |
{
|
74 |
+
$return = call_user_func_array($function, $args);
|
75 |
}
|
76 |
else // There are no additional arguments to pass.
|
77 |
{
|
91 |
* @package s2Member\Utilities
|
92 |
* @since 3.5
|
93 |
*
|
94 |
+
* @return string String with `[version]-[pro version]-[consolidated checksum]`.
|
95 |
*/
|
96 |
public static function ver_checksum ()
|
97 |
{
|
107 |
* @package s2Member\Utilities
|
108 |
* @since 130210
|
109 |
*
|
110 |
+
* @return string String with time representation (in UTC time).
|
111 |
*/
|
112 |
public static function time_details ()
|
113 |
{
|
122 |
* @package s2Member\Utilities
|
123 |
* @since 3.5
|
124 |
*
|
125 |
+
* @return string String with `PHP vX.XX :: WordPress vX.XX :: s2Member vX.XX :: s2Member Pro vX.XX`.
|
126 |
*/
|
127 |
public static function ver_details ()
|
128 |
{
|
137 |
* @package s2Member\Utilities
|
138 |
* @since 3.5
|
139 |
*
|
140 |
+
* @param string $v A variation number to display. Defaults to `1`.
|
141 |
* @param bool $no_cache Defaults to false. If true, the HTML markup will contain query string params that prevent caching.
|
142 |
* @param bool $display_on_failure. Defaults to false. True if we need to display the "NOT yet verified" version inside admin panels.
|
143 |
+
* @return string HTML markup for display of s2Member Security Badge.
|
144 |
*/
|
145 |
public static function s_badge_gen ($v = "1", $no_cache = FALSE, $display_on_failure = FALSE)
|
146 |
{
|
152 |
$badge = preg_replace ("/%%display_on_failure%%/i", (($display_on_failure) ? "&display_on_failure=1" : ""), $badge);
|
153 |
}
|
154 |
|
155 |
+
return (!empty($badge)) ? $badge : ""; // Return Security Badge.
|
156 |
}
|
157 |
/**
|
158 |
* Acquires information about memory usage.
|
160 |
* @package s2Member\Utilities
|
161 |
* @since 110815
|
162 |
*
|
163 |
+
* @return string String with `Memory x MB :: Real Memory x MB :: Peak Memory x MB :: Real Peak Memory x MB`.
|
164 |
*/
|
165 |
public static function mem_details ()
|
166 |
{
|
183 |
*/
|
184 |
public static function mms_options ()
|
185 |
{
|
186 |
+
return (is_multisite ()) ? (array)get_site_option ("ws_plugin__s2member_options") : array();
|
187 |
}
|
188 |
/**
|
189 |
* Builds an array of backtrace callers.
|
196 |
*/
|
197 |
public static function callers ($debug_backtrace = FALSE)
|
198 |
{
|
199 |
+
$callers = array(); // Initialize array.
|
200 |
+
foreach (($debug_backtrace = (is_array($debug_backtrace)) ? $debug_backtrace : debug_backtrace ()) as $caller)
|
201 |
if (isset ($caller["class"], $caller["function"]) || (!isset ($caller["class"]) && isset ($caller["function"])))
|
202 |
$callers[] = (isset ($caller["class"])) ? $caller["class"] . "::" . $caller["function"] : $caller["function"];
|
203 |
|
includes/classes/utils-arrays.inc.php
CHANGED
@@ -56,18 +56,18 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 3.5
|
58 |
*
|
59 |
-
* @param
|
60 |
* @return bool True if the regular expression matched at least one value in the array, else false.
|
61 |
*/
|
62 |
-
public static function regex_in_array
|
63 |
{
|
64 |
-
if (is_string ($regex) && strlen ($regex) && is_array
|
65 |
{
|
66 |
foreach ($array as $value)
|
67 |
{
|
68 |
-
if (is_array
|
69 |
{
|
70 |
-
if (c_ws_plugin__s2member_utils_arrays::regex_in_array
|
71 |
return true;
|
72 |
}
|
73 |
else if (is_string ($value) /* Must be a string. */)
|
@@ -87,19 +87,19 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
87 |
* @package s2Member\Utilities
|
88 |
* @since 3.5
|
89 |
*
|
90 |
-
* @param
|
91 |
* @param array $array An array of regex patterns to match against ``$string``.
|
92 |
* @return bool True if at least one regular expression in the ``$array`` matched ``$string``, else false.
|
93 |
*/
|
94 |
-
public static function in_regex_array
|
95 |
{
|
96 |
-
if (is_string ($string) && strlen ($string) && is_array
|
97 |
{
|
98 |
foreach ($array as $value)
|
99 |
{
|
100 |
-
if (is_array
|
101 |
{
|
102 |
-
if (c_ws_plugin__s2member_utils_arrays::in_regex_array
|
103 |
return true;
|
104 |
}
|
105 |
else if (is_string ($value) /* Must be a string. */)
|
@@ -128,11 +128,11 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
128 |
|
129 |
foreach ($array as $key => &$value)
|
130 |
{
|
131 |
-
if (is_array
|
132 |
$value = c_ws_plugin__s2member_utils_arrays::remove_nulls ($value);
|
133 |
|
134 |
else if (is_null /* Is it null? */ ($value))
|
135 |
-
unset
|
136 |
}
|
137 |
return $array;
|
138 |
}
|
@@ -151,11 +151,11 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
151 |
|
152 |
foreach ($array as $key => &$value)
|
153 |
{
|
154 |
-
if (is_array
|
155 |
$value = c_ws_plugin__s2member_utils_arrays::remove_0b_strings ($value);
|
156 |
|
157 |
else if (is_string ($value) && !strlen ($value))
|
158 |
-
unset
|
159 |
}
|
160 |
return $array;
|
161 |
}
|
@@ -174,7 +174,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
174 |
|
175 |
foreach ($array as &$value)
|
176 |
{
|
177 |
-
if (is_array
|
178 |
$value = c_ws_plugin__s2member_utils_arrays::force_strings ($value);
|
179 |
|
180 |
else if (!is_string ($value) /* String? */)
|
@@ -197,7 +197,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
197 |
|
198 |
foreach ($array as &$value)
|
199 |
{
|
200 |
-
if (is_array
|
201 |
$value = c_ws_plugin__s2member_utils_arrays::force_integers ($value);
|
202 |
|
203 |
else if (!is_integer ($value) /* Integer? */)
|
@@ -222,7 +222,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_arrays"))
|
|
222 |
ksort /* Sort by key. */ ($array, $flags);
|
223 |
|
224 |
foreach ($array as &$value)
|
225 |
-
if (is_array
|
226 |
$value = c_ws_plugin__s2member_utils_arrays::ksort_deep ($value, $flags);
|
227 |
|
228 |
return /* Now return the array. */ $array;
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 3.5
|
58 |
*
|
59 |
+
* @param string $regex A regular expression to look for inside the array.
|
60 |
* @return bool True if the regular expression matched at least one value in the array, else false.
|
61 |
*/
|
62 |
+
public static function regex_in_array($regex = FALSE, $array = FALSE)
|
63 |
{
|
64 |
+
if (is_string ($regex) && strlen ($regex) && is_array($array))
|
65 |
{
|
66 |
foreach ($array as $value)
|
67 |
{
|
68 |
+
if (is_array($value) /* Recursive function call? */)
|
69 |
{
|
70 |
+
if (c_ws_plugin__s2member_utils_arrays::regex_in_array($regex, $value))
|
71 |
return true;
|
72 |
}
|
73 |
else if (is_string ($value) /* Must be a string. */)
|
87 |
* @package s2Member\Utilities
|
88 |
* @since 3.5
|
89 |
*
|
90 |
+
* @param string $string A string to test against.
|
91 |
* @param array $array An array of regex patterns to match against ``$string``.
|
92 |
* @return bool True if at least one regular expression in the ``$array`` matched ``$string``, else false.
|
93 |
*/
|
94 |
+
public static function in_regex_array($string = FALSE, $array = FALSE)
|
95 |
{
|
96 |
+
if (is_string ($string) && strlen ($string) && is_array($array))
|
97 |
{
|
98 |
foreach ($array as $value)
|
99 |
{
|
100 |
+
if (is_array($value) /* Recursive function call. */)
|
101 |
{
|
102 |
+
if (c_ws_plugin__s2member_utils_arrays::in_regex_array($string, $value))
|
103 |
return true;
|
104 |
}
|
105 |
else if (is_string ($value) /* Must be a string. */)
|
128 |
|
129 |
foreach ($array as $key => &$value)
|
130 |
{
|
131 |
+
if (is_array($value) /* Recursive function call here. */)
|
132 |
$value = c_ws_plugin__s2member_utils_arrays::remove_nulls ($value);
|
133 |
|
134 |
else if (is_null /* Is it null? */ ($value))
|
135 |
+
unset($array[$key]);
|
136 |
}
|
137 |
return $array;
|
138 |
}
|
151 |
|
152 |
foreach ($array as $key => &$value)
|
153 |
{
|
154 |
+
if (is_array($value) /* Recursive function call here. */)
|
155 |
$value = c_ws_plugin__s2member_utils_arrays::remove_0b_strings ($value);
|
156 |
|
157 |
else if (is_string ($value) && !strlen ($value))
|
158 |
+
unset($array[$key]);
|
159 |
}
|
160 |
return $array;
|
161 |
}
|
174 |
|
175 |
foreach ($array as &$value)
|
176 |
{
|
177 |
+
if (is_array($value) /* Recursive function call here. */)
|
178 |
$value = c_ws_plugin__s2member_utils_arrays::force_strings ($value);
|
179 |
|
180 |
else if (!is_string ($value) /* String? */)
|
197 |
|
198 |
foreach ($array as &$value)
|
199 |
{
|
200 |
+
if (is_array($value) /* Recursive function call here. */)
|
201 |
$value = c_ws_plugin__s2member_utils_arrays::force_integers ($value);
|
202 |
|
203 |
else if (!is_integer ($value) /* Integer? */)
|
222 |
ksort /* Sort by key. */ ($array, $flags);
|
223 |
|
224 |
foreach ($array as &$value)
|
225 |
+
if (is_array($value) /* Recursive function call here. */)
|
226 |
$value = c_ws_plugin__s2member_utils_arrays::ksort_deep ($value, $flags);
|
227 |
|
228 |
return /* Now return the array. */ $array;
|
includes/classes/utils-captchas.inc.php
CHANGED
@@ -40,7 +40,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_captchas"))
|
|
40 |
$public = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["public_key"];
|
41 |
$private = /* Private key. */ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["private_key"];
|
42 |
|
43 |
-
return apply_filters
|
44 |
}
|
45 |
/**
|
46 |
* Verifies a reCAPTCHA™ code via Google.
|
@@ -48,14 +48,14 @@ if (!class_exists ("c_ws_plugin__s2member_utils_captchas"))
|
|
48 |
* @package s2Member\Utilities
|
49 |
* @since 3.5
|
50 |
*
|
51 |
-
* @param
|
52 |
-
* @param
|
53 |
* @return bool True if ``$response`` is valid, else false.
|
54 |
*/
|
55 |
public static function recaptcha_code_validates ($challenge = FALSE, $response = FALSE)
|
56 |
{
|
57 |
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys ();
|
58 |
-
$post_vars = array
|
59 |
|
60 |
return preg_match ("/^true/i", trim (c_ws_plugin__s2member_utils_urls::remote ("http://www.google.com/recaptcha/api/verify", $post_vars)));
|
61 |
}
|
@@ -65,10 +65,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_captchas"))
|
|
65 |
* @package s2Member\Utilities
|
66 |
* @since 3.5
|
67 |
*
|
68 |
-
* @param
|
69 |
-
* @param
|
70 |
-
* @param
|
71 |
-
* @return
|
72 |
*/
|
73 |
public static function recaptcha_script_tag ($theme = FALSE, $tabindex = FALSE, $error = FALSE)
|
74 |
{
|
@@ -78,7 +78,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_captchas"))
|
|
78 |
|
79 |
$options = '<script type="text/javascript">' . "if(typeof RecaptchaOptions !== 'object'){ var RecaptchaOptions = {theme: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($theme) . "', lang: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["lang"]) . "', tabindex: " . $tabindex . " }; }" . '</script>' . "\n";
|
80 |
$no_tabindex_icons = '<script type="text/javascript">' . "if(typeof jQuery === 'function'){ jQuery('td a[id^=\"recaptcha\"]').removeAttr('tabindex'); }" . '</script>';
|
81 |
-
$adjustments = (!apply_filters
|
82 |
|
83 |
return $options . '<script type="text/javascript" src="' . esc_attr ('https://www.google.com/recaptcha/api/challenge?k=' . urlencode ($keys["public"])) . '' . (($error) ? '&error=' . urlencode ($error) : '') . '"></script>' . $adjustments;
|
84 |
}
|
40 |
$public = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["public_key"];
|
41 |
$private = /* Private key. */ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["private_key"];
|
42 |
|
43 |
+
return apply_filters("ws_plugin__s2member_recaptcha_keys", array("public" => $public, "private" => $private), get_defined_vars ());
|
44 |
}
|
45 |
/**
|
46 |
* Verifies a reCAPTCHA™ code via Google.
|
48 |
* @package s2Member\Utilities
|
49 |
* @since 3.5
|
50 |
*
|
51 |
+
* @param string $challenge The value of `recaptcha_challenge_field` during form submisson.
|
52 |
+
* @param string $response The value of `recaptcha_response_field` during form submission.
|
53 |
* @return bool True if ``$response`` is valid, else false.
|
54 |
*/
|
55 |
public static function recaptcha_code_validates ($challenge = FALSE, $response = FALSE)
|
56 |
{
|
57 |
$keys = c_ws_plugin__s2member_utils_captchas::recaptcha_keys ();
|
58 |
+
$post_vars = array("privatekey" => $keys["private"], "remoteip" => $_SERVER["REMOTE_ADDR"], "challenge" => $challenge, "response" => $response);
|
59 |
|
60 |
return preg_match ("/^true/i", trim (c_ws_plugin__s2member_utils_urls::remote ("http://www.google.com/recaptcha/api/verify", $post_vars)));
|
61 |
}
|
65 |
* @package s2Member\Utilities
|
66 |
* @since 3.5
|
67 |
*
|
68 |
+
* @param string $theme Optional. The theme used in display. Defaults to `clean`.
|
69 |
+
* @param string $tabindex Optional. Value of `tabindex=""` attribute. Defaults to `-1`.
|
70 |
+
* @param string $error Optional. An error message to display.
|
71 |
+
* @return string HTML markup for JavaScript tag.
|
72 |
*/
|
73 |
public static function recaptcha_script_tag ($theme = FALSE, $tabindex = FALSE, $error = FALSE)
|
74 |
{
|
78 |
|
79 |
$options = '<script type="text/javascript">' . "if(typeof RecaptchaOptions !== 'object'){ var RecaptchaOptions = {theme: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($theme) . "', lang: '" . c_ws_plugin__s2member_utils_strings::esc_js_sq ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"]["lang"]) . "', tabindex: " . $tabindex . " }; }" . '</script>' . "\n";
|
80 |
$no_tabindex_icons = '<script type="text/javascript">' . "if(typeof jQuery === 'function'){ jQuery('td a[id^=\"recaptcha\"]').removeAttr('tabindex'); }" . '</script>';
|
81 |
+
$adjustments = (!apply_filters("c_ws_plugin__s2member_utils_tabindex_recaptcha_icons", false, get_defined_vars ())) ? $no_tabindex_icons : "";
|
82 |
|
83 |
return $options . '<script type="text/javascript" src="' . esc_attr ('https://www.google.com/recaptcha/api/challenge?k=' . urlencode ($keys["public"])) . '' . (($error) ? '&error=' . urlencode ($error) : '') . '"></script>' . $adjustments;
|
84 |
}
|
includes/classes/utils-conds.inc.php
CHANGED
@@ -91,7 +91,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_conds"))
|
|
91 |
* @since 3.5
|
92 |
*
|
93 |
* @param array $cats An array of Category IDs.
|
94 |
-
* @param int|
|
95 |
* @return bool True if the Post is inside a desendant of at least one of the specified Categories; else false.
|
96 |
*/
|
97 |
public static function in_descendant_category($cats = FALSE, $post_id = FALSE)
|
@@ -110,7 +110,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_conds"))
|
|
110 |
* @package s2Member\Utilities
|
111 |
* @since 3.5
|
112 |
*
|
113 |
-
* @param
|
114 |
* @return bool True if the URL or URI leads to the site root, else false.
|
115 |
*/
|
116 |
public static function is_site_root($url_uri = FALSE)
|
91 |
* @since 3.5
|
92 |
*
|
93 |
* @param array $cats An array of Category IDs.
|
94 |
+
* @param int|string $post_id A numeric WordPress Post ID.
|
95 |
* @return bool True if the Post is inside a desendant of at least one of the specified Categories; else false.
|
96 |
*/
|
97 |
public static function in_descendant_category($cats = FALSE, $post_id = FALSE)
|
110 |
* @package s2Member\Utilities
|
111 |
* @since 3.5
|
112 |
*
|
113 |
+
* @param string $url_uri Either a full URL, or a partial URI to test.
|
114 |
* @return bool True if the URL or URI leads to the site root, else false.
|
115 |
*/
|
116 |
public static function is_site_root($url_uri = FALSE)
|
includes/classes/utils-css.inc.php
CHANGED
@@ -33,8 +33,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_css"))
|
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @return
|
38 |
*/
|
39 |
public static function compress_css ($css = FALSE)
|
40 |
{
|
@@ -72,7 +72,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_css"))
|
|
72 |
* @since 3.5
|
73 |
*
|
74 |
* @param array $m Array of matches from ``preg_replace_callback()``.
|
75 |
-
* @return
|
76 |
*/
|
77 |
public static function _compress_css_c3 ($m = FALSE)
|
78 |
{
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $css A string of CSS.
|
37 |
+
* @return string String of CSS, after compression.
|
38 |
*/
|
39 |
public static function compress_css ($css = FALSE)
|
40 |
{
|
72 |
* @since 3.5
|
73 |
*
|
74 |
* @param array $m Array of matches from ``preg_replace_callback()``.
|
75 |
+
* @return string Shortened hex code when possible, full hex code when not possible.
|
76 |
*/
|
77 |
public static function _compress_css_c3 ($m = FALSE)
|
78 |
{
|
includes/classes/utils-cur.inc.php
CHANGED
@@ -1,107 +1,102 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Currency utilities.
|
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\Utilities
|
15 |
-
* @since 110531
|
16 |
-
*/
|
17 |
-
if(realpath(__FILE__) === realpath($_SERVER[
|
18 |
-
exit(
|
19 |
|
20 |
-
if(!class_exists(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
{
|
22 |
/**
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
{
|
30 |
-
|
31 |
-
|
32 |
-
*
|
33 |
-
* Uses the Google currency conversion API.
|
34 |
-
*
|
35 |
-
* @package s2Member\Utilities
|
36 |
-
* @since 3.5
|
37 |
-
*
|
38 |
-
* @param int|str $a The amount, in ``$from``.
|
39 |
-
* @param str $from A 3 character Currency Code.
|
40 |
-
* @param str $to A 3 character Currency Code.
|
41 |
-
* @return float|str|bool A numeric amount in ``$to``,
|
42 |
-
* after having been converted. Else false.
|
43 |
-
*
|
44 |
-
* @see http://www.techmug.com/ajax-currency-converter-with-google-api/
|
45 |
-
*/
|
46 |
-
public static function convert($a = FALSE, $from = FALSE, $to = FALSE)
|
47 |
-
{
|
48 |
-
if(is_numeric($a) && strlen($from = strtoupper($from)) === 3 && strlen($to = strtoupper($to)) === 3)
|
49 |
-
{
|
50 |
-
$q = number_format($a, 2, ".", "").$from."=?".$to;
|
51 |
-
$api = "http://www.google.com/ig/calculator?hl=en&q=".urlencode($q);
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
return false; // Default return value.
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* Converts Currency Codes to Currency Symbols.
|
64 |
-
*
|
65 |
-
* Defaults to the `$` dollar sign.
|
66 |
-
*
|
67 |
-
* @package s2Member\Utilities
|
68 |
-
* @since 110531
|
69 |
-
*
|
70 |
-
* @param str $currency Expects a 3 character Currency Code.
|
71 |
-
* @return str A Currency Symbol. Defaults to the `$` sign.
|
72 |
-
*/
|
73 |
-
public static function symbol($currency = FALSE)
|
74 |
-
{
|
75 |
-
$symbols["AUD"] = "$"; // Australian Dollar
|
76 |
-
$symbols["BRL"] = "R$"; // Brazilian Real
|
77 |
-
$symbols["CAD"] = "$"; // Canadian Dollar
|
78 |
-
$symbols["CZK"] = "Kč"; // Czech Koruna
|
79 |
-
$symbols["DKK"] = "kr"; // Danish Krone
|
80 |
-
$symbols["EUR"] = "€"; // Euro
|
81 |
-
$symbols["HKD"] = "$"; // Hong Kong Dollar
|
82 |
-
$symbols["HUF"] = "Ft"; // Hungarian Forint
|
83 |
-
$symbols["ILS"] = "₪"; // Israeli New Sheqel
|
84 |
-
$symbols["JPY"] = "¥"; // Japanese Yen
|
85 |
-
$symbols["MYR"] = "RM"; // Malaysian Ringgit
|
86 |
-
$symbols["MXN"] = "$"; // Mexican Peso
|
87 |
-
$symbols["NOK"] = "kr"; // Norwegian Krone
|
88 |
-
$symbols["NZD"] = "$"; // New Zealand Dollar
|
89 |
-
$symbols["PHP"] = "Php"; // Philippine Peso
|
90 |
-
$symbols["PLN"] = "zł"; // Polish Zloty
|
91 |
-
$symbols["GBP"] = "£"; // Pound Sterling
|
92 |
-
$symbols["SGD"] = "$"; // Singapore Dollar
|
93 |
-
$symbols["SEK"] = "kr"; // Swedish Krona
|
94 |
-
$symbols["CHF"] = "CHF"; // Swiss Franc
|
95 |
-
$symbols["TWD"] = "NT$"; // Taiwan New Dollar
|
96 |
-
$symbols["THB"] = "฿"; // Thai Baht
|
97 |
-
$symbols["USD"] = "$"; // U.S. Dollar
|
98 |
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
}
|
107 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Currency utilities.
|
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\Utilities
|
15 |
+
* @since 110531
|
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_utils_cur'))
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Currency utilities.
|
24 |
+
*
|
25 |
+
* @package s2Member\Utilities
|
26 |
+
* @since 3.5
|
27 |
+
*/
|
28 |
+
class c_ws_plugin__s2member_utils_cur
|
29 |
{
|
30 |
/**
|
31 |
+
* Currency converter.
|
32 |
+
*
|
33 |
+
* Uses the Google currency conversion API.
|
34 |
+
*
|
35 |
+
* @package s2Member\Utilities
|
36 |
+
* @since 3.5
|
37 |
+
*
|
38 |
+
* @param int|float|string $a The amount, in ``$from``.
|
39 |
+
* @param string $from Three character currency code.
|
40 |
+
* @param string $to Three character currency code.
|
41 |
+
*
|
42 |
+
* @return string A numeric amount in ``$to``, after having been converted. Else false.
|
43 |
+
*/
|
44 |
+
public static function convert($a = 0, $from = '', $to = '')
|
45 |
+
{
|
46 |
+
if(is_numeric($a) && strlen($from) === 3 && strlen($to) === 3)
|
47 |
{
|
48 |
+
$q = strtoupper($from.'-'.$to); // Also need this to test the return value.
|
49 |
+
$endpoint = 'http://www.freecurrencyconverterapi.com/api/convert?q='.urlencode($q).'&compact=y';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
if(($json = c_ws_plugin__s2member_utils_urls::remote($endpoint))
|
52 |
+
&& is_object($json = json_decode($json)) && isset($json->{$q}->val)
|
53 |
+
&& is_float($conversion = (float)$a * (float)$json->{$q}->val)
|
54 |
+
) return number_format($conversion, 2, '.', '');
|
55 |
+
}
|
56 |
+
return ''; // Default return value.
|
57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
/**
|
60 |
+
* Converts Currency Codes to Currency Symbols.
|
61 |
+
*
|
62 |
+
* Defaults to the `$` dollar sign.
|
63 |
+
*
|
64 |
+
* @package s2Member\Utilities
|
65 |
+
* @since 110531
|
66 |
+
*
|
67 |
+
* @param string $currency Expects a 3 character Currency Code.
|
68 |
+
*
|
69 |
+
* @return string A Currency Symbol. Defaults to the `$` sign.
|
70 |
+
*/
|
71 |
+
public static function symbol($currency = '')
|
72 |
+
{
|
73 |
+
$symbols['AUD'] = '$'; // Australian Dollar
|
74 |
+
$symbols['BRL'] = 'R$'; // Brazilian Real
|
75 |
+
$symbols['CAD'] = '$'; // Canadian Dollar
|
76 |
+
$symbols['CZK'] = 'Kč'; // Czech Koruna
|
77 |
+
$symbols['DKK'] = 'kr'; // Danish Krone
|
78 |
+
$symbols['EUR'] = '€'; // Euro
|
79 |
+
$symbols['HKD'] = '$'; // Hong Kong Dollar
|
80 |
+
$symbols['HUF'] = 'Ft'; // Hungarian Forint
|
81 |
+
$symbols['ILS'] = '₪'; // Israeli New Sheqel
|
82 |
+
$symbols['JPY'] = '¥'; // Japanese Yen
|
83 |
+
$symbols['MYR'] = 'RM'; // Malaysian Ringgit
|
84 |
+
$symbols['MXN'] = '$'; // Mexican Peso
|
85 |
+
$symbols['NOK'] = 'kr'; // Norwegian Krone
|
86 |
+
$symbols['NZD'] = '$'; // New Zealand Dollar
|
87 |
+
$symbols['PHP'] = 'Php'; // Philippine Peso
|
88 |
+
$symbols['PLN'] = 'zł'; // Polish Zloty
|
89 |
+
$symbols['GBP'] = '£'; // Pound Sterling
|
90 |
+
$symbols['SGD'] = '$'; // Singapore Dollar
|
91 |
+
$symbols['SEK'] = 'kr'; // Swedish Krona
|
92 |
+
$symbols['CHF'] = 'CHF'; // Swiss Franc
|
93 |
+
$symbols['TWD'] = 'NT$'; // Taiwan New Dollar
|
94 |
+
$symbols['THB'] = '฿'; // Thai Baht
|
95 |
+
$symbols['USD'] = '$'; // U.S. Dollar
|
96 |
|
97 |
+
if(($currency = strtoupper($currency)) && !empty($symbols[$currency]))
|
98 |
+
return $symbols[$currency];
|
99 |
+
return '$'; // Else `$` sign (default value).
|
100 |
+
}
|
101 |
}
|
102 |
+
}
|
includes/classes/utils-dirs.inc.php
CHANGED
@@ -33,12 +33,12 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 111017
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @return
|
38 |
*/
|
39 |
public static function n_dir_seps ($path = FALSE)
|
40 |
{
|
41 |
-
return rtrim (preg_replace ("/\/+/", "/", str_replace (array
|
42 |
}
|
43 |
/**
|
44 |
* Strips a trailing `/app_data/` sub-directory.
|
@@ -46,8 +46,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
46 |
* @package s2Member\Utilities
|
47 |
* @since 3.5
|
48 |
*
|
49 |
-
* @param
|
50 |
-
* @return
|
51 |
*/
|
52 |
public static function strip_dir_app_data ($path = FALSE)
|
53 |
{
|
@@ -59,8 +59,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
59 |
* @package s2Member\Utilities
|
60 |
* @since 110815
|
61 |
*
|
62 |
-
* @param
|
63 |
-
* @return
|
64 |
*/
|
65 |
public static function basename_dir_app_data ($path = FALSE)
|
66 |
{
|
@@ -74,8 +74,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
74 |
* @package s2Member\Utilities
|
75 |
* @since 110815
|
76 |
*
|
77 |
-
* @param
|
78 |
-
* @return
|
79 |
*/
|
80 |
public static function doc_root_path ($path = FALSE)
|
81 |
{
|
@@ -89,15 +89,15 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
89 |
* @package s2Member\Utilities
|
90 |
* @since 110815
|
91 |
*
|
92 |
-
* @param
|
93 |
-
* @param
|
94 |
* @param bool $try_realpaths Defaults to true. When true, try to acquire ``realpath()``, thereby resolving all relative paths and/or symlinks in ``$from`` and ``$to`` args.
|
95 |
* @param bool $use_win_diff_drive_jctn Defaults to true. When true, we'll work around issues with different drives on Windows by trying to create a directory junction.
|
96 |
-
* @return
|
97 |
*/
|
98 |
public static function rel_path ($from = FALSE, $to = FALSE, $try_realpaths = TRUE, $use_win_diff_drive_jctn = TRUE)
|
99 |
{
|
100 |
-
if ( /* Initialize/validate. */!($rel_path = array
|
101 |
{
|
102 |
$from = ($try_realpaths && ($_real_from = realpath ($from))) ? $_real_from : $from; // Try this?
|
103 |
$to = ($try_realpaths && ($_real_to = realpath ($to))) ? $_real_to : $to; // Try to find realpath?
|
@@ -133,7 +133,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
133 |
}
|
134 |
}
|
135 |
|
136 |
-
unset
|
137 |
|
138 |
$rel_path = $to; // Re-initialize. Start ``$rel_path`` as the value of the ``$to`` array.
|
139 |
|
@@ -164,8 +164,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
164 |
* @package s2Member\Utilities
|
165 |
* @since 111013
|
166 |
*
|
167 |
-
* @param
|
168 |
-
* @param
|
169 |
* @return bool True if created successfully, or already exists, else false.
|
170 |
*/
|
171 |
public static function create_win_jctn ($jctn = FALSE, $target = FALSE)
|
@@ -192,7 +192,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_dirs"))
|
|
192 |
* @package s2Member\Utilities
|
193 |
* @since 111017
|
194 |
*
|
195 |
-
* @param
|
196 |
* @return str|bool Full string path to a writable temp directory, else false on failure.
|
197 |
*/
|
198 |
public static function get_temp_dir ($fallback = TRUE)
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 111017
|
35 |
*
|
36 |
+
* @param string $path Directory or file path.
|
37 |
+
* @return string Directory or file path, after having been normalized by this routine.
|
38 |
*/
|
39 |
public static function n_dir_seps ($path = FALSE)
|
40 |
{
|
41 |
+
return rtrim (preg_replace ("/\/+/", "/", str_replace (array(DIRECTORY_SEPARATOR, "\\", "/"), "/", (string)$path)), "/");
|
42 |
}
|
43 |
/**
|
44 |
* Strips a trailing `/app_data/` sub-directory.
|
46 |
* @package s2Member\Utilities
|
47 |
* @since 3.5
|
48 |
*
|
49 |
+
* @param string $path Directory or file path.
|
50 |
+
* @return string Directory or file path without `/app_data/`.
|
51 |
*/
|
52 |
public static function strip_dir_app_data ($path = FALSE)
|
53 |
{
|
59 |
* @package s2Member\Utilities
|
60 |
* @since 110815
|
61 |
*
|
62 |
+
* @param string $path Directory or file path.
|
63 |
+
* @return string Basename; including a possible `/app_data/` directory.
|
64 |
*/
|
65 |
public static function basename_dir_app_data ($path = FALSE)
|
66 |
{
|
74 |
* @package s2Member\Utilities
|
75 |
* @since 110815
|
76 |
*
|
77 |
+
* @param string $path Directory or file path.
|
78 |
+
* @return string Shorther path, from document root.
|
79 |
*/
|
80 |
public static function doc_root_path ($path = FALSE)
|
81 |
{
|
89 |
* @package s2Member\Utilities
|
90 |
* @since 110815
|
91 |
*
|
92 |
+
* @param string $from The full directory path to calculate a relative path `from`.
|
93 |
+
* @param string $to The full directory or file path, which this routine will build a relative path `to`.
|
94 |
* @param bool $try_realpaths Defaults to true. When true, try to acquire ``realpath()``, thereby resolving all relative paths and/or symlinks in ``$from`` and ``$to`` args.
|
95 |
* @param bool $use_win_diff_drive_jctn Defaults to true. When true, we'll work around issues with different drives on Windows by trying to create a directory junction.
|
96 |
+
* @return string String with the relative path to: ``$to``.
|
97 |
*/
|
98 |
public static function rel_path ($from = FALSE, $to = FALSE, $try_realpaths = TRUE, $use_win_diff_drive_jctn = TRUE)
|
99 |
{
|
100 |
+
if ( /* Initialize/validate. */!($rel_path = array()) && is_string ($from) && strlen ($from) && is_string ($to) && strlen ($to))
|
101 |
{
|
102 |
$from = ($try_realpaths && ($_real_from = realpath ($from))) ? $_real_from : $from; // Try this?
|
103 |
$to = ($try_realpaths && ($_real_to = realpath ($to))) ? $_real_to : $to; // Try to find realpath?
|
133 |
}
|
134 |
}
|
135 |
|
136 |
+
unset($_real_from, $_real_to, $_from_drive, $_to_drive, $_from_drive_jctn, $_sys_temp_dir_jctn, $_jctn, $_from_drive_jctn_exists, $_jctn_dir, $_m);
|
137 |
|
138 |
$rel_path = $to; // Re-initialize. Start ``$rel_path`` as the value of the ``$to`` array.
|
139 |
|
164 |
* @package s2Member\Utilities
|
165 |
* @since 111013
|
166 |
*
|
167 |
+
* @param string $jctn Directory location of the Junction (i.e. the link).
|
168 |
+
* @param string $target Target directory that this Junction will connect to.
|
169 |
* @return bool True if created successfully, or already exists, else false.
|
170 |
*/
|
171 |
public static function create_win_jctn ($jctn = FALSE, $target = FALSE)
|
192 |
* @package s2Member\Utilities
|
193 |
* @since 111017
|
194 |
*
|
195 |
+
* @param string $fallback Defaults to true. If true, fallback on WordPress routine if not available, or if not writable.
|
196 |
* @return str|bool Full string path to a writable temp directory, else false on failure.
|
197 |
*/
|
198 |
public static function get_temp_dir ($fallback = TRUE)
|
includes/classes/utils-encryption.inc.php
CHANGED
@@ -33,8 +33,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
|
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 111106
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @return
|
38 |
*/
|
39 |
public static function key ($key = FALSE)
|
40 |
{
|
@@ -51,14 +51,14 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
|
|
51 |
* @package s2Member\Utilities
|
52 |
* @since 3.5
|
53 |
*
|
54 |
-
* @param
|
55 |
-
* @param
|
56 |
* @param bool $w_md5_cs Optional. Defaults to true. When true, an MD5 checksum is used in the encrypted string *(recommended)*.
|
57 |
-
* @return
|
58 |
*/
|
59 |
public static function encrypt ($string = FALSE, $key = FALSE, $w_md5_cs = TRUE)
|
60 |
{
|
61 |
-
if (function_exists ("mcrypt_encrypt") && in_array
|
62 |
{
|
63 |
$string = /* Force a valid string value here. */ (is_string ($string)) ? $string : "";
|
64 |
$string = /* Indicating this is an RIJNDAEL 256 encrypted string. */ (strlen ($string)) ? "~r2|" . $string : "";
|
@@ -84,16 +84,16 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
|
|
84 |
* @package s2Member\Utilities
|
85 |
* @since 3.5
|
86 |
*
|
87 |
-
* @param
|
88 |
-
* @param
|
89 |
-
* @return
|
90 |
*/
|
91 |
public static function decrypt ($base64 = FALSE, $key = FALSE)
|
92 |
{
|
93 |
$base64 = /* Force a valid string value here. */ (is_string ($base64)) ? $base64 : "";
|
94 |
$e = (strlen ($base64)) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode ($base64) : "";
|
95 |
|
96 |
-
if (function_exists ("mcrypt_decrypt") && in_array
|
97 |
&& strlen ($e) /* And, is this an RIJNDAEL 256 encrypted string? */ && preg_match ("/^~r2\:([a-zA-Z0-9]+)(?:\:([a-zA-Z0-9]+))?\|(.*?)$/s", $e, $iv_md5_e))
|
98 |
{
|
99 |
$key = /* Obtain encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key ($key);
|
@@ -120,10 +120,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
|
|
120 |
* @package s2Member\Utilities
|
121 |
* @since 3.5
|
122 |
*
|
123 |
-
* @param
|
124 |
-
* @param
|
125 |
* @param bool $w_md5_cs Optional. Defaults to true. When true, an MD5 checksum is used in the encrypted string *(recommended)*.
|
126 |
-
* @return
|
127 |
*/
|
128 |
public static function xencrypt ($string = FALSE, $key = FALSE, $w_md5_cs = TRUE)
|
129 |
{
|
@@ -148,9 +148,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_encryption"))
|
|
148 |
* @package s2Member\Utilities
|
149 |
* @since 3.5
|
150 |
*
|
151 |
-
* @param
|
152 |
-
* @param
|
153 |
-
* @return
|
154 |
*/
|
155 |
public static function xdecrypt ($base64 = FALSE, $key = FALSE)
|
156 |
{
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 111106
|
35 |
*
|
36 |
+
* @param string $key Optional. Attempt to force a specific Key. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
|
37 |
+
* @return string Proper encryption/decryption Key. If ``$key`` is passed in, and it validates, we'll return that. Otherwise use a default Key.
|
38 |
*/
|
39 |
public static function key ($key = FALSE)
|
40 |
{
|
51 |
* @package s2Member\Utilities
|
52 |
* @since 3.5
|
53 |
*
|
54 |
+
* @param string $string A string of data to encrypt.
|
55 |
+
* @param string $key Optional. Key used for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
|
56 |
* @param bool $w_md5_cs Optional. Defaults to true. When true, an MD5 checksum is used in the encrypted string *(recommended)*.
|
57 |
+
* @return string Encrypted string.
|
58 |
*/
|
59 |
public static function encrypt ($string = FALSE, $key = FALSE, $w_md5_cs = TRUE)
|
60 |
{
|
61 |
+
if (function_exists ("mcrypt_encrypt") && in_array("rijndael-256", mcrypt_list_algorithms ()) && in_array("cbc", mcrypt_list_modes ()))
|
62 |
{
|
63 |
$string = /* Force a valid string value here. */ (is_string ($string)) ? $string : "";
|
64 |
$string = /* Indicating this is an RIJNDAEL 256 encrypted string. */ (strlen ($string)) ? "~r2|" . $string : "";
|
84 |
* @package s2Member\Utilities
|
85 |
* @since 3.5
|
86 |
*
|
87 |
+
* @param string $base64 A string of data to decrypt. Should still be base64 encoded.
|
88 |
+
* @param string $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
|
89 |
+
* @return string Decrypted string.
|
90 |
*/
|
91 |
public static function decrypt ($base64 = FALSE, $key = FALSE)
|
92 |
{
|
93 |
$base64 = /* Force a valid string value here. */ (is_string ($base64)) ? $base64 : "";
|
94 |
$e = (strlen ($base64)) ? c_ws_plugin__s2member_utils_strings::base64_url_safe_decode ($base64) : "";
|
95 |
|
96 |
+
if (function_exists ("mcrypt_decrypt") && in_array("rijndael-256", mcrypt_list_algorithms ()) && in_array("cbc", mcrypt_list_modes ()) #
|
97 |
&& strlen ($e) /* And, is this an RIJNDAEL 256 encrypted string? */ && preg_match ("/^~r2\:([a-zA-Z0-9]+)(?:\:([a-zA-Z0-9]+))?\|(.*?)$/s", $e, $iv_md5_e))
|
98 |
{
|
99 |
$key = /* Obtain encryption/decryption key. */ c_ws_plugin__s2member_utils_encryption::key ($key);
|
120 |
* @package s2Member\Utilities
|
121 |
* @since 3.5
|
122 |
*
|
123 |
+
* @param string $string A string of data to encrypt.
|
124 |
+
* @param string $key Optional. Key used for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
|
125 |
* @param bool $w_md5_cs Optional. Defaults to true. When true, an MD5 checksum is used in the encrypted string *(recommended)*.
|
126 |
+
* @return string Encrypted string.
|
127 |
*/
|
128 |
public static function xencrypt ($string = FALSE, $key = FALSE, $w_md5_cs = TRUE)
|
129 |
{
|
148 |
* @package s2Member\Utilities
|
149 |
* @since 3.5
|
150 |
*
|
151 |
+
* @param string $base64 A string of data to decrypt. Should still be base64 encoded.
|
152 |
+
* @param string $key Optional. Key used originally for encryption. Defaults to the one configured for s2Member. Short of that, defaults to: ``wp_salt()``.
|
153 |
+
* @return string Decrypted string.
|
154 |
*/
|
155 |
public static function xdecrypt ($base64 = FALSE, $key = FALSE)
|
156 |
{
|
includes/classes/utils-forms.inc.php
CHANGED
@@ -33,8 +33,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_forms"))
|
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param
|
37 |
-
* @return
|
38 |
*/
|
39 |
public static function form_whips_2_url ($form = FALSE)
|
40 |
{
|
@@ -44,7 +44,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_forms"))
|
|
44 |
{
|
45 |
if (($url = trim ($form_action_m[7]))) // Set URL value dynamically. Now we add values.
|
46 |
{
|
47 |
-
foreach ((array)c_ws_plugin__s2member_utils_forms::form_whips_2_array
|
48 |
{
|
49 |
if (strlen ($name) && strlen ($value)) // Check $name -› $value lengths.
|
50 |
|
@@ -67,10 +67,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_forms"))
|
|
67 |
* @package s2Member\Utilities
|
68 |
* @since 3.5
|
69 |
*
|
70 |
-
* @param
|
71 |
* @return array An associative array of all hidden input fields.
|
72 |
*/
|
73 |
-
public static function form_whips_2_array
|
74 |
{
|
75 |
if (preg_match ("/\<form(.+?)\>/is", $form)) // Is this a form?
|
76 |
{
|
33 |
* @package s2Member\Utilities
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param string $form A form tag with hidden input fields.
|
37 |
+
* @return string A URL with query string equivalents.
|
38 |
*/
|
39 |
public static function form_whips_2_url ($form = FALSE)
|
40 |
{
|
44 |
{
|
45 |
if (($url = trim ($form_action_m[7]))) // Set URL value dynamically. Now we add values.
|
46 |
{
|
47 |
+
foreach ((array)c_ws_plugin__s2member_utils_forms::form_whips_2_array($form) as $name => $value)
|
48 |
{
|
49 |
if (strlen ($name) && strlen ($value)) // Check $name -› $value lengths.
|
50 |
|
67 |
* @package s2Member\Utilities
|
68 |
* @since 3.5
|
69 |
*
|
70 |
+
* @param string $form A form tag with hidden input fields.
|
71 |
* @return array An associative array of all hidden input fields.
|
72 |
*/
|
73 |
+
public static function form_whips_2_array($form = FALSE)
|
74 |
{
|
75 |
if (preg_match ("/\<form(.+?)\>/is", $form)) // Is this a form?
|
76 |
{
|
includes/classes/utils-gets.inc.php
CHANGED
@@ -39,10 +39,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
39 |
*/
|
40 |
public static function get_all_category_ids ()
|
41 |
{
|
42 |
-
if (is_array
|
43 |
$category_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($category_ids);
|
44 |
|
45 |
-
return (!empty
|
46 |
}
|
47 |
/**
|
48 |
* Retrieves a unique array of all child Category IDs, within a specific parent Category.
|
@@ -50,16 +50,16 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
50 |
* @package s2Member\Utilities
|
51 |
* @since 3.5
|
52 |
*
|
53 |
-
* @param int|
|
54 |
* @return array Unique array of all Category IDs *(as integers)* in ``$parent_category``.
|
55 |
*/
|
56 |
public static function get_all_child_category_ids ($parent_category = FALSE)
|
57 |
{
|
58 |
-
if (is_numeric ($parent_category) && is_array
|
59 |
foreach ($child_categories as /* Go through child Categories. */ $child_category)
|
60 |
$child_category_ids[] = (int)$child_category->term_id;
|
61 |
|
62 |
-
return (!empty
|
63 |
}
|
64 |
/**
|
65 |
* Retrieves a unique array of all Tag IDs in the database.
|
@@ -74,7 +74,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
74 |
foreach ((array)get_tags ("hide_empty=0") as $tag)
|
75 |
$tag_ids[] = (int)$tag->term_id; // Collect Tag's ID.
|
76 |
|
77 |
-
return (!empty
|
78 |
}
|
79 |
/**
|
80 |
* Converts a comma-delimited list of: Tag slugs/names/ids, into a unique array of all IDs.
|
@@ -82,7 +82,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
82 |
* @package s2Member\Utilities
|
83 |
* @since 111101
|
84 |
*
|
85 |
-
* @param
|
86 |
* @return array Unique array of Tag IDs *(as integers)*. With Tag slugs/names converted to IDs.
|
87 |
*/
|
88 |
public static function get_tags_converted_to_ids ($tags = FALSE)
|
@@ -101,7 +101,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
101 |
$tag_ids[] = (int)$term->term_id;
|
102 |
}
|
103 |
}
|
104 |
-
return (!empty
|
105 |
}
|
106 |
/**
|
107 |
* Retrieves a unique array of all published Post IDs in the database.
|
@@ -109,7 +109,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
109 |
* @package s2Member\Utilities
|
110 |
* @since 3.5
|
111 |
*
|
112 |
-
* @param
|
113 |
* Otherwise, return all Post IDs that are NOT of these Post Types: `page|attachment|nav_menu_item|revision`.
|
114 |
* @return array Unique array of all Post IDs *(as integers)*, including Custom Post Types; or all Post IDs of a specific Post Type.
|
115 |
*/
|
@@ -117,10 +117,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
117 |
{
|
118 |
global $wpdb; // Need this global DB object reference here.
|
119 |
|
120 |
-
if (is_array
|
121 |
$post_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($post_ids);
|
122 |
|
123 |
-
return (!empty
|
124 |
}
|
125 |
/**
|
126 |
* Retrieves a unique array of all published Page IDs in the database.
|
@@ -134,10 +134,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
134 |
{
|
135 |
global $wpdb; // Need this global DB object reference here.
|
136 |
|
137 |
-
if (is_array
|
138 |
$page_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($page_ids);
|
139 |
|
140 |
-
return (!empty
|
141 |
}
|
142 |
/**
|
143 |
* Retrieves a unique array of all Singular IDs in the database that require Custom Capabilities.
|
@@ -151,10 +151,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
151 |
{
|
152 |
global $wpdb; // Need this global DB object reference here.
|
153 |
|
154 |
-
if (is_array
|
155 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
156 |
|
157 |
-
return (!empty
|
158 |
}
|
159 |
/**
|
160 |
* Retrieves a unique array of unavailable Singular IDs that require Custom Capabilities.
|
@@ -165,20 +165,20 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
165 |
* @package s2Member\Utilities
|
166 |
* @since 111101
|
167 |
*
|
168 |
-
* @param
|
169 |
* @return array Unique array of all Singular IDs *(as integers)* NOT available to ``$user``, due to Custom Capability Restrictions.
|
170 |
*/
|
171 |
public static function get_unavailable_singular_ids_with_ccaps ($user = FALSE)
|
172 |
{
|
173 |
global $wpdb; // Need this global DB object reference here.
|
174 |
|
175 |
-
if (is_array
|
176 |
foreach ($results as $r) // Now we need to check Custom Capabilities against ``$user``. If ``$user`` is a valid `WP_User` object, else all are unavailable.
|
177 |
{
|
178 |
-
if (!is_object ($user) || empty
|
179 |
$singular_ids[] = (int)$r->post_id; // It's NOT available. There is no ``$user``.
|
180 |
|
181 |
-
else if (is_array
|
182 |
{
|
183 |
foreach ($ccaps as $ccap) // Test for Custom Capability Restrictions now.
|
184 |
if (strlen ($ccap) && !$user->has_cap ("access_s2member_ccap_" . $ccap))
|
@@ -188,7 +188,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
188 |
}
|
189 |
}
|
190 |
}
|
191 |
-
return (!empty
|
192 |
}
|
193 |
/**
|
194 |
* Retrieves a unique array of all Singular IDs that require Specific Post/Page Access.
|
@@ -203,12 +203,12 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
203 |
*/
|
204 |
public static function get_all_singular_ids_with_sp ($exclude_conflicts = FALSE)
|
205 |
{
|
206 |
-
if (is_array
|
207 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
208 |
|
209 |
-
if (!empty
|
210 |
{
|
211 |
-
$x_ids = array
|
212 |
|
213 |
$x_ids = array_merge ($x_ids, c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_ccaps ());
|
214 |
|
@@ -253,9 +253,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
253 |
|
254 |
foreach (($posts = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) as $p)
|
255 |
if (strpos ($p, "all-") === 0 && preg_match ("/^all-(.+)$/", $p, $m) /* Protecting `all-` of a specific Post Type? */)
|
256 |
-
if ((is_array
|
257 |
&& is_array($_p_of_type = c_ws_plugin__s2member_utils_gets::get_all_post_ids(substr($m[1], 0, -1)))))
|
258 |
-
&& !empty
|
259 |
|
260 |
$x_ids = /* Exclude the full list too. */ array_merge ($x_ids, $posts);
|
261 |
unset /* Just a little housekeeping here. */ ($posts, $p, $m, $p_of_type);
|
@@ -278,7 +278,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
278 |
$x_ids = array_unique (c_ws_plugin__s2member_utils_arrays::force_integers ($x_ids));
|
279 |
$singular_ids = /* Exclude all of the ``$x_ids`` now. */ array_diff ($singular_ids, $x_ids);
|
280 |
}
|
281 |
-
return (!empty
|
282 |
}
|
283 |
/**
|
284 |
* Retrieves a unique array of unavailable Singular IDs that require Specific Post/Page Access.
|
@@ -296,19 +296,19 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
296 |
*/
|
297 |
public static function get_unavailable_singular_ids_with_sp ($exclude_conflicts = FALSE)
|
298 |
{
|
299 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && is_array
|
300 |
foreach ($_singular_ids as $_singular_id) // Now check access to this Singular, against the current Visitor, via read-only ``c_ws_plugin__s2member_sp_access::sp_access()``.
|
301 |
if (is_numeric ($_singular_id) && !c_ws_plugin__s2member_sp_access::sp_access ($_singular_id, "read-only"))
|
302 |
$singular_ids[] = (int)$_singular_id;
|
303 |
|
304 |
-
if (!empty
|
305 |
{
|
306 |
$all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp ("exclude-conflicts");
|
307 |
foreach /* Weed out anything that's in conflict here. */ ($singular_ids as $s => $singular_id)
|
308 |
-
if (!in_array
|
309 |
-
unset
|
310 |
}
|
311 |
-
return (!empty
|
312 |
}
|
313 |
/**
|
314 |
* Retrieves a unique array of all published Singulars, protected with Specific Post/Page Access.
|
@@ -326,16 +326,16 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
326 |
*/
|
327 |
public static function get_all_singulars_with_sp ($exclude_conflicts = FALSE)
|
328 |
{
|
329 |
-
$singulars = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && is_array
|
330 |
|
331 |
-
if (!empty
|
332 |
{
|
333 |
$all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp ("exclude-conflicts");
|
334 |
foreach /* Weed out anything that's in conflict here. */ ($singulars as $s => $singular)
|
335 |
-
if (!in_array
|
336 |
-
unset
|
337 |
}
|
338 |
-
return (!empty
|
339 |
}
|
340 |
/**
|
341 |
* Retrieves a unique array of Singular IDs in the database, within specific term IDs.
|
@@ -352,10 +352,10 @@ if (!class_exists ("c_ws_plugin__s2member_utils_gets"))
|
|
352 |
{
|
353 |
global $wpdb; // Need this global DB object reference here.
|
354 |
|
355 |
-
if (!empty
|
356 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
357 |
|
358 |
-
return (!empty
|
359 |
}
|
360 |
}
|
361 |
}
|
39 |
*/
|
40 |
public static function get_all_category_ids ()
|
41 |
{
|
42 |
+
if (is_array($category_ids = /* Uses the WordPress function for this. */ get_all_category_ids ()))
|
43 |
$category_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($category_ids);
|
44 |
|
45 |
+
return (!empty($category_ids) && is_array($category_ids)) ? array_unique ($category_ids) : array();
|
46 |
}
|
47 |
/**
|
48 |
* Retrieves a unique array of all child Category IDs, within a specific parent Category.
|
50 |
* @package s2Member\Utilities
|
51 |
* @since 3.5
|
52 |
*
|
53 |
+
* @param int|string $parent_category A numeric Category ID.
|
54 |
* @return array Unique array of all Category IDs *(as integers)* in ``$parent_category``.
|
55 |
*/
|
56 |
public static function get_all_child_category_ids ($parent_category = FALSE)
|
57 |
{
|
58 |
+
if (is_numeric ($parent_category) && is_array($child_categories = get_categories ("child_of=" . $parent_category . "&hide_empty=0")))
|
59 |
foreach ($child_categories as /* Go through child Categories. */ $child_category)
|
60 |
$child_category_ids[] = (int)$child_category->term_id;
|
61 |
|
62 |
+
return (!empty($child_category_ids) && is_array($child_category_ids)) ? array_unique ($child_category_ids) : array();
|
63 |
}
|
64 |
/**
|
65 |
* Retrieves a unique array of all Tag IDs in the database.
|
74 |
foreach ((array)get_tags ("hide_empty=0") as $tag)
|
75 |
$tag_ids[] = (int)$tag->term_id; // Collect Tag's ID.
|
76 |
|
77 |
+
return (!empty($tag_ids) && is_array($tag_ids)) ? array_unique ($tag_ids) : array();
|
78 |
}
|
79 |
/**
|
80 |
* Converts a comma-delimited list of: Tag slugs/names/ids, into a unique array of all IDs.
|
82 |
* @package s2Member\Utilities
|
83 |
* @since 111101
|
84 |
*
|
85 |
+
* @param string $tags Tag slugs/names/IDs; comma-delimited.
|
86 |
* @return array Unique array of Tag IDs *(as integers)*. With Tag slugs/names converted to IDs.
|
87 |
*/
|
88 |
public static function get_tags_converted_to_ids ($tags = FALSE)
|
101 |
$tag_ids[] = (int)$term->term_id;
|
102 |
}
|
103 |
}
|
104 |
+
return (!empty($tag_ids) && is_array($tag_ids)) ? array_unique ($tag_ids) : array();
|
105 |
}
|
106 |
/**
|
107 |
* Retrieves a unique array of all published Post IDs in the database.
|
109 |
* @package s2Member\Utilities
|
110 |
* @since 3.5
|
111 |
*
|
112 |
+
* @param string $post_type Optional. If provided, return all Post IDs of a specific Post Type.
|
113 |
* Otherwise, return all Post IDs that are NOT of these Post Types: `page|attachment|nav_menu_item|revision`.
|
114 |
* @return array Unique array of all Post IDs *(as integers)*, including Custom Post Types; or all Post IDs of a specific Post Type.
|
115 |
*/
|
117 |
{
|
118 |
global $wpdb; // Need this global DB object reference here.
|
119 |
|
120 |
+
if (is_array($post_ids = $wpdb->get_col ("SELECT `ID` FROM `" . $wpdb->posts . "` WHERE `post_status` = 'publish' AND " . (($post_type) ? "`post_type` = '" . esc_sql ((string)$post_type) . "'" : "`post_type` NOT IN('page','attachment','nav_menu_item','revision')"))))
|
121 |
$post_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($post_ids);
|
122 |
|
123 |
+
return (!empty($post_ids) && is_array($post_ids)) ? array_unique ($post_ids) : array();
|
124 |
}
|
125 |
/**
|
126 |
* Retrieves a unique array of all published Page IDs in the database.
|
134 |
{
|
135 |
global $wpdb; // Need this global DB object reference here.
|
136 |
|
137 |
+
if (is_array($page_ids = $wpdb->get_col ("SELECT `ID` FROM `" . $wpdb->posts . "` WHERE `post_status` = 'publish' AND `post_type` = 'page'")))
|
138 |
$page_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($page_ids);
|
139 |
|
140 |
+
return (!empty($page_ids) && is_array($page_ids)) ? array_unique ($page_ids) : array();
|
141 |
}
|
142 |
/**
|
143 |
* Retrieves a unique array of all Singular IDs in the database that require Custom Capabilities.
|
151 |
{
|
152 |
global $wpdb; // Need this global DB object reference here.
|
153 |
|
154 |
+
if (is_array($singular_ids = $wpdb->get_col ("SELECT `post_id` FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` != ''")))
|
155 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
156 |
|
157 |
+
return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique ($singular_ids) : array();
|
158 |
}
|
159 |
/**
|
160 |
* Retrieves a unique array of unavailable Singular IDs that require Custom Capabilities.
|
165 |
* @package s2Member\Utilities
|
166 |
* @since 111101
|
167 |
*
|
168 |
+
* @param object $user Optional. A `WP_User` object. If this is a valid `WP_User` object, test against this ``$user``, else all are unavailable.
|
169 |
* @return array Unique array of all Singular IDs *(as integers)* NOT available to ``$user``, due to Custom Capability Restrictions.
|
170 |
*/
|
171 |
public static function get_unavailable_singular_ids_with_ccaps ($user = FALSE)
|
172 |
{
|
173 |
global $wpdb; // Need this global DB object reference here.
|
174 |
|
175 |
+
if (is_array($results = $wpdb->get_results ("SELECT `post_id`, `meta_value` FROM `" . $wpdb->postmeta . "` WHERE `meta_key` = 's2member_ccaps_req' AND `meta_value` != ''")))
|
176 |
foreach ($results as $r) // Now we need to check Custom Capabilities against ``$user``. If ``$user`` is a valid `WP_User` object, else all are unavailable.
|
177 |
{
|
178 |
+
if (!is_object ($user) || empty($user->ID)) // No ``$user`` object? Maybe not logged-in?.
|
179 |
$singular_ids[] = (int)$r->post_id; // It's NOT available. There is no ``$user``.
|
180 |
|
181 |
+
else if (is_array($ccaps = /* Make sure we unserialize. */ @unserialize ($r->meta_value)))
|
182 |
{
|
183 |
foreach ($ccaps as $ccap) // Test for Custom Capability Restrictions now.
|
184 |
if (strlen ($ccap) && !$user->has_cap ("access_s2member_ccap_" . $ccap))
|
188 |
}
|
189 |
}
|
190 |
}
|
191 |
+
return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique ($singular_ids) : array();
|
192 |
}
|
193 |
/**
|
194 |
* Retrieves a unique array of all Singular IDs that require Specific Post/Page Access.
|
203 |
*/
|
204 |
public static function get_all_singular_ids_with_sp ($exclude_conflicts = FALSE)
|
205 |
{
|
206 |
+
if (is_array(($singular_ids = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && is_array($singular_ids = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]))) ? $singular_ids : array())))
|
207 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
208 |
|
209 |
+
if (!empty($singular_ids) && is_array($singular_ids) && $exclude_conflicts /* Return ONLY those which are NOT in conflict with other Restrictions? */)
|
210 |
{
|
211 |
+
$x_ids = array($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]);
|
212 |
|
213 |
$x_ids = array_merge ($x_ids, c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_ccaps ());
|
214 |
|
253 |
|
254 |
foreach (($posts = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_posts"])) as $p)
|
255 |
if (strpos ($p, "all-") === 0 && preg_match ("/^all-(.+)$/", $p, $m) /* Protecting `all-` of a specific Post Type? */)
|
256 |
+
if ((is_array($p_of_type = c_ws_plugin__s2member_utils_gets::get_all_post_ids ($m[1])) || (substr($m[1], -1) === "s"
|
257 |
&& is_array($_p_of_type = c_ws_plugin__s2member_utils_gets::get_all_post_ids(substr($m[1], 0, -1)))))
|
258 |
+
&& !empty($p_of_type)) $x_ids = array_merge /* Merge all Posts of this Post Type. */ ($x_ids, $p_of_type);
|
259 |
|
260 |
$x_ids = /* Exclude the full list too. */ array_merge ($x_ids, $posts);
|
261 |
unset /* Just a little housekeeping here. */ ($posts, $p, $m, $p_of_type);
|
278 |
$x_ids = array_unique (c_ws_plugin__s2member_utils_arrays::force_integers ($x_ids));
|
279 |
$singular_ids = /* Exclude all of the ``$x_ids`` now. */ array_diff ($singular_ids, $x_ids);
|
280 |
}
|
281 |
+
return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique ($singular_ids) : array();
|
282 |
}
|
283 |
/**
|
284 |
* Retrieves a unique array of unavailable Singular IDs that require Specific Post/Page Access.
|
296 |
*/
|
297 |
public static function get_unavailable_singular_ids_with_sp ($exclude_conflicts = FALSE)
|
298 |
{
|
299 |
+
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && is_array($_singular_ids = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"])))
|
300 |
foreach ($_singular_ids as $_singular_id) // Now check access to this Singular, against the current Visitor, via read-only ``c_ws_plugin__s2member_sp_access::sp_access()``.
|
301 |
if (is_numeric ($_singular_id) && !c_ws_plugin__s2member_sp_access::sp_access ($_singular_id, "read-only"))
|
302 |
$singular_ids[] = (int)$_singular_id;
|
303 |
|
304 |
+
if (!empty($singular_ids) && is_array($singular_ids) /* And, are we excluding conflicts in this instance? */ && $exclude_conflicts)
|
305 |
{
|
306 |
$all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp ("exclude-conflicts");
|
307 |
foreach /* Weed out anything that's in conflict here. */ ($singular_ids as $s => $singular_id)
|
308 |
+
if (!in_array($singular_id, $all_singular_ids_not_conflicting))
|
309 |
+
unset($singular_ids[$s]);
|
310 |
}
|
311 |
+
return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique ($singular_ids) : array();
|
312 |
}
|
313 |
/**
|
314 |
* Retrieves a unique array of all published Singulars, protected with Specific Post/Page Access.
|
326 |
*/
|
327 |
public static function get_all_singulars_with_sp ($exclude_conflicts = FALSE)
|
328 |
{
|
329 |
+
$singulars = ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"] && is_array($singulars = get_posts ("post_status=publish&post_type=any&include=" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["specific_ids"]))) ? $singulars : array();
|
330 |
|
331 |
+
if (!empty($singulars) && is_array($singulars) /* And, are we excluding conflicts in this instance? */ && $exclude_conflicts)
|
332 |
{
|
333 |
$all_singular_ids_not_conflicting = c_ws_plugin__s2member_utils_gets::get_all_singular_ids_with_sp ("exclude-conflicts");
|
334 |
foreach /* Weed out anything that's in conflict here. */ ($singulars as $s => $singular)
|
335 |
+
if (!in_array($singular->ID, $all_singular_ids_not_conflicting))
|
336 |
+
unset($singulars[$s]);
|
337 |
}
|
338 |
+
return (!empty($singulars) && is_array($singulars)) ? c_ws_plugin__s2member_utils_arrays::array_unique ($singulars) : array();
|
339 |
}
|
340 |
/**
|
341 |
* Retrieves a unique array of Singular IDs in the database, within specific term IDs.
|
352 |
{
|
353 |
global $wpdb; // Need this global DB object reference here.
|
354 |
|
355 |
+
if (!empty($terms) && is_array($terms) && is_array($singular_ids = $wpdb->get_col ("SELECT `object_id` FROM `" . $wpdb->term_relationships . "` WHERE `term_taxonomy_id` IN (SELECT `term_taxonomy_id` FROM `" . $wpdb->term_taxonomy . "` WHERE `term_id` IN('" . implode ("','", $terms) . "'))")))
|
356 |
$singular_ids = c_ws_plugin__s2member_utils_arrays::force_integers ($singular_ids);
|
357 |
|
358 |
+
return (!empty($singular_ids) && is_array($singular_ids)) ? array_unique ($singular_ids) : array();
|
359 |
}
|
360 |
}
|
361 |
}
|
includes/classes/utils-html.inc.php
CHANGED
@@ -37,9 +37,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_html"))
|
|
37 |
* @package s2Member\Utilities
|
38 |
* @since 110720
|
39 |
*
|
40 |
-
* @param
|
41 |
-
* @param
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function doctype_html_head ($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE)
|
45 |
{
|
@@ -63,7 +63,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_html"))
|
|
63 |
echo '<title>' . $doctype_html_head_title . '</title>' . "\n";
|
64 |
|
65 |
if ($doctype_html_head_action) // Add content from Hook?
|
66 |
-
do_action
|
67 |
|
68 |
echo '</head>' . "\n";
|
69 |
|
37 |
* @package s2Member\Utilities
|
38 |
* @since 110720
|
39 |
*
|
40 |
+
* @param string $doctype_html_head_title Optional. The title of the HTML document being generated.
|
41 |
+
* @param string $doctype_html_head_action Optional. An action Hook to process during HEAD generation.
|
42 |
+
* @return string A DOCTYPE tag along with the HEAD section and title tag, configured by parameters.
|
43 |
*/
|
44 |
public static function doctype_html_head ($doctype_html_head_title = FALSE, $doctype_html_head_action = FALSE)
|
45 |
{
|
63 |
echo '<title>' . $doctype_html_head_title . '</title>' . "\n";
|
64 |
|
65 |
if ($doctype_html_head_action) // Add content from Hook?
|
66 |
+
do_action($doctype_html_head_action, get_defined_vars ());
|
67 |
|
68 |
echo '</head>' . "\n";
|
69 |
|
includes/classes/utils-logs.inc.php
CHANGED
@@ -141,7 +141,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_logs"))
|
|
141 |
{
|
142 |
if (is_dir ($dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]) && is_writable ($dir))
|
143 |
{
|
144 |
-
$max = apply_filters
|
145 |
|
146 |
$log_files = scandir ($dir); shuffle($log_files); $counter = 1;
|
147 |
|
@@ -181,7 +181,7 @@ if (!class_exists ("c_ws_plugin__s2member_utils_logs"))
|
|
181 |
|
182 |
if (!$stagger || is_float ($stagger = time () / 2)) // Stagger this routine?
|
183 |
{
|
184 |
-
if (is_array
|
185 |
{
|
186 |
foreach ($expired_s2m_transients as $expired_s2m_transient) // Delete the _timeout, and also the Transient entry name itself.
|
187 |
if (($id = $expired_s2m_transient->option_id) && ($name = preg_replace ("/_transient_timeout_/i", "_transient_", $expired_s2m_transient->option_name, 1)))
|
141 |
{
|
142 |
if (is_dir ($dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]) && is_writable ($dir))
|
143 |
{
|
144 |
+
$max = apply_filters("ws_plugin__s2member_oversize_log_file_bytes", 2097152, get_defined_vars ());
|
145 |
|
146 |
$log_files = scandir ($dir); shuffle($log_files); $counter = 1;
|
147 |
|
181 |
|
182 |
if (!$stagger || is_float ($stagger = time () / 2)) // Stagger this routine?
|
183 |
{
|
184 |
+
if (is_array($expired_s2m_transients = $wpdb->get_results ("SELECT * FROM `" . $wpdb->options . "` WHERE `option_name` LIKE '" . esc_sql (like_escape ("_transient_timeout_s2m_")) . "%' AND `option_value` < '" . esc_sql (time ()) . "' LIMIT 5")) && !empty($expired_s2m_transients))
|
185 |
{
|
186 |
foreach ($expired_s2m_transients as $expired_s2m_transient) // Delete the _timeout, and also the Transient entry name itself.
|
187 |
if (($id = $expired_s2m_transient->option_id) && ($name = preg_replace ("/_transient_timeout_/i", "_transient_", $expired_s2m_transient->option_name, 1)))
|
includes/classes/utils-s2o.inc.php
CHANGED
@@ -30,9 +30,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
|
|
30 |
* @package s2Member\Utilities
|
31 |
* @since 110912
|
32 |
*
|
33 |
-
* @param
|
34 |
-
* @param
|
35 |
-
* @return
|
36 |
*/
|
37 |
public static function wp_dir ($starting_dir = FALSE, $alt_starting_dir = FALSE)
|
38 |
{
|
@@ -56,8 +56,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
|
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 110912
|
58 |
*
|
59 |
-
* @param
|
60 |
-
* @param
|
61 |
* @return str|bool WordPress settings, else false on failure.
|
62 |
*/
|
63 |
public static function wp_settings_as ($wp_dir = FALSE, $o_file = FALSE)
|
@@ -105,9 +105,9 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
|
|
105 |
* @package s2Member\Utilities
|
106 |
* @since 110917
|
107 |
*
|
108 |
-
* @param
|
109 |
* @param int $times Mumber of escapes. Defaults to 1.
|
110 |
-
* @return
|
111 |
*/
|
112 |
public static function esc_ds ($string = FALSE, $times = FALSE)
|
113 |
{
|
@@ -120,8 +120,8 @@ if (!class_exists ("c_ws_plugin__s2member_utils_s2o"))
|
|
120 |
* @package s2Member\Utilities
|
121 |
* @since 110917
|
122 |
*
|
123 |
-
* @param
|
124 |
-
* @return
|
125 |
*/
|
126 |
public static function evl ($code = FALSE)
|
127 |
{
|
30 |
* @package s2Member\Utilities
|
31 |
* @since 110912
|
32 |
*
|
33 |
+
* @param string $starting_dir A directory to start searching from.
|
34 |
+
* @param string $alt_starting_dir An alternate directory to search from.
|
35 |
+
* @return string|null WordPress directory, else exits script execution on failure.
|
36 |
*/
|
37 |
public static function wp_dir ($starting_dir = FALSE, $alt_starting_dir = FALSE)
|
38 |
{
|
56 |
* @package s2Member\Utilities
|
57 |
* @since 110912
|
58 |
*
|
59 |
+
* @param string $wp_dir WordPress directory path.
|
60 |
+
* @param string $o_file Location of calling `*-o.php` file.
|
61 |
* @return str|bool WordPress settings, else false on failure.
|
62 |
*/
|
63 |
public static function wp_settings_as ($wp_dir = FALSE, $o_file = FALSE)
|
105 |
* @package s2Member\Utilities
|
106 |
* @since 110917
|
107 |
*
|
108 |
+
* @param string $string Input string.
|
109 |
* @param int $times Mumber of escapes. Defaults to 1.
|
110 |
+
* @return string Output string after dollar signs are escaped.
|
111 |
*/
|
112 |
public static function esc_ds ($string = FALSE, $times = FALSE)
|
113 |
{
|
120 |
* @package s2Member\Utilities
|
121 |
* @since 110917
|
122 |
*
|
123 |
+
* @param string $code A string of data, possibly with embedded PHP code.
|
124 |
+
* @return string Output after PHP evaluation.
|
125 |
*/
|
126 |
public static function evl ($code = FALSE)
|
127 |
{
|
includes/classes/utils-strings.inc.php
CHANGED
@@ -55,10 +55,10 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
55 |
* @package s2Member\Utilities
|
56 |
* @since 3.5
|
57 |
*
|
58 |
-
* @param
|
59 |
* @param int $times Number of escapes. Defaults to 1.
|
60 |
-
* @param
|
61 |
-
* @return
|
62 |
*/
|
63 |
public static function esc_dq($string = FALSE, $times = FALSE, $escape_char = "\\")
|
64 |
{
|
@@ -72,9 +72,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
72 |
* @package s2Member\Utilities
|
73 |
* @since 3.5
|
74 |
*
|
75 |
-
* @param
|
76 |
* @param int $times Number of escapes. Defaults to 1.
|
77 |
-
* @return
|
78 |
*/
|
79 |
public static function esc_sq($string = FALSE, $times = FALSE)
|
80 |
{
|
@@ -88,9 +88,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
88 |
* @package s2Member\Utilities
|
89 |
* @since 110901
|
90 |
*
|
91 |
-
* @param
|
92 |
* @param int $times Number of escapes. Defaults to 1.
|
93 |
-
* @return
|
94 |
*/
|
95 |
public static function esc_js_sq($string = FALSE, $times = FALSE)
|
96 |
{
|
@@ -104,9 +104,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
104 |
* @package s2Member\Utilities
|
105 |
* @since 3.5
|
106 |
*
|
107 |
-
* @param
|
108 |
* @param int $times Number of escapes. Defaults to 1.
|
109 |
-
* @return
|
110 |
*
|
111 |
* @deprecated Starting with s2Member v120103, please use:
|
112 |
* ``c_ws_plugin__s2member_utils_strings::esc_refs()``.
|
@@ -123,9 +123,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
123 |
* @package s2Member\Utilities
|
124 |
* @since 120103
|
125 |
*
|
126 |
-
* @param
|
127 |
* @param int $times Number of escapes. Defaults to 1.
|
128 |
-
* @return
|
129 |
*/
|
130 |
public static function esc_refs($string = NULL, $times = NULL)
|
131 |
{
|
@@ -139,8 +139,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
139 |
* @package s2Member\Utilities
|
140 |
* @since 111106
|
141 |
*
|
142 |
-
* @param
|
143 |
-
* @return
|
144 |
*/
|
145 |
public static function strip_2_kb_chars($string = FALSE)
|
146 |
{
|
@@ -155,7 +155,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
155 |
* @see s2Member\Utilities\c_ws_plugin__s2member_utils_strings::trim_deep()
|
156 |
* @see http://php.net/manual/en/function.trim.php
|
157 |
*
|
158 |
-
* @param
|
159 |
* @param str|bool $chars Optional. Defaults to false, indicating the default trim chars ` \t\n\r\0\x0B`. Or, set to a specific string of chars.
|
160 |
* @param str|bool $extra_chars Optional. This is NOT possible with PHP alone, but here you can specify extra chars; in addition to ``$chars``.
|
161 |
* @return str|array Either the input string, or the input array; after all data is trimmed up according to arguments passed in.
|
@@ -173,7 +173,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
173 |
* @see s2Member\Utilities\c_ws_plugin__s2member_utils_strings::trim()
|
174 |
* @see http://php.net/manual/en/function.trim.php
|
175 |
*
|
176 |
-
* @param
|
177 |
* @param str|bool $chars Optional. Defaults to false, indicating the default trim chars ` \t\n\r\0\x0B`. Or, set to a specific string of chars.
|
178 |
* @param str|bool $extra_chars Optional. This is NOT possible with PHP alone, but here you can specify extra chars; in addition to ``$chars``.
|
179 |
* @return str|array Either the input string, or the input array; after all data is trimmed up according to arguments passed in.
|
@@ -199,7 +199,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
199 |
* @package s2Member\Utilities
|
200 |
* @since 3.5
|
201 |
*
|
202 |
-
* @param
|
203 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
204 |
*/
|
205 |
public static function trim_dq_deep($value = FALSE)
|
@@ -212,7 +212,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
212 |
* @package s2Member\Utilities
|
213 |
* @since 111106
|
214 |
*
|
215 |
-
* @param
|
216 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
217 |
*/
|
218 |
public static function trim_sq_deep($value = FALSE)
|
@@ -225,7 +225,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
225 |
* @package s2Member\Utilities
|
226 |
* @since 111106
|
227 |
*
|
228 |
-
* @param
|
229 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
230 |
*/
|
231 |
public static function trim_dsq_deep($value = FALSE)
|
@@ -240,7 +240,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
240 |
* @package s2Member\Utilities
|
241 |
* @since 111011
|
242 |
*
|
243 |
-
* @param
|
244 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
245 |
*/
|
246 |
public static function trim_qts_deep($value = FALSE)
|
@@ -257,8 +257,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
257 |
* @package s2Member\Utilities
|
258 |
* @since 140124
|
259 |
*
|
260 |
-
* @param
|
261 |
-
* @return
|
262 |
*/
|
263 |
public static function trim_html($string = FALSE)
|
264 |
{
|
@@ -273,9 +273,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
273 |
* @package s2Member\Utilities
|
274 |
* @since 3.5
|
275 |
*
|
276 |
-
* @param
|
277 |
-
* @param
|
278 |
-
* @param
|
279 |
* @param bool $wrap_e Optional. Defaults to false. Should empty strings be wrapped too?
|
280 |
* @return str|array Either the input string, or the input array; after all data is wrapped up.
|
281 |
*/
|
@@ -297,8 +297,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
297 |
* @package s2Member\Utilities
|
298 |
* @since 110926
|
299 |
*
|
300 |
-
* @param
|
301 |
-
* @param
|
302 |
* @return str|array Either the input string, or the input array; after all data is escaped with ``preg_quote()``.
|
303 |
*/
|
304 |
public static function preg_quote_deep($value = FALSE, $delimiter = FALSE)
|
@@ -322,7 +322,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
322 |
* @param int $length Optional. Defaults to `12`. Length of the random string.
|
323 |
* @param bool $special_chars Defaults to true. If false, special chars are NOT included.
|
324 |
* @param bool $extra_special_chars Defaults to false. If true, extra special chars are included.
|
325 |
-
* @return
|
326 |
*/
|
327 |
public static function random_str_gen($length = FALSE, $special_chars = TRUE, $extra_special_chars = FALSE)
|
328 |
{
|
@@ -343,8 +343,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
343 |
* @package s2Member\Utilities
|
344 |
* @since 3.5
|
345 |
*
|
346 |
-
* @param
|
347 |
-
* @return
|
348 |
*/
|
349 |
public static function highlight_php($string = FALSE)
|
350 |
{
|
@@ -358,7 +358,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
358 |
* @package s2Member\Utilities
|
359 |
* @since 111009
|
360 |
*
|
361 |
-
* @param
|
362 |
* @return array Array of parsed email addresses.
|
363 |
*/
|
364 |
public static function parse_emails($value = FALSE)
|
@@ -389,11 +389,11 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
389 |
* @package s2Member\Utilities
|
390 |
* @since 110913
|
391 |
*
|
392 |
-
* @param
|
393 |
* @param array $url_unsafe_chars Optional. An array of un-safe characters. Defaults to: ``array("+", "/")``.
|
394 |
* @param array $url_safe_chars Optional. An array of safe character replacements. Defaults to: ``array("-", "_")``.
|
395 |
-
* @param
|
396 |
-
* @return
|
397 |
*/
|
398 |
public static function base64_url_safe_encode($string = FALSE, $url_unsafe_chars = array("+", "/"), $url_safe_chars = array("-", "_"), $trim_padding_chars = "=~.")
|
399 |
{
|
@@ -414,11 +414,11 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
414 |
* @package s2Member\Utilities
|
415 |
* @since 110913
|
416 |
*
|
417 |
-
* @param
|
418 |
* @param array $url_unsafe_chars Optional. An array of un-safe character replacements. Defaults to: ``array("+", "/")``.
|
419 |
* @param array $url_safe_chars Optional. An array of safe characters. Defaults to: ``array("-", "_")``.
|
420 |
-
* @param
|
421 |
-
* @return
|
422 |
*/
|
423 |
public static function base64_url_safe_decode($base64_url_safe = FALSE, $url_unsafe_chars = array("+", "/"), $url_safe_chars = array("-", "_"), $trim_padding_chars = "=~.")
|
424 |
{
|
@@ -437,8 +437,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
437 |
* @package s2Member\Utilities
|
438 |
* @since 111017
|
439 |
*
|
440 |
-
* @param
|
441 |
-
* @param
|
442 |
* @return str|bool An RSA-SHA1 signature string, or false on failure.
|
443 |
*/
|
444 |
public static function rsa_sha1_sign($string = FALSE, $key = FALSE)
|
@@ -471,9 +471,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
471 |
* @package s2Member\Utilities
|
472 |
* @since 111017
|
473 |
*
|
474 |
-
* @param
|
475 |
-
* @param
|
476 |
-
* @param
|
477 |
* @return str|bool An RSA-SHA1 signature string, or false on failure.
|
478 |
*/
|
479 |
public static function _rsa_sha1_shell_sign($string = FALSE, $key = FALSE, $openssl = FALSE)
|
@@ -498,8 +498,8 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
498 |
* @package s2Member\Utilities
|
499 |
* @since 111017
|
500 |
*
|
501 |
-
* @param
|
502 |
-
* @return
|
503 |
*
|
504 |
* @see http://www.faqs.org/qa/qa-14736.html
|
505 |
*/
|
@@ -524,9 +524,9 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
524 |
* @package s2Member\Utilities
|
525 |
* @since 111017
|
526 |
*
|
527 |
-
* @param
|
528 |
-
* @param
|
529 |
-
* @return
|
530 |
*/
|
531 |
public static function hmac_sha1_sign($string = FALSE, $key = FALSE)
|
532 |
{
|
@@ -544,7 +544,7 @@ if(!class_exists("c_ws_plugin__s2member_utils_strings"))
|
|
544 |
*
|
545 |
* @see http://www.faqs.org/rfcs/rfc3986.html
|
546 |
*
|
547 |
-
* @param
|
55 |
* @package s2Member\Utilities
|
56 |
* @since 3.5
|
57 |
*
|
58 |
+
* @param string $string Input string.
|
59 |
* @param int $times Number of escapes. Defaults to 1.
|
60 |
+
* @param string $escape_char The character to be used in escapes.
|
61 |
+
* @return string Output string after double quotes are escaped.
|
62 |
*/
|
63 |
public static function esc_dq($string = FALSE, $times = FALSE, $escape_char = "\\")
|
64 |
{
|
72 |
* @package s2Member\Utilities
|
73 |
* @since 3.5
|
74 |
*
|
75 |
+
* @param string $string Input string.
|
76 |
* @param int $times Number of escapes. Defaults to 1.
|
77 |
+
* @return string Output string after single quotes are escaped.
|
78 |
*/
|
79 |
public static function esc_sq($string = FALSE, $times = FALSE)
|
80 |
{
|
88 |
* @package s2Member\Utilities
|
89 |
* @since 110901
|
90 |
*
|
91 |
+
* @param string $string Input string.
|
92 |
* @param int $times Number of escapes. Defaults to 1.
|
93 |
+
* @return string Output string after JavaScript and single quotes are escaped.
|
94 |
*/
|
95 |
public static function esc_js_sq($string = FALSE, $times = FALSE)
|
96 |
{
|
104 |
* @package s2Member\Utilities
|
105 |
* @since 3.5
|
106 |
*
|
107 |
+
* @param string $string Input string.
|
108 |
* @param int $times Number of escapes. Defaults to 1.
|
109 |
+
* @return string Output string after dollar signs are escaped.
|
110 |
*
|
111 |
* @deprecated Starting with s2Member v120103, please use:
|
112 |
* ``c_ws_plugin__s2member_utils_strings::esc_refs()``.
|
123 |
* @package s2Member\Utilities
|
124 |
* @since 120103
|
125 |
*
|
126 |
+
* @param string $string Input string.
|
127 |
* @param int $times Number of escapes. Defaults to 1.
|
128 |
+
* @return string Output string after backreferences are escaped.
|
129 |
*/
|
130 |
public static function esc_refs($string = NULL, $times = NULL)
|
131 |
{
|
139 |
* @package s2Member\Utilities
|
140 |
* @since 111106
|
141 |
*
|
142 |
+
* @param string $string Input string.
|
143 |
+
* @return string Output string, after characters NOT on a standard U.S. keyboard have been stripped.
|
144 |
*/
|
145 |
public static function strip_2_kb_chars($string = FALSE)
|
146 |
{
|
155 |
* @see s2Member\Utilities\c_ws_plugin__s2member_utils_strings::trim_deep()
|
156 |
* @see http://php.net/manual/en/function.trim.php
|
157 |
*
|
158 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
159 |
* @param str|bool $chars Optional. Defaults to false, indicating the default trim chars ` \t\n\r\0\x0B`. Or, set to a specific string of chars.
|
160 |
* @param str|bool $extra_chars Optional. This is NOT possible with PHP alone, but here you can specify extra chars; in addition to ``$chars``.
|
161 |
* @return str|array Either the input string, or the input array; after all data is trimmed up according to arguments passed in.
|
173 |
* @see s2Member\Utilities\c_ws_plugin__s2member_utils_strings::trim()
|
174 |
* @see http://php.net/manual/en/function.trim.php
|
175 |
*
|
176 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
177 |
* @param str|bool $chars Optional. Defaults to false, indicating the default trim chars ` \t\n\r\0\x0B`. Or, set to a specific string of chars.
|
178 |
* @param str|bool $extra_chars Optional. This is NOT possible with PHP alone, but here you can specify extra chars; in addition to ``$chars``.
|
179 |
* @return str|array Either the input string, or the input array; after all data is trimmed up according to arguments passed in.
|
199 |
* @package s2Member\Utilities
|
200 |
* @since 3.5
|
201 |
*
|
202 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
203 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
204 |
*/
|
205 |
public static function trim_dq_deep($value = FALSE)
|
212 |
* @package s2Member\Utilities
|
213 |
* @since 111106
|
214 |
*
|
215 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
216 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
217 |
*/
|
218 |
public static function trim_sq_deep($value = FALSE)
|
225 |
* @package s2Member\Utilities
|
226 |
* @since 111106
|
227 |
*
|
228 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
229 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
230 |
*/
|
231 |
public static function trim_dsq_deep($value = FALSE)
|
240 |
* @package s2Member\Utilities
|
241 |
* @since 111011
|
242 |
*
|
243 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
244 |
* @return str|array Either the input string, or the input array; after all data is trimmed up.
|
245 |
*/
|
246 |
public static function trim_qts_deep($value = FALSE)
|
257 |
* @package s2Member\Utilities
|
258 |
* @since 140124
|
259 |
*
|
260 |
+
* @param string $string Input string to trim.
|
261 |
+
* @return string Output string with all HTML whitespace trimmed away.
|
262 |
*/
|
263 |
public static function trim_html($string = FALSE)
|
264 |
{
|
273 |
* @package s2Member\Utilities
|
274 |
* @since 3.5
|
275 |
*
|
276 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
277 |
+
* @param string $beg Optional. A string value to wrap at the beginning of each value.
|
278 |
+
* @param string $end Optional. A string value to wrap at the ending of each value.
|
279 |
* @param bool $wrap_e Optional. Defaults to false. Should empty strings be wrapped too?
|
280 |
* @return str|array Either the input string, or the input array; after all data is wrapped up.
|
281 |
*/
|
297 |
* @package s2Member\Utilities
|
298 |
* @since 110926
|
299 |
*
|
300 |
+
* @param string|array $value Either a string, an array, or a multi-dimensional array, filled with integer and/or string values.
|
301 |
+
* @param string $delimiter Optional. If a delimiting character is specified, it will also be escaped via ``preg_quote()``.
|
302 |
* @return str|array Either the input string, or the input array; after all data is escaped with ``preg_quote()``.
|
303 |
*/
|
304 |
public static function preg_quote_deep($value = FALSE, $delimiter = FALSE)
|
322 |
* @param int $length Optional. Defaults to `12`. Length of the random string.
|
323 |
* @param bool $special_chars Defaults to true. If false, special chars are NOT included.
|
324 |
* @param bool $extra_special_chars Defaults to false. If true, extra special chars are included.
|
325 |
+
* @return string A randomly generated string, based on parameter configuration.
|
326 |
*/
|
327 |
public static function random_str_gen($length = FALSE, $special_chars = TRUE, $extra_special_chars = FALSE)
|
328 |
{
|
343 |
* @package s2Member\Utilities
|
344 |
* @since 3.5
|
345 |
*
|
346 |
+
* @param string $str Input string to be highlighted.
|
347 |
+
* @return string The highlighted string.
|
348 |
*/
|
349 |
public static function highlight_php($string = FALSE)
|
350 |
{
|
358 |
* @package s2Member\Utilities
|
359 |
* @since 111009
|
360 |
*
|
361 |
+
* @param string|array $value Input string or an array is also fine.
|
362 |
* @return array Array of parsed email addresses.
|
363 |
*/
|
364 |
public static function parse_emails($value = FALSE)
|
389 |
* @package s2Member\Utilities
|
390 |
* @since 110913
|
391 |
*
|
392 |
+
* @param string $string Input string to be base64 encoded.
|
393 |
* @param array $url_unsafe_chars Optional. An array of un-safe characters. Defaults to: ``array("+", "/")``.
|
394 |
* @param array $url_safe_chars Optional. An array of safe character replacements. Defaults to: ``array("-", "_")``.
|
395 |
+
* @param string $trim_padding_chars Optional. A string of padding chars to rtrim. Defaults to: `=~.`.
|
396 |
+
* @return string The base64 URL-safe encoded string.
|
397 |
*/
|
398 |
public static function base64_url_safe_encode($string = FALSE, $url_unsafe_chars = array("+", "/"), $url_safe_chars = array("-", "_"), $trim_padding_chars = "=~.")
|
399 |
{
|
414 |
* @package s2Member\Utilities
|
415 |
* @since 110913
|
416 |
*
|
417 |
+
* @param string $base64_url_safe Input string to be base64 decoded.
|
418 |
* @param array $url_unsafe_chars Optional. An array of un-safe character replacements. Defaults to: ``array("+", "/")``.
|
419 |
* @param array $url_safe_chars Optional. An array of safe characters. Defaults to: ``array("-", "_")``.
|
420 |
+
* @param string $trim_padding_chars Optional. A string of padding chars to rtrim. Defaults to: `=~.`.
|
421 |
+
* @return string The decoded string.
|
422 |
*/
|
423 |
public static function base64_url_safe_decode($base64_url_safe = FALSE, $url_unsafe_chars = array("+", "/"), $url_safe_chars = array("-", "_"), $trim_padding_chars = "=~.")
|
424 |
{
|
437 |
* @package s2Member\Utilities
|
438 |
* @since 111017
|
439 |
*
|
440 |
+
* @param string $string Input string/data, to be signed by this routine.
|
441 |
+
* @param string $key The secret key that will be used in this signature.
|
442 |
* @return str|bool An RSA-SHA1 signature string, or false on failure.
|
443 |
*/
|
444 |
public static function rsa_sha1_sign($string = FALSE, $key = FALSE)
|
471 |
* @package s2Member\Utilities
|
472 |
* @since 111017
|
473 |
*
|
474 |
+
* @param string $string Input string/data, to be signed by this routine.
|
475 |
+
* @param string $key The secret key that will be used in this signature.
|
476 |
+
* @param string $openssl Optional. Defaults to `openssl`. Path to OpenSSL executable.
|
477 |
* @return str|bool An RSA-SHA1 signature string, or false on failure.
|
478 |
*/
|
479 |
public static function _rsa_sha1_shell_sign($string = FALSE, $key = FALSE, $openssl = FALSE)
|
498 |
* @package s2Member\Utilities
|
499 |
* @since 111017
|
500 |
*
|
501 |
+
* @param string $key The secret key to be used in an RSA-SHA1 signature.
|
502 |
+
* @return string Key with incomplete wrappers corrected, when/if possible.
|
503 |
*
|
504 |
* @see http://www.faqs.org/qa/qa-14736.html
|
505 |
*/
|
524 |
* @package s2Member\Utilities
|
525 |
* @since 111017
|
526 |
*
|
527 |
+
* @param string $string Input string/data, to be signed by this routine.
|
528 |
+
* @param string $key The secret key that will be used in this signature.
|
529 |
+
* @return string An HMAC-SHA1 signature string.
|
530 |
*/
|
531 |
public static function hmac_sha1_sign($string = FALSE, $key = FALSE)
|
532 |
{
|
544 |
*
|
545 |
* @see http://www.faqs.org/rfcs/rfc3986.html
|
546 |
*
|
547 |
+
* @param string
|