Version Description
Upgrade recommended. Two bugs fixed, and new Hook/Filter arguments. See Changelog for details.
Download this release
Release Info
Developer | PriMoThemes |
Plugin | s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members) |
Version | 3.0.2 |
Comparing to | |
See all releases |
Code changes from version 3.0.1 to 3.0.2
- includes/functions/activate-deactivate.inc.php +5 -5
- includes/functions/admin-lockout.inc.php +3 -3
- includes/functions/admin-notices.inc.php +8 -8
- includes/functions/auto-eots.inc.php +18 -18
- includes/functions/catg-level-access.inc.php +4 -4
- includes/functions/constants.inc.php +6 -6
- includes/functions/email-configs.inc.php +6 -6
- includes/functions/file-download-access.inc.php +10 -10
- includes/functions/hide-some-systematics.inc.php +2 -2
- includes/functions/ip-restrictions.inc.php +5 -5
- includes/functions/is-systematic.inc.php +11 -11
- includes/functions/js-globals.inc.php +6 -6
- includes/functions/list-servers.inc.php +10 -2
- includes/functions/login-customizations.inc.php +7 -7
- includes/functions/login-redirection.inc.php +5 -5
- includes/functions/menu-pages.inc.php +41 -41
- includes/functions/nocache.inc.php +8 -8
- includes/functions/page-level-access.inc.php +4 -4
- includes/functions/paypal-notify.inc.php +35 -35
- includes/functions/paypal-return.inc.php +20 -20
- includes/functions/paypal-utilities.inc.php +13 -13
- includes/functions/post-level-access.inc.php +4 -4
- includes/functions/profile-modifications.inc.php +5 -5
- includes/functions/ptag-level-access.inc.php +4 -4
- includes/functions/readme-parsing.inc.php +6 -6
- includes/functions/register-access.inc.php +30 -30
- includes/functions/ruri-level-access.inc.php +6 -6
- includes/functions/shortcodes.inc.php +7 -7
- includes/functions/sp-access.inc.php +13 -13
- includes/functions/tracking-codes.inc.php +12 -12
- includes/functions/translations.inc.php +2 -2
- includes/functions/user-access-level.inc.php +7 -7
- includes/functions/user-deletions.inc.php +3 -3
- includes/functions/user-has-wp-role.inc.php +4 -4
- includes/functions/user-notes.inc.php +4 -4
- includes/functions/users-list.inc.php +10 -10
- includes/functions/utilities.inc.php +23 -4
- readme.txt +14 -5
- s2member.php +6 -6
includes/functions/activate-deactivate.inc.php
CHANGED
@@ -25,7 +25,7 @@ extra queries before they are set.
|
|
25 |
*/
|
26 |
function ws_plugin__s2member_activate ()
|
27 |
{
|
28 |
-
do_action ("s2member_before_activation");
|
29 |
/**/
|
30 |
add_role ("s2member_level1", "s2Member Level 1");
|
31 |
add_role ("s2member_level2", "s2Member Level 2");
|
@@ -123,7 +123,7 @@ function ws_plugin__s2member_activate ()
|
|
123 |
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
|
124 |
}
|
125 |
/**/
|
126 |
-
do_action ("s2member_after_activation");
|
127 |
/**/
|
128 |
return;
|
129 |
}
|
@@ -134,7 +134,7 @@ ws_plugin__$plugin_key_deactivate() is called by our themes.
|
|
134 |
*/
|
135 |
function ws_plugin__s2member_deactivate ()
|
136 |
{
|
137 |
-
do_action ("s2member_before_deactivation");
|
138 |
/**/
|
139 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
|
140 |
{
|
@@ -198,10 +198,10 @@ function ws_plugin__s2member_deactivate ()
|
|
198 |
delete_option ("ws_plugin__s2member_notices");
|
199 |
delete_option ("ws_plugin__s2member_options");
|
200 |
/**/
|
201 |
-
do_action ("s2member_during_deactivation");
|
202 |
}
|
203 |
/**/
|
204 |
-
do_action ("s2member_after_deactivation");
|
205 |
/**/
|
206 |
return;
|
207 |
}
|
25 |
*/
|
26 |
function ws_plugin__s2member_activate ()
|
27 |
{
|
28 |
+
do_action ("s2member_before_activation", get_defined_vars ());
|
29 |
/**/
|
30 |
add_role ("s2member_level1", "s2Member Level 1");
|
31 |
add_role ("s2member_level2", "s2Member Level 2");
|
123 |
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
|
124 |
}
|
125 |
/**/
|
126 |
+
do_action ("s2member_after_activation", get_defined_vars ());
|
127 |
/**/
|
128 |
return;
|
129 |
}
|
134 |
*/
|
135 |
function ws_plugin__s2member_deactivate ()
|
136 |
{
|
137 |
+
do_action ("s2member_before_deactivation", get_defined_vars ());
|
138 |
/**/
|
139 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
|
140 |
{
|
198 |
delete_option ("ws_plugin__s2member_notices");
|
199 |
delete_option ("ws_plugin__s2member_options");
|
200 |
/**/
|
201 |
+
do_action ("s2member_during_deactivation", get_defined_vars ());
|
202 |
}
|
203 |
/**/
|
204 |
+
do_action ("s2member_after_deactivation", get_defined_vars ());
|
205 |
/**/
|
206 |
return;
|
207 |
}
|
includes/functions/admin-lockout.inc.php
CHANGED
@@ -19,15 +19,15 @@ Attach to: add_action("admin_init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_admin_lockout ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_admin_lockouts");
|
23 |
/**/
|
24 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
|
25 |
&& !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
|
26 |
-
&& apply_filters ("s2member_admin_lockout", true) && /* Give filters a chance
|
27 |
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
|
28 |
exit;
|
29 |
/**/
|
30 |
-
do_action ("s2member_after_admin_lockouts");
|
31 |
/**/
|
32 |
return;
|
33 |
}
|
19 |
*/
|
20 |
function ws_plugin__s2member_admin_lockout ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_admin_lockouts", get_defined_vars ());
|
23 |
/**/
|
24 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
|
25 |
&& !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
|
26 |
+
&& apply_filters ("s2member_admin_lockout", true, get_defined_vars ()) && /* Give filters a chance. */
|
27 |
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) !== "nill")
|
28 |
exit;
|
29 |
/**/
|
30 |
+
do_action ("s2member_after_admin_lockouts", get_defined_vars ());
|
31 |
/**/
|
32 |
return;
|
33 |
}
|
includes/functions/admin-notices.inc.php
CHANGED
@@ -18,7 +18,7 @@ Function displays an admin notice immediately.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FALSE)
|
20 |
{
|
21 |
-
do_action ("s2member_before_display_admin_notice");
|
22 |
/**/
|
23 |
if ($notice && $error) /* Special format for errors. */
|
24 |
{
|
@@ -29,7 +29,7 @@ function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FAL
|
|
29 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
30 |
}
|
31 |
/**/
|
32 |
-
do_action ("s2member_after_display_admin_notice");
|
33 |
/**/
|
34 |
return;
|
35 |
}
|
@@ -38,7 +38,7 @@ Function that enqueues admin notices.
|
|
38 |
*/
|
39 |
function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE)
|
40 |
{
|
41 |
-
do_action ("s2member_before_enqueue_admin_notice");
|
42 |
/**/
|
43 |
if ($notice && is_string ($notice)) /* If we have a valid string. */
|
44 |
{
|
@@ -46,12 +46,12 @@ function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages =
|
|
46 |
/**/
|
47 |
array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time));
|
48 |
/**/
|
49 |
-
do_action ("s2member_during_enqueue_admin_notice"); /* Give plugins a chance. */
|
50 |
/**/
|
51 |
update_option ("ws_plugin__s2member_notices", ws_plugin__s2member_array_unique ($notices));
|
52 |
}
|
53 |
/**/
|
54 |
-
do_action ("s2member_after_enqueue_admin_notice");
|
55 |
/**/
|
56 |
return;
|
57 |
}
|
@@ -63,7 +63,7 @@ function ws_plugin__s2member_admin_notices ()
|
|
63 |
{
|
64 |
global $pagenow; /* This holds the current page filename. */
|
65 |
/**/
|
66 |
-
do_action ("s2member_before_admin_notices");
|
67 |
/**/
|
68 |
if (is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
|
69 |
{
|
@@ -80,14 +80,14 @@ function ws_plugin__s2member_admin_notices ()
|
|
80 |
}
|
81 |
}
|
82 |
/**/
|
83 |
-
do_action ("s2member_during_admin_notices");
|
84 |
/**/
|
85 |
$notices = array_merge ($notices); /* Re-index. */
|
86 |
/**/
|
87 |
update_option ("ws_plugin__s2member_notices", $notices);
|
88 |
}
|
89 |
/**/
|
90 |
-
do_action ("s2member_after_admin_notices");
|
91 |
/**/
|
92 |
return;
|
93 |
}
|
18 |
*/
|
19 |
function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FALSE)
|
20 |
{
|
21 |
+
do_action ("s2member_before_display_admin_notice", get_defined_vars ());
|
22 |
/**/
|
23 |
if ($notice && $error) /* Special format for errors. */
|
24 |
{
|
29 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
30 |
}
|
31 |
/**/
|
32 |
+
do_action ("s2member_after_display_admin_notice", get_defined_vars ());
|
33 |
/**/
|
34 |
return;
|
35 |
}
|
38 |
*/
|
39 |
function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE)
|
40 |
{
|
41 |
+
do_action ("s2member_before_enqueue_admin_notice", get_defined_vars ());
|
42 |
/**/
|
43 |
if ($notice && is_string ($notice)) /* If we have a valid string. */
|
44 |
{
|
46 |
/**/
|
47 |
array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time));
|
48 |
/**/
|
49 |
+
do_action ("s2member_during_enqueue_admin_notice", get_defined_vars ()); /* Give plugins a chance. */
|
50 |
/**/
|
51 |
update_option ("ws_plugin__s2member_notices", ws_plugin__s2member_array_unique ($notices));
|
52 |
}
|
53 |
/**/
|
54 |
+
do_action ("s2member_after_enqueue_admin_notice", get_defined_vars ());
|
55 |
/**/
|
56 |
return;
|
57 |
}
|
63 |
{
|
64 |
global $pagenow; /* This holds the current page filename. */
|
65 |
/**/
|
66 |
+
do_action ("s2member_before_admin_notices", get_defined_vars ());
|
67 |
/**/
|
68 |
if (is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
|
69 |
{
|
80 |
}
|
81 |
}
|
82 |
/**/
|
83 |
+
do_action ("s2member_during_admin_notices", get_defined_vars ());
|
84 |
/**/
|
85 |
$notices = array_merge ($notices); /* Re-index. */
|
86 |
/**/
|
87 |
update_option ("ws_plugin__s2member_notices", $notices);
|
88 |
}
|
89 |
/**/
|
90 |
+
do_action ("s2member_after_admin_notices", get_defined_vars ());
|
91 |
/**/
|
92 |
return;
|
93 |
}
|
includes/functions/auto-eots.inc.php
CHANGED
@@ -22,13 +22,13 @@ function ws_plugin__s2member_auto_eot_system ($per_process = 10)
|
|
22 |
{
|
23 |
global $wpdb; /* Need global DB obj. */
|
24 |
/**/
|
25 |
-
do_action ("s2member_before_auto_eot_system");
|
26 |
/**/
|
27 |
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
|
28 |
/**/
|
29 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* Enabled? */
|
30 |
{
|
31 |
-
$per_process = apply_filters ("s2member_auto_eot_system_per_process", $per_process);
|
32 |
/**/
|
33 |
if ($eots = $wpdb->get_results ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
|
34 |
{
|
@@ -77,23 +77,23 @@ function ws_plugin__s2member_auto_eot_system ($per_process = 10)
|
|
77 |
ws_plugin__s2member_remote ($url);
|
78 |
}
|
79 |
/**/
|
80 |
-
do_action ("s2member_during_auto_eot_system_during_demote");
|
81 |
}
|
82 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
83 |
{
|
84 |
wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
|
85 |
/* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
|
86 |
/**/
|
87 |
-
do_action ("s2member_during_auto_eot_system_during_delete");
|
88 |
}
|
89 |
/**/
|
90 |
-
do_action ("s2member_during_auto_eot_system");
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
}
|
95 |
/**/
|
96 |
-
do_action ("s2member_after_auto_eot_system");
|
97 |
/**/
|
98 |
return;
|
99 |
}
|
@@ -104,7 +104,7 @@ Attach to: add_action("init");
|
|
104 |
*/
|
105 |
function ws_plugin__s2member_auto_eot_system_via_cron ()
|
106 |
{
|
107 |
-
do_action ("s2member_before_auto_eot_system_via_cron");
|
108 |
/**/
|
109 |
if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
|
110 |
{
|
@@ -112,13 +112,13 @@ function ws_plugin__s2member_auto_eot_system_via_cron ()
|
|
112 |
{
|
113 |
ws_plugin__s2member_auto_eot_system ();
|
114 |
/**/
|
115 |
-
do_action ("s2member_during_auto_eot_system_via_cron");
|
116 |
}
|
117 |
/**/
|
118 |
exit; /* Exit. */
|
119 |
}
|
120 |
/**/
|
121 |
-
do_action ("s2member_after_auto_eot_system_via_cron");
|
122 |
}
|
123 |
/*
|
124 |
Extends the WP-Cron schedules to support 10 minute intervals.
|
@@ -126,32 +126,32 @@ Attach to: add_filter("cron_schedules");
|
|
126 |
*/
|
127 |
function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
|
128 |
{
|
129 |
-
do_action ("s2member_before_extend_cron_schedules");
|
130 |
/**/
|
131 |
$array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
|
132 |
/**/
|
133 |
-
return apply_filters ("s2member_extend_cron_schedules", array_merge ($array, $schedules));
|
134 |
}
|
135 |
/*
|
136 |
Adds a scheduled task for s2Member's Auto-EOT System.
|
137 |
*/
|
138 |
function ws_plugin__s2member_add_auto_eot_system ()
|
139 |
{
|
140 |
-
do_action ("s2member_before_add_auto_eot_system");
|
141 |
/**/
|
142 |
if (!ws_plugin__s2member_delete_auto_eot_system ())
|
143 |
{
|
144 |
-
return apply_filters ("s2member_add_auto_eot_system", false);
|
145 |
}
|
146 |
else if (function_exists ("wp_cron")) /* Otherwise, we can schedule. */
|
147 |
{
|
148 |
wp_schedule_event (time (), "every10m", "s2member_auto_eot_system");
|
149 |
/**/
|
150 |
-
return apply_filters ("s2member_add_auto_eot_system", true);
|
151 |
}
|
152 |
else /* Otherwise, it would appear that WP-Cron is not available. */
|
153 |
{
|
154 |
-
return apply_filters ("s2member_add_auto_eot_system", false);
|
155 |
}
|
156 |
}
|
157 |
/*
|
@@ -159,17 +159,17 @@ Delete scheduled tasks for s2Member's Auto-EOT System.
|
|
159 |
*/
|
160 |
function ws_plugin__s2member_delete_auto_eot_system ()
|
161 |
{
|
162 |
-
do_action ("s2member_before_delete_auto_eot_system");
|
163 |
/**/
|
164 |
if (function_exists ("wp_cron"))
|
165 |
{
|
166 |
wp_clear_scheduled_hook ("s2member_auto_eot_system");
|
167 |
/**/
|
168 |
-
return apply_filters ("s2member_delete_auto_eot_system", true);
|
169 |
}
|
170 |
else /* Otherwise, it would appear that WP-Cron is not available. */
|
171 |
{
|
172 |
-
return apply_filters ("s2member_delete_auto_eot_system", false);
|
173 |
}
|
174 |
}
|
175 |
?>
|
22 |
{
|
23 |
global $wpdb; /* Need global DB obj. */
|
24 |
/**/
|
25 |
+
do_action ("s2member_before_auto_eot_system", get_defined_vars ());
|
26 |
/**/
|
27 |
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
|
28 |
/**/
|
29 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"]) /* Enabled? */
|
30 |
{
|
31 |
+
$per_process = apply_filters ("s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
|
32 |
/**/
|
33 |
if ($eots = $wpdb->get_results ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_auto_eot_time' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process))
|
34 |
{
|
77 |
ws_plugin__s2member_remote ($url);
|
78 |
}
|
79 |
/**/
|
80 |
+
do_action ("s2member_during_auto_eot_system_during_demote", get_defined_vars ());
|
81 |
}
|
82 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
83 |
{
|
84 |
wp_delete_user ($user_id); /* Triggers: `ws_plugin__s2member_handle_user_deletions()` */
|
85 |
/* `ws_plugin__s2member_handle_user_deletions()` triggers `eot_del_notification_urls` */
|
86 |
/**/
|
87 |
+
do_action ("s2member_during_auto_eot_system_during_delete", get_defined_vars ());
|
88 |
}
|
89 |
/**/
|
90 |
+
do_action ("s2member_during_auto_eot_system", get_defined_vars ());
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
}
|
95 |
/**/
|
96 |
+
do_action ("s2member_after_auto_eot_system", get_defined_vars ());
|
97 |
/**/
|
98 |
return;
|
99 |
}
|
104 |
*/
|
105 |
function ws_plugin__s2member_auto_eot_system_via_cron ()
|
106 |
{
|
107 |
+
do_action ("s2member_before_auto_eot_system_via_cron", get_defined_vars ());
|
108 |
/**/
|
109 |
if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
|
110 |
{
|
112 |
{
|
113 |
ws_plugin__s2member_auto_eot_system ();
|
114 |
/**/
|
115 |
+
do_action ("s2member_during_auto_eot_system_via_cron", get_defined_vars ());
|
116 |
}
|
117 |
/**/
|
118 |
exit; /* Exit. */
|
119 |
}
|
120 |
/**/
|
121 |
+
do_action ("s2member_after_auto_eot_system_via_cron", get_defined_vars ());
|
122 |
}
|
123 |
/*
|
124 |
Extends the WP-Cron schedules to support 10 minute intervals.
|
126 |
*/
|
127 |
function ws_plugin__s2member_extend_cron_schedules ($schedules = array ())
|
128 |
{
|
129 |
+
do_action ("s2member_before_extend_cron_schedules", get_defined_vars ());
|
130 |
/**/
|
131 |
$array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
|
132 |
/**/
|
133 |
+
return apply_filters ("s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
|
134 |
}
|
135 |
/*
|
136 |
Adds a scheduled task for s2Member's Auto-EOT System.
|
137 |
*/
|
138 |
function ws_plugin__s2member_add_auto_eot_system ()
|
139 |
{
|
140 |
+
do_action ("s2member_before_add_auto_eot_system", get_defined_vars ());
|
141 |
/**/
|
142 |
if (!ws_plugin__s2member_delete_auto_eot_system ())
|
143 |
{
|
144 |
+
return apply_filters ("s2member_add_auto_eot_system", false, get_defined_vars ());
|
145 |
}
|
146 |
else if (function_exists ("wp_cron")) /* Otherwise, we can schedule. */
|
147 |
{
|
148 |
wp_schedule_event (time (), "every10m", "s2member_auto_eot_system");
|
149 |
/**/
|
150 |
+
return apply_filters ("s2member_add_auto_eot_system", true, get_defined_vars ());
|
151 |
}
|
152 |
else /* Otherwise, it would appear that WP-Cron is not available. */
|
153 |
{
|
154 |
+
return apply_filters ("s2member_add_auto_eot_system", false, get_defined_vars ());
|
155 |
}
|
156 |
}
|
157 |
/*
|
159 |
*/
|
160 |
function ws_plugin__s2member_delete_auto_eot_system ()
|
161 |
{
|
162 |
+
do_action ("s2member_before_delete_auto_eot_system", get_defined_vars ());
|
163 |
/**/
|
164 |
if (function_exists ("wp_cron"))
|
165 |
{
|
166 |
wp_clear_scheduled_hook ("s2member_auto_eot_system");
|
167 |
/**/
|
168 |
+
return apply_filters ("s2member_delete_auto_eot_system", true, get_defined_vars ());
|
169 |
}
|
170 |
else /* Otherwise, it would appear that WP-Cron is not available. */
|
171 |
{
|
172 |
+
return apply_filters ("s2member_delete_auto_eot_system", false, get_defined_vars ());
|
173 |
}
|
174 |
}
|
175 |
?>
|
includes/functions/catg-level-access.inc.php
CHANGED
@@ -21,9 +21,9 @@ function ws_plugin__s2member_check_catg_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_check_catg_level_access");
|
25 |
/**/
|
26 |
-
$excluded = apply_filters ("s2member_check_catg_level_access_excluded", false);
|
27 |
/**/
|
28 |
if (!$excluded && ((is_category () && ($cat_ID = get_query_var ("cat"))) || (is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))))
|
29 |
{
|
@@ -104,11 +104,11 @@ function ws_plugin__s2member_check_catg_level_access ()
|
|
104 |
exit;
|
105 |
}
|
106 |
/**/
|
107 |
-
do_action ("s2member_during_check_catg_level_access");
|
108 |
}
|
109 |
}
|
110 |
/**/
|
111 |
-
do_action ("s2member_after_check_catg_level_access");
|
112 |
/**/
|
113 |
return;
|
114 |
}
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_catg_level_access", get_defined_vars ());
|
25 |
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_catg_level_access_excluded", false, get_defined_vars ());
|
27 |
/**/
|
28 |
if (!$excluded && ((is_category () && ($cat_ID = get_query_var ("cat"))) || (is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))))
|
29 |
{
|
104 |
exit;
|
105 |
}
|
106 |
/**/
|
107 |
+
do_action ("s2member_during_check_catg_level_access", get_defined_vars ());
|
108 |
}
|
109 |
}
|
110 |
/**/
|
111 |
+
do_action ("s2member_after_check_catg_level_access", get_defined_vars ());
|
112 |
/**/
|
113 |
return;
|
114 |
}
|
includes/functions/constants.inc.php
CHANGED
@@ -20,7 +20,7 @@ Attach to: add_action("init");
|
|
20 |
*/
|
21 |
function ws_plugin__s2member_constants ()
|
22 |
{
|
23 |
-
do_action ("s2member_before_constants");
|
24 |
/**/
|
25 |
$links = ws_plugin__s2member_constant_links ();
|
26 |
$metas = ws_plugin__s2member_constant_metas ();
|
@@ -95,7 +95,7 @@ function ws_plugin__s2member_constants ()
|
|
95 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID && !ws_plugin__s2member_user_has_wp_role ($current_user)) ? "Updating Subscr. ID" : ""));
|
96 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* ^ Not for built-in WP Roles. */
|
97 |
/**/
|
98 |
-
do_action ("s2member_after_constants");
|
99 |
/**/
|
100 |
return;
|
101 |
}
|
@@ -107,7 +107,7 @@ forced to execute get_page_link() all the time, which piles up DB queries.
|
|
107 |
*/
|
108 |
function ws_plugin__s2member_constant_links ()
|
109 |
{
|
110 |
-
do_action ("s2member_before_constant_links");
|
111 |
/**/
|
112 |
$cache_minutes = 15; /* Could be higher? */
|
113 |
/**/
|
@@ -167,7 +167,7 @@ function ws_plugin__s2member_constant_links ()
|
|
167 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
168 |
}
|
169 |
/**/
|
170 |
-
return apply_filters ("s2member_constant_links", $l);
|
171 |
}
|
172 |
/*
|
173 |
This function pulls all of the usermeta details needed for Constants.
|
@@ -177,7 +177,7 @@ function ws_plugin__s2member_constant_metas ()
|
|
177 |
{
|
178 |
global $wpdb; /* The global database object. */
|
179 |
/**/
|
180 |
-
do_action ("s2member_before_constant_metas");
|
181 |
/**/
|
182 |
$m["s2member_file_download_access_log"] = array ();
|
183 |
$m["s2member_custom_fields"] = array ();
|
@@ -200,6 +200,6 @@ function ws_plugin__s2member_constant_metas ()
|
|
200 |
}
|
201 |
}
|
202 |
/**/
|
203 |
-
return apply_filters ("s2member_constant_metas", $m);
|
204 |
}
|
205 |
?>
|
20 |
*/
|
21 |
function ws_plugin__s2member_constants ()
|
22 |
{
|
23 |
+
do_action ("s2member_before_constants", get_defined_vars ());
|
24 |
/**/
|
25 |
$links = ws_plugin__s2member_constant_links ();
|
26 |
$metas = ws_plugin__s2member_constant_metas ();
|
95 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID && !ws_plugin__s2member_user_has_wp_role ($current_user)) ? "Updating Subscr. ID" : ""));
|
96 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* ^ Not for built-in WP Roles. */
|
97 |
/**/
|
98 |
+
do_action ("s2member_after_constants", get_defined_vars ());
|
99 |
/**/
|
100 |
return;
|
101 |
}
|
107 |
*/
|
108 |
function ws_plugin__s2member_constant_links ()
|
109 |
{
|
110 |
+
do_action ("s2member_before_constant_links", get_defined_vars ());
|
111 |
/**/
|
112 |
$cache_minutes = 15; /* Could be higher? */
|
113 |
/**/
|
167 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
168 |
}
|
169 |
/**/
|
170 |
+
return apply_filters ("s2member_constant_links", $l, get_defined_vars ());
|
171 |
}
|
172 |
/*
|
173 |
This function pulls all of the usermeta details needed for Constants.
|
177 |
{
|
178 |
global $wpdb; /* The global database object. */
|
179 |
/**/
|
180 |
+
do_action ("s2member_before_constant_metas", get_defined_vars ());
|
181 |
/**/
|
182 |
$m["s2member_file_download_access_log"] = array ();
|
183 |
$m["s2member_custom_fields"] = array ();
|
200 |
}
|
201 |
}
|
202 |
/**/
|
203 |
+
return apply_filters ("s2member_constant_metas", $m, get_defined_vars ());
|
204 |
}
|
205 |
?>
|
includes/functions/email-configs.inc.php
CHANGED
@@ -18,27 +18,27 @@ Functions that modify the email From: name/address.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_email_config ()
|
20 |
{
|
21 |
-
do_action ("s2member_before_email_config");
|
22 |
/**/
|
23 |
add_filter ("wp_mail_from", "_ws_plugin__s2member_email_config_email");
|
24 |
add_filter ("wp_mail_from_name", "_ws_plugin__s2member_email_config_name");
|
25 |
/**/
|
26 |
-
do_action ("s2member_after_email_config");
|
27 |
/**/
|
28 |
return;
|
29 |
}
|
30 |
/**/
|
31 |
function _ws_plugin__s2member_email_config_email ($email = FALSE)
|
32 |
{
|
33 |
-
do_action ("s2member_before_email_config_email");
|
34 |
/**/
|
35 |
-
return apply_filters ("s2member_email_config_email", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]);
|
36 |
}
|
37 |
/**/
|
38 |
function _ws_plugin__s2member_email_config_name ($name = FALSE)
|
39 |
{
|
40 |
-
do_action ("s2member_before_email_config_name");
|
41 |
/**/
|
42 |
-
return apply_filters ("s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]);
|
43 |
}
|
44 |
?>
|
18 |
*/
|
19 |
function ws_plugin__s2member_email_config ()
|
20 |
{
|
21 |
+
do_action ("s2member_before_email_config", get_defined_vars ());
|
22 |
/**/
|
23 |
add_filter ("wp_mail_from", "_ws_plugin__s2member_email_config_email");
|
24 |
add_filter ("wp_mail_from_name", "_ws_plugin__s2member_email_config_name");
|
25 |
/**/
|
26 |
+
do_action ("s2member_after_email_config", get_defined_vars ());
|
27 |
/**/
|
28 |
return;
|
29 |
}
|
30 |
/**/
|
31 |
function _ws_plugin__s2member_email_config_email ($email = FALSE)
|
32 |
{
|
33 |
+
do_action ("s2member_before_email_config_email", get_defined_vars ());
|
34 |
/**/
|
35 |
+
return apply_filters ("s2member_email_config_email", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"], get_defined_vars ());
|
36 |
}
|
37 |
/**/
|
38 |
function _ws_plugin__s2member_email_config_name ($name = FALSE)
|
39 |
{
|
40 |
+
do_action ("s2member_before_email_config_name", get_defined_vars ());
|
41 |
/**/
|
42 |
+
return apply_filters ("s2member_email_config_name", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"], get_defined_vars ());
|
43 |
}
|
44 |
?>
|
includes/functions/file-download-access.inc.php
CHANGED
@@ -19,7 +19,7 @@ Returns number of days, where 0 means no access to files has been allowed.
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_max_download_period ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_max_download_period");
|
23 |
/**/
|
24 |
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
25 |
{
|
@@ -41,7 +41,7 @@ function ws_plugin__s2member_max_download_period ()
|
|
41 |
$max = ($max < $days) ? $days : $max;
|
42 |
}
|
43 |
/**/
|
44 |
-
return apply_filters ("s2member_max_download_period", (($max > 365) ? 365 : (int)$max));
|
45 |
}
|
46 |
/*
|
47 |
Function determines how many downloads allowed - etc, etc.
|
@@ -50,7 +50,7 @@ The 2nd parameter can be used to prevent another database connection.
|
|
50 |
*/
|
51 |
function ws_plugin__s2member_user_downloads ($not_counting_this_particular_file = false, $log = null)
|
52 |
{
|
53 |
-
do_action ("s2member_before_user_downloads");
|
54 |
/**/
|
55 |
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
56 |
{
|
@@ -85,7 +85,7 @@ function ws_plugin__s2member_user_downloads ($not_counting_this_particular_file
|
|
85 |
$currently = ($currently) ? $currently + 1 : 1;
|
86 |
}
|
87 |
/**/
|
88 |
-
return apply_filters ("s2member_user_downloads", array ("allowed" => (int)$allowed, "allowed_days" => (int)$allowed_days, "currently" => (int)$currently));
|
89 |
}
|
90 |
/*
|
91 |
Function determines the minimum level required for file download access.
|
@@ -93,7 +93,7 @@ Returns 0-4, where 0 means no access to file downloads has been allowed.
|
|
93 |
*/
|
94 |
function ws_plugin__s2member_min_level_4_downloads ()
|
95 |
{
|
96 |
-
do_action ("s2member_before_min_level_4_downloads");
|
97 |
/**/
|
98 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
99 |
{
|
@@ -112,7 +112,7 @@ function ws_plugin__s2member_min_level_4_downloads ()
|
|
112 |
$file_download_access_is_allowed = $min_level_4_downloads = 4;
|
113 |
}
|
114 |
/**/
|
115 |
-
return apply_filters ("s2member_min_level_4_downloads", (int)$min_level_4_downloads);
|
116 |
}
|
117 |
/*
|
118 |
Function for handling download access permissions.
|
@@ -120,11 +120,11 @@ Attach to: add_action("init");
|
|
120 |
*/
|
121 |
function ws_plugin__s2member_check_file_download_access ()
|
122 |
{
|
123 |
-
do_action ("s2member_before_file_download_access");
|
124 |
/**/
|
125 |
if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
|
126 |
{
|
127 |
-
$excluded = apply_filters ("s2member_check_file_download_access_excluded", false); /* Or use $_GET["s2member_free_file_download_key"] with a hash of the xencrypted version. */
|
128 |
/**/
|
129 |
if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ($_GET["s2member_free_file_download_key"] !== md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"]))/**/
|
130 |
/* For backward compatiblity, we also check the xencrypted value, without the hash. This is decprecated as of v2.9. It will be removed completely in a future version. */
|
@@ -209,7 +209,7 @@ function ws_plugin__s2member_check_file_download_access ()
|
|
209 |
$basename = $pathinfo["basename"]; /* The actual file name, including its extension. */
|
210 |
$length = filesize ($file); /* The overall file size, in bytes. */
|
211 |
/**/
|
212 |
-
do_action ("s2member_during_file_download_access");
|
213 |
/*
|
214 |
Now send the file to the browser. Be sure to turn off output compression.
|
215 |
*/
|
@@ -233,6 +233,6 @@ function ws_plugin__s2member_check_file_download_access ()
|
|
233 |
exit;
|
234 |
}
|
235 |
/**/
|
236 |
-
do_action ("s2member_after_file_download_access");
|
237 |
}
|
238 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_max_download_period ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_max_download_period", get_defined_vars ());
|
23 |
/**/
|
24 |
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
25 |
{
|
41 |
$max = ($max < $days) ? $days : $max;
|
42 |
}
|
43 |
/**/
|
44 |
+
return apply_filters ("s2member_max_download_period", (($max > 365) ? 365 : (int)$max), get_defined_vars ());
|
45 |
}
|
46 |
/*
|
47 |
Function determines how many downloads allowed - etc, etc.
|
50 |
*/
|
51 |
function ws_plugin__s2member_user_downloads ($not_counting_this_particular_file = false, $log = null)
|
52 |
{
|
53 |
+
do_action ("s2member_before_user_downloads", get_defined_vars ());
|
54 |
/**/
|
55 |
if (($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
56 |
{
|
85 |
$currently = ($currently) ? $currently + 1 : 1;
|
86 |
}
|
87 |
/**/
|
88 |
+
return apply_filters ("s2member_user_downloads", array ("allowed" => (int)$allowed, "allowed_days" => (int)$allowed_days, "currently" => (int)$currently), get_defined_vars ());
|
89 |
}
|
90 |
/*
|
91 |
Function determines the minimum level required for file download access.
|
93 |
*/
|
94 |
function ws_plugin__s2member_min_level_4_downloads ()
|
95 |
{
|
96 |
+
do_action ("s2member_before_min_level_4_downloads", get_defined_vars ());
|
97 |
/**/
|
98 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
99 |
{
|
112 |
$file_download_access_is_allowed = $min_level_4_downloads = 4;
|
113 |
}
|
114 |
/**/
|
115 |
+
return apply_filters ("s2member_min_level_4_downloads", (int)$min_level_4_downloads, get_defined_vars ());
|
116 |
}
|
117 |
/*
|
118 |
Function for handling download access permissions.
|
120 |
*/
|
121 |
function ws_plugin__s2member_check_file_download_access ()
|
122 |
{
|
123 |
+
do_action ("s2member_before_file_download_access", get_defined_vars ());
|
124 |
/**/
|
125 |
if ($_GET["s2member_file_download"]) /* Filter $excluded to force free downloads. */
|
126 |
{
|
127 |
+
$excluded = apply_filters ("s2member_check_file_download_access_excluded", false, get_defined_vars ()); /* Or use $_GET["s2member_free_file_download_key"] with a hash of the xencrypted version. */
|
128 |
/**/
|
129 |
if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ($_GET["s2member_free_file_download_key"] !== md5 (ws_plugin__s2member_xencrypt ($_GET["s2member_file_download"]))/**/
|
130 |
/* For backward compatiblity, we also check the xencrypted value, without the hash. This is decprecated as of v2.9. It will be removed completely in a future version. */
|
209 |
$basename = $pathinfo["basename"]; /* The actual file name, including its extension. */
|
210 |
$length = filesize ($file); /* The overall file size, in bytes. */
|
211 |
/**/
|
212 |
+
do_action ("s2member_during_file_download_access", get_defined_vars ());
|
213 |
/*
|
214 |
Now send the file to the browser. Be sure to turn off output compression.
|
215 |
*/
|
233 |
exit;
|
234 |
}
|
235 |
/**/
|
236 |
+
do_action ("s2member_after_file_download_access", get_defined_vars ());
|
237 |
}
|
238 |
?>
|
includes/functions/hide-some-systematics.inc.php
CHANGED
@@ -21,13 +21,13 @@ function ws_plugin__s2member_hide_some_systematics ($where = FALSE)
|
|
21 |
{
|
22 |
global $wpdb; /* Need this to get the table name. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_hide_some_systematics");
|
25 |
/**/
|
26 |
if (is_search ()) /* Here we exclude a few systematic use pages from the search query. */
|
27 |
{
|
28 |
$where .= " AND " . $wpdb->posts . ".ID NOT IN ('" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] . "')";
|
29 |
}
|
30 |
/**/
|
31 |
-
return apply_filters ("s2member_hide_some_systematics", $where);
|
32 |
}
|
33 |
?>
|
21 |
{
|
22 |
global $wpdb; /* Need this to get the table name. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_hide_some_systematics", get_defined_vars ());
|
25 |
/**/
|
26 |
if (is_search ()) /* Here we exclude a few systematic use pages from the search query. */
|
27 |
{
|
28 |
$where .= " AND " . $wpdb->posts . ".ID NOT IN ('" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] . "', '" . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] . "')";
|
29 |
}
|
30 |
/**/
|
31 |
+
return apply_filters ("s2member_hide_some_systematics", $where, get_defined_vars ());
|
32 |
}
|
33 |
?>
|
includes/functions/ip-restrictions.inc.php
CHANGED
@@ -19,7 +19,7 @@ IP addresses are stored in a Transient field.
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_ip_restrictions_ok");
|
23 |
/**/
|
24 |
if ($restriction) /* There MUST be a restriction. However, the IP *can* be empty. */
|
25 |
{
|
@@ -37,7 +37,7 @@ function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FAL
|
|
37 |
{
|
38 |
ws_plugin__s2member_nocache_constants () . wp_clear_auth_cookie (); /* Clear cookies. */
|
39 |
/**/
|
40 |
-
do_action ("s2member_during_ip_restrictions_not_ok");
|
41 |
/**/
|
42 |
header ("HTTP/1.0 503 Service Temporarily Unavailable");
|
43 |
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
|
@@ -48,14 +48,14 @@ function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FAL
|
|
48 |
}
|
49 |
else /* Otherwise, update the Transient array of IP addresses. They're good for now. */
|
50 |
{
|
51 |
-
do_action ("s2member_during_ip_restrictions_ok");
|
52 |
/**/
|
53 |
set_transient ($transient, $new_ips, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
|
54 |
/**/
|
55 |
-
return apply_filters ("s2member_ip_restrictions_ok", true);
|
56 |
}
|
57 |
}
|
58 |
/**/
|
59 |
-
return apply_filters ("s2member_ip_restrictions_ok", true);
|
60 |
}
|
61 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_ip_restrictions_ok ($ip = FALSE, $restriction = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_ip_restrictions_ok", get_defined_vars ());
|
23 |
/**/
|
24 |
if ($restriction) /* There MUST be a restriction. However, the IP *can* be empty. */
|
25 |
{
|
37 |
{
|
38 |
ws_plugin__s2member_nocache_constants () . wp_clear_auth_cookie (); /* Clear cookies. */
|
39 |
/**/
|
40 |
+
do_action ("s2member_during_ip_restrictions_not_ok", get_defined_vars ());
|
41 |
/**/
|
42 |
header ("HTTP/1.0 503 Service Temporarily Unavailable");
|
43 |
echo '<strong>503: Service Temporarily Unavailable</strong><br />' . "\n";
|
48 |
}
|
49 |
else /* Otherwise, update the Transient array of IP addresses. They're good for now. */
|
50 |
{
|
51 |
+
do_action ("s2member_during_ip_restrictions_ok", get_defined_vars ());
|
52 |
/**/
|
53 |
set_transient ($transient, $new_ips, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_ip_restriction_time"]);
|
54 |
/**/
|
55 |
+
return apply_filters ("s2member_ip_restrictions_ok", true, get_defined_vars ());
|
56 |
}
|
57 |
}
|
58 |
/**/
|
59 |
+
return apply_filters ("s2member_ip_restrictions_ok", true, get_defined_vars ());
|
60 |
}
|
61 |
?>
|
includes/functions/is-systematic.inc.php
CHANGED
@@ -20,47 +20,47 @@ function ws_plugin__s2member_is_systematic_use_page ()
|
|
20 |
{
|
21 |
static $is_systematic; /* For optimization. */
|
22 |
/**/
|
23 |
-
do_action ("s2member_before_is_systematic_use_page");
|
24 |
/**/
|
25 |
if (isset ($is_systematic)) /* Already cached? This saves time. */
|
26 |
{
|
27 |
-
return apply_filters ("s2member_is_systematic_use_page", $is_systematic);
|
28 |
}
|
29 |
else if (is_admin ()) /* In the admin area? */
|
30 |
{
|
31 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
32 |
}
|
33 |
else if (preg_match ("/^cli$/i", PHP_SAPI))
|
34 |
{
|
35 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
36 |
}
|
37 |
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])
|
38 |
{
|
39 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
40 |
}
|
41 |
else if (preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
42 |
{
|
43 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
44 |
}
|
45 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
|
46 |
{
|
47 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
48 |
}
|
49 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
|
50 |
{
|
51 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
52 |
}
|
53 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
|
54 |
{
|
55 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true));
|
56 |
}
|
57 |
else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
|
58 |
{
|
59 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true)); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the root URL of the
|
60 |
}
|
61 |
else /* Otherwise, we return false. */
|
62 |
{
|
63 |
-
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", false));
|
64 |
}
|
65 |
}
|
66 |
?>
|
20 |
{
|
21 |
static $is_systematic; /* For optimization. */
|
22 |
/**/
|
23 |
+
do_action ("s2member_before_is_systematic_use_page", get_defined_vars ());
|
24 |
/**/
|
25 |
if (isset ($is_systematic)) /* Already cached? This saves time. */
|
26 |
{
|
27 |
+
return apply_filters ("s2member_is_systematic_use_page", $is_systematic, get_defined_vars ());
|
28 |
}
|
29 |
else if (is_admin ()) /* In the admin area? */
|
30 |
{
|
31 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
32 |
}
|
33 |
else if (preg_match ("/^cli$/i", PHP_SAPI))
|
34 |
{
|
35 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
36 |
}
|
37 |
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])
|
38 |
{
|
39 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
40 |
}
|
41 |
else if (preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
42 |
{
|
43 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
44 |
}
|
45 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
|
46 |
{
|
47 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
48 |
}
|
49 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
|
50 |
{
|
51 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
52 |
}
|
53 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
|
54 |
{
|
55 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ()));
|
56 |
}
|
57 |
else if (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))
|
58 |
{
|
59 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", true, get_defined_vars ())); /* Only true when the request starts with /?s2member from the root URL of the domain, or from the root URL of the install. */
|
60 |
}
|
61 |
else /* Otherwise, we return false. */
|
62 |
{
|
63 |
+
return ($is_systematic = apply_filters ("s2member_is_systematic_use_page", false, get_defined_vars ()));
|
64 |
}
|
65 |
}
|
66 |
?>
|
includes/functions/js-globals.inc.php
CHANGED
@@ -21,7 +21,7 @@ Attach to: add_action("wp_print_scripts");
|
|
21 |
*/
|
22 |
function ws_plugin__s2member_add_js_w_globals ()
|
23 |
{
|
24 |
-
do_action ("s2member_before_add_js_w_globals");
|
25 |
/**/
|
26 |
if (!is_admin ()) /* Not in the admin. */
|
27 |
{
|
@@ -45,10 +45,10 @@ function ws_plugin__s2member_add_js_w_globals ()
|
|
45 |
wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
|
46 |
}
|
47 |
/**/
|
48 |
-
do_action ("s2member_during_add_js_w_globals");
|
49 |
}
|
50 |
/**/
|
51 |
-
do_action ("s2member_after_add_js_w_globals");
|
52 |
/**/
|
53 |
return;
|
54 |
}
|
@@ -58,7 +58,7 @@ Attach to: add_action("init");
|
|
58 |
*/
|
59 |
function ws_plugin__s2member_js_w_globals ()
|
60 |
{
|
61 |
-
do_action ("s2member_before_js_w_globals");
|
62 |
/**/
|
63 |
if ($_GET["ws_plugin__s2member_js_w_globals"])
|
64 |
{
|
@@ -135,11 +135,11 @@ function ws_plugin__s2member_js_w_globals ()
|
|
135 |
$j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
|
136 |
$j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
|
137 |
/**/
|
138 |
-
echo apply_filters ("s2member_js_w_globals", $j);
|
139 |
/**/
|
140 |
exit;
|
141 |
}
|
142 |
/**/
|
143 |
-
do_action ("s2member_after_js_w_globals");
|
144 |
}
|
145 |
?>
|
21 |
*/
|
22 |
function ws_plugin__s2member_add_js_w_globals ()
|
23 |
{
|
24 |
+
do_action ("s2member_before_add_js_w_globals", get_defined_vars ());
|
25 |
/**/
|
26 |
if (!is_admin ()) /* Not in the admin. */
|
27 |
{
|
45 |
wp_enqueue_script ("ws-plugin--s2member", get_bloginfo ("url") . "/?ws_plugin__s2member_js_w_globals=1&qcABC=1", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
|
46 |
}
|
47 |
/**/
|
48 |
+
do_action ("s2member_during_add_js_w_globals", get_defined_vars ());
|
49 |
}
|
50 |
/**/
|
51 |
+
do_action ("s2member_after_add_js_w_globals", get_defined_vars ());
|
52 |
/**/
|
53 |
return;
|
54 |
}
|
58 |
*/
|
59 |
function ws_plugin__s2member_js_w_globals ()
|
60 |
{
|
61 |
+
do_action ("s2member_before_js_w_globals", get_defined_vars ());
|
62 |
/**/
|
63 |
if ($_GET["ws_plugin__s2member_js_w_globals"])
|
64 |
{
|
135 |
$j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
|
136 |
$j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
|
137 |
/**/
|
138 |
+
echo apply_filters ("s2member_js_w_globals", $j, get_defined_vars ());
|
139 |
/**/
|
140 |
exit;
|
141 |
}
|
142 |
/**/
|
143 |
+
do_action ("s2member_after_js_w_globals", get_defined_vars ());
|
144 |
}
|
145 |
?>
|
includes/functions/list-servers.inc.php
CHANGED
@@ -18,6 +18,8 @@ Function that process list server integrations for s2Member.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
|
20 |
{
|
|
|
|
|
21 |
if (strlen ($level) && is_email ($email) && $opt_in) /* Must have a level, a valid email, and opt-in permission. */
|
22 |
{
|
23 |
if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
|
@@ -39,8 +41,12 @@ function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALS
|
|
39 |
"s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nLevel: " . $level . "\n - end.",/**/
|
40 |
"From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
|
41 |
}
|
|
|
|
|
42 |
}
|
43 |
/**/
|
|
|
|
|
44 |
return;
|
45 |
}
|
46 |
/*
|
@@ -49,11 +55,13 @@ servers have been integrated into the s2Member options.
|
|
49 |
*/
|
50 |
function ws_plugin__s2member_list_servers_integrated ()
|
51 |
{
|
|
|
|
|
52 |
for ($i = 0; $i <= 4; $i++)
|
53 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"]/**/
|
54 |
|| $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
|
55 |
-
return true;
|
56 |
/**/
|
57 |
-
return false;
|
58 |
}
|
59 |
?>
|
18 |
*/
|
19 |
function ws_plugin__s2member_process_list_servers ($level = FALSE, $email = FALSE, $fname = FALSE, $lname = FALSE, $ip = FALSE, $opt_in = FALSE)
|
20 |
{
|
21 |
+
do_action ("s2member_before_process_list_servers", get_defined_vars ());
|
22 |
+
/**/
|
23 |
if (strlen ($level) && is_email ($email) && $opt_in) /* Must have a level, a valid email, and opt-in permission. */
|
24 |
{
|
25 |
if (($mailchimp_api_key = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]))
|
41 |
"s2Member Subscription Request\ns2Member w/ PayPal Email ID\nEMail Address: " . $email . "\nBuyer: " . $fname . " " . $lname . "\nFull Name: " . $fname . " " . $lname . "\nFirst Name: " . $fname . "\nLast Name: " . $lname . "\nIP Address: " . $ip . "\nLevel: " . $level . "\n - end.",/**/
|
42 |
"From: \"" . preg_replace ("/\"/", "", $fname . " " . $lname) . "\" <" . $email . ">\r\nContent-Type: text/plain; charset=utf-8");
|
43 |
}
|
44 |
+
/**/
|
45 |
+
do_action ("s2member_during_process_list_servers", get_defined_vars ());
|
46 |
}
|
47 |
/**/
|
48 |
+
do_action ("s2member_after_process_list_servers", get_defined_vars ());
|
49 |
+
/**/
|
50 |
return;
|
51 |
}
|
52 |
/*
|
55 |
*/
|
56 |
function ws_plugin__s2member_list_servers_integrated ()
|
57 |
{
|
58 |
+
do_action ("s2member_before_list_servers_integrated", get_defined_vars ());
|
59 |
+
/**/
|
60 |
for ($i = 0; $i <= 4; $i++)
|
61 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_mailchimp_list_ids"]/**/
|
62 |
|| $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $i . "_aweber_list_ids"])
|
63 |
+
return apply_filters ("s2member_list_servers_integrated", true, get_defined_vars ());
|
64 |
/**/
|
65 |
+
return apply_filters ("s2member_list_servers_integrated", false, get_defined_vars ());
|
66 |
}
|
67 |
?>
|
includes/functions/login-customizations.inc.php
CHANGED
@@ -19,11 +19,11 @@ Attach to: add_filter("login_headerurl");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_login_header_url ($url = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_login_header_url");
|
23 |
/**/
|
24 |
$url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"];
|
25 |
/**/
|
26 |
-
return apply_filters ("s2member_login_header_url", $url);
|
27 |
}
|
28 |
/*
|
29 |
Function for filtering the login logo title.
|
@@ -31,11 +31,11 @@ Attach to: add_filter("login_headertitle");
|
|
31 |
*/
|
32 |
function ws_plugin__s2member_login_header_title ($title = FALSE)
|
33 |
{
|
34 |
-
do_action ("s2member_before_login_header_title");
|
35 |
/**/
|
36 |
$title = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"];
|
37 |
/**/
|
38 |
-
return apply_filters ("s2member_login_header_title", $title);
|
39 |
}
|
40 |
/*
|
41 |
Function for creating the styles for the login panel.
|
@@ -43,7 +43,7 @@ Attach to: add_action("login_head");
|
|
43 |
*/
|
44 |
function ws_plugin__s2member_login_header_styles ()
|
45 |
{
|
46 |
-
do_action ("s2member_before_login_header_styles");
|
47 |
/**/
|
48 |
$s = "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
|
49 |
$s .= '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugin__s2member_js_w_globals=1&no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
|
@@ -71,9 +71,9 @@ function ws_plugin__s2member_login_header_styles ()
|
|
71 |
/**/
|
72 |
$s .= '</style>' . "\n\n";
|
73 |
/**/
|
74 |
-
echo apply_filters ("s2member_login_header_styles", $s);
|
75 |
/**/
|
76 |
-
do_action ("s2member_after_login_header_styles");
|
77 |
/**/
|
78 |
return;
|
79 |
}
|
19 |
*/
|
20 |
function ws_plugin__s2member_login_header_url ($url = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_login_header_url", get_defined_vars ());
|
23 |
/**/
|
24 |
$url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"];
|
25 |
/**/
|
26 |
+
return apply_filters ("s2member_login_header_url", $url, get_defined_vars ());
|
27 |
}
|
28 |
/*
|
29 |
Function for filtering the login logo title.
|
31 |
*/
|
32 |
function ws_plugin__s2member_login_header_title ($title = FALSE)
|
33 |
{
|
34 |
+
do_action ("s2member_before_login_header_title", get_defined_vars ());
|
35 |
/**/
|
36 |
$title = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"];
|
37 |
/**/
|
38 |
+
return apply_filters ("s2member_login_header_title", $title, get_defined_vars ());
|
39 |
}
|
40 |
/*
|
41 |
Function for creating the styles for the login panel.
|
43 |
*/
|
44 |
function ws_plugin__s2member_login_header_styles ()
|
45 |
{
|
46 |
+
do_action ("s2member_before_login_header_styles", get_defined_vars ());
|
47 |
/**/
|
48 |
$s = "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
|
49 |
$s .= '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugin__s2member_js_w_globals=1&no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
|
71 |
/**/
|
72 |
$s .= '</style>' . "\n\n";
|
73 |
/**/
|
74 |
+
echo apply_filters ("s2member_login_header_styles", $s, get_defined_vars ());
|
75 |
/**/
|
76 |
+
do_action ("s2member_after_login_header_styles", get_defined_vars ());
|
77 |
/**/
|
78 |
return;
|
79 |
}
|
includes/functions/login-redirection.inc.php
CHANGED
@@ -19,13 +19,13 @@ Attach to: add_action("wp_login");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_login_redirect ($username = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_login_redirect");
|
23 |
/**/
|
24 |
$user = new WP_User ($username); /* Get user object reference. */
|
25 |
/**/
|
26 |
if (!$user->has_cap ("edit_posts")) /* Subscribers & Members. */
|
27 |
{
|
28 |
-
do_action ("s2member_during_login_redirect");
|
29 |
/**/
|
30 |
if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
|
31 |
{
|
@@ -40,7 +40,7 @@ function ws_plugin__s2member_login_redirect ($username = FALSE)
|
|
40 |
exit;
|
41 |
}
|
42 |
/**/
|
43 |
-
do_action ("s2member_after_login_redirect");
|
44 |
/**/
|
45 |
return;
|
46 |
}
|
@@ -49,7 +49,7 @@ Function that fills replacement code variables in special redirection URLs.
|
|
49 |
*/
|
50 |
function ws_plugin__s2member_fill_login_redirect_rc_vars ($url = FALSE, $current_user = FALSE)
|
51 |
{
|
52 |
-
do_action ("s2member_before_fill_login_redirect_rc_vars");
|
53 |
/**/
|
54 |
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
|
55 |
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
|
@@ -57,6 +57,6 @@ function ws_plugin__s2member_fill_login_redirect_rc_vars ($url = FALSE, $current
|
|
57 |
$url = preg_replace ("/%%current_user_login%%/i", $current_user_login, $url);
|
58 |
$url = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $url);
|
59 |
/**/
|
60 |
-
return apply_filters ("s2member_fill_login_redirect_rc_vars", $url);
|
61 |
}
|
62 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_login_redirect ($username = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_login_redirect", get_defined_vars ());
|
23 |
/**/
|
24 |
$user = new WP_User ($username); /* Get user object reference. */
|
25 |
/**/
|
26 |
if (!$user->has_cap ("edit_posts")) /* Subscribers & Members. */
|
27 |
{
|
28 |
+
do_action ("s2member_during_login_redirect", get_defined_vars ());
|
29 |
/**/
|
30 |
if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], strtolower ($username)))
|
31 |
{
|
40 |
exit;
|
41 |
}
|
42 |
/**/
|
43 |
+
do_action ("s2member_after_login_redirect", get_defined_vars ());
|
44 |
/**/
|
45 |
return;
|
46 |
}
|
49 |
*/
|
50 |
function ws_plugin__s2member_fill_login_redirect_rc_vars ($url = FALSE, $current_user = FALSE)
|
51 |
{
|
52 |
+
do_action ("s2member_before_fill_login_redirect_rc_vars", get_defined_vars ());
|
53 |
/**/
|
54 |
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
|
55 |
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
|
57 |
$url = preg_replace ("/%%current_user_login%%/i", $current_user_login, $url);
|
58 |
$url = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $url);
|
59 |
/**/
|
60 |
+
return apply_filters ("s2member_fill_login_redirect_rc_vars", $url, get_defined_vars ());
|
61 |
}
|
62 |
?>
|
includes/functions/menu-pages.inc.php
CHANGED
@@ -18,7 +18,7 @@ Function for saving all options from any page.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_update_all_options ()
|
20 |
{
|
21 |
-
do_action ("s2member_before_update_all_options");
|
22 |
/**/
|
23 |
if (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save"))
|
24 |
{
|
@@ -53,12 +53,12 @@ function ws_plugin__s2member_update_all_options ()
|
|
53 |
else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
|
54 |
ws_plugin__s2member_delete_auto_eot_system ();
|
55 |
/**/
|
56 |
-
do_action ("s2member_during_update_all_options");
|
57 |
/**/
|
58 |
ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>'); /* Display admin notice. */
|
59 |
}
|
60 |
/**/
|
61 |
-
do_action ("s2member_after_update_all_options");
|
62 |
/**/
|
63 |
return;
|
64 |
}
|
@@ -68,7 +68,7 @@ Attach to: add_action("admin_menu");
|
|
68 |
*/
|
69 |
function ws_plugin__s2member_add_admin_options ()
|
70 |
{
|
71 |
-
do_action ("s2member_before_add_admin_options");
|
72 |
/**/
|
73 |
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
|
74 |
/**/
|
@@ -84,7 +84,7 @@ function ws_plugin__s2member_add_admin_options ()
|
|
84 |
add_submenu_page ("ws-plugin--s2member-options", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
|
85 |
add_submenu_page ("ws-plugin--s2member-options", "s2Member Quick Start Guide", "Quick Start Guide", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
|
86 |
/**/
|
87 |
-
do_action ("s2member_after_add_admin_options");
|
88 |
/**/
|
89 |
return;
|
90 |
}
|
@@ -93,17 +93,17 @@ A sort of callback function to add the settings link.
|
|
93 |
*/
|
94 |
function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
|
95 |
{
|
96 |
-
do_action ("s2member_before_add_settings_link");
|
97 |
/**/
|
98 |
if (preg_match ("/" . preg_quote ($file, "/") . "$/", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
|
99 |
{
|
100 |
$settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
|
101 |
-
array_unshift ($links, apply_filters ("s2member_add_settings_link", $settings));
|
102 |
/**/
|
103 |
-
do_action ("s2member_during_add_settings_link");
|
104 |
}
|
105 |
/**/
|
106 |
-
return apply_filters ("s2member_add_settings_link", $links);
|
107 |
}
|
108 |
/*
|
109 |
Add scripts to admin panels.
|
@@ -111,7 +111,7 @@ Attach to: add_action("admin_print_scripts");
|
|
111 |
*/
|
112 |
function ws_plugin__s2member_add_admin_scripts ()
|
113 |
{
|
114 |
-
do_action ("s2member_before_add_admin_scripts");
|
115 |
/**/
|
116 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
117 |
{
|
@@ -120,10 +120,10 @@ function ws_plugin__s2member_add_admin_scripts ()
|
|
120 |
wp_enqueue_script ("media-upload");
|
121 |
wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
|
122 |
/**/
|
123 |
-
do_action ("s2member_during_add_admin_scripts");
|
124 |
}
|
125 |
/**/
|
126 |
-
do_action ("s2member_after_add_admin_scripts");
|
127 |
/**/
|
128 |
return;
|
129 |
}
|
@@ -133,17 +133,17 @@ Attach to: add_action("admin_print_styles");
|
|
133 |
*/
|
134 |
function ws_plugin__s2member_add_admin_styles ()
|
135 |
{
|
136 |
-
do_action ("s2member_before_add_admin_styles");
|
137 |
/**/
|
138 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
139 |
{
|
140 |
wp_enqueue_style ("thickbox");
|
141 |
wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
|
142 |
/**/
|
143 |
-
do_action ("s2member_during_add_admin_styles");
|
144 |
}
|
145 |
/**/
|
146 |
-
do_action ("s2member_after_add_admin_styles");
|
147 |
/**/
|
148 |
return;
|
149 |
}
|
@@ -153,7 +153,7 @@ Attach to: add_action("init");
|
|
153 |
*/
|
154 |
function ws_plugin__s2member_menu_pages_js ()
|
155 |
{
|
156 |
-
do_action ("s2member_before_menu_pages_js");
|
157 |
/**/
|
158 |
if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
159 |
{
|
@@ -168,12 +168,12 @@ function ws_plugin__s2member_menu_pages_js ()
|
|
168 |
/**/
|
169 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
|
170 |
/**/
|
171 |
-
do_action ("s2member_during_menu_pages_js");
|
172 |
/**/
|
173 |
exit;
|
174 |
}
|
175 |
/**/
|
176 |
-
do_action ("s2member_after_menu_pages_js");
|
177 |
}
|
178 |
/*
|
179 |
Function that outputs the CSS for menu pages.
|
@@ -181,7 +181,7 @@ Attach to: add_action("init");
|
|
181 |
*/
|
182 |
function ws_plugin__s2member_menu_pages_css ()
|
183 |
{
|
184 |
-
do_action ("s2member_before_menu_pages_css");
|
185 |
/**/
|
186 |
if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
187 |
{
|
@@ -196,25 +196,25 @@ function ws_plugin__s2member_menu_pages_css ()
|
|
196 |
/**/
|
197 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
|
198 |
/**/
|
199 |
-
do_action ("s2member_during_menu_pages_css");
|
200 |
/**/
|
201 |
exit;
|
202 |
}
|
203 |
/**/
|
204 |
-
do_action ("s2member_after_menu_pages_css");
|
205 |
}
|
206 |
/*
|
207 |
Function for building and handling the General Options page.
|
208 |
*/
|
209 |
function ws_plugin__s2member_options_page ()
|
210 |
{
|
211 |
-
do_action ("s2member_before_options_page");
|
212 |
/**/
|
213 |
ws_plugin__s2member_update_all_options ();
|
214 |
/**/
|
215 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
|
216 |
/**/
|
217 |
-
do_action ("s2member_after_options_page");
|
218 |
/**/
|
219 |
return;
|
220 |
}
|
@@ -223,7 +223,7 @@ Function for building and handling the Paypal Options page.
|
|
223 |
*/
|
224 |
function ws_plugin__s2member_paypal_ops_page ()
|
225 |
{
|
226 |
-
do_action ("s2member_before_paypal_ops_page");
|
227 |
/**/
|
228 |
ws_plugin__s2member_update_all_options ();
|
229 |
/**/
|
@@ -254,7 +254,7 @@ function ws_plugin__s2member_paypal_ops_page ()
|
|
254 |
/**/
|
255 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
|
256 |
/**/
|
257 |
-
do_action ("s2member_after_paypal_ops_page");
|
258 |
/**/
|
259 |
return;
|
260 |
}
|
@@ -263,7 +263,7 @@ Function for building and handling the Download Options page.
|
|
263 |
*/
|
264 |
function ws_plugin__s2member_down_ops_page ()
|
265 |
{
|
266 |
-
do_action ("s2member_before_down_ops_page");
|
267 |
/**/
|
268 |
ws_plugin__s2member_update_all_options ();
|
269 |
/**/
|
@@ -288,7 +288,7 @@ function ws_plugin__s2member_down_ops_page ()
|
|
288 |
/**/
|
289 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
|
290 |
/**/
|
291 |
-
do_action ("s2member_after_down_ops_page");
|
292 |
/**/
|
293 |
return;
|
294 |
}
|
@@ -297,13 +297,13 @@ Function for building and handling the API Tracking options page.
|
|
297 |
*/
|
298 |
function ws_plugin__s2member_trk_ops_page ()
|
299 |
{
|
300 |
-
do_action ("s2member_before_trk_ops_page");
|
301 |
/**/
|
302 |
ws_plugin__s2member_update_all_options ();
|
303 |
/**/
|
304 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
|
305 |
/**/
|
306 |
-
do_action ("s2member_after_trk_ops_page");
|
307 |
/**/
|
308 |
return;
|
309 |
}
|
@@ -312,13 +312,13 @@ Function for building and handling the API List Server options page.
|
|
312 |
*/
|
313 |
function ws_plugin__s2member_els_ops_page ()
|
314 |
{
|
315 |
-
do_action ("s2member_before_els_ops_page");
|
316 |
/**/
|
317 |
ws_plugin__s2member_update_all_options ();
|
318 |
/**/
|
319 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
|
320 |
/**/
|
321 |
-
do_action ("s2member_after_els_ops_page");
|
322 |
/**/
|
323 |
return;
|
324 |
}
|
@@ -327,13 +327,13 @@ Function for building and handling the API Notifications page.
|
|
327 |
*/
|
328 |
function ws_plugin__s2member_api_ops_page ()
|
329 |
{
|
330 |
-
do_action ("s2member_before_api_ops_page");
|
331 |
/**/
|
332 |
ws_plugin__s2member_update_all_options ();
|
333 |
/**/
|
334 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
|
335 |
/**/
|
336 |
-
do_action ("s2member_after_api_ops_page");
|
337 |
/**/
|
338 |
return;
|
339 |
}
|
@@ -342,11 +342,11 @@ Function for building the PayPal Button Generator page.
|
|
342 |
*/
|
343 |
function ws_plugin__s2member_buttons_page ()
|
344 |
{
|
345 |
-
do_action ("s2member_before_buttons_page");
|
346 |
/**/
|
347 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
|
348 |
/**/
|
349 |
-
do_action ("s2member_after_buttons_page");
|
350 |
/**/
|
351 |
return;
|
352 |
}
|
@@ -355,11 +355,11 @@ Function for building the API Scripting page.
|
|
355 |
*/
|
356 |
function ws_plugin__s2member_scripting_page ()
|
357 |
{
|
358 |
-
do_action ("s2member_before_scripting_page");
|
359 |
/**/
|
360 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
|
361 |
/**/
|
362 |
-
do_action ("s2member_after_scripting_page");
|
363 |
/**/
|
364 |
return;
|
365 |
}
|
@@ -368,11 +368,11 @@ Function for building the s2Member Info page.
|
|
368 |
*/
|
369 |
function ws_plugin__s2member_info_page ()
|
370 |
{
|
371 |
-
do_action ("s2member_before_info_page");
|
372 |
/**/
|
373 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
|
374 |
/**/
|
375 |
-
do_action ("s2member_after_info_page");
|
376 |
/**/
|
377 |
return;
|
378 |
}
|
@@ -381,11 +381,11 @@ Function for building and handling the Quick Start page.
|
|
381 |
*/
|
382 |
function ws_plugin__s2member_start_page ()
|
383 |
{
|
384 |
-
do_action ("s2member_before_start_page");
|
385 |
/**/
|
386 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
|
387 |
/**/
|
388 |
-
do_action ("s2member_after_start_page");
|
389 |
/**/
|
390 |
return;
|
391 |
}
|
18 |
*/
|
19 |
function ws_plugin__s2member_update_all_options ()
|
20 |
{
|
21 |
+
do_action ("s2member_before_update_all_options", get_defined_vars ());
|
22 |
/**/
|
23 |
if (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save"))
|
24 |
{
|
53 |
else /* Otherwise, the Auto-EOT System via WP-Cron is disabled. */
|
54 |
ws_plugin__s2member_delete_auto_eot_system ();
|
55 |
/**/
|
56 |
+
do_action ("s2member_during_update_all_options", get_defined_vars ());
|
57 |
/**/
|
58 |
ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>'); /* Display admin notice. */
|
59 |
}
|
60 |
/**/
|
61 |
+
do_action ("s2member_after_update_all_options", get_defined_vars ());
|
62 |
/**/
|
63 |
return;
|
64 |
}
|
68 |
*/
|
69 |
function ws_plugin__s2member_add_admin_options ()
|
70 |
{
|
71 |
+
do_action ("s2member_before_add_admin_options", get_defined_vars ());
|
72 |
/**/
|
73 |
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
|
74 |
/**/
|
84 |
add_submenu_page ("ws-plugin--s2member-options", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
|
85 |
add_submenu_page ("ws-plugin--s2member-options", "s2Member Quick Start Guide", "Quick Start Guide", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
|
86 |
/**/
|
87 |
+
do_action ("s2member_after_add_admin_options", get_defined_vars ());
|
88 |
/**/
|
89 |
return;
|
90 |
}
|
93 |
*/
|
94 |
function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
|
95 |
{
|
96 |
+
do_action ("s2member_before_add_settings_link", get_defined_vars ());
|
97 |
/**/
|
98 |
if (preg_match ("/" . preg_quote ($file, "/") . "$/", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
|
99 |
{
|
100 |
$settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
|
101 |
+
array_unshift ($links, apply_filters ("s2member_add_settings_link", $settings, get_defined_vars ()));
|
102 |
/**/
|
103 |
+
do_action ("s2member_during_add_settings_link", get_defined_vars ());
|
104 |
}
|
105 |
/**/
|
106 |
+
return apply_filters ("s2member_add_settings_link", $links, get_defined_vars ());
|
107 |
}
|
108 |
/*
|
109 |
Add scripts to admin panels.
|
111 |
*/
|
112 |
function ws_plugin__s2member_add_admin_scripts ()
|
113 |
{
|
114 |
+
do_action ("s2member_before_add_admin_scripts", get_defined_vars ());
|
115 |
/**/
|
116 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
117 |
{
|
120 |
wp_enqueue_script ("media-upload");
|
121 |
wp_enqueue_script ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_js=1", array ("jquery", "thickbox", "media-upload"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
|
122 |
/**/
|
123 |
+
do_action ("s2member_during_add_admin_scripts", get_defined_vars ());
|
124 |
}
|
125 |
/**/
|
126 |
+
do_action ("s2member_after_add_admin_scripts", get_defined_vars ());
|
127 |
/**/
|
128 |
return;
|
129 |
}
|
133 |
*/
|
134 |
function ws_plugin__s2member_add_admin_styles ()
|
135 |
{
|
136 |
+
do_action ("s2member_before_add_admin_styles", get_defined_vars ());
|
137 |
/**/
|
138 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
139 |
{
|
140 |
wp_enqueue_style ("thickbox");
|
141 |
wp_enqueue_style ("ws-plugin--s2member-menu-pages", get_bloginfo ("url") . "/?ws_plugin__s2member_menu_pages_css=1", array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
|
142 |
/**/
|
143 |
+
do_action ("s2member_during_add_admin_styles", get_defined_vars ());
|
144 |
}
|
145 |
/**/
|
146 |
+
do_action ("s2member_after_add_admin_styles", get_defined_vars ());
|
147 |
/**/
|
148 |
return;
|
149 |
}
|
153 |
*/
|
154 |
function ws_plugin__s2member_menu_pages_js ()
|
155 |
{
|
156 |
+
do_action ("s2member_before_menu_pages_js", get_defined_vars ());
|
157 |
/**/
|
158 |
if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
159 |
{
|
168 |
/**/
|
169 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
|
170 |
/**/
|
171 |
+
do_action ("s2member_during_menu_pages_js", get_defined_vars ());
|
172 |
/**/
|
173 |
exit;
|
174 |
}
|
175 |
/**/
|
176 |
+
do_action ("s2member_after_menu_pages_js", get_defined_vars ());
|
177 |
}
|
178 |
/*
|
179 |
Function that outputs the CSS for menu pages.
|
181 |
*/
|
182 |
function ws_plugin__s2member_menu_pages_css ()
|
183 |
{
|
184 |
+
do_action ("s2member_before_menu_pages_css", get_defined_vars ());
|
185 |
/**/
|
186 |
if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
187 |
{
|
196 |
/**/
|
197 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
|
198 |
/**/
|
199 |
+
do_action ("s2member_during_menu_pages_css", get_defined_vars ());
|
200 |
/**/
|
201 |
exit;
|
202 |
}
|
203 |
/**/
|
204 |
+
do_action ("s2member_after_menu_pages_css", get_defined_vars ());
|
205 |
}
|
206 |
/*
|
207 |
Function for building and handling the General Options page.
|
208 |
*/
|
209 |
function ws_plugin__s2member_options_page ()
|
210 |
{
|
211 |
+
do_action ("s2member_before_options_page", get_defined_vars ());
|
212 |
/**/
|
213 |
ws_plugin__s2member_update_all_options ();
|
214 |
/**/
|
215 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
|
216 |
/**/
|
217 |
+
do_action ("s2member_after_options_page", get_defined_vars ());
|
218 |
/**/
|
219 |
return;
|
220 |
}
|
223 |
*/
|
224 |
function ws_plugin__s2member_paypal_ops_page ()
|
225 |
{
|
226 |
+
do_action ("s2member_before_paypal_ops_page", get_defined_vars ());
|
227 |
/**/
|
228 |
ws_plugin__s2member_update_all_options ();
|
229 |
/**/
|
254 |
/**/
|
255 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
|
256 |
/**/
|
257 |
+
do_action ("s2member_after_paypal_ops_page", get_defined_vars ());
|
258 |
/**/
|
259 |
return;
|
260 |
}
|
263 |
*/
|
264 |
function ws_plugin__s2member_down_ops_page ()
|
265 |
{
|
266 |
+
do_action ("s2member_before_down_ops_page", get_defined_vars ());
|
267 |
/**/
|
268 |
ws_plugin__s2member_update_all_options ();
|
269 |
/**/
|
288 |
/**/
|
289 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
|
290 |
/**/
|
291 |
+
do_action ("s2member_after_down_ops_page", get_defined_vars ());
|
292 |
/**/
|
293 |
return;
|
294 |
}
|
297 |
*/
|
298 |
function ws_plugin__s2member_trk_ops_page ()
|
299 |
{
|
300 |
+
do_action ("s2member_before_trk_ops_page", get_defined_vars ());
|
301 |
/**/
|
302 |
ws_plugin__s2member_update_all_options ();
|
303 |
/**/
|
304 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
|
305 |
/**/
|
306 |
+
do_action ("s2member_after_trk_ops_page", get_defined_vars ());
|
307 |
/**/
|
308 |
return;
|
309 |
}
|
312 |
*/
|
313 |
function ws_plugin__s2member_els_ops_page ()
|
314 |
{
|
315 |
+
do_action ("s2member_before_els_ops_page", get_defined_vars ());
|
316 |
/**/
|
317 |
ws_plugin__s2member_update_all_options ();
|
318 |
/**/
|
319 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
|
320 |
/**/
|
321 |
+
do_action ("s2member_after_els_ops_page", get_defined_vars ());
|
322 |
/**/
|
323 |
return;
|
324 |
}
|
327 |
*/
|
328 |
function ws_plugin__s2member_api_ops_page ()
|
329 |
{
|
330 |
+
do_action ("s2member_before_api_ops_page", get_defined_vars ());
|
331 |
/**/
|
332 |
ws_plugin__s2member_update_all_options ();
|
333 |
/**/
|
334 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
|
335 |
/**/
|
336 |
+
do_action ("s2member_after_api_ops_page", get_defined_vars ());
|
337 |
/**/
|
338 |
return;
|
339 |
}
|
342 |
*/
|
343 |
function ws_plugin__s2member_buttons_page ()
|
344 |
{
|
345 |
+
do_action ("s2member_before_buttons_page", get_defined_vars ());
|
346 |
/**/
|
347 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
|
348 |
/**/
|
349 |
+
do_action ("s2member_after_buttons_page", get_defined_vars ());
|
350 |
/**/
|
351 |
return;
|
352 |
}
|
355 |
*/
|
356 |
function ws_plugin__s2member_scripting_page ()
|
357 |
{
|
358 |
+
do_action ("s2member_before_scripting_page", get_defined_vars ());
|
359 |
/**/
|
360 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
|
361 |
/**/
|
362 |
+
do_action ("s2member_after_scripting_page", get_defined_vars ());
|
363 |
/**/
|
364 |
return;
|
365 |
}
|
368 |
*/
|
369 |
function ws_plugin__s2member_info_page ()
|
370 |
{
|
371 |
+
do_action ("s2member_before_info_page", get_defined_vars ());
|
372 |
/**/
|
373 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
|
374 |
/**/
|
375 |
+
do_action ("s2member_after_info_page", get_defined_vars ());
|
376 |
/**/
|
377 |
return;
|
378 |
}
|
381 |
*/
|
382 |
function ws_plugin__s2member_start_page ()
|
383 |
{
|
384 |
+
do_action ("s2member_before_start_page", get_defined_vars ());
|
385 |
/**/
|
386 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
|
387 |
/**/
|
388 |
+
do_action ("s2member_after_start_page", get_defined_vars ());
|
389 |
/**/
|
390 |
return;
|
391 |
}
|
includes/functions/nocache.inc.php
CHANGED
@@ -20,11 +20,11 @@ Attach to: add_action("init");
|
|
20 |
*/
|
21 |
function ws_plugin__s2member_nocache ()
|
22 |
{
|
23 |
-
do_action ("s2member_before_nocache");
|
24 |
/**/
|
25 |
ws_plugin__s2member_nocache_constants () . ws_plugin__s2member_nocache_headers ();
|
26 |
/**/
|
27 |
-
do_action ("s2member_after_nocache");
|
28 |
/**/
|
29 |
return;
|
30 |
}
|
@@ -54,16 +54,16 @@ These additional supplemental routines, include:
|
|
54 |
*/
|
55 |
function ws_plugin__s2member_nocache_constants ($nocache = FALSE) /* Always obey the Quick Cache plugin. */
|
56 |
{
|
57 |
-
do_action ("s2member_before_nocache_constants");
|
58 |
/**/
|
59 |
if (!$_GET["qcAC"] && ($nocache || is_user_logged_in () || (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))))
|
60 |
{
|
61 |
define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
|
62 |
/**/
|
63 |
-
do_action ("s2member_during_nocache_constants");
|
64 |
}
|
65 |
/**/
|
66 |
-
do_action ("s2member_after_nocache_constants");
|
67 |
/**/
|
68 |
return;
|
69 |
}
|
@@ -75,7 +75,7 @@ This is compatible with the Quick Cache parameter ?qcABC=1 as well.
|
|
75 |
*/
|
76 |
function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
77 |
{
|
78 |
-
do_action ("s2member_before_nocache_headers");
|
79 |
/**/
|
80 |
if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
|
81 |
{
|
@@ -87,10 +87,10 @@ function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
|
87 |
if (!$no_cache_already_sent)
|
88 |
nocache_headers ();
|
89 |
/**/
|
90 |
-
do_action ("s2member_during_nocache_headers");
|
91 |
}
|
92 |
/**/
|
93 |
-
do_action ("s2member_after_nocache_headers");
|
94 |
/**/
|
95 |
return;
|
96 |
}
|
20 |
*/
|
21 |
function ws_plugin__s2member_nocache ()
|
22 |
{
|
23 |
+
do_action ("s2member_before_nocache", get_defined_vars ());
|
24 |
/**/
|
25 |
ws_plugin__s2member_nocache_constants () . ws_plugin__s2member_nocache_headers ();
|
26 |
/**/
|
27 |
+
do_action ("s2member_after_nocache", get_defined_vars ());
|
28 |
/**/
|
29 |
return;
|
30 |
}
|
54 |
*/
|
55 |
function ws_plugin__s2member_nocache_constants ($nocache = FALSE) /* Always obey the Quick Cache plugin. */
|
56 |
{
|
57 |
+
do_action ("s2member_before_nocache_constants", get_defined_vars ());
|
58 |
/**/
|
59 |
if (!$_GET["qcAC"] && ($nocache || is_user_logged_in () || (preg_match ("/^s2member/", $_SERVER["QUERY_STRING"]) && ($_SERVER["REQUEST_URI"] === "/" || strtolower (rtrim (get_bloginfo ("url"), "/")) === rtrim (strtolower ("http://" . $_SERVER["HTTP_HOST"]) . $_SERVER["REQUEST_URI"], "/")))))
|
60 |
{
|
61 |
define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
|
62 |
/**/
|
63 |
+
do_action ("s2member_during_nocache_constants", get_defined_vars ());
|
64 |
}
|
65 |
/**/
|
66 |
+
do_action ("s2member_after_nocache_constants", get_defined_vars ());
|
67 |
/**/
|
68 |
return;
|
69 |
}
|
75 |
*/
|
76 |
function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
77 |
{
|
78 |
+
do_action ("s2member_before_nocache_headers", get_defined_vars ());
|
79 |
/**/
|
80 |
if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
|
81 |
{
|
87 |
if (!$no_cache_already_sent)
|
88 |
nocache_headers ();
|
89 |
/**/
|
90 |
+
do_action ("s2member_during_nocache_headers", get_defined_vars ());
|
91 |
}
|
92 |
/**/
|
93 |
+
do_action ("s2member_after_nocache_headers", get_defined_vars ());
|
94 |
/**/
|
95 |
return;
|
96 |
}
|
includes/functions/page-level-access.inc.php
CHANGED
@@ -21,9 +21,9 @@ function ws_plugin__s2member_check_page_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_check_page_level_access");
|
25 |
/**/
|
26 |
-
$excluded = apply_filters ("s2member_check_page_level_access_excluded", false);
|
27 |
/**/
|
28 |
if (!$excluded && is_page () && is_object ($post) && ($page_ID = $post->ID))
|
29 |
{
|
@@ -62,10 +62,10 @@ function ws_plugin__s2member_check_page_level_access ()
|
|
62 |
else 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"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_sp_req", $page_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
63 |
exit;
|
64 |
/**/
|
65 |
-
do_action ("s2member_during_check_page_level_access");
|
66 |
}
|
67 |
/**/
|
68 |
-
do_action ("s2member_after_check_page_level_access");
|
69 |
/**/
|
70 |
return;
|
71 |
}
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_page_level_access", get_defined_vars ());
|
25 |
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_page_level_access_excluded", false, get_defined_vars ());
|
27 |
/**/
|
28 |
if (!$excluded && is_page () && is_object ($post) && ($page_ID = $post->ID))
|
29 |
{
|
62 |
else 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"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (add_query_arg ("s2member_sp_req", $page_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
63 |
exit;
|
64 |
/**/
|
65 |
+
do_action ("s2member_during_check_page_level_access", get_defined_vars ());
|
66 |
}
|
67 |
/**/
|
68 |
+
do_action ("s2member_after_check_page_level_access", get_defined_vars ());
|
69 |
/**/
|
70 |
return;
|
71 |
}
|
includes/functions/paypal-notify.inc.php
CHANGED
@@ -19,7 +19,7 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_notify ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_paypal_notify");
|
23 |
/**/
|
24 |
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
|
25 |
/**/
|
@@ -44,7 +44,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
44 |
*/
|
45 |
if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
|
46 |
{
|
47 |
-
do_action ("s2member_during_paypal_notify_before_sp_access");
|
48 |
/**/
|
49 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page Access.";
|
50 |
/**/
|
@@ -114,21 +114,21 @@ function ws_plugin__s2member_paypal_notify ()
|
|
114 |
}
|
115 |
}
|
116 |
/**/
|
117 |
-
do_action ("s2member_during_paypal_notify_during_sp_access");
|
118 |
}
|
119 |
else
|
120 |
{
|
121 |
$paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
122 |
}
|
123 |
/**/
|
124 |
-
do_action ("s2member_during_paypal_notify_after_sp_access");
|
125 |
}
|
126 |
/*
|
127 |
New Subscriptions. Possibly containing advanced update vars ( option_name1, option_selection1 ); which allow account modifications.
|
128 |
*/
|
129 |
-
else if (preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"]) && $paypal["payer_email"] && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
|
130 |
{
|
131 |
-
do_action ("s2member_during_paypal_notify_before_subscr_signup");
|
132 |
/**/
|
133 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
|
134 |
/**/
|
@@ -152,7 +152,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
152 |
/* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal will not allow the
|
153 |
modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
|
154 |
{
|
155 |
-
do_action ("s2member_during_paypal_notify_before_subscr_signup_w_update_vars");
|
156 |
/**/
|
157 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
|
158 |
/**/
|
@@ -193,7 +193,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
193 |
/**/
|
194 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
|
195 |
/**/
|
196 |
-
do_action ("s2member_during_paypal_notify_during_subscr_signup_w_update_vars");
|
197 |
}
|
198 |
else
|
199 |
{
|
@@ -205,14 +205,14 @@ function ws_plugin__s2member_paypal_notify ()
|
|
205 |
$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.";
|
206 |
}
|
207 |
/**/
|
208 |
-
do_action ("s2member_during_paypal_notify_after_subscr_signup_w_update_vars");
|
209 |
}
|
210 |
/*
|
211 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
212 |
*/
|
213 |
else /* Else this is a normal Subscription signup, we are not updating anything. */
|
214 |
{
|
215 |
-
do_action ("s2member_during_paypal_notify_before_subscr_signup_wo_update_vars");
|
216 |
/**/
|
217 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
|
218 |
/**/
|
@@ -246,10 +246,10 @@ function ws_plugin__s2member_paypal_notify ()
|
|
246 |
$paypal["s2member_log"][] = "Signup Confirmation Email sent to Customer, with a URL to assist w/ registration.";
|
247 |
}
|
248 |
/**/
|
249 |
-
do_action ("s2member_during_paypal_notify_during_subscr_signup_wo_update_vars");
|
250 |
}
|
251 |
/**/
|
252 |
-
do_action ("s2member_during_paypal_notify_after_subscr_signup_wo_update_vars");
|
253 |
}
|
254 |
/**/
|
255 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
@@ -304,14 +304,14 @@ function ws_plugin__s2member_paypal_notify ()
|
|
304 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
305 |
}
|
306 |
/**/
|
307 |
-
do_action ("s2member_during_paypal_notify_after_subscr_signup");
|
308 |
}
|
309 |
/*
|
310 |
Subscription modifications.
|
311 |
*/
|
312 |
-
else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
|
313 |
{
|
314 |
-
do_action ("s2member_during_paypal_notify_before_subscr_modify");
|
315 |
/**/
|
316 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
317 |
/**/
|
@@ -349,7 +349,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
349 |
/**/
|
350 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
|
351 |
/**/
|
352 |
-
do_action ("s2member_during_paypal_notify_during_subscr_modify");
|
353 |
}
|
354 |
else
|
355 |
{
|
@@ -361,14 +361,14 @@ function ws_plugin__s2member_paypal_notify ()
|
|
361 |
$paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
|
362 |
}
|
363 |
/**/
|
364 |
-
do_action ("s2member_during_paypal_notify_after_subscr_modify");
|
365 |
}
|
366 |
/*
|
367 |
Subscription payments.
|
368 |
*/
|
369 |
-
else if (preg_match ("/^subscr_payment$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]) && $paypal["txn_id"] && $paypal["mc_gross"])
|
370 |
{
|
371 |
-
do_action ("s2member_during_paypal_notify_before_subscr_payment");
|
372 |
/**/
|
373 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
|
374 |
$paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify.";
|
@@ -403,7 +403,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
403 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
404 |
}
|
405 |
/**/
|
406 |
-
do_action ("s2member_during_paypal_notify_during_subscr_payment");
|
407 |
}
|
408 |
else
|
409 |
{
|
@@ -412,7 +412,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
412 |
set_transient (md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $_POST, 43200);
|
413 |
}
|
414 |
/**/
|
415 |
-
do_action ("s2member_during_paypal_notify_after_subscr_payment");
|
416 |
}
|
417 |
/*
|
418 |
Subscription cancellations. s2Member can use this, to determine when/if it should Auto-EOT (demote|delete) a Member's account.
|
@@ -420,9 +420,9 @@ function ws_plugin__s2member_paypal_notify ()
|
|
420 |
This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
|
421 |
For further details & stupidity, see: https://www.x.com/thread/41155?start=15&tstart=0
|
422 |
*/
|
423 |
-
else if (preg_match ("/^subscr_cancel$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
|
424 |
{
|
425 |
-
do_action ("s2member_during_paypal_notify_before_subscr_cancel");
|
426 |
/**/
|
427 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_cancel.";
|
428 |
/**/
|
@@ -440,7 +440,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
440 |
/**/
|
441 |
$paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
442 |
/**/
|
443 |
-
do_action ("s2member_during_paypal_notify_during_subscr_cancel");
|
444 |
}
|
445 |
else
|
446 |
{
|
@@ -452,16 +452,16 @@ function ws_plugin__s2member_paypal_notify ()
|
|
452 |
$paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
|
453 |
}
|
454 |
/**/
|
455 |
-
do_action ("s2member_during_paypal_notify_after_subscr_cancel");
|
456 |
}
|
457 |
/*
|
458 |
Subscription terminations, max failed payments, initial payment failed, chargebacks, refunds, and reversals. *** NOT processed for Specific Posts/Pages. */
|
459 |
else if ( /* An immediate EOT is necessary under MANY different conditions. This consolidates them all, with a sub-classification for refunds/reversals. */
|
460 |
(preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i", $paypal["txn_type"]) || (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"])) || (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"])))/**/
|
461 |
&& ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
|
462 |
-
&& (preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]) || $paypal["recurring_payment_id"])/**/)
|
463 |
{
|
464 |
-
do_action ("s2member_during_paypal_notify_before_subscr_eot");
|
465 |
/**/
|
466 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - initial_payment_status (failed) - or - case_type (chargeback) - or - payment_status (refunded|reversed).";
|
467 |
/**/
|
@@ -512,7 +512,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
512 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
513 |
}
|
514 |
/**/
|
515 |
-
do_action ("s2member_during_paypal_notify_during_subscr_eot_demote");
|
516 |
}
|
517 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
518 |
{
|
@@ -525,10 +525,10 @@ function ws_plugin__s2member_paypal_notify ()
|
|
525 |
/**/
|
526 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
527 |
/**/
|
528 |
-
do_action ("s2member_during_paypal_notify_during_subscr_eot_delete");
|
529 |
}
|
530 |
/**/
|
531 |
-
do_action ("s2member_during_paypal_notify_during_subscr_eot");
|
532 |
}
|
533 |
/**/
|
534 |
else /* Otherwise, treat this as if it were a cancellation. EOTs are currently disabled. */
|
@@ -540,7 +540,7 @@ function ws_plugin__s2member_paypal_notify ()
|
|
540 |
$paypal["s2member_log"][] = "Auto-EOT is currently disabled. Skipping immediate EOT (demote|delete), for now.";
|
541 |
$paypal["s2member_log"][] = "Recording the Auto-EOT Time for this Member's account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
542 |
/**/
|
543 |
-
do_action ("s2member_during_paypal_notify_during_subscr_eot_disabled");
|
544 |
}
|
545 |
}
|
546 |
else
|
@@ -582,10 +582,10 @@ function ws_plugin__s2member_paypal_notify ()
|
|
582 |
$paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
|
583 |
}
|
584 |
/**/
|
585 |
-
do_action ("s2member_during_paypal_notify_during_subscr_eot_refund_reversal");
|
586 |
}
|
587 |
/**/
|
588 |
-
do_action ("s2member_during_paypal_notify_after_subscr_eot");
|
589 |
}
|
590 |
else
|
591 |
{
|
@@ -610,11 +610,11 @@ function ws_plugin__s2member_paypal_notify ()
|
|
610 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
611 |
file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
612 |
/**/
|
613 |
-
do_action ("s2member_during_paypal_notify");
|
614 |
/**/
|
615 |
exit;
|
616 |
}
|
617 |
/**/
|
618 |
-
do_action ("s2member_after_paypal_notify");
|
619 |
}
|
620 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_notify ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_paypal_notify", get_defined_vars ());
|
23 |
/**/
|
24 |
include_once ABSPATH . "wp-admin/includes/admin.php"; /* Get Admin APIs. */
|
25 |
/**/
|
44 |
*/
|
45 |
if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
|
46 |
{
|
47 |
+
do_action ("s2member_during_paypal_notify_before_sp_access", get_defined_vars ());
|
48 |
/**/
|
49 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page Access.";
|
50 |
/**/
|
114 |
}
|
115 |
}
|
116 |
/**/
|
117 |
+
do_action ("s2member_during_paypal_notify_during_sp_access", get_defined_vars ());
|
118 |
}
|
119 |
else
|
120 |
{
|
121 |
$paypal["s2member_log"][] = "Unable to generate Access Link for Specific Post/Page Access. Does your Leading Post/Page still exist?";
|
122 |
}
|
123 |
/**/
|
124 |
+
do_action ("s2member_during_paypal_notify_after_sp_access", get_defined_vars ());
|
125 |
}
|
126 |
/*
|
127 |
New Subscriptions. Possibly containing advanced update vars ( option_name1, option_selection1 ); which allow account modifications.
|
128 |
*/
|
129 |
+
else if (preg_match ("/^(web_accept|subscr_signup)$/i", $paypal["txn_type"]) && $paypal["payer_email"] && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
|
130 |
{
|
131 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup", get_defined_vars ());
|
132 |
/**/
|
133 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
|
134 |
/**/
|
152 |
/* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal will not allow the
|
153 |
modify=1|2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing that actually needs to be updated is the account. */
|
154 |
{
|
155 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup_w_update_vars", get_defined_vars ());
|
156 |
/**/
|
157 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
|
158 |
/**/
|
193 |
/**/
|
194 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
|
195 |
/**/
|
196 |
+
do_action ("s2member_during_paypal_notify_during_subscr_signup_w_update_vars", get_defined_vars ());
|
197 |
}
|
198 |
else
|
199 |
{
|
205 |
$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.";
|
206 |
}
|
207 |
/**/
|
208 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup_w_update_vars", get_defined_vars ());
|
209 |
}
|
210 |
/*
|
211 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
212 |
*/
|
213 |
else /* Else this is a normal Subscription signup, we are not updating anything. */
|
214 |
{
|
215 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup_wo_update_vars", get_defined_vars ());
|
216 |
/**/
|
217 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
|
218 |
/**/
|
246 |
$paypal["s2member_log"][] = "Signup Confirmation Email sent to Customer, with a URL to assist w/ registration.";
|
247 |
}
|
248 |
/**/
|
249 |
+
do_action ("s2member_during_paypal_notify_during_subscr_signup_wo_update_vars", get_defined_vars ());
|
250 |
}
|
251 |
/**/
|
252 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup_wo_update_vars", get_defined_vars ());
|
253 |
}
|
254 |
/**/
|
255 |
if ($processing && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
304 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
305 |
}
|
306 |
/**/
|
307 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup", get_defined_vars ());
|
308 |
}
|
309 |
/*
|
310 |
Subscription modifications.
|
311 |
*/
|
312 |
+
else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
|
313 |
{
|
314 |
+
do_action ("s2member_during_paypal_notify_before_subscr_modify", get_defined_vars ());
|
315 |
/**/
|
316 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
317 |
/**/
|
349 |
/**/
|
350 |
$paypal["s2member_log"][] = "Modification Confirmation Email sent to Customer, with a URL that provides them with a way to log back in.";
|
351 |
/**/
|
352 |
+
do_action ("s2member_during_paypal_notify_during_subscr_modify", get_defined_vars ());
|
353 |
}
|
354 |
else
|
355 |
{
|
361 |
$paypal["s2member_log"][] = "Unable to modify Subscription. Could not get the existing User ID from the DB.";
|
362 |
}
|
363 |
/**/
|
364 |
+
do_action ("s2member_during_paypal_notify_after_subscr_modify", get_defined_vars ());
|
365 |
}
|
366 |
/*
|
367 |
Subscription payments.
|
368 |
*/
|
369 |
+
else if (preg_match ("/^subscr_payment$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]) && $paypal["txn_id"] && $paypal["mc_gross"])
|
370 |
{
|
371 |
+
do_action ("s2member_during_paypal_notify_before_subscr_payment", get_defined_vars ());
|
372 |
/**/
|
373 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
|
374 |
$paypal["s2member_log"][] = "Sleeping for 2 seconds. Waiting for a possible subscr_signup|subscr_modify.";
|
403 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
404 |
}
|
405 |
/**/
|
406 |
+
do_action ("s2member_during_paypal_notify_during_subscr_payment", get_defined_vars ());
|
407 |
}
|
408 |
else
|
409 |
{
|
412 |
set_transient (md5 ("s2member_transient_ipn_subscr_payment_" . $paypal["subscr_id"]), $_POST, 43200);
|
413 |
}
|
414 |
/**/
|
415 |
+
do_action ("s2member_during_paypal_notify_after_subscr_payment", get_defined_vars ());
|
416 |
}
|
417 |
/*
|
418 |
Subscription cancellations. s2Member can use this, to determine when/if it should Auto-EOT (demote|delete) a Member's account.
|
420 |
This works in conjunction with `s2member_last_payment_time`, and the s2Member Auto-EOT System.
|
421 |
For further details & stupidity, see: https://www.x.com/thread/41155?start=15&tstart=0
|
422 |
*/
|
423 |
+
else if (preg_match ("/^subscr_cancel$/i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]))
|
424 |
{
|
425 |
+
do_action ("s2member_during_paypal_notify_before_subscr_cancel", get_defined_vars ());
|
426 |
/**/
|
427 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_cancel.";
|
428 |
/**/
|
440 |
/**/
|
441 |
$paypal["s2member_log"][] = "Auto-EOT Time for this account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
442 |
/**/
|
443 |
+
do_action ("s2member_during_paypal_notify_during_subscr_cancel", get_defined_vars ());
|
444 |
}
|
445 |
else
|
446 |
{
|
452 |
$paypal["s2member_log"][] = "Unable to handle Cancellation. Could not get the existing User ID from the DB.";
|
453 |
}
|
454 |
/**/
|
455 |
+
do_action ("s2member_during_paypal_notify_after_subscr_cancel", get_defined_vars ());
|
456 |
}
|
457 |
/*
|
458 |
Subscription terminations, max failed payments, initial payment failed, chargebacks, refunds, and reversals. *** NOT processed for Specific Posts/Pages. */
|
459 |
else if ( /* An immediate EOT is necessary under MANY different conditions. This consolidates them all, with a sub-classification for refunds/reversals. */
|
460 |
(preg_match ("/^(subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment)$/i", $paypal["txn_type"]) || (preg_match ("/^recurring_payment_profile_cancel$/i", $paypal["txn_type"]) && preg_match ("/^failed$/i", $paypal["initial_payment_status"])) || (preg_match ("/^new_case$/i", $paypal["txn_type"]) && preg_match ("/^chargeback$/i", $paypal["case_type"])) || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)$/i", $paypal["payment_status"])))/**/
|
461 |
&& ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["recurring_payment_id"]) || ($paypal["subscr_id"] = $paypal["parent_txn_id"]))/**/
|
462 |
+
&& (preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?$/", $paypal["item_number"]) || $paypal["recurring_payment_id"])/**/)
|
463 |
{
|
464 |
+
do_action ("s2member_during_paypal_notify_before_subscr_eot", get_defined_vars ());
|
465 |
/**/
|
466 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (subscr_eot|recurring_payment_expired|recurring_payment_suspended_due_to_max_failed_payment) - or - initial_payment_status (failed) - or - case_type (chargeback) - or - payment_status (refunded|reversed).";
|
467 |
/**/
|
512 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
513 |
}
|
514 |
/**/
|
515 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_demote", get_defined_vars ());
|
516 |
}
|
517 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
518 |
{
|
525 |
/**/
|
526 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
527 |
/**/
|
528 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_delete", get_defined_vars ());
|
529 |
}
|
530 |
/**/
|
531 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot", get_defined_vars ());
|
532 |
}
|
533 |
/**/
|
534 |
else /* Otherwise, treat this as if it were a cancellation. EOTs are currently disabled. */
|
540 |
$paypal["s2member_log"][] = "Auto-EOT is currently disabled. Skipping immediate EOT (demote|delete), for now.";
|
541 |
$paypal["s2member_log"][] = "Recording the Auto-EOT Time for this Member's account: " . date ("D M j, Y g:i a T", $auto_eot_time);
|
542 |
/**/
|
543 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_disabled", get_defined_vars ());
|
544 |
}
|
545 |
}
|
546 |
else
|
582 |
$paypal["s2member_log"][] = "Refund/Reversal Notification URLs have been processed.";
|
583 |
}
|
584 |
/**/
|
585 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_refund_reversal", get_defined_vars ());
|
586 |
}
|
587 |
/**/
|
588 |
+
do_action ("s2member_during_paypal_notify_after_subscr_eot", get_defined_vars ());
|
589 |
}
|
590 |
else
|
591 |
{
|
610 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
611 |
file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
612 |
/**/
|
613 |
+
do_action ("s2member_during_paypal_notify", get_defined_vars ());
|
614 |
/**/
|
615 |
exit;
|
616 |
}
|
617 |
/**/
|
618 |
+
do_action ("s2member_after_paypal_notify", get_defined_vars ());
|
619 |
}
|
620 |
?>
|
includes/functions/paypal-return.inc.php
CHANGED
@@ -19,7 +19,7 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_return ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_paypal_return");
|
23 |
/**/
|
24 |
if ($_GET["s2member_paypal_return"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
|
25 |
{
|
@@ -37,7 +37,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
37 |
*/
|
38 |
if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
|
39 |
{
|
40 |
-
do_action ("s2member_during_paypal_return_before_sp_access");
|
41 |
/**/
|
42 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page access.";
|
43 |
/**/
|
@@ -66,7 +66,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
66 |
}
|
67 |
}
|
68 |
/**/
|
69 |
-
do_action ("s2member_during_paypal_return_during_sp_access");
|
70 |
/**/
|
71 |
$paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
|
72 |
/**/
|
@@ -84,7 +84,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
84 |
echo '</script>' . "\n";
|
85 |
}
|
86 |
/**/
|
87 |
-
do_action ("s2member_during_paypal_return_after_sp_access");
|
88 |
}
|
89 |
/*
|
90 |
New Subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
@@ -93,7 +93,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
93 |
{ /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
|
94 |
So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
|
95 |
/**/
|
96 |
-
do_action ("s2member_during_paypal_return_before_subscr_signup");
|
97 |
/**/
|
98 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
|
99 |
/**/
|
@@ -105,7 +105,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
105 |
/* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
|
106 |
modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
|
107 |
{
|
108 |
-
do_action ("s2member_during_paypal_return_before_subscr_signup_w_update_vars");
|
109 |
/**/
|
110 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
|
111 |
/**/
|
@@ -142,7 +142,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
142 |
/**/
|
143 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
144 |
/**/
|
145 |
-
do_action ("s2member_during_paypal_return_during_subscr_signup_w_update_vars");
|
146 |
/**/
|
147 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
|
148 |
/**/
|
@@ -175,14 +175,14 @@ function ws_plugin__s2member_paypal_return ()
|
|
175 |
echo '</script>' . "\n";
|
176 |
}
|
177 |
/**/
|
178 |
-
do_action ("s2member_during_paypal_return_after_subscr_signup_w_update_vars");
|
179 |
}
|
180 |
/*
|
181 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
182 |
*/
|
183 |
else /* Else this is a normal Subscription signup, we are not updating an existing Subscription. */
|
184 |
{
|
185 |
-
do_action ("s2member_during_paypal_return_before_subscr_signup_wo_update_vars");
|
186 |
/**/
|
187 |
$processing = $during = true; /* Yes, we ARE processing this new Subscription request. */
|
188 |
/**/
|
@@ -194,7 +194,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
194 |
/**/
|
195 |
$paypal["s2member_log"][] = "Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
196 |
/**/
|
197 |
-
do_action ("s2member_during_paypal_return_during_subscr_signup_wo_update_vars");
|
198 |
/**/
|
199 |
$paypal["s2member_log"][] = "Redirecting Customer to Registration Page. They need to register a Username now.";
|
200 |
/**/
|
@@ -203,17 +203,17 @@ function ws_plugin__s2member_paypal_return ()
|
|
203 |
echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';" . "\n";
|
204 |
echo '</script>' . "\n";
|
205 |
/**/
|
206 |
-
do_action ("s2member_during_paypal_return_after_subscr_signup_wo_update_vars");
|
207 |
}
|
208 |
/**/
|
209 |
-
do_action ("s2member_during_paypal_return_after_subscr_signup");
|
210 |
}
|
211 |
/*
|
212 |
Subscription modifications.
|
213 |
*/
|
214 |
else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
|
215 |
{
|
216 |
-
do_action ("s2member_during_paypal_return_before_subscr_modify");
|
217 |
/**/
|
218 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
219 |
/**/
|
@@ -247,7 +247,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
247 |
/**/
|
248 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
|
249 |
/**/
|
250 |
-
do_action ("s2member_during_paypal_return_during_subscr_modify");
|
251 |
/**/
|
252 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
|
253 |
/**/
|
@@ -280,7 +280,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
280 |
echo '</script>' . "\n";
|
281 |
}
|
282 |
/**/
|
283 |
-
do_action ("s2member_during_paypal_return_after_subscr_modify");
|
284 |
}
|
285 |
else
|
286 |
{
|
@@ -308,11 +308,11 @@ function ws_plugin__s2member_paypal_return ()
|
|
308 |
}
|
309 |
else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
|
310 |
{
|
311 |
-
do_action ("s2member_during_paypal_return_before_no_return_data");
|
312 |
/**/
|
313 |
$paypal["s2member_log"][] = "No Return-Data from PayPal®. Customer must wait for Email Confirmation.";
|
314 |
/**/
|
315 |
-
do_action ("s2member_during_paypal_return_during_no_return_data");
|
316 |
/**/
|
317 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page.";
|
318 |
/**/
|
@@ -322,7 +322,7 @@ function ws_plugin__s2member_paypal_return ()
|
|
322 |
echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
|
323 |
echo '</script>' . "\n";
|
324 |
/**/
|
325 |
-
do_action ("s2member_during_paypal_return_after_no_return_data");
|
326 |
}
|
327 |
else
|
328 |
{
|
@@ -344,11 +344,11 @@ function ws_plugin__s2member_paypal_return ()
|
|
344 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
345 |
file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
346 |
/**/
|
347 |
-
do_action ("s2member_during_paypal_return");
|
348 |
/**/
|
349 |
exit;
|
350 |
}
|
351 |
/**/
|
352 |
-
do_action ("s2member_after_paypal_return");
|
353 |
}
|
354 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_return ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_paypal_return", get_defined_vars ());
|
23 |
/**/
|
24 |
if ($_GET["s2member_paypal_return"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
|
25 |
{
|
37 |
*/
|
38 |
if (preg_match ("/^web_accept$/i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+$/", $paypal["item_number"]))
|
39 |
{
|
40 |
+
do_action ("s2member_during_paypal_return_before_sp_access", get_defined_vars ());
|
41 |
/**/
|
42 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Specific Post/Page access.";
|
43 |
/**/
|
66 |
}
|
67 |
}
|
68 |
/**/
|
69 |
+
do_action ("s2member_during_paypal_return_during_sp_access", get_defined_vars ());
|
70 |
/**/
|
71 |
$paypal["s2member_log"][] = "Redirecting Customer to the Specific Post/Page.";
|
72 |
/**/
|
84 |
echo '</script>' . "\n";
|
85 |
}
|
86 |
/**/
|
87 |
+
do_action ("s2member_during_paypal_return_after_sp_access", get_defined_vars ());
|
88 |
}
|
89 |
/*
|
90 |
New Subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
93 |
{ /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
|
94 |
So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
|
95 |
/**/
|
96 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup", get_defined_vars ());
|
97 |
/**/
|
98 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
|
99 |
/**/
|
105 |
/* This advanced method is required whenever a Subscription that is already completed, or was never setup to recur in the first place needs to be modified. PayPal® will not allow the
|
106 |
modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the account. */
|
107 |
{
|
108 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup_w_update_vars", get_defined_vars ());
|
109 |
/**/
|
110 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
|
111 |
/**/
|
142 |
/**/
|
143 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
144 |
/**/
|
145 |
+
do_action ("s2member_during_paypal_return_during_subscr_signup_w_update_vars", get_defined_vars ());
|
146 |
/**/
|
147 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
|
148 |
/**/
|
175 |
echo '</script>' . "\n";
|
176 |
}
|
177 |
/**/
|
178 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup_w_update_vars", get_defined_vars ());
|
179 |
}
|
180 |
/*
|
181 |
New Subscription. Normal Subscription signup, we are not updating anything for a past Subscription.
|
182 |
*/
|
183 |
else /* Else this is a normal Subscription signup, we are not updating an existing Subscription. */
|
184 |
{
|
185 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup_wo_update_vars", get_defined_vars ());
|
186 |
/**/
|
187 |
$processing = $during = true; /* Yes, we ARE processing this new Subscription request. */
|
188 |
/**/
|
194 |
/**/
|
195 |
$paypal["s2member_log"][] = "Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
196 |
/**/
|
197 |
+
do_action ("s2member_during_paypal_return_during_subscr_signup_wo_update_vars", get_defined_vars ());
|
198 |
/**/
|
199 |
$paypal["s2member_log"][] = "Redirecting Customer to Registration Page. They need to register a Username now.";
|
200 |
/**/
|
203 |
echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';" . "\n";
|
204 |
echo '</script>' . "\n";
|
205 |
/**/
|
206 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup_wo_update_vars", get_defined_vars ());
|
207 |
}
|
208 |
/**/
|
209 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup", get_defined_vars ());
|
210 |
}
|
211 |
/*
|
212 |
Subscription modifications.
|
213 |
*/
|
214 |
else if (preg_match ("/^subscr_modify$/i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", $paypal["item_number"]))
|
215 |
{
|
216 |
+
do_action ("s2member_during_paypal_return_before_subscr_modify", get_defined_vars ());
|
217 |
/**/
|
218 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
219 |
/**/
|
247 |
/**/
|
248 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on Subscription modification.";
|
249 |
/**/
|
250 |
+
do_action ("s2member_during_paypal_return_during_subscr_modify", get_defined_vars ());
|
251 |
/**/
|
252 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page. They need to log back in after this modification.";
|
253 |
/**/
|
280 |
echo '</script>' . "\n";
|
281 |
}
|
282 |
/**/
|
283 |
+
do_action ("s2member_during_paypal_return_after_subscr_modify", get_defined_vars ());
|
284 |
}
|
285 |
else
|
286 |
{
|
308 |
}
|
309 |
else if (!isset ($_GET["tx"]) && (empty ($_POST) || $_POST["auth"]))
|
310 |
{
|
311 |
+
do_action ("s2member_during_paypal_return_before_no_return_data", get_defined_vars ());
|
312 |
/**/
|
313 |
$paypal["s2member_log"][] = "No Return-Data from PayPal®. Customer must wait for Email Confirmation.";
|
314 |
/**/
|
315 |
+
do_action ("s2member_during_paypal_return_during_no_return_data", get_defined_vars ());
|
316 |
/**/
|
317 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page.";
|
318 |
/**/
|
322 |
echo "window.location = '" . esc_js (get_bloginfo ("url")) . "';";
|
323 |
echo '</script>' . "\n";
|
324 |
/**/
|
325 |
+
do_action ("s2member_during_paypal_return_after_no_return_data", get_defined_vars ());
|
326 |
}
|
327 |
else
|
328 |
{
|
344 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
345 |
file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
346 |
/**/
|
347 |
+
do_action ("s2member_during_paypal_return", get_defined_vars ());
|
348 |
/**/
|
349 |
exit;
|
350 |
}
|
351 |
/**/
|
352 |
+
do_action ("s2member_after_paypal_return", get_defined_vars ());
|
353 |
}
|
354 |
?>
|
includes/functions/paypal-utilities.inc.php
CHANGED
@@ -18,7 +18,7 @@ Get POST vars from PayPal®, verify and return array.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_paypal_postvars ()
|
20 |
{
|
21 |
-
do_action ("s2member_before_paypal_postvars");
|
22 |
/**/
|
23 |
if ($_GET["tx"]) /* PDT with Auto-Return. */
|
24 |
{
|
@@ -39,7 +39,7 @@ function ws_plugin__s2member_paypal_postvars ()
|
|
39 |
$postvars[$key] = trim (stripslashes (urldecode ($value)));
|
40 |
}
|
41 |
/**/
|
42 |
-
return apply_filters ("s2member_paypal_postvars", $postvars);
|
43 |
}
|
44 |
}
|
45 |
/**/
|
@@ -57,7 +57,7 @@ function ws_plugin__s2member_paypal_postvars ()
|
|
57 |
/**/
|
58 |
if (strtolower (trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
|
59 |
{
|
60 |
-
return apply_filters ("s2member_paypal_postvars", $postvars);
|
61 |
}
|
62 |
/**/
|
63 |
return false;
|
@@ -74,23 +74,23 @@ function ws_plugin__s2member_paypal_custom ($subscr_id = FALSE, $os0 = FALSE)
|
|
74 |
{
|
75 |
global $wpdb; /* Need global DB obj. */
|
76 |
/**/
|
77 |
-
do_action ("s2member_before_paypal_custom");
|
78 |
/**/
|
79 |
if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
|
80 |
{
|
81 |
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
|
82 |
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
|
83 |
if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
|
84 |
-
return apply_filters ("s2member_paypal_custom", $custom);
|
85 |
}
|
86 |
else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
|
87 |
{
|
88 |
if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
89 |
if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
|
90 |
-
return apply_filters ("s2member_paypal_custom", $custom);
|
91 |
}
|
92 |
/**/
|
93 |
-
return apply_filters ("s2member_paypal_custom", false);
|
94 |
}
|
95 |
/*
|
96 |
Get the user ID for an existing Member, referenced by a Subscr. ID.
|
@@ -101,21 +101,21 @@ function ws_plugin__s2member_paypal_user_id ($subscr_id = FALSE, $os0 = FALSE)
|
|
101 |
{
|
102 |
global $wpdb; /* Need global DB obj. */
|
103 |
/**/
|
104 |
-
do_action ("s2member_before_paypal_user_id");
|
105 |
/**/
|
106 |
if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
|
107 |
{
|
108 |
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
|
109 |
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
|
110 |
-
return apply_filters ("s2member_paypal_user_id", $q->user_id);
|
111 |
}
|
112 |
else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
|
113 |
{
|
114 |
if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
115 |
-
return apply_filters ("s2member_paypal_user_id", $q->user_id);
|
116 |
}
|
117 |
/**/
|
118 |
-
return apply_filters ("s2member_paypal_user_id", false);
|
119 |
}
|
120 |
/*
|
121 |
Calculate Auto-EOT Time, based on last_payment_time, period1, and period3.
|
@@ -123,7 +123,7 @@ This is used by s2Member's built-in Auto-EOT System, and by its IPN routines.
|
|
123 |
*/
|
124 |
function ws_plugin__s2member_paypal_auto_eot_time ($user_id = FALSE, $period1 = FALSE, $period3 = FALSE, $eotper = FALSE)
|
125 |
{
|
126 |
-
do_action ("s2member_before_paypal_auto_eot_time");
|
127 |
/**/
|
128 |
if ($user_id && ($user = new WP_User ($user_id))) /* Must have a valid user_id. */
|
129 |
{
|
@@ -195,6 +195,6 @@ function ws_plugin__s2member_paypal_auto_eot_time ($user_id = FALSE, $period1 =
|
|
195 |
/**/
|
196 |
$auto_eot_time = ($auto_eot_time <= 0) ? strtotime ("now") : $auto_eot_time;
|
197 |
/**/
|
198 |
-
return apply_filters ("s2member_paypal_auto_eot_time", $auto_eot_time);
|
199 |
}
|
200 |
?>
|
18 |
*/
|
19 |
function ws_plugin__s2member_paypal_postvars ()
|
20 |
{
|
21 |
+
do_action ("s2member_before_paypal_postvars", get_defined_vars ());
|
22 |
/**/
|
23 |
if ($_GET["tx"]) /* PDT with Auto-Return. */
|
24 |
{
|
39 |
$postvars[$key] = trim (stripslashes (urldecode ($value)));
|
40 |
}
|
41 |
/**/
|
42 |
+
return apply_filters ("s2member_paypal_postvars", $postvars, get_defined_vars ());
|
43 |
}
|
44 |
}
|
45 |
/**/
|
57 |
/**/
|
58 |
if (strtolower (trim (ws_plugin__s2member_remote ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
|
59 |
{
|
60 |
+
return apply_filters ("s2member_paypal_postvars", $postvars, get_defined_vars ());
|
61 |
}
|
62 |
/**/
|
63 |
return false;
|
74 |
{
|
75 |
global $wpdb; /* Need global DB obj. */
|
76 |
/**/
|
77 |
+
do_action ("s2member_before_paypal_custom", get_defined_vars ());
|
78 |
/**/
|
79 |
if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
|
80 |
{
|
81 |
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
|
82 |
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
|
83 |
if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
|
84 |
+
return apply_filters ("s2member_paypal_custom", $custom, get_defined_vars ());
|
85 |
}
|
86 |
else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
|
87 |
{
|
88 |
if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
89 |
if (($custom = get_usermeta ($q->user_id, "s2member_custom")))
|
90 |
+
return apply_filters ("s2member_paypal_custom", $custom, get_defined_vars ());
|
91 |
}
|
92 |
/**/
|
93 |
+
return apply_filters ("s2member_paypal_custom", false, get_defined_vars ());
|
94 |
}
|
95 |
/*
|
96 |
Get the user ID for an existing Member, referenced by a Subscr. ID.
|
101 |
{
|
102 |
global $wpdb; /* Need global DB obj. */
|
103 |
/**/
|
104 |
+
do_action ("s2member_before_paypal_user_id", get_defined_vars ());
|
105 |
/**/
|
106 |
if ($subscr_id && $os0) /* This case includes some additional routines that can use the $os0 value. */
|
107 |
{
|
108 |
if (($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND (`meta_value` = '" . $wpdb->escape ($subscr_id) . "' OR `meta_value` = '" . $wpdb->escape ($os0) . "') LIMIT 1"))/**/
|
109 |
|| ($q = $wpdb->get_row ("SELECT `ID` AS `user_id` FROM `" . $wpdb->users . "` WHERE `ID` = '" . $wpdb->escape ($os0) . "' LIMIT 1")))
|
110 |
+
return apply_filters ("s2member_paypal_user_id", $q->user_id, get_defined_vars ());
|
111 |
}
|
112 |
else if ($subscr_id) /* Otherwise, if all we have is a Subscr. ID value. */
|
113 |
{
|
114 |
if ($q = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
115 |
+
return apply_filters ("s2member_paypal_user_id", $q->user_id, get_defined_vars ());
|
116 |
}
|
117 |
/**/
|
118 |
+
return apply_filters ("s2member_paypal_user_id", false, get_defined_vars ());
|
119 |
}
|
120 |
/*
|
121 |
Calculate Auto-EOT Time, based on last_payment_time, period1, and period3.
|
123 |
*/
|
124 |
function ws_plugin__s2member_paypal_auto_eot_time ($user_id = FALSE, $period1 = FALSE, $period3 = FALSE, $eotper = FALSE)
|
125 |
{
|
126 |
+
do_action ("s2member_before_paypal_auto_eot_time", get_defined_vars ());
|
127 |
/**/
|
128 |
if ($user_id && ($user = new WP_User ($user_id))) /* Must have a valid user_id. */
|
129 |
{
|
195 |
/**/
|
196 |
$auto_eot_time = ($auto_eot_time <= 0) ? strtotime ("now") : $auto_eot_time;
|
197 |
/**/
|
198 |
+
return apply_filters ("s2member_paypal_auto_eot_time", $auto_eot_time, get_defined_vars ());
|
199 |
}
|
200 |
?>
|
includes/functions/post-level-access.inc.php
CHANGED
@@ -21,9 +21,9 @@ function ws_plugin__s2member_check_post_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_check_post_level_access");
|
25 |
/**/
|
26 |
-
$excluded = apply_filters ("s2member_check_post_level_access_excluded", false);
|
27 |
/**/
|
28 |
if (!$excluded && is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))
|
29 |
{
|
@@ -58,11 +58,11 @@ function ws_plugin__s2member_check_post_level_access ()
|
|
58 |
else 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"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($post_ID) && wp_redirect (add_query_arg ("s2member_sp_req", $post_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
59 |
exit;
|
60 |
/**/
|
61 |
-
do_action ("s2member_during_check_post_level_access");
|
62 |
}
|
63 |
}
|
64 |
/**/
|
65 |
-
do_action ("s2member_after_check_post_level_access");
|
66 |
/**/
|
67 |
return;
|
68 |
}
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_post_level_access", get_defined_vars ());
|
25 |
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_post_level_access_excluded", false, get_defined_vars ());
|
27 |
/**/
|
28 |
if (!$excluded && is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))
|
29 |
{
|
58 |
else 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"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($post_ID) && wp_redirect (add_query_arg ("s2member_sp_req", $post_ID, get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
59 |
exit;
|
60 |
/**/
|
61 |
+
do_action ("s2member_during_check_post_level_access", get_defined_vars ());
|
62 |
}
|
63 |
}
|
64 |
/**/
|
65 |
+
do_action ("s2member_after_check_post_level_access", get_defined_vars ());
|
66 |
/**/
|
67 |
return;
|
68 |
}
|
includes/functions/profile-modifications.inc.php
CHANGED
@@ -19,7 +19,7 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_profile_modifications ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_handle_profile_modifications");
|
23 |
/**/
|
24 |
if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
25 |
{
|
@@ -56,7 +56,7 @@ function ws_plugin__s2member_handle_profile_modifications ()
|
|
56 |
/**/
|
57 |
update_usermeta ($user_id, "s2member_custom_fields", $fields);
|
58 |
/**/
|
59 |
-
do_action ("s2member_during_handle_profile_modifications");
|
60 |
/**/
|
61 |
echo '<script type="text/javascript">' . "\n";
|
62 |
echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
@@ -67,16 +67,16 @@ function ws_plugin__s2member_handle_profile_modifications ()
|
|
67 |
exit;
|
68 |
}
|
69 |
/**/
|
70 |
-
do_action ("s2member_before_profile");
|
71 |
/**/
|
72 |
include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
|
73 |
/**/
|
74 |
-
do_action ("s2member_after_profile");
|
75 |
/**/
|
76 |
exit;
|
77 |
}
|
78 |
/**/
|
79 |
-
do_action ("s2member_after_handle_profile_modifications");
|
80 |
/**/
|
81 |
return;
|
82 |
}
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_profile_modifications ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_handle_profile_modifications", get_defined_vars ());
|
23 |
/**/
|
24 |
if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
25 |
{
|
56 |
/**/
|
57 |
update_usermeta ($user_id, "s2member_custom_fields", $fields);
|
58 |
/**/
|
59 |
+
do_action ("s2member_during_handle_profile_modifications", get_defined_vars ());
|
60 |
/**/
|
61 |
echo '<script type="text/javascript">' . "\n";
|
62 |
echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
67 |
exit;
|
68 |
}
|
69 |
/**/
|
70 |
+
do_action ("s2member_before_profile", get_defined_vars ());
|
71 |
/**/
|
72 |
include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
|
73 |
/**/
|
74 |
+
do_action ("s2member_after_profile", get_defined_vars ());
|
75 |
/**/
|
76 |
exit;
|
77 |
}
|
78 |
/**/
|
79 |
+
do_action ("s2member_after_handle_profile_modifications", get_defined_vars ());
|
80 |
/**/
|
81 |
return;
|
82 |
}
|
includes/functions/ptag-level-access.inc.php
CHANGED
@@ -21,9 +21,9 @@ function ws_plugin__s2member_check_ptag_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_check_ptag_level_access");
|
25 |
/**/
|
26 |
-
$excluded = apply_filters ("s2member_check_ptag_level_access_excluded", false);
|
27 |
/**/
|
28 |
if (!$excluded && ((is_tag () && ($tag_ID = get_query_var ("tag"))) || (is_single () && has_tag () && is_object ($post) && ($post_ID = $post->ID))))
|
29 |
{
|
@@ -84,11 +84,11 @@ function ws_plugin__s2member_check_ptag_level_access ()
|
|
84 |
exit;
|
85 |
}
|
86 |
/**/
|
87 |
-
do_action ("s2member_during_check_ptag_level_access");
|
88 |
}
|
89 |
}
|
90 |
/**/
|
91 |
-
do_action ("s2member_after_check_ptag_level_access");
|
92 |
/**/
|
93 |
return;
|
94 |
}
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_ptag_level_access", get_defined_vars ());
|
25 |
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_ptag_level_access_excluded", false, get_defined_vars ());
|
27 |
/**/
|
28 |
if (!$excluded && ((is_tag () && ($tag_ID = get_query_var ("tag"))) || (is_single () && has_tag () && is_object ($post) && ($post_ID = $post->ID))))
|
29 |
{
|
84 |
exit;
|
85 |
}
|
86 |
/**/
|
87 |
+
do_action ("s2member_during_check_ptag_level_access", get_defined_vars ());
|
88 |
}
|
89 |
}
|
90 |
/**/
|
91 |
+
do_action ("s2member_after_check_ptag_level_access", get_defined_vars ());
|
92 |
/**/
|
93 |
return;
|
94 |
}
|
includes/functions/readme-parsing.inc.php
CHANGED
@@ -18,7 +18,7 @@ Function that handles readme.txt parsing.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_parse_readme ()
|
20 |
{
|
21 |
-
do_action ("s2member_before_parse_readme");
|
22 |
/**/
|
23 |
if (file_exists (dirname (dirname (dirname (__FILE__))) . "/readme.txt"))
|
24 |
{
|
@@ -55,7 +55,7 @@ function ws_plugin__s2member_parse_readme ()
|
|
55 |
$readme .= $rm . "\n"; /* Content. */
|
56 |
$readme .= '</div>' . "\n";
|
57 |
/**/
|
58 |
-
return apply_filters ("s2member_parse_readme", $readme);
|
59 |
}
|
60 |
else /* Just in case readme.txt was deleted by the site owner. */
|
61 |
{
|
@@ -67,13 +67,13 @@ Callback function that helps readme file parsing with specs.
|
|
67 |
*/
|
68 |
function _ws_plugin__s2member_parse_readme_specs ($str = FALSE)
|
69 |
{
|
70 |
-
do_action ("s2member_before_parse_readme_specs");
|
71 |
/**/
|
72 |
$str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . ' <code>' . "$5" . '</code></li>' . "$6", $str);
|
73 |
$str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); /* Open the list items. */
|
74 |
$str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
|
75 |
/**/
|
76 |
-
return apply_filters ("s2member_parse_readme_specs", $str);
|
77 |
}
|
78 |
/*
|
79 |
Function for parsing readme.txt files and returning a key value.
|
@@ -82,7 +82,7 @@ function ws_plugin__s2member_parse_readme_value ($key = FALSE)
|
|
82 |
{
|
83 |
static $readme; /* For repeated lookups. */
|
84 |
/**/
|
85 |
-
do_action ("s2member_before_parse_readme_value");
|
86 |
/**/
|
87 |
$path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
|
88 |
/**/
|
@@ -97,7 +97,7 @@ function ws_plugin__s2member_parse_readme_value ($key = FALSE)
|
|
97 |
/**/
|
98 |
preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme, $m);
|
99 |
/**/
|
100 |
-
return strlen ($m[5] = trim ($m[5])) ? apply_filters ("s2member_parse_readme_value", $m[5]) : false;
|
101 |
}
|
102 |
else /* Nope. */
|
103 |
return false;
|
18 |
*/
|
19 |
function ws_plugin__s2member_parse_readme ()
|
20 |
{
|
21 |
+
do_action ("s2member_before_parse_readme", get_defined_vars ());
|
22 |
/**/
|
23 |
if (file_exists (dirname (dirname (dirname (__FILE__))) . "/readme.txt"))
|
24 |
{
|
55 |
$readme .= $rm . "\n"; /* Content. */
|
56 |
$readme .= '</div>' . "\n";
|
57 |
/**/
|
58 |
+
return apply_filters ("s2member_parse_readme", $readme, get_defined_vars ());
|
59 |
}
|
60 |
else /* Just in case readme.txt was deleted by the site owner. */
|
61 |
{
|
67 |
*/
|
68 |
function _ws_plugin__s2member_parse_readme_specs ($str = FALSE)
|
69 |
{
|
70 |
+
do_action ("s2member_before_parse_readme_specs", get_defined_vars ());
|
71 |
/**/
|
72 |
$str = preg_replace ("/(\<p\>|^)(.+?)(\:)( )(.+?)($|\<\/p\>)/mi", "$1" . '<li><strong>' . "$2" . '</strong>' . "$3" . ' <code>' . "$5" . '</code></li>' . "$6", $str);
|
73 |
$str = preg_replace ("/\<p\>\<li\>/i", '<ul><li>', $str); /* Open the list items. */
|
74 |
$str = preg_replace ("/\<\/li\>\<\/p\>/i", '</li></ul><br />', $str);
|
75 |
/**/
|
76 |
+
return apply_filters ("s2member_parse_readme_specs", $str, get_defined_vars ());
|
77 |
}
|
78 |
/*
|
79 |
Function for parsing readme.txt files and returning a key value.
|
82 |
{
|
83 |
static $readme; /* For repeated lookups. */
|
84 |
/**/
|
85 |
+
do_action ("s2member_before_parse_readme_value", get_defined_vars ());
|
86 |
/**/
|
87 |
$path = dirname (dirname (dirname (__FILE__))) . "/readme.txt";
|
88 |
/**/
|
97 |
/**/
|
98 |
preg_match ("/(^)(" . preg_quote ($key, "/") . ")(\:)( )(.+?)($)/m", $readme, $m);
|
99 |
/**/
|
100 |
+
return strlen ($m[5] = trim ($m[5])) ? apply_filters ("s2member_parse_readme_value", $m[5], get_defined_vars ()) : false;
|
101 |
}
|
102 |
else /* Nope. */
|
103 |
return false;
|
includes/functions/register-access.inc.php
CHANGED
@@ -19,9 +19,9 @@ Attach to: add_filter("pre_option_default_role");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_force_default_role ($default_role = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_force_default_role");
|
23 |
/**/
|
24 |
-
return apply_filters ("s2member_force_default_role", ($default_role = "subscriber"));
|
25 |
}
|
26 |
/*
|
27 |
Function for allowing access to the register form.
|
@@ -31,11 +31,11 @@ function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
|
|
31 |
{
|
32 |
global $pagenow; /* Check if we are on the General Options page. */
|
33 |
/**/
|
34 |
-
do_action ("s2member_before_check_register_access");
|
35 |
/**/
|
36 |
if (current_user_can ("create_users") || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])
|
37 |
{
|
38 |
-
return apply_filters ("s2member_check_register_access", ($users_can_register = "1"));
|
39 |
}
|
40 |
else if ($pagenow !== "options-general.php" && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
|
41 |
{
|
@@ -43,11 +43,11 @@ function ws_plugin__s2member_check_register_access ($users_can_register = FALSE)
|
|
43 |
/**/
|
44 |
if (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
45 |
{
|
46 |
-
return apply_filters ("s2member_check_register_access", ($users_can_register = "1"));
|
47 |
}
|
48 |
}
|
49 |
/**/
|
50 |
-
return apply_filters ("s2member_check_register_access", ($users_can_register = "0"));
|
51 |
}
|
52 |
/*
|
53 |
Function that describes the General Option overrides for clarity.
|
@@ -57,18 +57,18 @@ function ws_plugin__s2member_general_ops_notice ()
|
|
57 |
{
|
58 |
global $pagenow; /* Need this. */
|
59 |
/**/
|
60 |
-
do_action ("s2member_before_general_ops_notice");
|
61 |
/**/
|
62 |
if ($pagenow === "options-general.php" && !isset ($_GET["page"]))
|
63 |
{
|
64 |
$notice = "<em>* Note: The s2Member plugin has control over two options on this page. <code>Anyone Can Register = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>. For further details, see: <code>s2Member -> General Options -> Login Welcome Page -> Allow Free Subscribers</code>.";
|
65 |
/**/
|
66 |
-
do_action ("s2member_during_general_ops_notice");
|
67 |
/**/
|
68 |
ws_plugin__s2member_enqueue_admin_notice ($notice, $pagenow);
|
69 |
}
|
70 |
/**/
|
71 |
-
do_action ("s2member_after_general_ops_notice");
|
72 |
/**/
|
73 |
return;
|
74 |
}
|
@@ -78,7 +78,7 @@ Attach to: add_action("register_form");
|
|
78 |
*/
|
79 |
function ws_plugin__s2member_custom_registration_fields ()
|
80 |
{
|
81 |
-
do_action ("s2member_before_custom_registration_fields");
|
82 |
/**/
|
83 |
if (!defined ("BP_VERSION")) /* Not compatible with BuddyPress. */
|
84 |
{
|
@@ -137,10 +137,10 @@ function ws_plugin__s2member_custom_registration_fields ()
|
|
137 |
echo '</p>';
|
138 |
}
|
139 |
/**/
|
140 |
-
do_action ("s2member_during_custom_registration_fields");
|
141 |
}
|
142 |
/**/
|
143 |
-
do_action ("s2member_after_custom_registration_fields");
|
144 |
/**/
|
145 |
return;
|
146 |
}
|
@@ -150,11 +150,11 @@ Attach to: add_action("bp_before_registration_submit_buttons");
|
|
150 |
*/
|
151 |
function ws_plugin__s2member_opt_in_4bp ()
|
152 |
{
|
153 |
-
do_action ("s2member_before_opt_in_4bp");
|
154 |
/**/
|
155 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
|
156 |
{
|
157 |
-
echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;") . '">' . "\n";
|
158 |
/**/
|
159 |
echo '<p>' . "\n";
|
160 |
echo '<label>' . "\n";
|
@@ -165,10 +165,10 @@ function ws_plugin__s2member_opt_in_4bp ()
|
|
165 |
/**/
|
166 |
echo '</div>' . "\n";
|
167 |
/**/
|
168 |
-
do_action ("s2member_during_opt_in_4bp");
|
169 |
}
|
170 |
/**/
|
171 |
-
do_action ("s2member_after_opt_in_4bp");
|
172 |
/**/
|
173 |
return;
|
174 |
}
|
@@ -177,7 +177,7 @@ Generates registration links.
|
|
177 |
*/
|
178 |
function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
|
179 |
{
|
180 |
-
do_action ("s2member_before_register_link_gen");
|
181 |
/**/
|
182 |
if ($subscr_id && $custom && $item_number) /* Must have all of these. */
|
183 |
{
|
@@ -185,9 +185,9 @@ function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FA
|
|
185 |
$register_link = add_query_arg ("s2member_register", $register, get_bloginfo ("url") . "/");
|
186 |
/**/
|
187 |
if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
|
188 |
-
return apply_filters ("s2member_register_link_gen", $tinyurl); /* tinyURL is easier to work with. */
|
189 |
-
else /* Else use the long one; tinyURL
|
190 |
-
return apply_filters ("s2member_register_link_gen", $register_link);
|
191 |
}
|
192 |
/**/
|
193 |
return false;
|
@@ -198,7 +198,7 @@ Attach to: add_action("init");
|
|
198 |
*/
|
199 |
function ws_plugin__s2member_register ()
|
200 |
{
|
201 |
-
do_action ("s2member_before_register");
|
202 |
/**/
|
203 |
if ($_GET["s2member_register"]) /* If they're attempting to access the registration system. */
|
204 |
{
|
@@ -210,7 +210,7 @@ function ws_plugin__s2member_register ()
|
|
210 |
setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($register[2]), time () + 31556926, "/");
|
211 |
setcookie ("s2member_level", ws_plugin__s2member_encrypt ($register[3]), time () + 31556926, "/");
|
212 |
/**/
|
213 |
-
do_action ("s2member_during_register");
|
214 |
/**/
|
215 |
echo '<script type="text/javascript">' . "\n";
|
216 |
echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';";
|
@@ -220,7 +220,7 @@ function ws_plugin__s2member_register ()
|
|
220 |
exit;
|
221 |
}
|
222 |
/**/
|
223 |
-
do_action ("s2member_after_register");
|
224 |
}
|
225 |
/*
|
226 |
Function for configuring new users.
|
@@ -231,7 +231,7 @@ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
|
|
231 |
global $wpdb; /* Global database object may be required for this routine. */
|
232 |
static $processed; /* Prevents duplicate processing. */
|
233 |
/**/
|
234 |
-
do_action ("s2member_before_configure_user_registration");
|
235 |
/**/
|
236 |
if (!$processed && $user_id && is_array ($_POST = stripslashes_deep ($_POST)) && is_object ($user = new WP_User ($user_id)) && ($processed = true))
|
237 |
{
|
@@ -287,7 +287,7 @@ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
|
|
287 |
/**/
|
288 |
setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
|
289 |
/**/
|
290 |
-
do_action ("s2member_during_configure_user_registration_front_side");
|
291 |
}
|
292 |
/**/
|
293 |
else if (!is_admin () && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
|
@@ -315,7 +315,7 @@ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
|
|
315 |
/**/
|
316 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
|
317 |
/**/
|
318 |
-
do_action ("s2member_during_configure_user_registration_front_side");
|
319 |
}
|
320 |
/**/
|
321 |
else if (is_admin () && preg_match ("/wp-admin\/user-new\.php/", $_POST["_wp_http_referer"]) && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
|
@@ -343,7 +343,7 @@ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
|
|
343 |
/**/
|
344 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
|
345 |
/**/
|
346 |
-
do_action ("s2member_during_configure_user_registration_admin_side");
|
347 |
}
|
348 |
/**/
|
349 |
if ($processed === "yes") /* If registration was processed by one of the routines above. */
|
@@ -386,11 +386,11 @@ function ws_plugin__s2member_configure_user_registration ($user_id = FALSE)
|
|
386 |
setcookie ("s2member_custom", "", time () + 31556926, "/");
|
387 |
setcookie ("s2member_level", "", time () + 31556926, "/");
|
388 |
/**/
|
389 |
-
do_action ("s2member_during_configure_user_registration");
|
390 |
}
|
391 |
}
|
392 |
/**/
|
393 |
-
do_action ("s2member_after_configure_user_registration");
|
394 |
/**/
|
395 |
return;
|
396 |
}
|
@@ -407,7 +407,7 @@ if (!function_exists ("wp_generate_password"))
|
|
407 |
/**/
|
408 |
function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
|
409 |
{
|
410 |
-
do_action ("s2member_before_generate_password");
|
411 |
/**/
|
412 |
$password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
|
413 |
/**/
|
19 |
*/
|
20 |
function ws_plugin__s2member_force_default_role ($default_role = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_force_default_role", get_defined_vars ());
|
23 |
/**/
|
24 |
+
return apply_filters ("s2member_force_default_role", ($default_role = "subscriber"), get_defined_vars ());
|
25 |
}
|
26 |
/*
|
27 |
Function for allowing access to the register form.
|
31 |
{
|
32 |
global $pagenow; /* Check if we are on the General Options page. */
|
33 |
/**/
|
34 |
+
do_action ("s2member_before_check_register_access", get_defined_vars ());
|
35 |
/**/
|
36 |
if (current_user_can ("create_users") || $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"])
|
37 |
{
|
38 |
+
return apply_filters ("s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
|
39 |
}
|
40 |
else if ($pagenow !== "options-general.php" && ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) && ($custom = ws_plugin__s2member_decrypt ($_COOKIE["s2member_custom"])) && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?$/", ($level = ws_plugin__s2member_decrypt ($_COOKIE["s2member_level"]))))
|
41 |
{
|
43 |
/**/
|
44 |
if (!$usermeta = $wpdb->get_row ("SELECT `user_id` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = 's2member_subscr_id' AND `meta_value` = '" . $wpdb->escape ($subscr_id) . "' LIMIT 1"))
|
45 |
{
|
46 |
+
return apply_filters ("s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());
|
47 |
}
|
48 |
}
|
49 |
/**/
|
50 |
+
return apply_filters ("s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());
|
51 |
}
|
52 |
/*
|
53 |
Function that describes the General Option overrides for clarity.
|
57 |
{
|
58 |
global $pagenow; /* Need this. */
|
59 |
/**/
|
60 |
+
do_action ("s2member_before_general_ops_notice", get_defined_vars ());
|
61 |
/**/
|
62 |
if ($pagenow === "options-general.php" && !isset ($_GET["page"]))
|
63 |
{
|
64 |
$notice = "<em>* Note: The s2Member plugin has control over two options on this page. <code>Anyone Can Register = " . esc_html (get_option ("users_can_register")) . "</code>, and <code>Default Role = " . esc_html (get_option ("default_role")) . "</code>. For further details, see: <code>s2Member -> General Options -> Login Welcome Page -> Allow Free Subscribers</code>.";
|
65 |
/**/
|
66 |
+
do_action ("s2member_during_general_ops_notice", get_defined_vars ());
|
67 |
/**/
|
68 |
ws_plugin__s2member_enqueue_admin_notice ($notice, $pagenow);
|
69 |
}
|
70 |
/**/
|
71 |
+
do_action ("s2member_after_general_ops_notice", get_defined_vars ());
|
72 |
/**/
|
73 |
return;
|
74 |
}
|
78 |
*/
|
79 |
function ws_plugin__s2member_custom_registration_fields ()
|
80 |
{
|
81 |
+
do_action ("s2member_before_custom_registration_fields", get_defined_vars ());
|
82 |
/**/
|
83 |
if (!defined ("BP_VERSION")) /* Not compatible with BuddyPress. */
|
84 |
{
|
137 |
echo '</p>';
|
138 |
}
|
139 |
/**/
|
140 |
+
do_action ("s2member_during_custom_registration_fields", get_defined_vars ());
|
141 |
}
|
142 |
/**/
|
143 |
+
do_action ("s2member_after_custom_registration_fields", get_defined_vars ());
|
144 |
/**/
|
145 |
return;
|
146 |
}
|
150 |
*/
|
151 |
function ws_plugin__s2member_opt_in_4bp ()
|
152 |
{
|
153 |
+
do_action ("s2member_before_opt_in_4bp", get_defined_vars ());
|
154 |
/**/
|
155 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] && ws_plugin__s2member_list_servers_integrated ())
|
156 |
{
|
157 |
+
echo '<div class="s2member-opt-in-4bp" style="' . apply_filters ("s2member_opt_in_4bp_styles", "clear:both; padding-top:10px; margin-left:-3px;", get_defined_vars ()) . '">' . "\n";
|
158 |
/**/
|
159 |
echo '<p>' . "\n";
|
160 |
echo '<label>' . "\n";
|
165 |
/**/
|
166 |
echo '</div>' . "\n";
|
167 |
/**/
|
168 |
+
do_action ("s2member_during_opt_in_4bp", get_defined_vars ());
|
169 |
}
|
170 |
/**/
|
171 |
+
do_action ("s2member_after_opt_in_4bp", get_defined_vars ());
|
172 |
/**/
|
173 |
return;
|
174 |
}
|
177 |
*/
|
178 |
function ws_plugin__s2member_register_link_gen ($subscr_id = FALSE, $custom = FALSE, $item_number = FALSE, $shrink = TRUE)
|
179 |
{
|
180 |
+
do_action ("s2member_before_register_link_gen", get_defined_vars ());
|
181 |
/**/
|
182 |
if ($subscr_id && $custom && $item_number) /* Must have all of these. */
|
183 |
{
|
185 |
$register_link = add_query_arg ("s2member_register", $register, get_bloginfo ("url") . "/");
|
186 |
/**/
|
187 |
if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($register_link))))
|
188 |
+
return apply_filters ("s2member_register_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
|
189 |
+
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
|
190 |
+
return apply_filters ("s2member_register_link_gen", $register_link, get_defined_vars ());
|
191 |
}
|
192 |
/**/
|
193 |
return false;
|
198 |
*/
|
199 |
function ws_plugin__s2member_register ()
|
200 |
{
|
201 |
+
do_action ("s2member_before_register", get_defined_vars ());
|
202 |
/**/
|
203 |
if ($_GET["s2member_register"]) /* If they're attempting to access the registration system. */
|
204 |
{
|
210 |
setcookie ("s2member_custom", ws_plugin__s2member_encrypt ($register[2]), time () + 31556926, "/");
|
211 |
setcookie ("s2member_level", ws_plugin__s2member_encrypt ($register[3]), time () + 31556926, "/");
|
212 |
/**/
|
213 |
+
do_action ("s2member_during_register", get_defined_vars ());
|
214 |
/**/
|
215 |
echo '<script type="text/javascript">' . "\n";
|
216 |
echo "window.location = '" . esc_js (add_query_arg ("action", "register", wp_login_url ())) . "';";
|
220 |
exit;
|
221 |
}
|
222 |
/**/
|
223 |
+
do_action ("s2member_after_register", get_defined_vars ());
|
224 |
}
|
225 |
/*
|
226 |
Function for configuring new users.
|
231 |
global $wpdb; /* Global database object may be required for this routine. */
|
232 |
static $processed; /* Prevents duplicate processing. */
|
233 |
/**/
|
234 |
+
do_action ("s2member_before_configure_user_registration", get_defined_vars ());
|
235 |
/**/
|
236 |
if (!$processed && $user_id && is_array ($_POST = stripslashes_deep ($_POST)) && is_object ($user = new WP_User ($user_id)) && ($processed = true))
|
237 |
{
|
287 |
/**/
|
288 |
setcookie ("s2member_signup_tracking", ws_plugin__s2member_encrypt ($subscr_id), time () + 31556926, "/");
|
289 |
/**/
|
290 |
+
do_action ("s2member_during_configure_user_registration_front_side", get_defined_vars ());
|
291 |
}
|
292 |
/**/
|
293 |
else if (!is_admin () && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
|
315 |
/**/
|
316 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
|
317 |
/**/
|
318 |
+
do_action ("s2member_during_configure_user_registration_front_side", get_defined_vars ());
|
319 |
}
|
320 |
/**/
|
321 |
else if (is_admin () && preg_match ("/wp-admin\/user-new\.php/", $_POST["_wp_http_referer"]) && preg_match ("/^(subscriber|s2member_level[1-4])$/", ($role = $user->roles[0])))
|
343 |
/**/
|
344 |
$opt_in = (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_opt_in"] || $_POST["ws_plugin__s2member_custom_reg_field_opt_in"]) ? true : false;
|
345 |
/**/
|
346 |
+
do_action ("s2member_during_configure_user_registration_admin_side", get_defined_vars ());
|
347 |
}
|
348 |
/**/
|
349 |
if ($processed === "yes") /* If registration was processed by one of the routines above. */
|
386 |
setcookie ("s2member_custom", "", time () + 31556926, "/");
|
387 |
setcookie ("s2member_level", "", time () + 31556926, "/");
|
388 |
/**/
|
389 |
+
do_action ("s2member_during_configure_user_registration", get_defined_vars ());
|
390 |
}
|
391 |
}
|
392 |
/**/
|
393 |
+
do_action ("s2member_after_configure_user_registration", get_defined_vars ());
|
394 |
/**/
|
395 |
return;
|
396 |
}
|
407 |
/**/
|
408 |
function ws_plugin__s2member_generate_password ($length = 12, $special_chars = TRUE)
|
409 |
{
|
410 |
+
do_action ("s2member_before_generate_password", get_defined_vars ());
|
411 |
/**/
|
412 |
$password = ws_plugin__s2member_random_str_gen ($length, $special_chars);
|
413 |
/**/
|
includes/functions/ruri-level-access.inc.php
CHANGED
@@ -19,9 +19,9 @@ Attach to: add_action("template_redirect");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_check_ruri_level_access ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_check_ruri_level_access");
|
23 |
/**/
|
24 |
-
$excluded = apply_filters ("s2member_check_ruri_level_access_excluded", false);
|
25 |
/**/
|
26 |
if (!$excluded && !ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
27 |
{
|
@@ -47,10 +47,10 @@ function ws_plugin__s2member_check_ruri_level_access ()
|
|
47 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
48 |
exit;
|
49 |
/**/
|
50 |
-
do_action ("s2member_during_check_ruri_level_access");
|
51 |
}
|
52 |
/**/
|
53 |
-
do_action ("s2member_after_check_ruri_level_access");
|
54 |
/**/
|
55 |
return;
|
56 |
}
|
@@ -59,7 +59,7 @@ Function that fills replacement code variables in URIs; collectively.
|
|
59 |
*/
|
60 |
function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $current_user = FALSE)
|
61 |
{
|
62 |
-
do_action ("s2member_before_fill_ruri_level_access_rc_vars");
|
63 |
/**/
|
64 |
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
|
65 |
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
|
@@ -67,6 +67,6 @@ function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $cur
|
|
67 |
$uris = preg_replace ("/%%current_user_login%%/i", $current_user_login, $uris);
|
68 |
$uris = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $uris);
|
69 |
/**/
|
70 |
-
return apply_filters ("s2member_fill_ruri_level_access_rc_vars", $uris);
|
71 |
}
|
72 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_check_ruri_level_access ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_check_ruri_level_access", get_defined_vars ());
|
23 |
/**/
|
24 |
+
$excluded = apply_filters ("s2member_check_ruri_level_access_excluded", false, get_defined_vars ());
|
25 |
/**/
|
26 |
if (!$excluded && !ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
27 |
{
|
47 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (add_query_arg ("s2member_level_req", "4", get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))) !== "nill")
|
48 |
exit;
|
49 |
/**/
|
50 |
+
do_action ("s2member_during_check_ruri_level_access", get_defined_vars ());
|
51 |
}
|
52 |
/**/
|
53 |
+
do_action ("s2member_after_check_ruri_level_access", get_defined_vars ());
|
54 |
/**/
|
55 |
return;
|
56 |
}
|
59 |
*/
|
60 |
function ws_plugin__s2member_fill_ruri_level_access_rc_vars ($uris = FALSE, $current_user = FALSE)
|
61 |
{
|
62 |
+
do_action ("s2member_before_fill_ruri_level_access_rc_vars", get_defined_vars ());
|
63 |
/**/
|
64 |
$current_user_login = (is_object ($current_user)) ? strtolower ($current_user->user_login) : "";
|
65 |
$current_user_ID = (is_object ($current_user)) ? (string)$current_user->ID : "";
|
67 |
$uris = preg_replace ("/%%current_user_login%%/i", $current_user_login, $uris);
|
68 |
$uris = preg_replace ("/%%current_user_ID%%/i", $current_user_ID, $uris);
|
69 |
/**/
|
70 |
+
return apply_filters ("s2member_fill_ruri_level_access_rc_vars", $uris, get_defined_vars ());
|
71 |
}
|
72 |
?>
|
includes/functions/shortcodes.inc.php
CHANGED
@@ -32,7 +32,7 @@ Attach to: add_shortcode("s2Member-PayPal-Button");
|
|
32 |
*/
|
33 |
function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
34 |
{
|
35 |
-
do_action ("s2member_before_paypal_button");
|
36 |
/**/
|
37 |
$attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
|
38 |
$attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
|
@@ -45,7 +45,7 @@ function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $sh
|
|
45 |
/**/
|
46 |
$sc = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "mb" => "0", "cb" => "0", "sp" => "0", "image" => "default"), $attr);
|
47 |
/**/
|
48 |
-
do_action ("s2member_before_paypal_button_after_shortcode_atts");
|
49 |
/**/
|
50 |
if ($sc["cb"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
|
51 |
{
|
@@ -55,7 +55,7 @@ function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $sh
|
|
55 |
/**/
|
56 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
57 |
/**/
|
58 |
-
do_action ("s2member_during_paypal_button_cb");
|
59 |
}
|
60 |
/**/
|
61 |
else if ($sc["sp"]) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */
|
@@ -77,7 +77,7 @@ function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $sh
|
|
77 |
/**/
|
78 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
79 |
/**/
|
80 |
-
do_action ("s2member_during_paypal_button_sp");
|
81 |
}
|
82 |
else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
|
83 |
{
|
@@ -122,11 +122,11 @@ function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $sh
|
|
122 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
123 |
/**/
|
124 |
if ($sc["mb"])
|
125 |
-
do_action ("s2member_during_paypal_button_mb");
|
126 |
else
|
127 |
-
do_action ("s2member_during_paypal_button");
|
128 |
}
|
129 |
/**/
|
130 |
-
return apply_filters ("s2member_paypal_button", $code); /* The finished PayPal® Button. */
|
131 |
}
|
132 |
?>
|
32 |
*/
|
33 |
function ws_plugin__s2member_paypal_button ($attr = FALSE, $content = FALSE, $shortcode = FALSE)
|
34 |
{
|
35 |
+
do_action ("s2member_before_paypal_button", get_defined_vars ());
|
36 |
/**/
|
37 |
$attr["tt"] = strtoupper ($attr["tt"]); /* Term lengths absolutely must be provided in upper-case format. */
|
38 |
$attr["rt"] = strtoupper ($attr["rt"]); /* Term lengths absolutely must be provided in upper-case format. */
|
45 |
/**/
|
46 |
$sc = shortcode_atts (array ("ids" => "0", "exp" => "72", "level" => "1", "ccaps" => "", "desc" => "", "ps" => "paypal", "cc" => "USD", "custom" => $_SERVER["HTTP_HOST"], "tp" => "0", "tt" => "D", "ra" => "0.01", "rp" => "1", "rt" => "M", "rr" => "1", "mb" => "0", "cb" => "0", "sp" => "0", "image" => "default"), $attr);
|
47 |
/**/
|
48 |
+
do_action ("s2member_before_paypal_button_after_shortcode_atts", get_defined_vars ());
|
49 |
/**/
|
50 |
if ($sc["cb"]) /* This is a special routine for Cancellation Buttons. Cancellation Buttons use a different template. */
|
51 |
{
|
55 |
/**/
|
56 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
57 |
/**/
|
58 |
+
do_action ("s2member_during_paypal_button_cb", get_defined_vars ());
|
59 |
}
|
60 |
/**/
|
61 |
else if ($sc["sp"]) /* This is a special routine for Specific Post/Page Buttons. Specific Post/Page Buttons use a different template. */
|
77 |
/**/
|
78 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
79 |
/**/
|
80 |
+
do_action ("s2member_during_paypal_button_sp", get_defined_vars ());
|
81 |
}
|
82 |
else /* Otherwise, we'll process this Button normally, using the Membership routines. Also handles Modification Buttons. */
|
83 |
{
|
122 |
$code = ($sc["image"] && $sc["image"] !== "default") ? preg_replace ('/ src\="(.*?)"/', ' src="' . $sc["image"] . '"', $code) : $code;
|
123 |
/**/
|
124 |
if ($sc["mb"])
|
125 |
+
do_action ("s2member_during_paypal_button_mb", get_defined_vars ());
|
126 |
else
|
127 |
+
do_action ("s2member_during_paypal_button", get_defined_vars ());
|
128 |
}
|
129 |
/**/
|
130 |
+
return apply_filters ("s2member_paypal_button", $code, get_defined_vars ()); /* The finished PayPal® Button. */
|
131 |
}
|
132 |
?>
|
includes/functions/sp-access.inc.php
CHANGED
@@ -18,7 +18,7 @@ Generates Specific Post/Page Access links.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_sp_access_link_gen ($sp_IDs = FALSE, $hours = 72, $shrink = TRUE)
|
20 |
{
|
21 |
-
do_action ("s2member_before_sp_access_link_gen");
|
22 |
/**/
|
23 |
if (($sp_IDs = preg_replace ("/[^0-9;,]/", "", $sp_IDs)) && ($leading_ID = preg_replace ("/^([0-9]+)(.*?)$/", "$1", $sp_IDs)) && $hours)
|
24 |
{
|
@@ -26,9 +26,9 @@ function ws_plugin__s2member_sp_access_link_gen ($sp_IDs = FALSE, $hours = 72, $
|
|
26 |
$sp_access_link = add_query_arg ("s2member_sp_access", $sp_access, get_permalink ($leading_ID));
|
27 |
/**/
|
28 |
if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
|
29 |
-
return apply_filters ("s2member_sp_access_link_gen", $tinyurl); /* tinyURL is easier to work with. */
|
30 |
-
else /* Else use the long one; tinyURL
|
31 |
-
return apply_filters ("s2member_sp_access_link_gen", $sp_access_link);
|
32 |
}
|
33 |
/**/
|
34 |
return false;
|
@@ -39,11 +39,11 @@ Attach to: add_action("wp_ajax_s2member_sp_access_link");
|
|
39 |
*/
|
40 |
function ws_plugin__s2member_sp_access_link ()
|
41 |
{
|
42 |
-
do_action ("s2member_before_sp_access_link");
|
43 |
/**/
|
44 |
if (current_user_can ("edit_plugins")) /* Check priveledges as well. */
|
45 |
if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
|
46 |
-
echo apply_filters ("s2member_sp_access_link", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]));
|
47 |
/**/
|
48 |
exit;
|
49 |
}
|
@@ -52,9 +52,9 @@ Handles Specific Post/Page Access authentication.
|
|
52 |
*/
|
53 |
function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
|
54 |
{
|
55 |
-
do_action ("s2member_before_sp_access");
|
56 |
/**/
|
57 |
-
$excluded = apply_filters ("s2member_sp_access_excluded", false);
|
58 |
/**/
|
59 |
if ($excluded || current_user_can ("edit_posts"))
|
60 |
return true; /* Excluded? Or editing? */
|
@@ -75,7 +75,7 @@ function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
|
|
75 |
ws_plugin__s2member_sp_access_session ($_GET["s2member_sp_access"]);
|
76 |
/**/
|
77 |
if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
|
78 |
-
return apply_filters ("s2member_sp_access", true);
|
79 |
}
|
80 |
}
|
81 |
}
|
@@ -88,11 +88,11 @@ function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
|
|
88 |
exit; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */
|
89 |
}
|
90 |
/**/
|
91 |
-
return apply_filters ("s2member_sp_access", false);
|
92 |
}
|
93 |
/**/
|
94 |
else /* Access is not possible. */
|
95 |
-
return apply_filters ("s2member_sp_access", false);
|
96 |
}
|
97 |
/*
|
98 |
Handles Specific Post/Page sessions, by writing access values into a cookie.
|
@@ -100,7 +100,7 @@ This function can be used to add a new value into the session, and/or to return
|
|
100 |
*/
|
101 |
function ws_plugin__s2member_sp_access_session ($add_sp_access_value = FALSE)
|
102 |
{
|
103 |
-
do_action ("s2member_before_sp_access_session");
|
104 |
/**/
|
105 |
$sp_access_values = ($_COOKIE["s2member_sp_access"]) ? preg_split ("/\:\.\:\|\:\.\:/", $_COOKIE["s2member_sp_access"]) : array ();
|
106 |
/**/
|
@@ -113,6 +113,6 @@ function ws_plugin__s2member_sp_access_session ($add_sp_access_value = FALSE)
|
|
113 |
setcookie ("s2member_sp_access", $cookie, time () + 31556926, "/");
|
114 |
}
|
115 |
/**/
|
116 |
-
return apply_filters ("s2member_sp_access_session", $sp_access_values);
|
117 |
}
|
118 |
?>
|
18 |
*/
|
19 |
function ws_plugin__s2member_sp_access_link_gen ($sp_IDs = FALSE, $hours = 72, $shrink = TRUE)
|
20 |
{
|
21 |
+
do_action ("s2member_before_sp_access_link_gen", get_defined_vars ());
|
22 |
/**/
|
23 |
if (($sp_IDs = preg_replace ("/[^0-9;,]/", "", $sp_IDs)) && ($leading_ID = preg_replace ("/^([0-9]+)(.*?)$/", "$1", $sp_IDs)) && $hours)
|
24 |
{
|
26 |
$sp_access_link = add_query_arg ("s2member_sp_access", $sp_access, get_permalink ($leading_ID));
|
27 |
/**/
|
28 |
if ($shrink && ($tinyurl = ws_plugin__s2member_remote ("http://tinyurl.com/api-create.php?url=" . rawurlencode ($sp_access_link))))
|
29 |
+
return apply_filters ("s2member_sp_access_link_gen", $tinyurl, get_defined_vars ()); /* tinyURL is easier to work with. */
|
30 |
+
else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */
|
31 |
+
return apply_filters ("s2member_sp_access_link_gen", $sp_access_link, get_defined_vars ());
|
32 |
}
|
33 |
/**/
|
34 |
return false;
|
39 |
*/
|
40 |
function ws_plugin__s2member_sp_access_link ()
|
41 |
{
|
42 |
+
do_action ("s2member_before_sp_access_link", get_defined_vars ());
|
43 |
/**/
|
44 |
if (current_user_can ("edit_plugins")) /* Check priveledges as well. */
|
45 |
if (($nonce = $_POST["s2member_sp_access_link"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-sp-access-link"))
|
46 |
+
echo apply_filters ("s2member_sp_access_link", ws_plugin__s2member_sp_access_link_gen ($_POST["s2member_sp_access_link_ids"], $_POST["s2member_sp_access_link_hours"]), get_defined_vars ());
|
47 |
/**/
|
48 |
exit;
|
49 |
}
|
52 |
*/
|
53 |
function ws_plugin__s2member_sp_access ($sp_ID = FALSE)
|
54 |
{
|
55 |
+
do_action ("s2member_before_sp_access", get_defined_vars ());
|
56 |
/**/
|
57 |
+
$excluded = apply_filters ("s2member_sp_access_excluded", false, get_defined_vars ());
|
58 |
/**/
|
59 |
if ($excluded || current_user_can ("edit_posts"))
|
60 |
return true; /* Excluded? Or editing? */
|
75 |
ws_plugin__s2member_sp_access_session ($_GET["s2member_sp_access"]);
|
76 |
/**/
|
77 |
if (ws_plugin__s2member_ip_restrictions_ok ($_SERVER["REMOTE_ADDR"], $sp_access_value))
|
78 |
+
return apply_filters ("s2member_sp_access", true, get_defined_vars ());
|
79 |
}
|
80 |
}
|
81 |
}
|
88 |
exit; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */
|
89 |
}
|
90 |
/**/
|
91 |
+
return apply_filters ("s2member_sp_access", false, get_defined_vars ());
|
92 |
}
|
93 |
/**/
|
94 |
else /* Access is not possible. */
|
95 |
+
return apply_filters ("s2member_sp_access", false, get_defined_vars ());
|
96 |
}
|
97 |
/*
|
98 |
Handles Specific Post/Page sessions, by writing access values into a cookie.
|
100 |
*/
|
101 |
function ws_plugin__s2member_sp_access_session ($add_sp_access_value = FALSE)
|
102 |
{
|
103 |
+
do_action ("s2member_before_sp_access_session", get_defined_vars ());
|
104 |
/**/
|
105 |
$sp_access_values = ($_COOKIE["s2member_sp_access"]) ? preg_split ("/\:\.\:\|\:\.\:/", $_COOKIE["s2member_sp_access"]) : array ();
|
106 |
/**/
|
113 |
setcookie ("s2member_sp_access", $cookie, time () + 31556926, "/");
|
114 |
}
|
115 |
/**/
|
116 |
+
return apply_filters ("s2member_sp_access_session", $sp_access_values, get_defined_vars ());
|
117 |
}
|
118 |
?>
|
includes/functions/tracking-codes.inc.php
CHANGED
@@ -29,7 +29,7 @@ s2Member will display Tracking Codes in (1) of these 3 locations:
|
|
29 |
*/
|
30 |
function ws_plugin__s2member_display_signup_tracking_codes ()
|
31 |
{
|
32 |
-
do_action ("s2member_before_display_signup_tracking_codes");
|
33 |
/**/
|
34 |
if (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) || ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_signup_tracking"])))
|
35 |
{
|
@@ -48,11 +48,11 @@ function ws_plugin__s2member_display_signup_tracking_codes ()
|
|
48 |
eval ("?>" . $code);
|
49 |
}
|
50 |
/**/
|
51 |
-
do_action ("s2member_during_display_signup_tracking_codes");
|
52 |
}
|
53 |
}
|
54 |
/**/
|
55 |
-
do_action ("s2member_after_display_signup_tracking_codes");
|
56 |
}
|
57 |
/*
|
58 |
Deletes s2Member's temporary tracking cookie.
|
@@ -60,18 +60,18 @@ Attach to: add_action("init");
|
|
60 |
*/
|
61 |
function ws_plugin__s2member_delete_signup_tracking_cookie ()
|
62 |
{
|
63 |
-
do_action ("s2member_before_delete_signup_tracking_cookie");
|
64 |
/**/
|
65 |
if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
|
66 |
{
|
67 |
setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
|
68 |
/**/
|
69 |
-
do_action ("s2member_during_delete_signup_tracking_cookie");
|
70 |
/**/
|
71 |
exit;
|
72 |
}
|
73 |
/**/
|
74 |
-
do_action ("s2member_after_delete_signup_tracking_cookie");
|
75 |
}
|
76 |
/*
|
77 |
Function that displays Specific Post/Page Tracking Codes.
|
@@ -85,7 +85,7 @@ s2Member will display Tracking Codes in the footer of your theme.
|
|
85 |
*/
|
86 |
function ws_plugin__s2member_display_sp_tracking_codes ()
|
87 |
{
|
88 |
-
do_action ("s2member_before_display_sp_tracking_codes");
|
89 |
/**/
|
90 |
if (($txn_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_sp_tracking"])))
|
91 |
{
|
@@ -104,11 +104,11 @@ function ws_plugin__s2member_display_sp_tracking_codes ()
|
|
104 |
eval ("?>" . $code);
|
105 |
}
|
106 |
/**/
|
107 |
-
do_action ("s2member_during_display_sp_tracking_codes");
|
108 |
}
|
109 |
}
|
110 |
/**/
|
111 |
-
do_action ("s2member_after_display_sp_tracking_codes");
|
112 |
}
|
113 |
/*
|
114 |
Deletes s2Member's temporary tracking cookie.
|
@@ -116,17 +116,17 @@ Attach to: add_action("init");
|
|
116 |
*/
|
117 |
function ws_plugin__s2member_delete_sp_tracking_cookie ()
|
118 |
{
|
119 |
-
do_action ("s2member_before_delete_sp_tracking_cookie");
|
120 |
/**/
|
121 |
if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
|
122 |
{
|
123 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
|
124 |
/**/
|
125 |
-
do_action ("s2member_during_delete_sp_tracking_cookie");
|
126 |
/**/
|
127 |
exit;
|
128 |
}
|
129 |
/**/
|
130 |
-
do_action ("s2member_after_delete_sp_tracking_cookie");
|
131 |
}
|
132 |
?>
|
29 |
*/
|
30 |
function ws_plugin__s2member_display_signup_tracking_codes ()
|
31 |
{
|
32 |
+
do_action ("s2member_before_display_signup_tracking_codes", get_defined_vars ());
|
33 |
/**/
|
34 |
if (($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_subscr_id"])) || ($subscr_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_signup_tracking"])))
|
35 |
{
|
48 |
eval ("?>" . $code);
|
49 |
}
|
50 |
/**/
|
51 |
+
do_action ("s2member_during_display_signup_tracking_codes", get_defined_vars ());
|
52 |
}
|
53 |
}
|
54 |
/**/
|
55 |
+
do_action ("s2member_after_display_signup_tracking_codes", get_defined_vars ());
|
56 |
}
|
57 |
/*
|
58 |
Deletes s2Member's temporary tracking cookie.
|
60 |
*/
|
61 |
function ws_plugin__s2member_delete_signup_tracking_cookie ()
|
62 |
{
|
63 |
+
do_action ("s2member_before_delete_signup_tracking_cookie", get_defined_vars ());
|
64 |
/**/
|
65 |
if ($_GET["s2member_delete_signup_tracking_cookie"]) /* Deletes cookie. */
|
66 |
{
|
67 |
setcookie ("s2member_signup_tracking", "", time () + 31556926, "/");
|
68 |
/**/
|
69 |
+
do_action ("s2member_during_delete_signup_tracking_cookie", get_defined_vars ());
|
70 |
/**/
|
71 |
exit;
|
72 |
}
|
73 |
/**/
|
74 |
+
do_action ("s2member_after_delete_signup_tracking_cookie", get_defined_vars ());
|
75 |
}
|
76 |
/*
|
77 |
Function that displays Specific Post/Page Tracking Codes.
|
85 |
*/
|
86 |
function ws_plugin__s2member_display_sp_tracking_codes ()
|
87 |
{
|
88 |
+
do_action ("s2member_before_display_sp_tracking_codes", get_defined_vars ());
|
89 |
/**/
|
90 |
if (($txn_id = ws_plugin__s2member_decrypt ($_COOKIE["s2member_sp_tracking"])))
|
91 |
{
|
104 |
eval ("?>" . $code);
|
105 |
}
|
106 |
/**/
|
107 |
+
do_action ("s2member_during_display_sp_tracking_codes", get_defined_vars ());
|
108 |
}
|
109 |
}
|
110 |
/**/
|
111 |
+
do_action ("s2member_after_display_sp_tracking_codes", get_defined_vars ());
|
112 |
}
|
113 |
/*
|
114 |
Deletes s2Member's temporary tracking cookie.
|
116 |
*/
|
117 |
function ws_plugin__s2member_delete_sp_tracking_cookie ()
|
118 |
{
|
119 |
+
do_action ("s2member_before_delete_sp_tracking_cookie", get_defined_vars ());
|
120 |
/**/
|
121 |
if ($_GET["s2member_delete_sp_tracking_cookie"]) /* Deletes cookie. */
|
122 |
{
|
123 |
setcookie ("s2member_sp_tracking", "", time () + 31556926, "/");
|
124 |
/**/
|
125 |
+
do_action ("s2member_during_delete_sp_tracking_cookie", get_defined_vars ());
|
126 |
/**/
|
127 |
exit;
|
128 |
}
|
129 |
/**/
|
130 |
+
do_action ("s2member_after_delete_sp_tracking_cookie", get_defined_vars ());
|
131 |
}
|
132 |
?>
|
includes/functions/translations.inc.php
CHANGED
@@ -21,7 +21,7 @@ function ws_plugin__s2member_translation_mangler ($translated = FALSE, $original
|
|
21 |
{
|
22 |
static $is_admin_media_upload, $is_wp_login; /* Optimizes this routine. */
|
23 |
/**/
|
24 |
-
do_action ("s2member_before_translation_mangler");
|
25 |
/**/
|
26 |
if (!isset ($is_admin_media_upload) || $is_admin_media_upload)
|
27 |
{
|
@@ -61,6 +61,6 @@ function ws_plugin__s2member_translation_mangler ($translated = FALSE, $original
|
|
61 |
}
|
62 |
}
|
63 |
/**/
|
64 |
-
return apply_filters ("s2member_translation_mangler", $translated);
|
65 |
}
|
66 |
?>
|
21 |
{
|
22 |
static $is_admin_media_upload, $is_wp_login; /* Optimizes this routine. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_translation_mangler", get_defined_vars ());
|
25 |
/**/
|
26 |
if (!isset ($is_admin_media_upload) || $is_admin_media_upload)
|
27 |
{
|
61 |
}
|
62 |
}
|
63 |
/**/
|
64 |
+
return apply_filters ("s2member_translation_mangler", $translated, get_defined_vars ());
|
65 |
}
|
66 |
?>
|
includes/functions/user-access-level.inc.php
CHANGED
@@ -19,36 +19,36 @@ Returns 0-4 according to the current User/Member's Access Level.
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_user_access_level ()
|
21 |
{
|
22 |
-
do_action ("s2member_before_user_access_level");
|
23 |
/**/
|
24 |
if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
25 |
{
|
26 |
-
return apply_filters ("s2member_user_access_level", -1);
|
27 |
/* Return of -1, means a User is not logged in. */
|
28 |
}
|
29 |
else if (current_user_can ("access_s2member_level4"))
|
30 |
{
|
31 |
-
return apply_filters ("s2member_user_access_level", 4);
|
32 |
/* Member logged in with Level 4 Access. */
|
33 |
}
|
34 |
else if (current_user_can ("access_s2member_level3"))
|
35 |
{
|
36 |
-
return apply_filters ("s2member_user_access_level", 3);
|
37 |
/* Member logged in with Level 3 Access. */
|
38 |
}
|
39 |
else if (current_user_can ("access_s2member_level2"))
|
40 |
{
|
41 |
-
return apply_filters ("s2member_user_access_level", 2);
|
42 |
/* Member logged in with Level 2 Access. */
|
43 |
}
|
44 |
else if (current_user_can ("access_s2member_level1"))
|
45 |
{
|
46 |
-
return apply_filters ("s2member_user_access_level", 1);
|
47 |
/* Member logged in with Level 1 Access. */
|
48 |
}
|
49 |
else /* Else if a User ( Free Subscriber ) is logged in. */
|
50 |
{
|
51 |
-
return apply_filters ("s2member_user_access_level", 0);
|
52 |
/* User is logged in without Access. A Free Subscriber. */
|
53 |
}
|
54 |
}
|
19 |
*/
|
20 |
function ws_plugin__s2member_user_access_level ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_user_access_level", get_defined_vars ());
|
23 |
/**/
|
24 |
if (!($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
25 |
{
|
26 |
+
return apply_filters ("s2member_user_access_level", -1, get_defined_vars ());
|
27 |
/* Return of -1, means a User is not logged in. */
|
28 |
}
|
29 |
else if (current_user_can ("access_s2member_level4"))
|
30 |
{
|
31 |
+
return apply_filters ("s2member_user_access_level", 4, get_defined_vars ());
|
32 |
/* Member logged in with Level 4 Access. */
|
33 |
}
|
34 |
else if (current_user_can ("access_s2member_level3"))
|
35 |
{
|
36 |
+
return apply_filters ("s2member_user_access_level", 3, get_defined_vars ());
|
37 |
/* Member logged in with Level 3 Access. */
|
38 |
}
|
39 |
else if (current_user_can ("access_s2member_level2"))
|
40 |
{
|
41 |
+
return apply_filters ("s2member_user_access_level", 2, get_defined_vars ());
|
42 |
/* Member logged in with Level 2 Access. */
|
43 |
}
|
44 |
else if (current_user_can ("access_s2member_level1"))
|
45 |
{
|
46 |
+
return apply_filters ("s2member_user_access_level", 1, get_defined_vars ());
|
47 |
/* Member logged in with Level 1 Access. */
|
48 |
}
|
49 |
else /* Else if a User ( Free Subscriber ) is logged in. */
|
50 |
{
|
51 |
+
return apply_filters ("s2member_user_access_level", 0, get_defined_vars ());
|
52 |
/* User is logged in without Access. A Free Subscriber. */
|
53 |
}
|
54 |
}
|
includes/functions/user-deletions.inc.php
CHANGED
@@ -19,7 +19,7 @@ Attach to: add_action("delete_user");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_user_deletions ($user_id = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_handle_user_deletions");
|
23 |
/**/
|
24 |
$user = new WP_User ($user_id); /* Acquire user obj. */
|
25 |
/**/
|
@@ -37,10 +37,10 @@ function ws_plugin__s2member_handle_user_deletions ($user_id = FALSE)
|
|
37 |
if (($url = trim ($url))) /* Empty? */
|
38 |
ws_plugin__s2member_remote ($url);
|
39 |
/**/
|
40 |
-
do_action ("s2member_during_handle_user_deletions");
|
41 |
}
|
42 |
/**/
|
43 |
-
do_action ("s2member_after_handle_user_deletions");
|
44 |
/**/
|
45 |
return;
|
46 |
}
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_user_deletions ($user_id = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_handle_user_deletions", get_defined_vars ());
|
23 |
/**/
|
24 |
$user = new WP_User ($user_id); /* Acquire user obj. */
|
25 |
/**/
|
37 |
if (($url = trim ($url))) /* Empty? */
|
38 |
ws_plugin__s2member_remote ($url);
|
39 |
/**/
|
40 |
+
do_action ("s2member_during_handle_user_deletions", get_defined_vars ());
|
41 |
}
|
42 |
/**/
|
43 |
+
do_action ("s2member_after_handle_user_deletions", get_defined_vars ());
|
44 |
/**/
|
45 |
return;
|
46 |
}
|
includes/functions/user-has-wp-role.inc.php
CHANGED
@@ -20,10 +20,10 @@ By default, this excludes the "subscriber" role.
|
|
20 |
*/
|
21 |
function ws_plugin__s2member_user_has_wp_role ($user = FALSE, $exclude = array ("subscriber"))
|
22 |
{
|
23 |
-
do_action ("s2member_before_user_has_wp_role");
|
24 |
/**/
|
25 |
if (!is_object ($user) || !is_array ($user->roles) || empty ($user->roles))
|
26 |
-
return apply_filters ("s2member_user_has_wp_role", false);
|
27 |
/**/
|
28 |
$exclude = (array)$exclude; /* Force array on the exclusions. */
|
29 |
/**/
|
@@ -32,8 +32,8 @@ function ws_plugin__s2member_user_has_wp_role ($user = FALSE, $exclude = array (
|
|
32 |
if (in_array ("author", $exclude) || !in_array ("author", $user->roles))
|
33 |
if (in_array ("contributor", $exclude) || !in_array ("contributor", $user->roles))
|
34 |
if (in_array ("subscriber", $exclude) || !in_array ("subscriber", $user->roles))
|
35 |
-
return apply_filters ("s2member_user_has_wp_role", false);
|
36 |
/**/
|
37 |
-
return apply_filters ("s2member_user_has_wp_role", true);
|
38 |
}
|
39 |
?>
|
20 |
*/
|
21 |
function ws_plugin__s2member_user_has_wp_role ($user = FALSE, $exclude = array ("subscriber"))
|
22 |
{
|
23 |
+
do_action ("s2member_before_user_has_wp_role", get_defined_vars ());
|
24 |
/**/
|
25 |
if (!is_object ($user) || !is_array ($user->roles) || empty ($user->roles))
|
26 |
+
return apply_filters ("s2member_user_has_wp_role", false, get_defined_vars ());
|
27 |
/**/
|
28 |
$exclude = (array)$exclude; /* Force array on the exclusions. */
|
29 |
/**/
|
32 |
if (in_array ("author", $exclude) || !in_array ("author", $user->roles))
|
33 |
if (in_array ("contributor", $exclude) || !in_array ("contributor", $user->roles))
|
34 |
if (in_array ("subscriber", $exclude) || !in_array ("subscriber", $user->roles))
|
35 |
+
return apply_filters ("s2member_user_has_wp_role", false, get_defined_vars ());
|
36 |
/**/
|
37 |
+
return apply_filters ("s2member_user_has_wp_role", true, get_defined_vars ());
|
38 |
}
|
39 |
?>
|
includes/functions/user-notes.inc.php
CHANGED
@@ -18,12 +18,12 @@ Append a note onto a specific User/Member's account.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_append_user_notes ($user_id = FALSE, $notes = FALSE)
|
20 |
{
|
21 |
-
do_action ("s2member_before_append_user_notes");
|
22 |
/**/
|
23 |
if ($user_id && $notes && is_string ($notes)) /* Must have these. */
|
24 |
{
|
25 |
$notes = trim (get_usermeta ($user_id, "s2member_notes") . "\n" . $notes);
|
26 |
-
$notes = apply_filters ("s2member_append_user_notes", $notes);
|
27 |
update_usermeta ($user_id, "s2member_notes", $notes);
|
28 |
}
|
29 |
/**/
|
@@ -34,7 +34,7 @@ Clear specific notes from a User/Member's account; based on line-by-line regex.
|
|
34 |
*/
|
35 |
function ws_plugin__s2member_clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
|
36 |
{
|
37 |
-
do_action ("s2member_before_clear_user_note_lines");
|
38 |
/**/
|
39 |
if ($user_id && $regex && is_string ($regex) && ($lines = array ()))
|
40 |
{
|
@@ -44,7 +44,7 @@ function ws_plugin__s2member_clear_user_note_lines ($user_id = FALSE, $regex = F
|
|
44 |
if (!preg_match ($regex, $line))
|
45 |
$lines[] = $line;
|
46 |
/**/
|
47 |
-
$notes = apply_filters ("s2member_clear_user_note_lines", trim (implode ("\n", $lines)));
|
48 |
update_usermeta ($user_id, "s2member_notes", $notes);
|
49 |
}
|
50 |
/**/
|
18 |
*/
|
19 |
function ws_plugin__s2member_append_user_notes ($user_id = FALSE, $notes = FALSE)
|
20 |
{
|
21 |
+
do_action ("s2member_before_append_user_notes", get_defined_vars ());
|
22 |
/**/
|
23 |
if ($user_id && $notes && is_string ($notes)) /* Must have these. */
|
24 |
{
|
25 |
$notes = trim (get_usermeta ($user_id, "s2member_notes") . "\n" . $notes);
|
26 |
+
$notes = apply_filters ("s2member_append_user_notes", $notes, get_defined_vars ());
|
27 |
update_usermeta ($user_id, "s2member_notes", $notes);
|
28 |
}
|
29 |
/**/
|
34 |
*/
|
35 |
function ws_plugin__s2member_clear_user_note_lines ($user_id = FALSE, $regex = FALSE)
|
36 |
{
|
37 |
+
do_action ("s2member_before_clear_user_note_lines", get_defined_vars ());
|
38 |
/**/
|
39 |
if ($user_id && $regex && is_string ($regex) && ($lines = array ()))
|
40 |
{
|
44 |
if (!preg_match ($regex, $line))
|
45 |
$lines[] = $line;
|
46 |
/**/
|
47 |
+
$notes = apply_filters ("s2member_clear_user_note_lines", trim (implode ("\n", $lines)), get_defined_vars ());
|
48 |
update_usermeta ($user_id, "s2member_notes", $notes);
|
49 |
}
|
50 |
/**/
|
includes/functions/users-list.inc.php
CHANGED
@@ -19,7 +19,7 @@ Attach to: add_filter ("manage_users_columns");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_users_list_cols ($cols = FALSE)
|
21 |
{
|
22 |
-
do_action ("s2member_before_users_list_cols");
|
23 |
/**/
|
24 |
$cols["s2member_registration_time"] = "Registered On"; /* Date they signed up. */
|
25 |
$cols["s2member_subscr_id"] = "PayPal® Subscr. ID"; /* Special field that is always applied. */
|
@@ -36,7 +36,7 @@ function ws_plugin__s2member_users_list_cols ($cols = FALSE)
|
|
36 |
}
|
37 |
}
|
38 |
/**/
|
39 |
-
return apply_filters ("s2member_users_list_cols", $cols);
|
40 |
}
|
41 |
/*
|
42 |
Function that displays column data in the row of details.
|
@@ -48,7 +48,7 @@ function ws_plugin__s2member_users_list_display_cols ($_ = FALSE, $col = FALSE,
|
|
48 |
$user = $user_object; /* Shorter reference to the $user_object var. */
|
49 |
static $fields, $fields_4_user_id; /* Used for optimization. */
|
50 |
/**/
|
51 |
-
do_action ("s2member_before_users_list_display_cols");
|
52 |
/**/
|
53 |
if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
|
54 |
$fields = get_usermeta ($user_id, "s2member_custom_fields");
|
@@ -74,7 +74,7 @@ function ws_plugin__s2member_users_list_display_cols ($_ = FALSE, $col = FALSE,
|
|
74 |
else if ($fields[$col])
|
75 |
$val = esc_html ($fields[$col]);
|
76 |
/**/
|
77 |
-
return apply_filters ("s2member_users_list_display_cols", (($val) ? $val : "—"));
|
78 |
}
|
79 |
/*
|
80 |
Function that adds custom fields to the admin profile editing page.
|
@@ -83,7 +83,7 @@ Attach to: add_action("show_user_profile");
|
|
83 |
*/
|
84 |
function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
|
85 |
{
|
86 |
-
do_action ("s2member_before_users_list_edit_cols");
|
87 |
/**/
|
88 |
if (current_user_can ("edit_users")) /* Security check. */
|
89 |
{
|
@@ -157,14 +157,14 @@ function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
|
|
157 |
echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" rows="5" wrap="off" spellcheck="false">' . format_to_edit (get_usermeta ($user->ID, "s2member_notes")) . '</textarea></td>' . "\n";
|
158 |
echo '</tr>' . "\n";
|
159 |
/**/
|
160 |
-
do_action ("s2member_during_users_list_edit_cols");
|
161 |
/**/
|
162 |
echo '</table>' . "\n";
|
163 |
/**/
|
164 |
echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
|
165 |
}
|
166 |
/**/
|
167 |
-
do_action ("s2member_after_users_list_edit_cols");
|
168 |
/**/
|
169 |
return;
|
170 |
}
|
@@ -175,7 +175,7 @@ Attach to: add_action("personal_options_update");
|
|
175 |
*/
|
176 |
function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
|
177 |
{
|
178 |
-
do_action ("s2member_before_users_list_update_cols");
|
179 |
/**/
|
180 |
if (current_user_can ("edit_users")) /* Quick security check here. */
|
181 |
{
|
@@ -212,10 +212,10 @@ function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
|
|
212 |
/**/
|
213 |
update_usermeta ($user_id, "s2member_notes", $_POST["ws_plugin__s2member_profile_s2member_notes"]);
|
214 |
/**/
|
215 |
-
do_action ("s2member_during_users_list_update_cols");
|
216 |
}
|
217 |
}
|
218 |
/**/
|
219 |
-
do_action ("s2member_after_users_list_update_cols");
|
220 |
}
|
221 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_users_list_cols ($cols = FALSE)
|
21 |
{
|
22 |
+
do_action ("s2member_before_users_list_cols", get_defined_vars ());
|
23 |
/**/
|
24 |
$cols["s2member_registration_time"] = "Registered On"; /* Date they signed up. */
|
25 |
$cols["s2member_subscr_id"] = "PayPal® Subscr. ID"; /* Special field that is always applied. */
|
36 |
}
|
37 |
}
|
38 |
/**/
|
39 |
+
return apply_filters ("s2member_users_list_cols", $cols, get_defined_vars ());
|
40 |
}
|
41 |
/*
|
42 |
Function that displays column data in the row of details.
|
48 |
$user = $user_object; /* Shorter reference to the $user_object var. */
|
49 |
static $fields, $fields_4_user_id; /* Used for optimization. */
|
50 |
/**/
|
51 |
+
do_action ("s2member_before_users_list_display_cols", get_defined_vars ());
|
52 |
/**/
|
53 |
if ((!isset ($fields) || $fields_4_user_id !== $user_id) && ($fields_4_user_id = $user_id))
|
54 |
$fields = get_usermeta ($user_id, "s2member_custom_fields");
|
74 |
else if ($fields[$col])
|
75 |
$val = esc_html ($fields[$col]);
|
76 |
/**/
|
77 |
+
return apply_filters ("s2member_users_list_display_cols", (($val) ? $val : "—"), get_defined_vars ());
|
78 |
}
|
79 |
/*
|
80 |
Function that adds custom fields to the admin profile editing page.
|
83 |
*/
|
84 |
function ws_plugin__s2member_users_list_edit_cols ($user = FALSE)
|
85 |
{
|
86 |
+
do_action ("s2member_before_users_list_edit_cols", get_defined_vars ());
|
87 |
/**/
|
88 |
if (current_user_can ("edit_users")) /* Security check. */
|
89 |
{
|
157 |
echo '<td><textarea name="ws_plugin__s2member_profile_s2member_notes" rows="5" wrap="off" spellcheck="false">' . format_to_edit (get_usermeta ($user->ID, "s2member_notes")) . '</textarea></td>' . "\n";
|
158 |
echo '</tr>' . "\n";
|
159 |
/**/
|
160 |
+
do_action ("s2member_during_users_list_edit_cols", get_defined_vars ());
|
161 |
/**/
|
162 |
echo '</table>' . "\n";
|
163 |
/**/
|
164 |
echo '<div style="margin:25px 0 25px 0; height:1px; line-height:1px; background:#CCCCCC;"></div>' . "\n";
|
165 |
}
|
166 |
/**/
|
167 |
+
do_action ("s2member_after_users_list_edit_cols", get_defined_vars ());
|
168 |
/**/
|
169 |
return;
|
170 |
}
|
175 |
*/
|
176 |
function ws_plugin__s2member_users_list_update_cols ($user_id = FALSE)
|
177 |
{
|
178 |
+
do_action ("s2member_before_users_list_update_cols", get_defined_vars ());
|
179 |
/**/
|
180 |
if (current_user_can ("edit_users")) /* Quick security check here. */
|
181 |
{
|
212 |
/**/
|
213 |
update_usermeta ($user_id, "s2member_notes", $_POST["ws_plugin__s2member_profile_s2member_notes"]);
|
214 |
/**/
|
215 |
+
do_action ("s2member_during_users_list_update_cols", get_defined_vars ());
|
216 |
}
|
217 |
}
|
218 |
/**/
|
219 |
+
do_action ("s2member_after_users_list_update_cols", get_defined_vars ());
|
220 |
}
|
221 |
?>
|
includes/functions/utilities.inc.php
CHANGED
@@ -19,24 +19,43 @@ This extends wp_remote_request() through the `WP_Http` class.
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_remote ($url = FALSE, $post_vars = FALSE, $args = array ())
|
21 |
{
|
|
|
|
|
22 |
$args = (!is_array ($args)) ? array (): $args;
|
23 |
/**/
|
|
|
|
|
|
|
24 |
if ($url) /* Obviously, we must have a URL to do anything. */
|
25 |
{
|
26 |
-
if (is_array ($post_vars) && !empty ($post_vars))
|
27 |
{
|
28 |
$args["method"] = "POST";
|
29 |
$args["body"] = $post_vars;
|
30 |
}
|
31 |
/**/
|
32 |
-
|
33 |
-
if (strlen ($response["body"]))
|
34 |
-
return $response["body"];
|
35 |
}
|
36 |
/**/
|
37 |
return false;
|
38 |
}
|
39 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
Function that extends array_unique to
|
41 |
support multi-dimensional arrays.
|
42 |
*/
|
19 |
*/
|
20 |
function ws_plugin__s2member_remote ($url = FALSE, $post_vars = FALSE, $args = array ())
|
21 |
{
|
22 |
+
static $http_response_filtered = false; /* Filter once. */
|
23 |
+
/**/
|
24 |
$args = (!is_array ($args)) ? array (): $args;
|
25 |
/**/
|
26 |
+
if (!$http_response_filtered && ($http_response_filtered = true))
|
27 |
+
add_filter ("http_response", "_ws_plugin__s2member_remote_gz_variations");
|
28 |
+
/**/
|
29 |
if ($url) /* Obviously, we must have a URL to do anything. */
|
30 |
{
|
31 |
+
if ((is_array ($post_vars) || is_string ($post_vars)) && !empty ($post_vars))
|
32 |
{
|
33 |
$args["method"] = "POST";
|
34 |
$args["body"] = $post_vars;
|
35 |
}
|
36 |
/**/
|
37 |
+
return wp_remote_retrieve_body (wp_remote_request ($url, $args));
|
|
|
|
|
38 |
}
|
39 |
/**/
|
40 |
return false;
|
41 |
}
|
42 |
/*
|
43 |
+
A sort of callback function that filters the WP_Http response for additional gzinflate variations.
|
44 |
+
Attach to: add_filter("http_response");
|
45 |
+
*/
|
46 |
+
function _ws_plugin__s2member_remote_gz_variations ($response = array ())
|
47 |
+
{
|
48 |
+
if (!isset ($response["ws__gz_variations"]) && ($response["ws__gz_variations"] = 1))
|
49 |
+
{
|
50 |
+
if ($response["headers"]["content-encoding"])
|
51 |
+
if (substr ($response["body"], 0, 2) === "\x78\x9c")
|
52 |
+
if (($gz = @gzinflate (substr ($response["body"], 2))))
|
53 |
+
$response["body"] = $gz;
|
54 |
+
}
|
55 |
+
/**/
|
56 |
+
return $response;
|
57 |
+
}
|
58 |
+
/*
|
59 |
Function that extends array_unique to
|
60 |
support multi-dimensional arrays.
|
61 |
*/
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== s2Member ( Membership w/ PayPal® Integration ) also works w/ BuddyPress ===
|
2 |
|
3 |
-
Version: 3.0.
|
4 |
-
Stable tag: 3.0.
|
5 |
-
Framework: WS-P-2.
|
6 |
|
7 |
WordPress Compatible: yes
|
8 |
BuddyPress Compatible: yes
|
@@ -103,14 +103,23 @@ Archived releases of s2Member are maintained [here](http://wordpress.org/extend/
|
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
|
|
|
|
|
|
106 |
= 3.0.1 =
|
107 |
-
No major changes. Just a few compatiblity improvements.
|
108 |
|
109 |
= 3.0 =
|
110 |
-
Many new features, fixes, and improvements.
|
111 |
|
112 |
== Changelog ==
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
= 3.0.1 =
|
115 |
* Compatibility. The function `ws_plugin__s2member_curlpsr()` has been replaced by `ws_plugin__s2member_remote()`, which makes use of `wp_remote_request()` through the WP_Http class. This removes s2Member's absolute dependency on the cURL extension for PHP. Removing this dependency, allows s2Member/WordPress® to work out the best method of communication; based on what the installation server has available.
|
116 |
* Compatibility. The MailChimp® API Class has also been modified to use `ws_plugin__s2member_remote()`. In previous versions of s2Member, the MailChimp® API required `allow_url_fopen = on` because it used the fsockopen method to communicate with the MailChimp® server. Removing this dependency on fsockopen, allows s2Member/WordPress® to work out the best method of communication; based on what the installation server has available.
|
1 |
=== s2Member ( Membership w/ PayPal® Integration ) also works w/ BuddyPress ===
|
2 |
|
3 |
+
Version: 3.0.2
|
4 |
+
Stable tag: 3.0.2
|
5 |
+
Framework: WS-P-2.3
|
6 |
|
7 |
WordPress Compatible: yes
|
8 |
BuddyPress Compatible: yes
|
103 |
|
104 |
== Upgrade Notice ==
|
105 |
|
106 |
+
= 3.0.2 =
|
107 |
+
Upgrade recommended. Two bugs fixed, and new Hook/Filter arguments. See Changelog for details.
|
108 |
+
|
109 |
= 3.0.1 =
|
110 |
+
Upgrade recommended. No major changes. Just a few compatiblity improvements.
|
111 |
|
112 |
= 3.0 =
|
113 |
+
Upgrade recommended. Many new features, fixes, and improvements.
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 3.0.2 =
|
118 |
+
* Feature for developers. All of s2Member's internal Hooks & Filters have been updated to support `get_defined_vars()` as a single argument on Hooks, and as a secondary argument on Filters. The PHP function: `get_defined_vars()` provides plugin developers with full access to all defined variables - within the scope of a function that is calling upon Hooks/Filters.
|
119 |
+
* Bug fix. A bug was found in a regex pattern that matched against the PayPal® `item_number` field. This was causing the IPN system to fail under certain conditions. This has been resolved in s2Member v3.0.2.
|
120 |
+
* Bug fix. A bug was found in remote calls on some servers that use `zlib.output_compression`. This was affecting s2Member's ability to read data returned by `wp_remote_request()` whenever gzinflate failed on strings starting with these two bytes `\x78\x9c`.
|
121 |
+
* Framework updated to WS-P-2.3.
|
122 |
+
|
123 |
= 3.0.1 =
|
124 |
* Compatibility. The function `ws_plugin__s2member_curlpsr()` has been replaced by `ws_plugin__s2member_remote()`, which makes use of `wp_remote_request()` through the WP_Http class. This removes s2Member's absolute dependency on the cURL extension for PHP. Removing this dependency, allows s2Member/WordPress® to work out the best method of communication; based on what the installation server has available.
|
125 |
* Compatibility. The MailChimp® API Class has also been modified to use `ws_plugin__s2member_remote()`. In previous versions of s2Member, the MailChimp® API required `allow_url_fopen = on` because it used the fsockopen method to communicate with the MailChimp® server. Removing this dependency on fsockopen, allows s2Member/WordPress® to work out the best method of communication; based on what the installation server has available.
|
s2member.php
CHANGED
@@ -9,9 +9,9 @@ along with this software. In the main directory, see: /licensing/
|
|
9 |
If not, see: <http://www.gnu.org/licenses/>.
|
10 |
*/
|
11 |
/*
|
12 |
-
Version: 3.0.
|
13 |
-
Stable tag: 3.0.
|
14 |
-
Framework: WS-P-2.
|
15 |
|
16 |
WordPress Compatible: yes
|
17 |
BuddyPress Compatible: yes
|
@@ -66,15 +66,15 @@ if (version_compare (PHP_VERSION, "5.2", ">=") && version_compare (get_bloginfo
|
|
66 |
/*
|
67 |
Else handle incompatibilities.
|
68 |
*/
|
69 |
-
else if (is_admin ()
|
70 |
{
|
71 |
if (!version_compare (PHP_VERSION, "5.2", ">="))
|
72 |
{
|
73 |
-
|
74 |
}
|
75 |
else if (!version_compare (get_bloginfo ("version"), "2.9.2", ">="))
|
76 |
{
|
77 |
-
|
78 |
}
|
79 |
}
|
80 |
?>
|
9 |
If not, see: <http://www.gnu.org/licenses/>.
|
10 |
*/
|
11 |
/*
|
12 |
+
Version: 3.0.2
|
13 |
+
Stable tag: 3.0.2
|
14 |
+
Framework: WS-P-2.3
|
15 |
|
16 |
WordPress Compatible: yes
|
17 |
BuddyPress Compatible: yes
|
66 |
/*
|
67 |
Else handle incompatibilities.
|
68 |
*/
|
69 |
+
else if (is_admin ()) /* Admin compatibility errors. */
|
70 |
{
|
71 |
if (!version_compare (PHP_VERSION, "5.2", ">="))
|
72 |
{
|
73 |
+
add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need PHP version 5.2 or higher to use the s2Member plugin.</p></div>\';'));
|
74 |
}
|
75 |
else if (!version_compare (get_bloginfo ("version"), "2.9.2", ">="))
|
76 |
{
|
77 |
+
add_action ("admin_notices", create_function ('', 'echo \'<div class="error fade"><p>You need WordPress® 2.9.2 or higher to use the s2Member plugin.</p></div>\';'));
|
78 |
}
|
79 |
}
|
80 |
?>
|