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

Version Description

Upgrade recommended. Two bugs fixed, and new Hook/Filter arguments. See Changelog for details.

Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 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

Files changed (39) hide show
  1. includes/functions/activate-deactivate.inc.php +5 -5
  2. includes/functions/admin-lockout.inc.php +3 -3
  3. includes/functions/admin-notices.inc.php +8 -8
  4. includes/functions/auto-eots.inc.php +18 -18
  5. includes/functions/catg-level-access.inc.php +4 -4
  6. includes/functions/constants.inc.php +6 -6
  7. includes/functions/email-configs.inc.php +6 -6
  8. includes/functions/file-download-access.inc.php +10 -10
  9. includes/functions/hide-some-systematics.inc.php +2 -2
  10. includes/functions/ip-restrictions.inc.php +5 -5
  11. includes/functions/is-systematic.inc.php +11 -11
  12. includes/functions/js-globals.inc.php +6 -6
  13. includes/functions/list-servers.inc.php +10 -2
  14. includes/functions/login-customizations.inc.php +7 -7
  15. includes/functions/login-redirection.inc.php +5 -5
  16. includes/functions/menu-pages.inc.php +41 -41
  17. includes/functions/nocache.inc.php +8 -8
  18. includes/functions/page-level-access.inc.php +4 -4
  19. includes/functions/paypal-notify.inc.php +35 -35
  20. includes/functions/paypal-return.inc.php +20 -20
  21. includes/functions/paypal-utilities.inc.php +13 -13
  22. includes/functions/post-level-access.inc.php +4 -4
  23. includes/functions/profile-modifications.inc.php +5 -5
  24. includes/functions/ptag-level-access.inc.php +4 -4
  25. includes/functions/readme-parsing.inc.php +6 -6
  26. includes/functions/register-access.inc.php +30 -30
  27. includes/functions/ruri-level-access.inc.php +6 -6
  28. includes/functions/shortcodes.inc.php +7 -7
  29. includes/functions/sp-access.inc.php +13 -13
  30. includes/functions/tracking-codes.inc.php +12 -12
  31. includes/functions/translations.inc.php +2 -2
  32. includes/functions/user-access-level.inc.php +7 -7
  33. includes/functions/user-deletions.inc.php +3 -3
  34. includes/functions/user-has-wp-role.inc.php +4 -4
  35. includes/functions/user-notes.inc.php +4 -4
  36. includes/functions/users-list.inc.php +10 -10
  37. includes/functions/utilities.inc.php +23 -4
  38. readme.txt +14 -5
  39. 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 here. */
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"); /* Give plugins a chance. */
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#x2F;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 WordPress® installation. */
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#x2F;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&amp;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&amp;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"); /* Custom redirections. */
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"); /* Purposely after the update. */
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, "/") . "#x2F;", $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, "/") . "#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+#x2F;", $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)#x2F;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])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?#x2F;", $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)#x2F;i", $paypal["txn_type"]) || (preg_match ("/^recurring_payment_profile_cancel#x2F;i", $paypal["txn_type"]) && preg_match ("/^failed#x2F;i", $paypal["initial_payment_status"])) || (preg_match ("/^new_case#x2F;i", $paypal["txn_type"]) && preg_match ("/^chargeback#x2F;i", $paypal["case_type"])) || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)#x2F;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])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+#x2F;", $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)#x2F;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])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9]+ [A-Z])?#x2F;", $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)#x2F;i", $paypal["txn_type"]) || (preg_match ("/^recurring_payment_profile_cancel#x2F;i", $paypal["txn_type"]) && preg_match ("/^failed#x2F;i", $paypal["initial_payment_status"])) || (preg_match ("/^new_case#x2F;i", $paypal["txn_type"]) && preg_match ("/^chargeback#x2F;i", $paypal["case_type"])) || (!$paypal["txn_type"] && preg_match ("/^(refunded|reversed)#x2F;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])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9,]+\:[0-9]+#x2F;", $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#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)([a-z_0-9,]+)?(\:)?([0-9] [A-Z])?#x2F;", $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