Version Description
- Integration instructions for iDevAffiliate and ShareASale are now available under:
s2Member -> API Tracking
. - Fixed a bug in the new Email Confirmation template for Single-Page Access. The replacement code: %%access_url%% has been changed to %%sp_access_url%%. This was a typo. The variable remains the same as it was, but the typo in the default template was corrected.
- Added a new replacement code to the Single-Page Email Confirmation template. See:
s2Member -> PayPal Options -> Single-Page
. The new replacement code is: %%sp_access_exp%%, indicating a human readable duration for link validity. - High priority bug fixed with s2Member Hook/Filter on Login Design. This bug was just introduced in v2.8.7. This bug was preventing a customized Login Design from being displayed properly. Corrected in v2.8.8.
- Bug fix in PayPal Button Generator. The modify="" parameter was being set to a value of "1" in some rare cases, depending on button configuration. It should always default to a value of "0", and only be set to a value of "1" or "2" whenever a Subscription Modification Button is being generated. This bug was introduced in v2.8.6. Corrected in v2.8.8.
Download this release
Release Info
Developer | PriMoThemes |
Plugin | ![]() |
Version | 2.8.8 |
Comparing to | |
See all releases |
Code changes from version 2.8.6 to 2.8.8
- images/idev-logo.gif +0 -0
- images/sas-logo.png +0 -0
- includes/functions/activate-deactivate.inc.php +10 -0
- includes/functions/admin-lockout.inc.php +6 -1
- includes/functions/admin-notices.inc.php +17 -1
- includes/functions/catg-level-access.inc.php +9 -1
- includes/functions/constants.inc.php +10 -2
- includes/functions/email-configs.inc.php +10 -2
- includes/functions/file-download-access.inc.php +113 -4
- includes/functions/hide-some-systematics.inc.php +5 -3
- includes/functions/is-systematic.inc.php +13 -11
- includes/functions/js-globals.inc.php +11 -1
- includes/functions/login-customizations.inc.php +29 -19
- includes/functions/login-redirection.inc.php +8 -2
- includes/functions/max-download-period.inc.php +0 -44
- includes/functions/menu-pages.inc.php +81 -2
- includes/functions/min-level-4-downloads.inc.php +0 -41
- includes/functions/nocache.inc.php +16 -0
- includes/functions/page-level-access.inc.php +9 -1
- includes/functions/paypal-notify.inc.php +63 -11
- includes/functions/paypal-postvars.inc.php +4 -2
- includes/functions/paypal-return.inc.php +38 -3
- includes/functions/post-level-access.inc.php +9 -1
- includes/functions/profile-modifications.inc.php +10 -0
- includes/functions/ptag-level-access.inc.php +9 -1
- includes/functions/readme-parsing.inc.php +10 -4
- includes/functions/register-access.inc.php +48 -10
- includes/functions/ruri-level-access.inc.php +10 -2
- includes/functions/shortcodes.inc.php +18 -5
- includes/functions/sp-access.inc.php +18 -10
- includes/functions/translations.inc.php +3 -1
- includes/functions/user-access-level.inc.php +17 -9
- includes/functions/user-deletions.inc.php +4 -0
- includes/functions/user-downloads.inc.php +0 -58
- includes/functions/users-list.inc.php +30 -10
- includes/menu-pages/api-ops.inc.php +10 -9
- includes/menu-pages/button.html +1 -1
- includes/menu-pages/buttons.inc.php +10 -10
- includes/menu-pages/code-samples/idev-signup-tracking-code.php +6 -0
- includes/menu-pages/code-samples/sas-signup-tracking-code.php +6 -0
- includes/menu-pages/menu-pages.js +6 -3
- includes/menu-pages/paypal-ops.inc.php +7 -4
- includes/menu-pages/scripting.inc.php +10 -0
- includes/menu-pages/sp-button.html +1 -1
- includes/menu-pages/sp-shortcode.html +1 -1
- includes/menu-pages/start.inc.php +3 -3
- includes/menu-pages/trk-ops.inc.php +30 -2
- includes/syscon.inc.php +1 -1
- readme.txt +13 -2
- s2member.php +2 -2
images/idev-logo.gif
ADDED
Binary file
|
images/sas-logo.png
ADDED
Binary file
|
includes/functions/activate-deactivate.inc.php
CHANGED
@@ -25,6 +25,8 @@ extra queries before they are set.
|
|
25 |
*/
|
26 |
function ws_plugin__s2member_activate ()
|
27 |
{
|
|
|
|
|
28 |
add_role ("s2member_level1", "s2Member Level 1");
|
29 |
add_role ("s2member_level2", "s2Member Level 2");
|
30 |
add_role ("s2member_level3", "s2Member Level 3");
|
@@ -121,6 +123,8 @@ function ws_plugin__s2member_activate ()
|
|
121 |
ws_plugin__s2member_enqueue_admin_notice ($notice, array ("plugins.php", "ws-plugin--s2member-options"));
|
122 |
}
|
123 |
/**/
|
|
|
|
|
124 |
return;
|
125 |
}
|
126 |
/*
|
@@ -130,6 +134,8 @@ ws_plugin__$plugin_key_deactivate() is called by our themes.
|
|
130 |
*/
|
131 |
function ws_plugin__s2member_deactivate ()
|
132 |
{
|
|
|
|
|
133 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["run_deactivation_routines"])
|
134 |
{
|
135 |
remove_role ("s2member_level1");
|
@@ -191,8 +197,12 @@ function ws_plugin__s2member_deactivate ()
|
|
191 |
delete_option ("ws_plugin__s2member_cache");
|
192 |
delete_option ("ws_plugin__s2member_notices");
|
193 |
delete_option ("ws_plugin__s2member_options");
|
|
|
|
|
194 |
}
|
195 |
/**/
|
|
|
|
|
196 |
return;
|
197 |
}
|
198 |
?>
|
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");
|
32 |
add_role ("s2member_level3", "s2Member Level 3");
|
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 |
}
|
130 |
/*
|
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 |
{
|
141 |
remove_role ("s2member_level1");
|
197 |
delete_option ("ws_plugin__s2member_cache");
|
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 |
}
|
208 |
?>
|
includes/functions/admin-lockout.inc.php
CHANGED
@@ -19,11 +19,16 @@ Attach to: add_action("admin_init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_admin_lockout ()
|
21 |
{
|
|
|
|
|
22 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"]/**/
|
23 |
&& !current_user_can ("edit_posts") /* In other words: Subscribers and Members. */
|
24 |
-
&&
|
|
|
25 |
exit;
|
26 |
/**/
|
|
|
|
|
27 |
return;
|
28 |
}
|
29 |
?>
|
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 |
}
|
34 |
?>
|
includes/functions/admin-notices.inc.php
CHANGED
@@ -18,6 +18,8 @@ Function displays an admin notice immediately.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FALSE)
|
20 |
{
|
|
|
|
|
21 |
if ($notice && $error) /* Special format for errors. */
|
22 |
{
|
23 |
echo '<div class="error fade"><p>' . $notice . '</p></div>';
|
@@ -27,6 +29,8 @@ function ws_plugin__s2member_display_admin_notice ($notice = FALSE, $error = FAL
|
|
27 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
28 |
}
|
29 |
/**/
|
|
|
|
|
30 |
return;
|
31 |
}
|
32 |
/*
|
@@ -34,15 +38,21 @@ Function that enqueues admin notices.
|
|
34 |
*/
|
35 |
function ws_plugin__s2member_enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE)
|
36 |
{
|
|
|
|
|
37 |
if ($notice && is_string ($notice)) /* If we have a valid string. */
|
38 |
{
|
39 |
$notices = (array)get_option ("ws_plugin__s2member_notices");
|
40 |
/**/
|
41 |
array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time));
|
42 |
/**/
|
|
|
|
|
43 |
update_option ("ws_plugin__s2member_notices", ws_plugin__s2member_array_unique ($notices));
|
44 |
}
|
45 |
/**/
|
|
|
|
|
46 |
return;
|
47 |
}
|
48 |
/*
|
@@ -53,6 +63,8 @@ function ws_plugin__s2member_admin_notices ()
|
|
53 |
{
|
54 |
global $pagenow; /* This holds the current page filename. */
|
55 |
/**/
|
|
|
|
|
56 |
if (is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
|
57 |
{
|
58 |
foreach ($notices as $key => $notice) /* Check time on each notice. */
|
@@ -68,11 +80,15 @@ function ws_plugin__s2member_admin_notices ()
|
|
68 |
}
|
69 |
}
|
70 |
/**/
|
71 |
-
|
|
|
|
|
72 |
/**/
|
73 |
update_option ("ws_plugin__s2member_notices", $notices);
|
74 |
}
|
75 |
/**/
|
|
|
|
|
76 |
return;
|
77 |
}
|
78 |
?>
|
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 |
{
|
25 |
echo '<div class="error fade"><p>' . $notice . '</p></div>';
|
29 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
30 |
}
|
31 |
/**/
|
32 |
+
do_action ("s2member_after_display_admin_notice");
|
33 |
+
/**/
|
34 |
return;
|
35 |
}
|
36 |
/*
|
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 |
{
|
45 |
$notices = (array)get_option ("ws_plugin__s2member_notices");
|
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 |
}
|
58 |
/*
|
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 |
{
|
70 |
foreach ($notices as $key => $notice) /* Check time on each notice. */
|
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 |
}
|
94 |
?>
|
includes/functions/catg-level-access.inc.php
CHANGED
@@ -21,7 +21,11 @@ function ws_plugin__s2member_check_catg_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
27 |
{
|
@@ -95,9 +99,13 @@ function ws_plugin__s2member_check_catg_level_access ()
|
|
95 |
else if (($level4_catgs = preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])) && (in_category ($level4_catgs, $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
96 |
exit;
|
97 |
}
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
/**/
|
|
|
|
|
101 |
return;
|
102 |
}
|
103 |
?>
|
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 |
{
|
30 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
31 |
{
|
99 |
else if (($level4_catgs = preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_catgs"])) && (in_category ($level4_catgs, $post_ID) || ws_plugin__s2member_in_descendant_category ($level4_catgs, $post_ID)) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
100 |
exit;
|
101 |
}
|
102 |
+
/**/
|
103 |
+
do_action ("s2member_during_check_catg_level_access");
|
104 |
}
|
105 |
}
|
106 |
/**/
|
107 |
+
do_action ("s2member_after_check_catg_level_access");
|
108 |
+
/**/
|
109 |
return;
|
110 |
}
|
111 |
?>
|
includes/functions/constants.inc.php
CHANGED
@@ -20,6 +20,8 @@ Attach to: add_action("init");
|
|
20 |
*/
|
21 |
function ws_plugin__s2member_constants ()
|
22 |
{
|
|
|
|
|
23 |
$links = ws_plugin__s2member_constant_links ();
|
24 |
$metas = ws_plugin__s2member_constant_metas ();
|
25 |
$level = ws_plugin__s2member_user_access_level ();
|
@@ -89,6 +91,8 @@ function ws_plugin__s2member_constants ()
|
|
89 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr" : "")); /* Auto-fills the on0 value in PayPal buttons. */
|
90 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* For the os0 value. */
|
91 |
/**/
|
|
|
|
|
92 |
return;
|
93 |
}
|
94 |
/*
|
@@ -99,6 +103,8 @@ forced to execute get_page_link() all the time, which piles up DB queries.
|
|
99 |
*/
|
100 |
function ws_plugin__s2member_constant_links ()
|
101 |
{
|
|
|
|
|
102 |
$cache_minutes = 15; /* Could be higher? */
|
103 |
/**/
|
104 |
$l["login_welcome_page"] = (string)"";
|
@@ -157,7 +163,7 @@ function ws_plugin__s2member_constant_links ()
|
|
157 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
158 |
}
|
159 |
/**/
|
160 |
-
return $l
|
161 |
}
|
162 |
/*
|
163 |
This function pulls all of the usermeta details needed for Constants.
|
@@ -167,6 +173,8 @@ function ws_plugin__s2member_constant_metas ()
|
|
167 |
{
|
168 |
global $wpdb; /* The global database object. */
|
169 |
/**/
|
|
|
|
|
170 |
$m["s2member_file_download_access_log"] = array ();
|
171 |
$m["s2member_custom_fields"] = array ();
|
172 |
$m["s2member_subscr_id"] = (string)"";
|
@@ -188,6 +196,6 @@ function ws_plugin__s2member_constant_metas ()
|
|
188 |
}
|
189 |
}
|
190 |
/**/
|
191 |
-
return $m
|
192 |
}
|
193 |
?>
|
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 ();
|
27 |
$level = ws_plugin__s2member_user_access_level ();
|
91 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr" : "")); /* Auto-fills the on0 value in PayPal buttons. */
|
92 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")); /* For the os0 value. */
|
93 |
/**/
|
94 |
+
do_action ("s2member_after_constants");
|
95 |
+
/**/
|
96 |
return;
|
97 |
}
|
98 |
/*
|
103 |
*/
|
104 |
function ws_plugin__s2member_constant_links ()
|
105 |
{
|
106 |
+
do_action ("s2member_before_constant_links");
|
107 |
+
/**/
|
108 |
$cache_minutes = 15; /* Could be higher? */
|
109 |
/**/
|
110 |
$l["login_welcome_page"] = (string)"";
|
163 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
164 |
}
|
165 |
/**/
|
166 |
+
return apply_filters ("s2member_constant_links", $l);
|
167 |
}
|
168 |
/*
|
169 |
This function pulls all of the usermeta details needed for Constants.
|
173 |
{
|
174 |
global $wpdb; /* The global database object. */
|
175 |
/**/
|
176 |
+
do_action ("s2member_before_constant_metas");
|
177 |
+
/**/
|
178 |
$m["s2member_file_download_access_log"] = array ();
|
179 |
$m["s2member_custom_fields"] = array ();
|
180 |
$m["s2member_subscr_id"] = (string)"";
|
196 |
}
|
197 |
}
|
198 |
/**/
|
199 |
+
return apply_filters ("s2member_constant_metas", $m);
|
200 |
}
|
201 |
?>
|
includes/functions/email-configs.inc.php
CHANGED
@@ -18,19 +18,27 @@ Functions that modify the email From: name/address.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_email_config ()
|
20 |
{
|
|
|
|
|
21 |
add_filter ("wp_mail_from", "_ws_plugin__s2member_email_config_email");
|
22 |
add_filter ("wp_mail_from_name", "_ws_plugin__s2member_email_config_name");
|
23 |
/**/
|
|
|
|
|
24 |
return;
|
25 |
}
|
26 |
/**/
|
27 |
function _ws_plugin__s2member_email_config_email ($email = FALSE)
|
28 |
{
|
29 |
-
|
|
|
|
|
30 |
}
|
31 |
/**/
|
32 |
function _ws_plugin__s2member_email_config_name ($name = FALSE)
|
33 |
{
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
?>
|
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 |
?>
|
includes/functions/file-download-access.inc.php
CHANGED
@@ -14,14 +14,119 @@ Direct access denial.
|
|
14 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
15 |
exit;
|
16 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
Function for handling download access permissions.
|
18 |
Attach to: add_action("init");
|
19 |
*/
|
20 |
function ws_plugin__s2member_check_file_download_access ()
|
21 |
{
|
22 |
-
|
|
|
|
|
23 |
{
|
24 |
-
|
|
|
|
|
25 |
{
|
26 |
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
|
27 |
/**/
|
@@ -49,13 +154,13 @@ function ws_plugin__s2member_check_file_download_access ()
|
|
49 |
exit;
|
50 |
/**/
|
51 |
$previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
|
52 |
-
$
|
53 |
$file_download_access_log = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
|
54 |
$file_download_access_arc = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_arc");
|
55 |
/**/
|
56 |
foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
|
57 |
{
|
58 |
-
if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $
|
59 |
{
|
60 |
unset ($file_download_access_log[$file_download_access_log_entry_key]);
|
61 |
$file_download_access_arc[] = $file_download_access_log_entry;
|
@@ -101,6 +206,8 @@ function ws_plugin__s2member_check_file_download_access ()
|
|
101 |
$mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream"; /* Lookup MIME type. */
|
102 |
/**/
|
103 |
$length = filesize ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]);
|
|
|
|
|
104 |
/*
|
105 |
Now send the file to the browser. Be sure to turn off output compression.
|
106 |
*/
|
@@ -120,5 +227,7 @@ function ws_plugin__s2member_check_file_download_access ()
|
|
120 |
/**/
|
121 |
exit;
|
122 |
}
|
|
|
|
|
123 |
}
|
124 |
?>
|
14 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
15 |
exit;
|
16 |
/*
|
17 |
+
Function determines the max period in days for download access.
|
18 |
+
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 |
+
{
|
26 |
+
$max = ($max < $days) ? $days : $max;
|
27 |
+
}
|
28 |
+
/**/
|
29 |
+
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
|
30 |
+
{
|
31 |
+
$max = ($max < $days) ? $days : $max;
|
32 |
+
}
|
33 |
+
/**/
|
34 |
+
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
|
35 |
+
{
|
36 |
+
$max = ($max < $days) ? $days : $max;
|
37 |
+
}
|
38 |
+
/**/
|
39 |
+
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
|
40 |
+
{
|
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.
|
48 |
+
Returns an array with 3 elements: allowed, allowed_days, currently.
|
49 |
+
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 |
+
{
|
57 |
+
if (current_user_can ("access_s2member_level1") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"])
|
58 |
+
{
|
59 |
+
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"];
|
60 |
+
$allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"];
|
61 |
+
}
|
62 |
+
/**/
|
63 |
+
if (current_user_can ("access_s2member_level2") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"])
|
64 |
+
{
|
65 |
+
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"];
|
66 |
+
$allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"];
|
67 |
+
}
|
68 |
+
/**/
|
69 |
+
if (current_user_can ("access_s2member_level3") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"])
|
70 |
+
{
|
71 |
+
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"];
|
72 |
+
$allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"];
|
73 |
+
}
|
74 |
+
/**/
|
75 |
+
if (current_user_can ("access_s2member_level4") && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"])
|
76 |
+
{
|
77 |
+
$allowed = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"];
|
78 |
+
$allowed_days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"];
|
79 |
+
}
|
80 |
+
/**/
|
81 |
+
$file_download_access_log = (isset ($log)) ? (array)$log : (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
|
82 |
+
foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
|
83 |
+
if (strtotime ($file_download_access_log_entry["date"]) >= strtotime ("-" . (int)$allowed_days . " days"))
|
84 |
+
if ($file_download_access_log_entry["file"] !== $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.
|
92 |
+
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 |
+
{
|
100 |
+
$file_download_access_is_allowed = $min_level_4_downloads = 1;
|
101 |
+
}
|
102 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
|
103 |
+
{
|
104 |
+
$file_download_access_is_allowed = $min_level_4_downloads = 2;
|
105 |
+
}
|
106 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
|
107 |
+
{
|
108 |
+
$file_download_access_is_allowed = $min_level_4_downloads = 3;
|
109 |
+
}
|
110 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
|
111 |
+
{
|
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.
|
119 |
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"]. */
|
128 |
+
/**/
|
129 |
+
if (!$excluded && (!$_GET["s2member_free_file_download_key"] || ws_plugin__s2member_xdecrypt ($_GET["s2member_free_file_download_key"]) !== $_GET["s2member_file_download"]))
|
130 |
{
|
131 |
$_GET["s2member_file_download"] = trim ($_GET["s2member_file_download"], "/");
|
132 |
/**/
|
154 |
exit;
|
155 |
/**/
|
156 |
$previous_file_downloads = 0; /* Here we're going to count how many downloads they've performed. */
|
157 |
+
$max_days_logged = ws_plugin__s2member_max_download_period (); /* The longest period in days. */
|
158 |
$file_download_access_log = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_log");
|
159 |
$file_download_access_arc = (array)get_usermeta ($current_user->ID, "s2member_file_download_access_arc");
|
160 |
/**/
|
161 |
foreach ($file_download_access_log as $file_download_access_log_entry_key => $file_download_access_log_entry)
|
162 |
{
|
163 |
+
if (strtotime ($file_download_access_log_entry["date"]) < strtotime ("-" . $max_days_logged . " days"))
|
164 |
{
|
165 |
unset ($file_download_access_log[$file_download_access_log_entry_key]);
|
166 |
$file_download_access_arc[] = $file_download_access_log_entry;
|
206 |
$mimetype = ($mimetypes[$extension]) ? $mimetypes[$extension] : "application/octet-stream"; /* Lookup MIME type. */
|
207 |
/**/
|
208 |
$length = filesize ($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] . "/" . $_GET["s2member_file_download"]);
|
209 |
+
/**/
|
210 |
+
do_action ("s2member_during_file_download_access"); /* Give plugins a chance. */
|
211 |
/*
|
212 |
Now send the file to the browser. Be sure to turn off output compression.
|
213 |
*/
|
227 |
/**/
|
228 |
exit;
|
229 |
}
|
230 |
+
/**/
|
231 |
+
do_action ("s2member_after_file_download_access");
|
232 |
}
|
233 |
?>
|
includes/functions/hide-some-systematics.inc.php
CHANGED
@@ -11,7 +11,7 @@ If not, see: <http://www.gnu.org/licenses/>.
|
|
11 |
/*
|
12 |
Direct access denial.
|
13 |
*/
|
14 |
-
if (realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
15 |
exit;
|
16 |
/*
|
17 |
Function that hides some of the systematic use pages.
|
@@ -21,11 +21,13 @@ function ws_plugin__s2member_hide_some_systematics ($where = FALSE)
|
|
21 |
{
|
22 |
global $wpdb; /* Need this to get the table name. */
|
23 |
/**/
|
24 |
-
|
|
|
|
|
25 |
{
|
26 |
$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"] . "')";
|
27 |
}
|
28 |
/**/
|
29 |
-
return $where
|
30 |
}
|
31 |
?>
|
11 |
/*
|
12 |
Direct access denial.
|
13 |
*/
|
14 |
+
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
15 |
exit;
|
16 |
/*
|
17 |
Function that hides some of the systematic use pages.
|
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 |
?>
|
includes/functions/is-systematic.inc.php
CHANGED
@@ -20,45 +20,47 @@ function ws_plugin__s2member_is_systematic_use_page ()
|
|
20 |
{
|
21 |
static $is_systematic; /* For optimization. */
|
22 |
/**/
|
23 |
-
|
|
|
|
|
24 |
{
|
25 |
-
return $is_systematic
|
26 |
}
|
27 |
else if (is_admin ()) /* In the admin area? */
|
28 |
{
|
29 |
-
return ($is_systematic = true
|
30 |
}
|
31 |
else if (preg_match ("/^cli#x2F;i", PHP_SAPI))
|
32 |
{
|
33 |
-
return ($is_systematic = true
|
34 |
}
|
35 |
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])
|
36 |
{
|
37 |
-
return ($is_systematic = true
|
38 |
}
|
39 |
else if (preg_match ("/\/wp-login\.php/", $_SERVER["REQUEST_URI"]))
|
40 |
{
|
41 |
-
return ($is_systematic = true
|
42 |
}
|
43 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
|
44 |
{
|
45 |
-
return ($is_systematic = true
|
46 |
}
|
47 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]))
|
48 |
{
|
49 |
-
return ($is_systematic = true
|
50 |
}
|
51 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"] && is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]))
|
52 |
{
|
53 |
-
return ($is_systematic = true
|
54 |
}
|
55 |
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"], "/")))
|
56 |
{
|
57 |
-
return ($is_systematic = true
|
58 |
}
|
59 |
else /* Otherwise, we return false. */
|
60 |
{
|
61 |
-
return ($is_systematic = false
|
62 |
}
|
63 |
}
|
64 |
?>
|
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 |
?>
|
includes/functions/js-globals.inc.php
CHANGED
@@ -21,6 +21,8 @@ Attach to: add_action("wp_print_scripts");
|
|
21 |
*/
|
22 |
function ws_plugin__s2member_add_js_w_globals ()
|
23 |
{
|
|
|
|
|
24 |
if (!is_admin ()) /* Not in the admin. */
|
25 |
{
|
26 |
if (is_user_logged_in ())
|
@@ -42,8 +44,12 @@ function ws_plugin__s2member_add_js_w_globals ()
|
|
42 |
{ /* This essentially creates 2 versions of the script. One while logged in & another when not. */
|
43 |
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"]);
|
44 |
}
|
|
|
|
|
45 |
}
|
46 |
/**/
|
|
|
|
|
47 |
return;
|
48 |
}
|
49 |
/*
|
@@ -52,6 +58,8 @@ Attach to: add_action("init");
|
|
52 |
*/
|
53 |
function ws_plugin__s2member_js_w_globals ()
|
54 |
{
|
|
|
|
|
55 |
if ($_GET["ws_plugin__s2member_js_w_globals"])
|
56 |
{
|
57 |
header ("Content-Type: text/javascript; charset=utf-8");
|
@@ -123,9 +131,11 @@ function ws_plugin__s2member_js_w_globals ()
|
|
123 |
$j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
|
124 |
$j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
|
125 |
/**/
|
126 |
-
echo $j
|
127 |
/**/
|
128 |
exit;
|
129 |
}
|
|
|
|
|
130 |
}
|
131 |
?>
|
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 |
{
|
28 |
if (is_user_logged_in ())
|
44 |
{ /* This essentially creates 2 versions of the script. One while logged in & another when not. */
|
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 |
}
|
55 |
/*
|
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 |
{
|
65 |
header ("Content-Type: text/javascript; charset=utf-8");
|
131 |
$j = file_get_contents (dirname (dirname (__FILE__)) . "/s2member-min.js");
|
132 |
$j = preg_replace ("/('|\")%%globals%%('|\");/", $g, $j);
|
133 |
/**/
|
134 |
+
echo apply_filters ("s2member_js_w_globals", $j);
|
135 |
/**/
|
136 |
exit;
|
137 |
}
|
138 |
+
/**/
|
139 |
+
do_action ("s2member_after_js_w_globals");
|
140 |
}
|
141 |
?>
|
includes/functions/login-customizations.inc.php
CHANGED
@@ -19,9 +19,11 @@ Attach to: add_filter("login_headerurl");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_login_header_url ($url = FALSE)
|
21 |
{
|
|
|
|
|
22 |
$url = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_url"];
|
23 |
/**/
|
24 |
-
return $url
|
25 |
}
|
26 |
/*
|
27 |
Function for filtering the login logo title.
|
@@ -29,9 +31,11 @@ Attach to: add_filter("login_headertitle");
|
|
29 |
*/
|
30 |
function ws_plugin__s2member_login_header_title ($title = FALSE)
|
31 |
{
|
|
|
|
|
32 |
$title = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_title"];
|
33 |
/**/
|
34 |
-
return $title
|
35 |
}
|
36 |
/*
|
37 |
Function for creating the styles for the login panel.
|
@@ -39,31 +43,37 @@ Attach to: add_action("login_head");
|
|
39 |
*/
|
40 |
function ws_plugin__s2member_login_header_styles ()
|
41 |
{
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
/**/
|
45 |
-
|
46 |
/**/
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
/**/
|
51 |
-
|
52 |
/**/
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
/**/
|
61 |
-
|
62 |
/**/
|
63 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
64 |
-
|
|
|
|
|
|
|
|
|
65 |
/**/
|
66 |
-
|
67 |
/**/
|
68 |
return;
|
69 |
}
|
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 |
*/
|
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 |
*/
|
44 |
function ws_plugin__s2member_login_header_styles ()
|
45 |
{
|
46 |
+
do_action ("s2member_before_login_header_styles");
|
47 |
+
/**/
|
48 |
+
$s = "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>' . "\n";
|
49 |
+
$s .= '<script type="text/javascript" src="' . get_bloginfo ("url") . '/?ws_plugin__s2member_js_w_globals=1&no-cache=' . urlencode (md5 (mt_rand ())) . '"></script>' . "\n";
|
50 |
/**/
|
51 |
+
$s .= "\n" . '<style type="text/css">' . "\n";
|
52 |
/**/
|
53 |
+
$s .= 'html, body { border: 0 !important; background: none !important; }' . "\n"; /* Clear borders & existing background. */
|
54 |
+
$s .= 'html { background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; }' . "\n";
|
55 |
+
$s .= 'html { background-image: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_image"] . ') !important; }' . "\n";
|
56 |
/**/
|
57 |
+
$s .= 'p#backtoblog a, p#backtoblog a:hover, p#backtoblog a:active, p#backtoblog a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; top: 15px !important; left: 15px !important; padding: 10px !important; border:1px solid #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; background-color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_color"] . ' !important; -moz-border-radius:3px !important; -webkit-border-radius:3px !important; border-radius:3px !important; }' . "\n";
|
58 |
/**/
|
59 |
+
$s .= 'div#login { width: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] . 'px !important; }' . "\n";
|
60 |
+
$s .= 'div#login h1 a { background: url(' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] . ') no-repeat top center !important; }' . "\n";
|
61 |
+
$s .= 'div#login h1 a { display: block !important; width: 100% !important; height: ' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_height"] . 'px !important; }' . "\n";
|
62 |
+
$s .= 'div#login p#nav, div#login p#nav a, div#login p#nav a:hover, div#login p#nav a:active, div#login p#nav a:focus { color: #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_color"] . ' !important; text-shadow: 1px 1px 3px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_text_shadow_color"] . ' !important; }' . "\n";
|
63 |
+
$s .= 'div#login form { -moz-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -webkit-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; -khtml-box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; box-shadow: 1px 1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ', -1px -1px 5px #' . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_background_box_shadow_color"] . ' !important; }' . "\n";
|
64 |
+
$s .= 'div#login form input[type="submit"], div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #333333 !important; border: 1px solid #666666 !important; background: #CCCCCC !important; padding: 5px !important; -moz-border-radius: 3px !important; -webkit-border-radius: 3px !important; -khtml-border-radius: 3px !important; border-radius: 3px !important; }' . "\n";
|
65 |
+
$s .= 'div#login form input[type="submit"]:hover, div#login form input[type="submit"]:active, div#login form input[type="submit"]:focus { color: #000000 !important; border: 1px solid #000000 !important; }' . "\n";
|
66 |
/**/
|
67 |
+
$s .= 'div#login form input.ws-plugin--s2member-custom-reg-field { background:none repeat scroll 0 0 #FBFBFB; border:1px solid #E5E5E5; font-size:24px; margin-bottom:16px; margin-right:6px; margin-top:2px; padding:3px; width:97%; }' . "\n";
|
68 |
/**/
|
69 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_password"])
|
70 |
+
$s .= 'p#reg_passmail { display: none; }' . "\n";
|
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 |
}
|
includes/functions/login-redirection.inc.php
CHANGED
@@ -22,10 +22,14 @@ function ws_plugin__s2member_login_redirect ()
|
|
22 |
/* Note that current_user_can() will not work here because the cookie was just set. */
|
23 |
global $user; /* Available during the login routine just before wp_login is hooked in. */
|
24 |
/**/
|
25 |
-
|
26 |
/**/
|
27 |
-
|
|
|
|
|
28 |
{
|
|
|
|
|
29 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"])
|
30 |
wp_redirect ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]);
|
31 |
/**/
|
@@ -35,6 +39,8 @@ function ws_plugin__s2member_login_redirect ()
|
|
35 |
exit;
|
36 |
}
|
37 |
/**/
|
|
|
|
|
38 |
return;
|
39 |
}
|
40 |
?>
|
22 |
/* Note that current_user_can() will not work here because the cookie was just set. */
|
23 |
global $user; /* Available during the login routine just before wp_login is hooked in. */
|
24 |
/**/
|
25 |
+
do_action ("s2member_before_login_redirect");
|
26 |
/**/
|
27 |
+
$uzer = new WP_User ($user->ID); /* Now lets get a user object to check Capabilities. */
|
28 |
+
/**/
|
29 |
+
if (!$uzer->has_cap ("edit_posts")) /* In other words, all Subscribers & Members. */
|
30 |
{
|
31 |
+
do_action ("s2member_during_login_redirect");
|
32 |
+
/**/
|
33 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"])
|
34 |
wp_redirect ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]);
|
35 |
/**/
|
39 |
exit;
|
40 |
}
|
41 |
/**/
|
42 |
+
do_action ("s2member_after_login_redirect");
|
43 |
+
/**/
|
44 |
return;
|
45 |
}
|
46 |
?>
|
includes/functions/max-download-period.inc.php
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
|
4 |
-
<mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
|
5 |
-
|
6 |
-
Released under the terms of the GNU General Public License.
|
7 |
-
You should have received a copy of the GNU General Public License,
|
8 |
-
along with this software. In the main directory, see: /licensing/
|
9 |
-
If not, see: <http://www.gnu.org/licenses/>.
|
10 |
-
*/
|
11 |
-
/*
|
12 |
-
Direct access denial.
|
13 |
-
*/
|
14 |
-
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
15 |
-
exit;
|
16 |
-
/*
|
17 |
-
Function determines the maximum period in days for download access.
|
18 |
-
Returns number of days, where 0 means no access to files has been allowed.
|
19 |
-
*/
|
20 |
-
function ws_plugin__s2member_maximum_download_period ()
|
21 |
-
{
|
22 |
-
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
23 |
-
{
|
24 |
-
$maximum = ($maximum < $days) ? $days : $maximum;
|
25 |
-
}
|
26 |
-
/**/
|
27 |
-
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
|
28 |
-
{
|
29 |
-
$maximum = ($maximum < $days) ? $days : $maximum;
|
30 |
-
}
|
31 |
-
/**/
|
32 |
-
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
|
33 |
-
{
|
34 |
-
$maximum = ($maximum < $days) ? $days : $maximum;
|
35 |
-
}
|
36 |
-
/**/
|
37 |
-
if ($days = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
|
38 |
-
{
|
39 |
-
$maximum = ($maximum < $days) ? $days : $maximum;
|
40 |
-
}
|
41 |
-
/**/
|
42 |
-
return ($maximum > 365) ? 365 : (int)$maximum;
|
43 |
-
}
|
44 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions/menu-pages.inc.php
CHANGED
@@ -18,6 +18,8 @@ Function for saving all options from any page.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_update_all_options ()
|
20 |
{
|
|
|
|
|
21 |
if (($nonce = $_POST["ws_plugin__s2member_options_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-options-save"))
|
22 |
{
|
23 |
$options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
|
@@ -46,9 +48,14 @@ function ws_plugin__s2member_update_all_options ()
|
|
46 |
/**/
|
47 |
update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
|
48 |
/**/
|
|
|
|
|
|
|
49 |
ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>'); /* Display admin notice. */
|
50 |
}
|
51 |
/**/
|
|
|
|
|
52 |
return;
|
53 |
}
|
54 |
/*
|
@@ -57,6 +64,8 @@ Attach to: add_action("admin_menu");
|
|
57 |
*/
|
58 |
function ws_plugin__s2member_add_admin_options ()
|
59 |
{
|
|
|
|
|
60 |
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
|
61 |
/**/
|
62 |
add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
|
@@ -71,6 +80,8 @@ function ws_plugin__s2member_add_admin_options ()
|
|
71 |
add_submenu_page ("ws-plugin--s2member-start", "s2Member API / Scripting", "API / Scripting", "edit_plugins", "ws-plugin--s2member-scripting", "ws_plugin__s2member_scripting_page");
|
72 |
add_submenu_page ("ws-plugin--s2member-start", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
|
73 |
/**/
|
|
|
|
|
74 |
return;
|
75 |
}
|
76 |
/*
|
@@ -78,13 +89,17 @@ A sort of callback function to add the settings link.
|
|
78 |
*/
|
79 |
function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
|
80 |
{
|
|
|
|
|
81 |
if (preg_match ("/" . preg_quote ($file, "/") . "#x2F;", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
|
82 |
{
|
83 |
$settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
|
84 |
-
array_unshift ($links, $settings
|
|
|
|
|
85 |
}
|
86 |
/**/
|
87 |
-
return $links
|
88 |
}
|
89 |
/*
|
90 |
Add scripts to admin panels.
|
@@ -92,14 +107,20 @@ Attach to: add_action("admin_print_scripts");
|
|
92 |
*/
|
93 |
function ws_plugin__s2member_add_admin_scripts ()
|
94 |
{
|
|
|
|
|
95 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
96 |
{
|
97 |
wp_enqueue_script ("jquery");
|
98 |
wp_enqueue_script ("thickbox");
|
99 |
wp_enqueue_script ("media-upload");
|
100 |
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"]);
|
|
|
|
|
101 |
}
|
102 |
/**/
|
|
|
|
|
103 |
return;
|
104 |
}
|
105 |
/*
|
@@ -108,12 +129,18 @@ Attach to: add_action("admin_print_styles");
|
|
108 |
*/
|
109 |
function ws_plugin__s2member_add_admin_styles ()
|
110 |
{
|
|
|
|
|
111 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
112 |
{
|
113 |
wp_enqueue_style ("thickbox");
|
114 |
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");
|
|
|
|
|
115 |
}
|
116 |
/**/
|
|
|
|
|
117 |
return;
|
118 |
}
|
119 |
/*
|
@@ -122,6 +149,8 @@ Attach to: add_action("init");
|
|
122 |
*/
|
123 |
function ws_plugin__s2member_menu_pages_js ()
|
124 |
{
|
|
|
|
|
125 |
if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
126 |
{
|
127 |
header ("Content-Type: text/javascript; charset=utf-8");
|
@@ -135,8 +164,12 @@ function ws_plugin__s2member_menu_pages_js ()
|
|
135 |
/**/
|
136 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
|
137 |
/**/
|
|
|
|
|
138 |
exit;
|
139 |
}
|
|
|
|
|
140 |
}
|
141 |
/*
|
142 |
Function that outputs the CSS for menu pages.
|
@@ -144,6 +177,8 @@ Attach to: add_action("init");
|
|
144 |
*/
|
145 |
function ws_plugin__s2member_menu_pages_css ()
|
146 |
{
|
|
|
|
|
147 |
if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
148 |
{
|
149 |
header ("Content-Type: text/css; charset=utf-8");
|
@@ -157,16 +192,24 @@ function ws_plugin__s2member_menu_pages_css ()
|
|
157 |
/**/
|
158 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
|
159 |
/**/
|
|
|
|
|
160 |
exit;
|
161 |
}
|
|
|
|
|
162 |
}
|
163 |
/*
|
164 |
Function for building and handling the Quick Start page.
|
165 |
*/
|
166 |
function ws_plugin__s2member_start_page ()
|
167 |
{
|
|
|
|
|
168 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
|
169 |
/**/
|
|
|
|
|
170 |
return;
|
171 |
}
|
172 |
/*
|
@@ -174,10 +217,14 @@ Function for building and handling the General Options page.
|
|
174 |
*/
|
175 |
function ws_plugin__s2member_options_page ()
|
176 |
{
|
|
|
|
|
177 |
ws_plugin__s2member_update_all_options ();
|
178 |
/**/
|
179 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
|
180 |
/**/
|
|
|
|
|
181 |
return;
|
182 |
}
|
183 |
/*
|
@@ -185,6 +232,8 @@ Function for building and handling the Paypal Options page.
|
|
185 |
*/
|
186 |
function ws_plugin__s2member_paypal_ops_page ()
|
187 |
{
|
|
|
|
|
188 |
ws_plugin__s2member_update_all_options ();
|
189 |
/**/
|
190 |
$logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
|
@@ -214,6 +263,8 @@ function ws_plugin__s2member_paypal_ops_page ()
|
|
214 |
/**/
|
215 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
|
216 |
/**/
|
|
|
|
|
217 |
return;
|
218 |
}
|
219 |
/*
|
@@ -221,6 +272,8 @@ Function for building and handling the Download Options page.
|
|
221 |
*/
|
222 |
function ws_plugin__s2member_down_ops_page ()
|
223 |
{
|
|
|
|
|
224 |
ws_plugin__s2member_update_all_options ();
|
225 |
/**/
|
226 |
$files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
|
@@ -244,6 +297,8 @@ function ws_plugin__s2member_down_ops_page ()
|
|
244 |
/**/
|
245 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
|
246 |
/**/
|
|
|
|
|
247 |
return;
|
248 |
}
|
249 |
/*
|
@@ -251,10 +306,14 @@ Function for building and handling the API Tracking options page.
|
|
251 |
*/
|
252 |
function ws_plugin__s2member_trk_ops_page ()
|
253 |
{
|
|
|
|
|
254 |
ws_plugin__s2member_update_all_options ();
|
255 |
/**/
|
256 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
|
257 |
/**/
|
|
|
|
|
258 |
return;
|
259 |
}
|
260 |
/*
|
@@ -262,10 +321,14 @@ Function for building and handling the API List Server options page.
|
|
262 |
*/
|
263 |
function ws_plugin__s2member_els_ops_page ()
|
264 |
{
|
|
|
|
|
265 |
ws_plugin__s2member_update_all_options ();
|
266 |
/**/
|
267 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
|
268 |
/**/
|
|
|
|
|
269 |
return;
|
270 |
}
|
271 |
/*
|
@@ -273,10 +336,14 @@ Function for building and handling the API Notifications page.
|
|
273 |
*/
|
274 |
function ws_plugin__s2member_api_ops_page ()
|
275 |
{
|
|
|
|
|
276 |
ws_plugin__s2member_update_all_options ();
|
277 |
/**/
|
278 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
|
279 |
/**/
|
|
|
|
|
280 |
return;
|
281 |
}
|
282 |
/*
|
@@ -284,8 +351,12 @@ Function for building the PayPal Button Generator page.
|
|
284 |
*/
|
285 |
function ws_plugin__s2member_buttons_page ()
|
286 |
{
|
|
|
|
|
287 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
|
288 |
/**/
|
|
|
|
|
289 |
return;
|
290 |
}
|
291 |
/*
|
@@ -293,8 +364,12 @@ Function for building the API Scripting page.
|
|
293 |
*/
|
294 |
function ws_plugin__s2member_scripting_page ()
|
295 |
{
|
|
|
|
|
296 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
|
297 |
/**/
|
|
|
|
|
298 |
return;
|
299 |
}
|
300 |
/*
|
@@ -302,8 +377,12 @@ Function for building the s2Member Info page.
|
|
302 |
*/
|
303 |
function ws_plugin__s2member_info_page ()
|
304 |
{
|
|
|
|
|
305 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
|
306 |
/**/
|
|
|
|
|
307 |
return;
|
308 |
}
|
309 |
?>
|
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 |
{
|
25 |
$options = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]; /* Get current options. */
|
48 |
/**/
|
49 |
update_option ("ws_plugin__s2member_options", $options) . update_option ("ws_plugin__s2member_cache", array ());
|
50 |
/**/
|
51 |
+
do_action ("s2member_during_update_all_options"); /* Purposely after the update. */
|
52 |
+
/* If you need to save custom options, please save them into a separate option key of your own. */
|
53 |
+
/**/
|
54 |
ws_plugin__s2member_display_admin_notice ('<strong>Options saved.</strong>'); /* Display admin notice. */
|
55 |
}
|
56 |
/**/
|
57 |
+
do_action ("s2member_after_update_all_options");
|
58 |
+
/**/
|
59 |
return;
|
60 |
}
|
61 |
/*
|
64 |
*/
|
65 |
function ws_plugin__s2member_add_admin_options ()
|
66 |
{
|
67 |
+
do_action ("s2member_before_add_admin_options");
|
68 |
+
/**/
|
69 |
add_filter ("plugin_action_links", "_ws_plugin__s2member_add_settings_link", 10, 2);
|
70 |
/**/
|
71 |
add_menu_page ("s2Member Options", "s2Member", "edit_plugins", "ws-plugin--s2member-start", "ws_plugin__s2member_start_page");
|
80 |
add_submenu_page ("ws-plugin--s2member-start", "s2Member API / Scripting", "API / Scripting", "edit_plugins", "ws-plugin--s2member-scripting", "ws_plugin__s2member_scripting_page");
|
81 |
add_submenu_page ("ws-plugin--s2member-start", "s2Member Information", "s2Member Info", "edit_plugins", "ws-plugin--s2member-info", "ws_plugin__s2member_info_page");
|
82 |
/**/
|
83 |
+
do_action ("s2member_after_add_admin_options");
|
84 |
+
/**/
|
85 |
return;
|
86 |
}
|
87 |
/*
|
89 |
*/
|
90 |
function _ws_plugin__s2member_add_settings_link ($links = array (), $file = "")
|
91 |
{
|
92 |
+
do_action ("s2member_before_add_settings_link");
|
93 |
+
/**/
|
94 |
if (preg_match ("/" . preg_quote ($file, "/") . "#x2F;", $GLOBALS["WS_PLUGIN__"]["s2member"]["l"]) && is_array ($links))
|
95 |
{
|
96 |
$settings = '<a href="admin.php?page=ws-plugin--s2member-options">Settings</a>';
|
97 |
+
array_unshift ($links, apply_filters ("s2member_add_settings_link", $settings));
|
98 |
+
/**/
|
99 |
+
do_action ("s2member_during_add_settings_link");
|
100 |
}
|
101 |
/**/
|
102 |
+
return apply_filters ("s2member_add_settings_link", $links);
|
103 |
}
|
104 |
/*
|
105 |
Add scripts to admin panels.
|
107 |
*/
|
108 |
function ws_plugin__s2member_add_admin_scripts ()
|
109 |
{
|
110 |
+
do_action ("s2member_before_add_admin_scripts");
|
111 |
+
/**/
|
112 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
113 |
{
|
114 |
wp_enqueue_script ("jquery");
|
115 |
wp_enqueue_script ("thickbox");
|
116 |
wp_enqueue_script ("media-upload");
|
117 |
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"]);
|
118 |
+
/**/
|
119 |
+
do_action ("s2member_during_add_admin_scripts");
|
120 |
}
|
121 |
/**/
|
122 |
+
do_action ("s2member_after_add_admin_scripts");
|
123 |
+
/**/
|
124 |
return;
|
125 |
}
|
126 |
/*
|
129 |
*/
|
130 |
function ws_plugin__s2member_add_admin_styles ()
|
131 |
{
|
132 |
+
do_action ("s2member_before_add_admin_styles");
|
133 |
+
/**/
|
134 |
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
|
135 |
{
|
136 |
wp_enqueue_style ("thickbox");
|
137 |
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");
|
138 |
+
/**/
|
139 |
+
do_action ("s2member_during_add_admin_styles");
|
140 |
}
|
141 |
/**/
|
142 |
+
do_action ("s2member_after_add_admin_styles");
|
143 |
+
/**/
|
144 |
return;
|
145 |
}
|
146 |
/*
|
149 |
*/
|
150 |
function ws_plugin__s2member_menu_pages_js ()
|
151 |
{
|
152 |
+
do_action ("s2member_before_menu_pages_js");
|
153 |
+
/**/
|
154 |
if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
155 |
{
|
156 |
header ("Content-Type: text/javascript; charset=utf-8");
|
164 |
/**/
|
165 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.js";
|
166 |
/**/
|
167 |
+
do_action ("s2member_during_menu_pages_js");
|
168 |
+
/**/
|
169 |
exit;
|
170 |
}
|
171 |
+
/**/
|
172 |
+
do_action ("s2member_after_menu_pages_js");
|
173 |
}
|
174 |
/*
|
175 |
Function that outputs the CSS for menu pages.
|
177 |
*/
|
178 |
function ws_plugin__s2member_menu_pages_css ()
|
179 |
{
|
180 |
+
do_action ("s2member_before_menu_pages_css");
|
181 |
+
/**/
|
182 |
if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("edit_plugins"))
|
183 |
{
|
184 |
header ("Content-Type: text/css; charset=utf-8");
|
192 |
/**/
|
193 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
|
194 |
/**/
|
195 |
+
do_action ("s2member_during_menu_pages_css");
|
196 |
+
/**/
|
197 |
exit;
|
198 |
}
|
199 |
+
/**/
|
200 |
+
do_action ("s2member_after_menu_pages_css");
|
201 |
}
|
202 |
/*
|
203 |
Function for building and handling the Quick Start page.
|
204 |
*/
|
205 |
function ws_plugin__s2member_start_page ()
|
206 |
{
|
207 |
+
do_action ("s2member_before_start_page");
|
208 |
+
/**/
|
209 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/start.inc.php";
|
210 |
/**/
|
211 |
+
do_action ("s2member_after_start_page");
|
212 |
+
/**/
|
213 |
return;
|
214 |
}
|
215 |
/*
|
217 |
*/
|
218 |
function ws_plugin__s2member_options_page ()
|
219 |
{
|
220 |
+
do_action ("s2member_before_options_page");
|
221 |
+
/**/
|
222 |
ws_plugin__s2member_update_all_options ();
|
223 |
/**/
|
224 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/options.inc.php";
|
225 |
/**/
|
226 |
+
do_action ("s2member_after_options_page");
|
227 |
+
/**/
|
228 |
return;
|
229 |
}
|
230 |
/*
|
232 |
*/
|
233 |
function ws_plugin__s2member_paypal_ops_page ()
|
234 |
{
|
235 |
+
do_action ("s2member_before_paypal_ops_page");
|
236 |
+
/**/
|
237 |
ws_plugin__s2member_update_all_options ();
|
238 |
/**/
|
239 |
$logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"];
|
263 |
/**/
|
264 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/paypal-ops.inc.php";
|
265 |
/**/
|
266 |
+
do_action ("s2member_after_paypal_ops_page");
|
267 |
+
/**/
|
268 |
return;
|
269 |
}
|
270 |
/*
|
272 |
*/
|
273 |
function ws_plugin__s2member_down_ops_page ()
|
274 |
{
|
275 |
+
do_action ("s2member_before_down_ops_page");
|
276 |
+
/**/
|
277 |
ws_plugin__s2member_update_all_options ();
|
278 |
/**/
|
279 |
$files_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"];
|
297 |
/**/
|
298 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/down-ops.inc.php";
|
299 |
/**/
|
300 |
+
do_action ("s2member_after_down_ops_page");
|
301 |
+
/**/
|
302 |
return;
|
303 |
}
|
304 |
/*
|
306 |
*/
|
307 |
function ws_plugin__s2member_trk_ops_page ()
|
308 |
{
|
309 |
+
do_action ("s2member_before_trk_ops_page");
|
310 |
+
/**/
|
311 |
ws_plugin__s2member_update_all_options ();
|
312 |
/**/
|
313 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/trk-ops.inc.php";
|
314 |
/**/
|
315 |
+
do_action ("s2member_after_trk_ops_page");
|
316 |
+
/**/
|
317 |
return;
|
318 |
}
|
319 |
/*
|
321 |
*/
|
322 |
function ws_plugin__s2member_els_ops_page ()
|
323 |
{
|
324 |
+
do_action ("s2member_before_els_ops_page");
|
325 |
+
/**/
|
326 |
ws_plugin__s2member_update_all_options ();
|
327 |
/**/
|
328 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/els-ops.inc.php";
|
329 |
/**/
|
330 |
+
do_action ("s2member_after_els_ops_page");
|
331 |
+
/**/
|
332 |
return;
|
333 |
}
|
334 |
/*
|
336 |
*/
|
337 |
function ws_plugin__s2member_api_ops_page ()
|
338 |
{
|
339 |
+
do_action ("s2member_before_api_ops_page");
|
340 |
+
/**/
|
341 |
ws_plugin__s2member_update_all_options ();
|
342 |
/**/
|
343 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/api-ops.inc.php";
|
344 |
/**/
|
345 |
+
do_action ("s2member_after_api_ops_page");
|
346 |
+
/**/
|
347 |
return;
|
348 |
}
|
349 |
/*
|
351 |
*/
|
352 |
function ws_plugin__s2member_buttons_page ()
|
353 |
{
|
354 |
+
do_action ("s2member_before_buttons_page");
|
355 |
+
/**/
|
356 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/buttons.inc.php";
|
357 |
/**/
|
358 |
+
do_action ("s2member_after_buttons_page");
|
359 |
+
/**/
|
360 |
return;
|
361 |
}
|
362 |
/*
|
364 |
*/
|
365 |
function ws_plugin__s2member_scripting_page ()
|
366 |
{
|
367 |
+
do_action ("s2member_before_scripting_page");
|
368 |
+
/**/
|
369 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/scripting.inc.php";
|
370 |
/**/
|
371 |
+
do_action ("s2member_after_scripting_page");
|
372 |
+
/**/
|
373 |
return;
|
374 |
}
|
375 |
/*
|
377 |
*/
|
378 |
function ws_plugin__s2member_info_page ()
|
379 |
{
|
380 |
+
do_action ("s2member_before_info_page");
|
381 |
+
/**/
|
382 |
include_once dirname (dirname (__FILE__)) . "/menu-pages/info.inc.php";
|
383 |
/**/
|
384 |
+
do_action ("s2member_after_info_page");
|
385 |
+
/**/
|
386 |
return;
|
387 |
}
|
388 |
?>
|
includes/functions/min-level-4-downloads.inc.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
|
4 |
-
<mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
|
5 |
-
|
6 |
-
Released under the terms of the GNU General Public License.
|
7 |
-
You should have received a copy of the GNU General Public License,
|
8 |
-
along with this software. In the main directory, see: /licensing/
|
9 |
-
If not, see: <http://www.gnu.org/licenses/>.
|
10 |
-
*/
|
11 |
-
/*
|
12 |
-
Direct access denial.
|
13 |
-
*/
|
14 |
-
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
15 |
-
exit;
|
16 |
-
/*
|
17 |
-
Function determines the minimum level required for file download access.
|
18 |
-
Returns 0-4, where 0 means no access to file downloads has been allowed.
|
19 |
-
*/
|
20 |
-
function ws_plugin__s2member_min_level_4_downloads ()
|
21 |
-
{
|
22 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_file_downloads_allowed_days"])
|
23 |
-
{
|
24 |
-
$file_download_access_is_allowed = $minimum_level_required_to_download_files = 1;
|
25 |
-
}
|
26 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level2_file_downloads_allowed_days"])
|
27 |
-
{
|
28 |
-
$file_download_access_is_allowed = $minimum_level_required_to_download_files = 2;
|
29 |
-
}
|
30 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level3_file_downloads_allowed_days"])
|
31 |
-
{
|
32 |
-
$file_download_access_is_allowed = $minimum_level_required_to_download_files = 3;
|
33 |
-
}
|
34 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_file_downloads_allowed_days"])
|
35 |
-
{
|
36 |
-
$file_download_access_is_allowed = $minimum_level_required_to_download_files = 4;
|
37 |
-
}
|
38 |
-
/**/
|
39 |
-
return (int)$minimum_level_required_to_download_files;
|
40 |
-
}
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions/nocache.inc.php
CHANGED
@@ -20,8 +20,12 @@ Attach to: add_action("init");
|
|
20 |
*/
|
21 |
function ws_plugin__s2member_nocache ()
|
22 |
{
|
|
|
|
|
23 |
ws_plugin__s2member_nocache_constants () . ws_plugin__s2member_nocache_headers ();
|
24 |
/**/
|
|
|
|
|
25 |
return;
|
26 |
}
|
27 |
/*
|
@@ -49,11 +53,17 @@ These additional supplemental routines, include:
|
|
49 |
*/
|
50 |
function ws_plugin__s2member_nocache_constants ($nocache = FALSE) /* Always obey the Quick Cache plugin. */
|
51 |
{
|
|
|
|
|
52 |
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"], "/")))))
|
53 |
{
|
54 |
define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
|
|
|
|
|
55 |
}
|
56 |
/**/
|
|
|
|
|
57 |
return;
|
58 |
}
|
59 |
/*
|
@@ -64,6 +74,8 @@ This is compatible with the Quick Cache parameter ?qcABC=1 as well.
|
|
64 |
*/
|
65 |
function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
66 |
{
|
|
|
|
|
67 |
if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
|
68 |
{
|
69 |
if (is_array ($headers = headers_list ()))
|
@@ -73,8 +85,12 @@ function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
|
73 |
/**/
|
74 |
if (!$no_cache_already_sent)
|
75 |
nocache_headers ();
|
|
|
|
|
76 |
}
|
77 |
/**/
|
|
|
|
|
78 |
return;
|
79 |
}
|
80 |
?>
|
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 |
}
|
31 |
/*
|
53 |
*/
|
54 |
function ws_plugin__s2member_nocache_constants ($nocache = FALSE) /* Always obey the Quick Cache plugin. */
|
55 |
{
|
56 |
+
do_action ("s2member_before_nocache_constants");
|
57 |
+
/**/
|
58 |
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"], "/")))))
|
59 |
{
|
60 |
define ("QUICK_CACHE_ALLOWED", false) . define ("DONOTCACHEPAGE", true);
|
61 |
+
/**/
|
62 |
+
do_action ("s2member_during_nocache_constants");
|
63 |
}
|
64 |
/**/
|
65 |
+
do_action ("s2member_after_nocache_constants");
|
66 |
+
/**/
|
67 |
return;
|
68 |
}
|
69 |
/*
|
74 |
*/
|
75 |
function ws_plugin__s2member_nocache_headers () /* Cache-Control header. */
|
76 |
{
|
77 |
+
do_action ("s2member_before_nocache_headers");
|
78 |
+
/**/
|
79 |
if (!$_GET["qcABC"]) /* Always obey the Quick Cache plugin. */
|
80 |
{
|
81 |
if (is_array ($headers = headers_list ()))
|
85 |
/**/
|
86 |
if (!$no_cache_already_sent)
|
87 |
nocache_headers ();
|
88 |
+
/**/
|
89 |
+
do_action ("s2member_during_nocache_headers");
|
90 |
}
|
91 |
/**/
|
92 |
+
do_action ("s2member_after_nocache_headers");
|
93 |
+
/**/
|
94 |
return;
|
95 |
}
|
96 |
?>
|
includes/functions/page-level-access.inc.php
CHANGED
@@ -21,7 +21,11 @@ function ws_plugin__s2member_check_page_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
$current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
|
27 |
/**/
|
@@ -57,8 +61,12 @@ function ws_plugin__s2member_check_page_level_access ()
|
|
57 |
/**/
|
58 |
else if (in_array ($page_ID, preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_sp_req=" . urlencode ($page_ID))) !== "nill")
|
59 |
exit;
|
|
|
|
|
60 |
}
|
61 |
/**/
|
|
|
|
|
62 |
return;
|
63 |
}
|
64 |
?>
|
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 |
{
|
30 |
$current_user = (is_user_logged_in ()) ? wp_get_current_user () : false;
|
31 |
/**/
|
61 |
/**/
|
62 |
else if (in_array ($page_ID, preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_pages"])) && ws_plugin__s2member_nocache_constants () !== "nill" && !ws_plugin__s2member_sp_access ($page_ID) && !ws_plugin__s2member_is_systematic_use_page () && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_sp_req=" . urlencode ($page_ID))) !== "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 |
}
|
72 |
?>
|
includes/functions/paypal-notify.inc.php
CHANGED
@@ -19,6 +19,8 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_notify ()
|
21 |
{
|
|
|
|
|
22 |
if ($_GET["s2member_paypal_notify"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
|
23 |
{
|
24 |
global $wpdb; /* Need this global variable as a reference to the database object. */
|
@@ -34,16 +36,21 @@ function ws_plugin__s2member_paypal_notify ()
|
|
34 |
/*
|
35 |
Single-Page Access.
|
36 |
*/
|
37 |
-
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["txn_id"] && preg_match ("/^sp\:[0-9]+#x2F;", $paypal["item_number"]))
|
38 |
{
|
|
|
|
|
39 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Single-Page access.";
|
40 |
/**/
|
41 |
-
list (, $paypal["page"]) = preg_split ("/\:/", $paypal["item_number"],
|
42 |
/**/
|
43 |
-
if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["page"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
44 |
{
|
45 |
$sbj = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_page_email_subject"]);
|
|
|
|
|
46 |
$msg = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_page_email_message"]);
|
|
|
47 |
/**/
|
48 |
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $sbj)))
|
49 |
if (($sbj = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $sbj))) /* Full amount of the payment, before fee is subtracted. */
|
@@ -71,24 +78,31 @@ function ws_plugin__s2member_paypal_notify ()
|
|
71 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) as $url)
|
72 |
/**/
|
73 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", rawurlencode ($sp_access_url), $url)))
|
74 |
-
if (($url = preg_replace ("/%%
|
75 |
-
if (($url = preg_replace ("/%%
|
76 |
-
if (($url = preg_replace ("/%%
|
77 |
-
if (($url = preg_replace ("/%%
|
78 |
-
if (($url = preg_replace ("/%%
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
82 |
/**/
|
83 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
84 |
}
|
|
|
|
|
85 |
}
|
|
|
|
|
86 |
}
|
87 |
/*
|
88 |
New subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
89 |
*/
|
90 |
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](\:|$)/", $paypal["item_number"]))
|
91 |
{
|
|
|
|
|
92 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
|
93 |
/**/
|
94 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -99,6 +113,8 @@ function ws_plugin__s2member_paypal_notify ()
|
|
99 |
/* 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
|
100 |
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 their existing account. */
|
101 |
{
|
|
|
|
|
102 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
|
103 |
/**/
|
104 |
/* Here we need to check for both the old & new s2member_subscr_id's, just in case the Return routine has already changed it. */
|
@@ -124,6 +140,8 @@ function ws_plugin__s2member_paypal_notify ()
|
|
124 |
delete_usermeta ($user_id, "s2member_file_download_access_log");
|
125 |
/**/
|
126 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
|
|
|
|
127 |
}
|
128 |
else
|
129 |
{
|
@@ -134,12 +152,16 @@ function ws_plugin__s2member_paypal_notify ()
|
|
134 |
{
|
135 |
$paypal["s2member_log"][] = "Unable to modify subscription. Could not find existing subscription in the DB. Please check the on0 and os0 variables in your Button Code.";
|
136 |
}
|
|
|
|
|
137 |
}
|
138 |
/*
|
139 |
New subscription. Normal subscription signup, we are not updating anything for a past subscription.
|
140 |
*/
|
141 |
else /* Else this is a normal subscription signup, we are not updating anything for a past subscription. */
|
142 |
{
|
|
|
|
|
143 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
|
144 |
/**/
|
145 |
if ($registration_url = ws_plugin__s2member_register_link_gen ($paypal["subscr_id"], $paypal["custom"], $paypal["item_number"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
@@ -181,7 +203,11 @@ function ws_plugin__s2member_paypal_notify ()
|
|
181 |
/**/
|
182 |
$paypal["s2member_log"][] = "Email sent after signup, with a URL to assist Customer w/ registration.";
|
183 |
}
|
|
|
|
|
184 |
}
|
|
|
|
|
185 |
}
|
186 |
/**/
|
187 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
@@ -213,12 +239,16 @@ function ws_plugin__s2member_paypal_notify ()
|
|
213 |
/**/
|
214 |
$paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
|
215 |
}
|
|
|
|
|
216 |
}
|
217 |
/*
|
218 |
Subscription modifications.
|
219 |
*/
|
220 |
else if (preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
221 |
{
|
|
|
|
|
222 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
223 |
/**/
|
224 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -244,6 +274,8 @@ function ws_plugin__s2member_paypal_notify ()
|
|
244 |
delete_usermeta ($user_id, "s2member_file_download_access_log");
|
245 |
/**/
|
246 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on subscription modification.";
|
|
|
|
|
247 |
}
|
248 |
else
|
249 |
{
|
@@ -254,12 +286,16 @@ function ws_plugin__s2member_paypal_notify ()
|
|
254 |
{
|
255 |
$paypal["s2member_log"][] = "Unable to modify subscription. Could not find existing subscription in the DB.";
|
256 |
}
|
|
|
|
|
257 |
}
|
258 |
/*
|
259 |
Subscription payments.
|
260 |
*/
|
261 |
else if (preg_match ("/^subscr_payment#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]) && $paypal["txn_id"] && $paypal["mc_gross"])
|
262 |
{
|
|
|
|
|
263 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
|
264 |
/**/
|
265 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -280,12 +316,16 @@ function ws_plugin__s2member_paypal_notify ()
|
|
280 |
/**/
|
281 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
282 |
}
|
|
|
|
|
283 |
}
|
284 |
/*
|
285 |
Subscription terminations.
|
286 |
*/
|
287 |
else if ((preg_match ("/^subscr_eot#x2F;i", $paypal["txn_type"]) || preg_match ("/^(refunded|reversed)#x2F;i", $paypal["payment_status"])) && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["parent_txn_id"])) && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
288 |
{
|
|
|
|
|
289 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_eot - or - payment_status (refunded|reversed).";
|
290 |
/**/
|
291 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -324,6 +364,8 @@ function ws_plugin__s2member_paypal_notify ()
|
|
324 |
/**/
|
325 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
326 |
}
|
|
|
|
|
327 |
}
|
328 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
329 |
{
|
@@ -333,7 +375,11 @@ function ws_plugin__s2member_paypal_notify ()
|
|
333 |
$paypal["s2member_log"][] = "The Member's account has been deleted completely.";
|
334 |
/**/
|
335 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
|
|
|
|
336 |
}
|
|
|
|
|
337 |
}
|
338 |
else
|
339 |
{
|
@@ -364,6 +410,8 @@ function ws_plugin__s2member_paypal_notify ()
|
|
364 |
{
|
365 |
$paypal["s2member_log"][] = "Unable to (demote|delete) Member. Could not find existing subscription in the DB. It's possible that it was already removed manually by a site administrator.";
|
366 |
}
|
|
|
|
|
367 |
}
|
368 |
else
|
369 |
{
|
@@ -388,7 +436,11 @@ function ws_plugin__s2member_paypal_notify ()
|
|
388 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
389 |
file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
390 |
/**/
|
|
|
|
|
391 |
exit;
|
392 |
}
|
|
|
|
|
393 |
}
|
394 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_notify ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_paypal_notify");
|
23 |
+
/**/
|
24 |
if ($_GET["s2member_paypal_notify"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"])
|
25 |
{
|
26 |
global $wpdb; /* Need this global variable as a reference to the database object. */
|
36 |
/*
|
37 |
Single-Page Access.
|
38 |
*/
|
39 |
+
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"]))
|
40 |
{
|
41 |
+
do_action ("s2member_during_paypal_notify_before_sp_access");
|
42 |
+
/**/
|
43 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Single-Page access.";
|
44 |
/**/
|
45 |
+
list (, $paypal["page"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
|
46 |
/**/
|
47 |
+
if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["page"], $paypal["hours"])) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
48 |
{
|
49 |
$sbj = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_page_email_subject"]);
|
50 |
+
$sbj = preg_replace ("/%%sp_access_exp%%/i", human_time_diff (strtotime ("now"), strtotime ("+" . $paypal["hours"] . " hours")), $sbj);
|
51 |
+
/**/
|
52 |
$msg = preg_replace ("/%%sp_access_url%%/i", $sp_access_url, $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["single_page_email_message"]);
|
53 |
+
$msg = preg_replace ("/%%sp_access_exp%%/i", human_time_diff (strtotime ("now"), strtotime ("+" . $paypal["hours"] . " hours")), $msg);
|
54 |
/**/
|
55 |
if (($sbj = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $sbj)) && ($sbj = preg_replace ("/%%txn_id%%/i", $paypal["txn_id"], $sbj)))
|
56 |
if (($sbj = preg_replace ("/%%amount%%/i", $paypal["mc_gross"], $sbj))) /* Full amount of the payment, before fee is subtracted. */
|
78 |
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sp_notification_urls"]) as $url)
|
79 |
/**/
|
80 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%sp_access_url%%/i", rawurlencode ($sp_access_url), $url)))
|
81 |
+
if (($url = preg_replace ("/%%sp_access_exp%%/i", urlencode (human_time_diff (strtotime ("now"), strtotime ("+" . $paypal["hours"] . " hours"))), $url)))
|
82 |
+
if (($url = preg_replace ("/%%amount%%/i", urlencode ($paypal["mc_gross"]), $url)) && ($url = preg_replace ("/%%txn_id%%/i", urlencode ($paypal["txn_id"]), $url)))
|
83 |
+
if (($url = preg_replace ("/%%item_number%%/i", urlencode ($paypal["item_number"]), $url)) && ($url = preg_replace ("/%%item_name%%/i", urlencode ($paypal["item_name"]), $url)))
|
84 |
+
if (($url = preg_replace ("/%%first_name%%/i", urlencode ($paypal["first_name"]), $url)) && ($url = preg_replace ("/%%last_name%%/i", urlencode ($paypal["last_name"]), $url)))
|
85 |
+
if (($url = preg_replace ("/%%full_name%%/i", urlencode (trim ($paypal["first_name"] . " " . $paypal["last_name"])), $url)))
|
86 |
+
if (($url = preg_replace ("/%%payer_email%%/i", urlencode ($paypal["payer_email"]), $url)))
|
87 |
+
/**/
|
88 |
+
if (($url = trim ($url))) /* Make sure it is not empty. */
|
89 |
+
ws_plugin__s2member_curlpsr ($url, "s2member=1");
|
90 |
/**/
|
91 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
92 |
}
|
93 |
+
/**/
|
94 |
+
do_action ("s2member_during_paypal_notify_during_sp_access");
|
95 |
}
|
96 |
+
/**/
|
97 |
+
do_action ("s2member_during_paypal_notify_after_sp_access");
|
98 |
}
|
99 |
/*
|
100 |
New subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
101 |
*/
|
102 |
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](\:|$)/", $paypal["item_number"]))
|
103 |
{
|
104 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup");
|
105 |
+
/**/
|
106 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup).";
|
107 |
/**/
|
108 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
113 |
/* 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
|
114 |
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 their existing account. */
|
115 |
{
|
116 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup_w_update_vars");
|
117 |
+
/**/
|
118 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/ update vars.";
|
119 |
/**/
|
120 |
/* Here we need to check for both the old & new s2member_subscr_id's, just in case the Return routine has already changed it. */
|
140 |
delete_usermeta ($user_id, "s2member_file_download_access_log");
|
141 |
/**/
|
142 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
143 |
+
/**/
|
144 |
+
do_action ("s2member_during_paypal_notify_during_subscr_signup_w_update_vars");
|
145 |
}
|
146 |
else
|
147 |
{
|
152 |
{
|
153 |
$paypal["s2member_log"][] = "Unable to modify subscription. Could not find existing subscription in the DB. Please check the on0 and os0 variables in your Button Code.";
|
154 |
}
|
155 |
+
/**/
|
156 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup_w_update_vars");
|
157 |
}
|
158 |
/*
|
159 |
New subscription. Normal subscription signup, we are not updating anything for a past subscription.
|
160 |
*/
|
161 |
else /* Else this is a normal subscription signup, we are not updating anything for a past subscription. */
|
162 |
{
|
163 |
+
do_action ("s2member_during_paypal_notify_before_subscr_signup_wo_update_vars");
|
164 |
+
/**/
|
165 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup) w/o update vars.";
|
166 |
/**/
|
167 |
if ($registration_url = ws_plugin__s2member_register_link_gen ($paypal["subscr_id"], $paypal["custom"], $paypal["item_number"]) && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
203 |
/**/
|
204 |
$paypal["s2member_log"][] = "Email sent after signup, with a URL to assist Customer w/ registration.";
|
205 |
}
|
206 |
+
/**/
|
207 |
+
do_action ("s2member_during_paypal_notify_during_subscr_signup_wo_update_vars");
|
208 |
}
|
209 |
+
/**/
|
210 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup_wo_update_vars");
|
211 |
}
|
212 |
/**/
|
213 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["signup_notification_urls"] && is_array ($cv = preg_split ("/\|/", $paypal["custom"])))
|
239 |
/**/
|
240 |
$paypal["s2member_log"][] = "Signup Notification URLs have been processed.";
|
241 |
}
|
242 |
+
/**/
|
243 |
+
do_action ("s2member_during_paypal_notify_after_subscr_signup");
|
244 |
}
|
245 |
/*
|
246 |
Subscription modifications.
|
247 |
*/
|
248 |
else if (preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
249 |
{
|
250 |
+
do_action ("s2member_during_paypal_notify_before_subscr_modify");
|
251 |
+
/**/
|
252 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
253 |
/**/
|
254 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
274 |
delete_usermeta ($user_id, "s2member_file_download_access_log");
|
275 |
/**/
|
276 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on subscription modification.";
|
277 |
+
/**/
|
278 |
+
do_action ("s2member_during_paypal_notify_during_subscr_modify");
|
279 |
}
|
280 |
else
|
281 |
{
|
286 |
{
|
287 |
$paypal["s2member_log"][] = "Unable to modify subscription. Could not find existing subscription in the DB.";
|
288 |
}
|
289 |
+
/**/
|
290 |
+
do_action ("s2member_during_paypal_notify_after_subscr_modify");
|
291 |
}
|
292 |
/*
|
293 |
Subscription payments.
|
294 |
*/
|
295 |
else if (preg_match ("/^subscr_payment#x2F;i", $paypal["txn_type"]) && $paypal["payer_email"] && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]) && $paypal["txn_id"] && $paypal["mc_gross"])
|
296 |
{
|
297 |
+
do_action ("s2member_during_paypal_notify_before_subscr_payment");
|
298 |
+
/**/
|
299 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_payment.";
|
300 |
/**/
|
301 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
316 |
/**/
|
317 |
$paypal["s2member_log"][] = "Payment Notification URLs have been processed.";
|
318 |
}
|
319 |
+
/**/
|
320 |
+
do_action ("s2member_during_paypal_notify_after_subscr_payment");
|
321 |
}
|
322 |
/*
|
323 |
Subscription terminations.
|
324 |
*/
|
325 |
else if ((preg_match ("/^subscr_eot#x2F;i", $paypal["txn_type"]) || preg_match ("/^(refunded|reversed)#x2F;i", $paypal["payment_status"])) && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["parent_txn_id"])) && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
326 |
{
|
327 |
+
do_action ("s2member_during_paypal_notify_before_subscr_eot");
|
328 |
+
/**/
|
329 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_eot - or - payment_status (refunded|reversed).";
|
330 |
/**/
|
331 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
364 |
/**/
|
365 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
366 |
}
|
367 |
+
/**/
|
368 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_demote");
|
369 |
}
|
370 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
371 |
{
|
375 |
$paypal["s2member_log"][] = "The Member's account has been deleted completely.";
|
376 |
/**/
|
377 |
$paypal["s2member_log"][] = "EOT/Deletion Notification URLs have been processed.";
|
378 |
+
/**/
|
379 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot_delete");
|
380 |
}
|
381 |
+
/**/
|
382 |
+
do_action ("s2member_during_paypal_notify_during_subscr_eot");
|
383 |
}
|
384 |
else
|
385 |
{
|
410 |
{
|
411 |
$paypal["s2member_log"][] = "Unable to (demote|delete) Member. Could not find existing subscription in the DB. It's possible that it was already removed manually by a site administrator.";
|
412 |
}
|
413 |
+
/**/
|
414 |
+
do_action ("s2member_during_paypal_notify_after_subscr_eot");
|
415 |
}
|
416 |
else
|
417 |
{
|
436 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
437 |
file_put_contents ($logs_dir . "/paypal-ipn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
438 |
/**/
|
439 |
+
do_action ("s2member_during_paypal_notify");
|
440 |
+
/**/
|
441 |
exit;
|
442 |
}
|
443 |
+
/**/
|
444 |
+
do_action ("s2member_after_paypal_notify");
|
445 |
}
|
446 |
?>
|
includes/functions/paypal-postvars.inc.php
CHANGED
@@ -18,6 +18,8 @@ Get post vars from paypal, verify and return array.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_paypal_postvars ()
|
20 |
{
|
|
|
|
|
21 |
if ($_GET["tx"]) /* PDT with Auto-Return. */
|
22 |
{
|
23 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"])
|
@@ -38,7 +40,7 @@ function ws_plugin__s2member_paypal_postvars ()
|
|
38 |
$postvars[$key] = trim (stripslashes (urldecode ($value)));
|
39 |
}
|
40 |
/**/
|
41 |
-
return $postvars
|
42 |
}
|
43 |
}
|
44 |
/**/
|
@@ -58,7 +60,7 @@ function ws_plugin__s2member_paypal_postvars ()
|
|
58 |
/**/
|
59 |
if (strtolower (trim (ws_plugin__s2member_curlpsr ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
|
60 |
{
|
61 |
-
return $postvars
|
62 |
}
|
63 |
/**/
|
64 |
return false;
|
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 |
{
|
25 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"])
|
40 |
$postvars[$key] = trim (stripslashes (urldecode ($value)));
|
41 |
}
|
42 |
/**/
|
43 |
+
return apply_filters ("s2member_paypal_postvars", $postvars);
|
44 |
}
|
45 |
}
|
46 |
/**/
|
60 |
/**/
|
61 |
if (strtolower (trim (ws_plugin__s2member_curlpsr ("https://" . $endpoint . "/cgi-bin/webscr", $postback))) === "verified")
|
62 |
{
|
63 |
+
return apply_filters ("s2member_paypal_postvars", $postvars);
|
64 |
}
|
65 |
/**/
|
66 |
return false;
|
includes/functions/paypal-return.inc.php
CHANGED
@@ -19,6 +19,8 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_return ()
|
21 |
{
|
|
|
|
|
22 |
/* Note: Auto-Return with PDT does not send anything when subscriptions are modified.
|
23 |
Therefore, we need to be sure that we always send a thank you message here by default,
|
24 |
and then we'll just leave the rest of the modification up to the IPN handler instead. */
|
@@ -37,14 +39,18 @@ function ws_plugin__s2member_paypal_return ()
|
|
37 |
/*
|
38 |
Single-Page Access.
|
39 |
*/
|
40 |
-
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9]+#x2F;", $paypal["item_number"]))
|
41 |
{
|
|
|
|
|
42 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Single-Page access.";
|
43 |
/**/
|
44 |
-
list (, $paypal["page"]) = preg_split ("/\:/", $paypal["item_number"],
|
45 |
/**/
|
46 |
-
if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["page"], false)))
|
47 |
{
|
|
|
|
|
48 |
header ("Location: " . $sp_access_url);
|
49 |
}
|
50 |
else /* Otherwise, the page ID must have been invalid. Or it's possible that the Page was deleted. */
|
@@ -58,6 +64,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
58 |
/**/
|
59 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
|
60 |
}
|
|
|
|
|
61 |
}
|
62 |
/*
|
63 |
New subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
@@ -65,6 +73,9 @@ function ws_plugin__s2member_paypal_return ()
|
|
65 |
else if (preg_match ("/^(web_accept|subscr_signup|subscr_payment)#x2F;i", $paypal["txn_type"]) && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
66 |
{ /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
|
67 |
So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
|
|
|
|
|
|
|
68 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
|
69 |
/**/
|
70 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -75,6 +86,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
75 |
/* 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
|
76 |
modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the existing account. */
|
77 |
{
|
|
|
|
|
78 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
|
79 |
/**/
|
80 |
/* Here we need to check for both the old & new s2member_subscr_id's, just in case the IPN routine has already changed it. */
|
@@ -101,6 +114,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
101 |
/**/
|
102 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
103 |
/**/
|
|
|
|
|
104 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
|
105 |
echo '<html xmlns="http://www.w3.org/1999/xhtml" ', language_attributes (), '>' . "\n";
|
106 |
echo '<head profile="http://gmpg.org/xfn/11">' . "\n";
|
@@ -175,12 +190,16 @@ function ws_plugin__s2member_paypal_return ()
|
|
175 |
/**/
|
176 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
|
177 |
}
|
|
|
|
|
178 |
}
|
179 |
/*
|
180 |
New subscription. Normal subscription signup, we are not updating anything for a past subscription.
|
181 |
*/
|
182 |
else /* Else this is a normal subscription signup, we are not updating anything for a past subscription. */
|
183 |
{
|
|
|
|
|
184 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
185 |
/**/
|
186 |
setcookie ("s2member_subscr_id", $paypal["subscr_id"], time () + 31556926, "/");
|
@@ -189,6 +208,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
189 |
/**/
|
190 |
$paypal["s2member_log"][] = "s2Member cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
191 |
/**/
|
|
|
|
|
192 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
|
193 |
echo '<html xmlns="http://www.w3.org/1999/xhtml" ', language_attributes (), '>' . "\n";
|
194 |
echo '<head profile="http://gmpg.org/xfn/11">' . "\n";
|
@@ -239,13 +260,19 @@ function ws_plugin__s2member_paypal_return ()
|
|
239 |
/**/
|
240 |
echo '</body>' . "\n";
|
241 |
echo '</html>';
|
|
|
|
|
242 |
}
|
|
|
|
|
243 |
}
|
244 |
/*
|
245 |
Subscription modifications.
|
246 |
*/
|
247 |
else if (preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
248 |
{
|
|
|
|
|
249 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
250 |
/**/
|
251 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
@@ -272,6 +299,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
272 |
/**/
|
273 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on subscription modification.";
|
274 |
/**/
|
|
|
|
|
275 |
echo '<script type="text/javascript">' . "\n";
|
276 |
echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
|
277 |
echo "window.location = '" . esc_js (wp_login_url ()) . "';";
|
@@ -302,6 +331,8 @@ function ws_plugin__s2member_paypal_return ()
|
|
302 |
/**/
|
303 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
|
304 |
}
|
|
|
|
|
305 |
}
|
306 |
else
|
307 |
{
|
@@ -347,7 +378,11 @@ function ws_plugin__s2member_paypal_return ()
|
|
347 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
348 |
file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
349 |
/**/
|
|
|
|
|
350 |
exit;
|
351 |
}
|
|
|
|
|
352 |
}
|
353 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_paypal_return ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_paypal_return");
|
23 |
+
/**/
|
24 |
/* Note: Auto-Return with PDT does not send anything when subscriptions are modified.
|
25 |
Therefore, we need to be sure that we always send a thank you message here by default,
|
26 |
and then we'll just leave the rest of the modification up to the IPN handler instead. */
|
39 |
/*
|
40 |
Single-Page Access.
|
41 |
*/
|
42 |
+
if (preg_match ("/^web_accept#x2F;i", $paypal["txn_type"]) && $paypal["txn_id"] && preg_match ("/^sp\:[0-9]+\:[0-9]+#x2F;", $paypal["item_number"]))
|
43 |
{
|
44 |
+
do_action ("s2member_during_paypal_return_before_sp_access");
|
45 |
+
/**/
|
46 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept) for Single-Page access.";
|
47 |
/**/
|
48 |
+
list (, $paypal["page"], $paypal["hours"]) = preg_split ("/\:/", $paypal["item_number"], 3);
|
49 |
/**/
|
50 |
+
if (($sp_access_url = ws_plugin__s2member_sp_access_link_gen ($paypal["page"], $paypal["hours"], false)))
|
51 |
{
|
52 |
+
do_action ("s2member_during_paypal_return_during_sp_access");
|
53 |
+
/**/
|
54 |
header ("Location: " . $sp_access_url);
|
55 |
}
|
56 |
else /* Otherwise, the page ID must have been invalid. Or it's possible that the Page was deleted. */
|
64 |
/**/
|
65 |
$paypal["s2member_log"][] = "Redirecting Customer to the Home Page, due to an error that occurred.";
|
66 |
}
|
67 |
+
/**/
|
68 |
+
do_action ("s2member_during_paypal_return_after_sp_access");
|
69 |
}
|
70 |
/*
|
71 |
New subscriptions. Possibly containing advanced updated vars ( option_name1, option_selection1 ); which allow account modifications.
|
73 |
else if (preg_match ("/^(web_accept|subscr_signup|subscr_payment)#x2F;i", $paypal["txn_type"]) && ($paypal["subscr_id"] || ($paypal["subscr_id"] = $paypal["txn_id"])) && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
74 |
{ /* With Auto-Return/PDT, PayPal will send subscr_payment instead of subscr_signup to the return URL.
|
75 |
So we need to look for (web_accept|subscr_signup|subscr_payment), and treat them as the same. */
|
76 |
+
/**/
|
77 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup");
|
78 |
+
/**/
|
79 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).";
|
80 |
/**/
|
81 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
86 |
/* 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
|
87 |
modify=2 parameter to be used in those scenarios, because technically there is nothing to update. The only thing to be updated is the existing account. */
|
88 |
{
|
89 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup_w_update_vars");
|
90 |
+
/**/
|
91 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/ update vars.";
|
92 |
/**/
|
93 |
/* Here we need to check for both the old & new s2member_subscr_id's, just in case the IPN routine has already changed it. */
|
114 |
/**/
|
115 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated w/ advanced update routines.";
|
116 |
/**/
|
117 |
+
do_action ("s2member_during_paypal_return_during_subscr_signup_w_update_vars");
|
118 |
+
/**/
|
119 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
|
120 |
echo '<html xmlns="http://www.w3.org/1999/xhtml" ', language_attributes (), '>' . "\n";
|
121 |
echo '<head profile="http://gmpg.org/xfn/11">' . "\n";
|
190 |
/**/
|
191 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
|
192 |
}
|
193 |
+
/**/
|
194 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup_w_update_vars");
|
195 |
}
|
196 |
/*
|
197 |
New subscription. Normal subscription signup, we are not updating anything for a past subscription.
|
198 |
*/
|
199 |
else /* Else this is a normal subscription signup, we are not updating anything for a past subscription. */
|
200 |
{
|
201 |
+
do_action ("s2member_during_paypal_return_before_subscr_signup_wo_update_vars");
|
202 |
+
/**/
|
203 |
$paypal["s2member_log"][] = "s2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
204 |
/**/
|
205 |
setcookie ("s2member_subscr_id", $paypal["subscr_id"], time () + 31556926, "/");
|
208 |
/**/
|
209 |
$paypal["s2member_log"][] = "s2Member cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.";
|
210 |
/**/
|
211 |
+
do_action ("s2member_during_paypal_return_during_subscr_signup_wo_update_vars");
|
212 |
+
/**/
|
213 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
|
214 |
echo '<html xmlns="http://www.w3.org/1999/xhtml" ', language_attributes (), '>' . "\n";
|
215 |
echo '<head profile="http://gmpg.org/xfn/11">' . "\n";
|
260 |
/**/
|
261 |
echo '</body>' . "\n";
|
262 |
echo '</html>';
|
263 |
+
/**/
|
264 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup_wo_update_vars");
|
265 |
}
|
266 |
+
/**/
|
267 |
+
do_action ("s2member_during_paypal_return_after_subscr_signup");
|
268 |
}
|
269 |
/*
|
270 |
Subscription modifications.
|
271 |
*/
|
272 |
else if (preg_match ("/^subscr_modify#x2F;i", $paypal["txn_type"]) && $paypal["subscr_id"] && preg_match ("/^[1-4](\:|$)/", $paypal["item_number"]))
|
273 |
{
|
274 |
+
do_action ("s2member_during_paypal_return_before_subscr_modify");
|
275 |
+
/**/
|
276 |
$paypal["s2member_log"][] = "s2Member txn_type identified as subscr_modify.";
|
277 |
/**/
|
278 |
list ($paypal["level"], $paypal["ccaps"]) = preg_split ("/\:/", $paypal["item_number"], 2);
|
299 |
/**/
|
300 |
$paypal["s2member_log"][] = "s2Member Level/Capabilities updated on subscription modification.";
|
301 |
/**/
|
302 |
+
do_action ("s2member_during_paypal_return_during_subscr_modify");
|
303 |
+
/**/
|
304 |
echo '<script type="text/javascript">' . "\n";
|
305 |
echo "alert('Thank You! Your membership has been updated to:\\n\\n" . esc_js ($paypal["item_name"]) . "\\n\\nYou\\'ll need to log back in now.');" . "\n";
|
306 |
echo "window.location = '" . esc_js (wp_login_url ()) . "';";
|
331 |
/**/
|
332 |
$paypal["s2member_log"][] = "Redirecting Customer to the Login Page, due to an error that occurred.";
|
333 |
}
|
334 |
+
/**/
|
335 |
+
do_action ("s2member_during_paypal_return_after_subscr_modify");
|
336 |
}
|
337 |
else
|
338 |
{
|
378 |
if (is_writable ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
|
379 |
file_put_contents ($logs_dir . "/paypal-rtn.log", var_export ($paypal, true) . "\n\n", FILE_APPEND);
|
380 |
/**/
|
381 |
+
do_action ("s2member_during_paypal_return");
|
382 |
+
/**/
|
383 |
exit;
|
384 |
}
|
385 |
+
/**/
|
386 |
+
do_action ("s2member_after_paypal_return");
|
387 |
}
|
388 |
?>
|
includes/functions/post-level-access.inc.php
CHANGED
@@ -21,7 +21,11 @@ function ws_plugin__s2member_check_post_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
27 |
{
|
@@ -50,9 +54,13 @@ function ws_plugin__s2member_check_post_level_access ()
|
|
50 |
/**/
|
51 |
else if (in_array ($post_ID, preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
52 |
exit;
|
|
|
|
|
53 |
}
|
54 |
}
|
55 |
/**/
|
|
|
|
|
56 |
return;
|
57 |
}
|
58 |
?>
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_post_level_access");
|
25 |
+
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_post_level_access_excluded", false);
|
27 |
+
/**/
|
28 |
+
if (!$excluded && is_single () && !is_page () && is_object ($post) && ($post_ID = $post->ID))
|
29 |
{
|
30 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
31 |
{
|
54 |
/**/
|
55 |
else if (in_array ($post_ID, preg_split ("/,/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_posts"])) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
56 |
exit;
|
57 |
+
/**/
|
58 |
+
do_action ("s2member_during_check_post_level_access");
|
59 |
}
|
60 |
}
|
61 |
/**/
|
62 |
+
do_action ("s2member_after_check_post_level_access");
|
63 |
+
/**/
|
64 |
return;
|
65 |
}
|
66 |
?>
|
includes/functions/profile-modifications.inc.php
CHANGED
@@ -19,6 +19,8 @@ Attach to: add_action("init");
|
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_profile_modifications ()
|
21 |
{
|
|
|
|
|
22 |
if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
23 |
{
|
24 |
if (($nonce = $_POST["ws_plugin__s2member_profile_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-profile-save"))
|
@@ -54,6 +56,8 @@ function ws_plugin__s2member_handle_profile_modifications ()
|
|
54 |
/**/
|
55 |
update_usermeta ($user_id, "s2member_custom_fields", $fields);
|
56 |
/**/
|
|
|
|
|
57 |
echo '<script type="text/javascript">' . "\n";
|
58 |
echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
59 |
echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
@@ -63,11 +67,17 @@ function ws_plugin__s2member_handle_profile_modifications ()
|
|
63 |
exit;
|
64 |
}
|
65 |
/**/
|
|
|
|
|
66 |
include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
|
67 |
/**/
|
|
|
|
|
68 |
exit;
|
69 |
}
|
70 |
/**/
|
|
|
|
|
71 |
return;
|
72 |
}
|
73 |
?>
|
19 |
*/
|
20 |
function ws_plugin__s2member_handle_profile_modifications ()
|
21 |
{
|
22 |
+
do_action ("s2member_before_handle_profile_modifications");
|
23 |
+
/**/
|
24 |
if ($_GET["s2member_profile"] && ($current_user = (is_user_logged_in ()) ? wp_get_current_user () : false))
|
25 |
{
|
26 |
if (($nonce = $_POST["ws_plugin__s2member_profile_save"]) && wp_verify_nonce ($nonce, "ws-plugin--s2member-profile-save"))
|
56 |
/**/
|
57 |
update_usermeta ($user_id, "s2member_custom_fields", $fields);
|
58 |
/**/
|
59 |
+
do_action ("s2member_during_handle_profile_modifications");
|
60 |
+
/**/
|
61 |
echo '<script type="text/javascript">' . "\n";
|
62 |
echo "if(window.parent && window.parent != window) { try{ window.parent.Shadowbox.close(); } catch(e){} try{ window.parent.tb_remove(); } catch(e){} window.parent.alert('Profile updated successfully!'); window.parent.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
63 |
echo "else if(window.opener) { window.close(); window.opener.alert('Profile updated successfully!'); window.opener.location = '" . esc_js (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . "'; }";
|
67 |
exit;
|
68 |
}
|
69 |
/**/
|
70 |
+
do_action ("s2member_before_profile");
|
71 |
+
/**/
|
72 |
include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
|
73 |
/**/
|
74 |
+
do_action ("s2member_after_profile");
|
75 |
+
/**/
|
76 |
exit;
|
77 |
}
|
78 |
/**/
|
79 |
+
do_action ("s2member_after_handle_profile_modifications");
|
80 |
+
/**/
|
81 |
return;
|
82 |
}
|
83 |
?>
|
includes/functions/ptag-level-access.inc.php
CHANGED
@@ -21,7 +21,11 @@ function ws_plugin__s2member_check_ptag_level_access ()
|
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
{
|
26 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
27 |
{
|
@@ -79,9 +83,13 @@ function ws_plugin__s2member_check_ptag_level_access ()
|
|
79 |
else if (($level4_ptags = preg_split ("/,/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && has_tag ($level4_ptags) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
80 |
exit;
|
81 |
}
|
|
|
|
|
82 |
}
|
83 |
}
|
84 |
/**/
|
|
|
|
|
85 |
return;
|
86 |
}
|
87 |
?>
|
21 |
{
|
22 |
global $post; /* get_the_ID() not yet available here. */
|
23 |
/**/
|
24 |
+
do_action ("s2member_before_check_ptag_level_access");
|
25 |
+
/**/
|
26 |
+
$excluded = apply_filters ("s2member_check_ptag_level_access_excluded", false);
|
27 |
+
/**/
|
28 |
+
if (!$excluded && ((is_tag () && ($tag_ID = get_query_var ("tag"))) || (is_single () && has_tag () && is_object ($post) && ($post_ID = $post->ID))))
|
29 |
{
|
30 |
if (!ws_plugin__s2member_is_systematic_use_page ()) /* Never restrict systematic use pages. */
|
31 |
{
|
83 |
else if (($level4_ptags = preg_split ("/,/", preg_replace ("/( +)/", "-", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level4_ptags"]))) && has_tag ($level4_ptags) && ws_plugin__s2member_nocache_constants () !== "nill" && (!$current_user || !current_user_can ("access_s2member_level4")) && wp_redirect (ws_plugin__s2member_append_query_var (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]), "s2member_level_req=4")) !== "nill")
|
84 |
exit;
|
85 |
}
|
86 |
+
/**/
|
87 |
+
do_action ("s2member_during_check_ptag_level_access");
|
88 |
}
|
89 |
}
|
90 |
/**/
|
91 |
+
do_action ("s2member_after_check_ptag_level_access");
|
92 |
+
/**/
|
93 |
return;
|
94 |
}
|
95 |
?>
|
includes/functions/readme-parsing.inc.php
CHANGED
@@ -18,6 +18,8 @@ Function that handles readme.txt parsing.
|
|
18 |
*/
|
19 |
function ws_plugin__s2member_parse_readme ()
|
20 |
{
|