Version Description
= v130213 = (Maintenance Release) Upgrade immediately.
Download this release
Release Info
Developer | WebSharks |
Plugin | ![]() |
Version | 130213 |
Comparing to | |
See all releases |
Code changes from version 130207 to 130213
- checksum.txt +1 -1
- includes/classes/admin-css-js-in.inc.php +34 -36
- includes/classes/admin-css-js.inc.php +4 -4
- includes/classes/admin-lockouts.inc.php +27 -30
- includes/classes/admin-notices.inc.php +49 -54
- includes/classes/auto-eots.inc.php +90 -92
- includes/classes/brute-force.inc.php +18 -20
- includes/classes/cache.inc.php +19 -23
- includes/classes/catgs-sp.inc.php +23 -25
- includes/classes/catgs.inc.php +23 -26
- includes/classes/check-activation.inc.php +4 -5
- includes/classes/constants.inc.php +70 -70
- includes/classes/cron-jobs-in.inc.php +13 -14
- includes/classes/cron-jobs.inc.php +4 -4
- includes/classes/css-js-in.inc.php +52 -57
- includes/classes/css-js-themes.inc.php +20 -23
- includes/classes/css-js.inc.php +2 -2
- includes/classes/custom-reg-fields-4bp.inc.php +100 -103
- includes/classes/custom-reg-fields.inc.php +147 -167
- includes/classes/email-configs.inc.php +55 -56
- includes/classes/files-in.inc.php +298 -284
- includes/classes/files.inc.php +65 -65
- includes/classes/installation.inc.php +66 -66
- includes/classes/ip-restrictions.inc.php +87 -87
- includes/classes/labels.inc.php +10 -10
- includes/classes/list-servers.inc.php +150 -146
- includes/classes/login-customizations.inc.php +56 -44
- includes/classes/login-redirects-r.inc.php +11 -11
- includes/classes/login-redirects.inc.php +54 -52
- includes/classes/menu-pages-rs.inc.php +15 -15
- includes/classes/menu-pages.inc.php +498 -263
- includes/classes/meta-box-saves.inc.php +43 -43
- includes/classes/meta-box-security.inc.php +49 -49
- includes/classes/meta-boxes.inc.php +7 -7
- includes/classes/mms-patches.inc.php +37 -37
- includes/classes/mo-page-in.inc.php +17 -17
- includes/classes/mo-page.inc.php +3 -3
- includes/classes/no-cache.inc.php +37 -37
- includes/classes/op-notices.inc.php +42 -42
- includes/classes/option-forces.inc.php +49 -49
- includes/classes/pages-sp.inc.php +34 -34
- includes/classes/pages.inc.php +34 -34
- includes/classes/paypal-notify-in-cart.inc.php +27 -28
- includes/classes/paypal-notify-in-express-checkout.inc.php +26 -26
- includes/classes/paypal-notify-in-rec-profile-creation-w-level.inc.php +28 -28
- includes/classes/paypal-notify-in-send-money.inc.php +26 -26
- includes/classes/paypal-notify-in-sp-refund-reversal.inc.php +42 -42
- includes/classes/paypal-notify-in-subscr-modify-w-level.inc.php +92 -91
- includes/classes/paypal-notify-in-subscr-or-rp-cancellation-w-level.inc.php +63 -64
- includes/classes/paypal-notify-in-subscr-or-rp-eots-w-level.inc.php +166 -166
- includes/classes/paypal-notify-in-subscr-or-rp-payment-failed-w-level.inc.php +28 -28
- includes/classes/paypal-notify-in-subscr-or-rp-payment-w-level.inc.php +72 -72
- includes/classes/paypal-notify-in-subscr-or-wa-w-level.inc.php +192 -216
- includes/classes/paypal-notify-in-virtual-terminal.inc.php +26 -26
- includes/classes/paypal-notify-in-wa-ccaps-wo-level.inc.php +76 -76
- includes/classes/paypal-notify-in-web-accept-sp.inc.php +72 -72
- includes/classes/paypal-notify-in.inc.php +76 -75
- includes/classes/paypal-notify.inc.php +3 -3
- includes/classes/paypal-return-in-no-tx-data.inc.php +36 -32
- includes/classes/paypal-return-in-proxy-ty-email.inc.php +34 -29
- includes/classes/paypal-return-in-proxy-x-preview.inc.php +33 -28
- includes/classes/paypal-return-in-subscr-modify-w-level.inc.php +100 -103
- includes/classes/paypal-return-in-subscr-or-wa-w-level.inc.php +163 -171
- includes/classes/paypal-return-in-wa-ccaps-wo-level.inc.php +78 -82
- includes/classes/paypal-return-in-web-accept-sp.inc.php +55 -58
- includes/classes/paypal-return-in.inc.php +38 -36
checksum.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
d5307fe33825c3590ddb8e4809996e75
|
includes/classes/admin-css-js-in.inc.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* Administrative CSS/JS for menu pages (
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
21 |
{
|
22 |
/**
|
23 |
-
* Administrative CSS/JS for menu pages (
|
24 |
*
|
25 |
* @package s2Member\Admin_CSS_JS
|
26 |
* @since 3.5
|
@@ -40,35 +40,34 @@ if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
|
40 |
public static function menu_pages_css()
|
41 |
{
|
42 |
do_action("ws_plugin__s2member_before_menu_pages_css", get_defined_vars());
|
43 |
-
|
44 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in() && current_user_can("create_users"))
|
45 |
{
|
46 |
-
status_header
|
47 |
-
|
48 |
-
header("Content-Type: text/css; charset=
|
49 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
50 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
51 |
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
52 |
header("Pragma: no-cache");
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
57 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
58 |
-
|
59 |
ob_start("c_ws_plugin__s2member_utils_css::compress_css");
|
60 |
-
|
61 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages.css";
|
62 |
-
|
63 |
-
echo
|
64 |
-
|
65 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s.css";
|
66 |
-
|
67 |
do_action("ws_plugin__s2member_during_menu_pages_css", get_defined_vars());
|
68 |
-
|
69 |
-
exit
|
70 |
}
|
71 |
-
/**/
|
72 |
do_action("ws_plugin__s2member_after_menu_pages_css", get_defined_vars());
|
73 |
}
|
74 |
/**
|
@@ -84,37 +83,36 @@ if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
|
84 |
public static function menu_pages_js()
|
85 |
{
|
86 |
do_action("ws_plugin__s2member_before_menu_pages_js", get_defined_vars());
|
87 |
-
|
88 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in() && current_user_can("create_users"))
|
89 |
{
|
90 |
-
status_header
|
91 |
-
|
92 |
-
header("Content-Type: application/x-javascript; charset=
|
93 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
94 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
95 |
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
96 |
header("Pragma: no-cache");
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
101 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
102 |
-
|
103 |
for($n = 0, $labels = ""; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
104 |
$labels .= "labels['level".$n."'] = '".((!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"])) ? str_replace('"', "", c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"], 3)) : "")."';";
|
105 |
unset($n);
|
106 |
-
|
107 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-min.js";
|
108 |
-
|
109 |
-
echo
|
110 |
-
|
111 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s-min.js";
|
112 |
-
|
113 |
do_action("ws_plugin__s2member_during_menu_pages_js", get_defined_vars());
|
114 |
-
|
115 |
-
exit
|
116 |
}
|
117 |
-
/**/
|
118 |
do_action("ws_plugin__s2member_after_menu_pages_js", get_defined_vars());
|
119 |
}
|
120 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Administrative CSS/JS for menu pages (inner processing routines).
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if(!class_exists("c_ws_plugin__s2member_admin_css_js_in"))
|
21 |
{
|
22 |
/**
|
23 |
+
* Administrative CSS/JS for menu pages (inner processing routines).
|
24 |
*
|
25 |
* @package s2Member\Admin_CSS_JS
|
26 |
* @since 3.5
|
40 |
public static function menu_pages_css()
|
41 |
{
|
42 |
do_action("ws_plugin__s2member_before_menu_pages_css", get_defined_vars());
|
43 |
+
|
44 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_css"]) && is_user_logged_in() && current_user_can("create_users"))
|
45 |
{
|
46 |
+
status_header /* 200 OK status header. */(200);
|
47 |
+
|
48 |
+
header("Content-Type: text/css; charset=UTF-8");
|
49 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
50 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
51 |
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
52 |
header("Pragma: no-cache");
|
53 |
+
|
54 |
+
while (@ob_end_clean ()); // Clean any existing output buffers.
|
55 |
+
|
56 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
57 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
58 |
+
|
59 |
ob_start("c_ws_plugin__s2member_utils_css::compress_css");
|
60 |
+
|
61 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages.css";
|
62 |
+
|
63 |
+
echo /* Add a line break before inclusion of this file. */ "\n";
|
64 |
+
|
65 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s.css";
|
66 |
+
|
67 |
do_action("ws_plugin__s2member_during_menu_pages_css", get_defined_vars());
|
68 |
+
|
69 |
+
exit /* Clean exit. */();
|
70 |
}
|
|
|
71 |
do_action("ws_plugin__s2member_after_menu_pages_css", get_defined_vars());
|
72 |
}
|
73 |
/**
|
83 |
public static function menu_pages_js()
|
84 |
{
|
85 |
do_action("ws_plugin__s2member_before_menu_pages_js", get_defined_vars());
|
86 |
+
|
87 |
if(!empty($_GET["ws_plugin__s2member_menu_pages_js"]) && is_user_logged_in() && current_user_can("create_users"))
|
88 |
{
|
89 |
+
status_header /* 200 OK status header. */(200);
|
90 |
+
|
91 |
+
header("Content-Type: application/x-javascript; charset=UTF-8");
|
92 |
header("Expires: ".gmdate("D, d M Y H:i:s", strtotime("-1 week"))." GMT");
|
93 |
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
94 |
header("Cache-Control: no-cache, must-revalidate, max-age=0");
|
95 |
header("Pragma: no-cache");
|
96 |
+
|
97 |
+
while (@ob_end_clean ()); // Clean any existing output buffers.
|
98 |
+
|
99 |
$u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
|
100 |
$i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]."/images";
|
101 |
+
|
102 |
for($n = 0, $labels = ""; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
103 |
$labels .= "labels['level".$n."'] = '".((!empty($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"])) ? str_replace('"', "", c_ws_plugin__s2member_utils_strings::esc_js_sq($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level".$n."_label"], 3)) : "")."';";
|
104 |
unset($n);
|
105 |
+
|
106 |
include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-min.js";
|
107 |
+
|
108 |
+
echo /* Add a line break before inclusion of this file. */"\n";
|
109 |
+
|
110 |
@include_once dirname(dirname(__FILE__))."/menu-pages/menu-pages-s-min.js";
|
111 |
+
|
112 |
do_action("ws_plugin__s2member_during_menu_pages_js", get_defined_vars());
|
113 |
+
|
114 |
+
exit /* Clean exit. */();
|
115 |
}
|
|
|
116 |
do_action("ws_plugin__s2member_after_menu_pages_js", get_defined_vars());
|
117 |
}
|
118 |
}
|
includes/classes/admin-css-js.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
|
21 |
{
|
22 |
/**
|
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
|
|
39 |
*/
|
40 |
public static function menu_pages_css ()
|
41 |
{
|
42 |
-
if (!empty ($_GET["ws_plugin__s2member_menu_pages_css"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
|
45 |
}
|
@@ -56,7 +56,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
|
|
56 |
*/
|
57 |
public static function menu_pages_js ()
|
58 |
{
|
59 |
-
if (!empty ($_GET["ws_plugin__s2member_menu_pages_js"]))
|
60 |
{
|
61 |
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
|
62 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
|
21 |
{
|
22 |
/**
|
39 |
*/
|
40 |
public static function menu_pages_css ()
|
41 |
{
|
42 |
+
if (!empty ($_GET["ws_plugin__s2member_menu_pages_css"]))
|
43 |
{
|
44 |
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
|
45 |
}
|
56 |
*/
|
57 |
public static function menu_pages_js ()
|
58 |
{
|
59 |
+
if (!empty ($_GET["ws_plugin__s2member_menu_pages_js"]))
|
60 |
{
|
61 |
return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
|
62 |
}
|
includes/classes/admin-lockouts.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
|
21 |
{
|
22 |
/**
|
@@ -37,23 +37,22 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
|
|
37 |
*
|
38 |
* @return null Or exits script execution after redirection.
|
39 |
*/
|
40 |
-
public static function admin_lockout ()
|
41 |
{
|
42 |
do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
|
43 |
-
|
44 |
if (is_admin () && (!defined ("DOING_AJAX") || !DOING_AJAX) && !current_user_can ("edit_posts") /* Give Filters a chance here too. */)
|
45 |
if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
|
46 |
{
|
47 |
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
|
48 |
-
wp_redirect ($redirection_url) . exit ();
|
49 |
-
|
50 |
-
else
|
51 |
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . exit ();
|
52 |
}
|
53 |
-
/**/
|
54 |
do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
|
55 |
-
|
56 |
-
return
|
57 |
}
|
58 |
/**
|
59 |
* Filters administrative menu bar for Users/Members.
|
@@ -69,9 +68,9 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
|
|
69 |
public static function filter_admin_menu_bar (&$wp_admin_bar = FALSE)
|
70 |
{
|
71 |
do_action ("ws_plugin__s2member_before_filter_admin_menu_bar", get_defined_vars ());
|
72 |
-
|
73 |
$uses_nodes = (version_compare (get_bloginfo ("version"), "3.3-RC1", ">=")) ? true : false;
|
74 |
-
|
75 |
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* Always for Users/Members. */)
|
76 |
{
|
77 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("site-name"))
|
@@ -80,62 +79,60 @@ if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
|
|
80 |
$title = wp_html_excerpt /* A brief excerpt. */ (get_bloginfo ("name"), 42);
|
81 |
$title = ($title !== get_bloginfo ("name")) ? trim ($title) . "…" : $title;
|
82 |
$href = /* Change to front page. */ site_url ("/");
|
83 |
-
|
84 |
$wp_admin_bar->add_node (array ("id" => $id, "title" => $title, "href" => $href));
|
85 |
$wp_admin_bar->remove_node /* Ditch now, replacing this. */ ("site-name");
|
86 |
-
|
87 |
unset /* A little housekeeping. */ ($id, $title, $href);
|
88 |
}
|
89 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("wp-logo"))
|
90 |
$wp_admin_bar->remove_node /* Ditch this node. */ ("wp-logo");
|
91 |
-
|
92 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"dashboard"}))
|
93 |
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"dashboard"});
|
94 |
-
|
95 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-blogs"}))
|
96 |
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"my-blogs"});
|
97 |
-
|
98 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-sites"))
|
99 |
$wp_admin_bar->remove_node /* Ditch this node. */ ("my-sites");
|
100 |
}
|
101 |
-
/**/
|
102 |
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* If locking Users/Members out of `/wp-admin/` areas. */)
|
103 |
if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
|
104 |
{
|
105 |
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ();
|
106 |
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
|
107 |
-
|
108 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-account"))
|
109 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "my-account", "href" => $lwp));
|
110 |
-
|
111 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("user-info"))
|
112 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "user-info", "href" => $lwp));
|
113 |
-
|
114 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("edit-profile"))
|
115 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "edit-profile", "href" => $lwp));
|
116 |
-
|
117 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["href"]))
|
118 |
$wp_admin_bar->menu->{"my-account"}["href"] = /* Update this item. */ $lwp;
|
119 |
-
|
120 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"]))
|
121 |
$wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
122 |
-
|
123 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"]))
|
124 |
$wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
125 |
-
|
126 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["href"]))
|
127 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["href"] = /* Update this item. */ $lwp;
|
128 |
-
|
129 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"]))
|
130 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
131 |
-
|
132 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"]))
|
133 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
134 |
}
|
135 |
-
/**/
|
136 |
do_action ("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
|
137 |
-
|
138 |
-
return
|
139 |
}
|
140 |
}
|
141 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_lockouts"))
|
21 |
{
|
22 |
/**
|
37 |
*
|
38 |
* @return null Or exits script execution after redirection.
|
39 |
*/
|
40 |
+
public static function admin_lockout ()
|
41 |
{
|
42 |
do_action ("ws_plugin__s2member_before_admin_lockouts", get_defined_vars ());
|
43 |
+
|
44 |
if (is_admin () && (!defined ("DOING_AJAX") || !DOING_AJAX) && !current_user_can ("edit_posts") /* Give Filters a chance here too. */)
|
45 |
if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
|
46 |
{
|
47 |
if ($redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ())
|
48 |
+
/* Special Redirection. */wp_redirect ($redirection_url) . exit ();
|
49 |
+
|
50 |
+
else // Else we use the Login Welcome Page configured for s2Member.
|
51 |
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"])) . exit ();
|
52 |
}
|
|
|
53 |
do_action ("ws_plugin__s2member_after_admin_lockouts", get_defined_vars ());
|
54 |
+
|
55 |
+
return /* Return for uniformity. */;
|
56 |
}
|
57 |
/**
|
58 |
* Filters administrative menu bar for Users/Members.
|
68 |
public static function filter_admin_menu_bar (&$wp_admin_bar = FALSE)
|
69 |
{
|
70 |
do_action ("ws_plugin__s2member_before_filter_admin_menu_bar", get_defined_vars ());
|
71 |
+
|
72 |
$uses_nodes = (version_compare (get_bloginfo ("version"), "3.3-RC1", ">=")) ? true : false;
|
73 |
+
|
74 |
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* Always for Users/Members. */)
|
75 |
{
|
76 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("site-name"))
|
79 |
$title = wp_html_excerpt /* A brief excerpt. */ (get_bloginfo ("name"), 42);
|
80 |
$title = ($title !== get_bloginfo ("name")) ? trim ($title) . "…" : $title;
|
81 |
$href = /* Change to front page. */ site_url ("/");
|
82 |
+
|
83 |
$wp_admin_bar->add_node (array ("id" => $id, "title" => $title, "href" => $href));
|
84 |
$wp_admin_bar->remove_node /* Ditch now, replacing this. */ ("site-name");
|
85 |
+
|
86 |
unset /* A little housekeeping. */ ($id, $title, $href);
|
87 |
}
|
88 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("wp-logo"))
|
89 |
$wp_admin_bar->remove_node /* Ditch this node. */ ("wp-logo");
|
90 |
+
// -------
|
91 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"dashboard"}))
|
92 |
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"dashboard"});
|
93 |
+
|
94 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-blogs"}))
|
95 |
unset /* Ditch this item. */ ($wp_admin_bar->menu->{"my-blogs"});
|
96 |
+
// -------
|
97 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-sites"))
|
98 |
$wp_admin_bar->remove_node /* Ditch this node. */ ("my-sites");
|
99 |
}
|
|
|
100 |
if (is_object ($wp_admin_bar) && !current_user_can ("edit_posts") /* If locking Users/Members out of `/wp-admin/` areas. */)
|
101 |
if (apply_filters ("ws_plugin__s2member_admin_lockout", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["force_admin_lockouts"], get_defined_vars ()))
|
102 |
{
|
103 |
$lwp = c_ws_plugin__s2member_login_redirects::login_redirection_url ();
|
104 |
$lwp = (!$lwp) ? get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]) : $lwp;
|
105 |
+
|
106 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("my-account"))
|
107 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "my-account", "href" => $lwp));
|
108 |
+
|
109 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("user-info"))
|
110 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "user-info", "href" => $lwp));
|
111 |
+
|
112 |
if ($uses_nodes && $wp_admin_bar->get_node /* We have this node? */ ("edit-profile"))
|
113 |
$wp_admin_bar->add_node /* Update this node. */ (array ("id" => "edit-profile", "href" => $lwp));
|
114 |
+
// -------
|
115 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["href"]))
|
116 |
$wp_admin_bar->menu->{"my-account"}["href"] = /* Update this item. */ $lwp;
|
117 |
+
|
118 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"]))
|
119 |
$wp_admin_bar->menu->{"my-account"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
120 |
+
|
121 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"]))
|
122 |
$wp_admin_bar->menu->{"my-account"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
123 |
+
// -------
|
124 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["href"]))
|
125 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["href"] = /* Update this item. */ $lwp;
|
126 |
+
|
127 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"]))
|
128 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"user-info"}["href"] = /* Update this item. */ $lwp;
|
129 |
+
|
130 |
if (!$uses_nodes && isset /* Have this item? */ ($wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"]))
|
131 |
$wp_admin_bar->menu->{"my-account-with-avatar"}["children"]->{"edit-profile"}["href"] = /* Update this item. */ $lwp;
|
132 |
}
|
|
|
133 |
do_action ("ws_plugin__s2member_after_filter_admin_menu_bar", get_defined_vars ());
|
134 |
+
|
135 |
+
return /* Return for uniformity. */;
|
136 |
}
|
137 |
}
|
138 |
}
|
includes/classes/admin-notices.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
21 |
{
|
22 |
/**
|
@@ -33,7 +33,7 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
|
33 |
* @package s2Member\Admin_Notices
|
34 |
* @since 3.5
|
35 |
*
|
36 |
-
* @param str $notice String value of actual notice *(
|
37 |
* @param str|array $on_pages Optional. Defaults to any page. String or array of pages to display this notice on.
|
38 |
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
|
39 |
* @param int $time Optional. Unix timestamp indicating when this notice will be displayed.
|
@@ -42,26 +42,25 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
|
42 |
*/
|
43 |
public static function enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE, $dismiss = FALSE)
|
44 |
{
|
45 |
-
|
46 |
do_action ("ws_plugin__s2member_before_enqueue_admin_notice", get_defined_vars ());
|
47 |
-
unset
|
48 |
-
|
49 |
-
if
|
50 |
{
|
51 |
$notices = (array)get_option ("ws_plugin__s2member_notices");
|
52 |
-
|
53 |
array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time, "dismiss" => $dismiss));
|
54 |
-
|
55 |
-
|
56 |
do_action ("ws_plugin__s2member_during_enqueue_admin_notice", get_defined_vars ());
|
57 |
-
unset
|
58 |
-
|
59 |
update_option ("ws_plugin__s2member_notices", c_ws_plugin__s2member_utils_arrays::array_unique ($notices));
|
60 |
}
|
61 |
-
/**/
|
62 |
do_action ("ws_plugin__s2member_after_enqueue_admin_notice", get_defined_vars ());
|
63 |
-
|
64 |
-
return
|
65 |
}
|
66 |
/**
|
67 |
* Displays an administrative notice.
|
@@ -69,33 +68,32 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
|
69 |
* @package s2Member\Admin_Notices
|
70 |
* @since 3.5
|
71 |
*
|
72 |
-
* @param str $notice String value of actual notice *(
|
73 |
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
|
74 |
* @param bool $dismiss Optional. If true, the notice will be displayed with a dismissal link. Defaults to false.
|
75 |
* @return null
|
76 |
*/
|
77 |
public static function display_admin_notice ($notice = FALSE, $error = FALSE, $dismiss = FALSE)
|
78 |
{
|
79 |
-
|
80 |
do_action ("ws_plugin__s2member_before_display_admin_notice", get_defined_vars ());
|
81 |
-
unset
|
82 |
-
|
83 |
-
if (is_string ($notice) && $notice && $error)
|
84 |
{
|
85 |
$notice .= ($dismiss) ? ' [ <a href="' . esc_attr(add_query_arg ("ws-plugin--s2member-dismiss-admin-notice", urlencode (md5 ($notice)), $_SERVER["REQUEST_URI"])) . '">dismiss message</a> ]' : '';
|
86 |
-
|
87 |
-
echo '<div class="error fade"><p>' . $notice . '</p></div>';
|
88 |
}
|
89 |
else if (is_string ($notice) && $notice)
|
90 |
{
|
91 |
$notice .= ($dismiss) ? ' [ <a href="' . esc_attr(add_query_arg ("ws-plugin--s2member-dismiss-admin-notice", urlencode (md5 ($notice)), $_SERVER["REQUEST_URI"])) . '">dismiss message</a> ]' : '';
|
92 |
-
|
93 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
94 |
}
|
95 |
-
/**/
|
96 |
do_action ("ws_plugin__s2member_after_display_admin_notice", get_defined_vars ());
|
97 |
-
|
98 |
-
return
|
99 |
}
|
100 |
/**
|
101 |
* Processes all administrative notices.
|
@@ -112,60 +110,57 @@ if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
|
112 |
*/
|
113 |
public static function admin_notices ()
|
114 |
{
|
115 |
-
global
|
116 |
-
|
117 |
do_action ("ws_plugin__s2member_before_admin_notices", get_defined_vars ());
|
118 |
-
|
119 |
if (is_admin () && is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
|
120 |
{
|
121 |
$a = (is_blog_admin ()) ? "blog" : $a;
|
122 |
$a = (is_user_admin ()) ? "user" : $a;
|
123 |
$a = (is_network_admin ()) ? "network" : $a;
|
124 |
-
$a = (!$a) ? "blog" : $a;
|
125 |
-
|
126 |
-
foreach
|
127 |
foreach (((!$notice["on_pages"]) ? array ("*"): (array)$notice["on_pages"]) as $page)
|
128 |
{
|
129 |
-
if (!preg_match ("/^(.+?)\:/", $page))
|
130 |
-
$page = "blog:" . ltrim ($page, ":");
|
131 |
-
|
132 |
$adms = preg_split ("/\|/", preg_replace ("/\:(.*)$/i", "", $page));
|
133 |
$page = preg_replace ("/^([^\:]*)\:/i", "", $page);
|
134 |
-
|
135 |
if (empty ($adms) || in_array ("*", $adms) || in_array ($a, $adms))
|
136 |
if (!$page || "*" === $page || $pagenow === $page || $_GET["page"] === $page)
|
137 |
{
|
138 |
-
if (strtotime ("now") >= (int)$notice["time"])
|
139 |
{
|
140 |
-
|
141 |
do_action ("ws_plugin__s2member_during_admin_notices_before_display", get_defined_vars ());
|
142 |
-
unset
|
143 |
-
|
144 |
if (!$notice["dismiss"] || (!empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) && $_GET["ws-plugin--s2member-dismiss-admin-notice"] === md5 ($notice["notice"])))
|
145 |
-
unset
|
146 |
-
|
147 |
if (!$notice["dismiss"] || empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
|
148 |
c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
|
149 |
-
|
150 |
do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
|
151 |
}
|
152 |
-
|
153 |
-
continue 2; /* This Notice processed; continue. */
|
154 |
}
|
155 |
}
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
160 |
do_action ("ws_plugin__s2member_during_admin_notices", get_defined_vars ());
|
161 |
-
unset
|
162 |
-
|
163 |
update_option ("ws_plugin__s2member_notices", $notices);
|
164 |
}
|
165 |
-
/**/
|
166 |
do_action ("ws_plugin__s2member_after_admin_notices", get_defined_vars ());
|
167 |
-
|
168 |
-
return
|
169 |
}
|
170 |
}
|
171 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_admin_notices"))
|
21 |
{
|
22 |
/**
|
33 |
* @package s2Member\Admin_Notices
|
34 |
* @since 3.5
|
35 |
*
|
36 |
+
* @param str $notice String value of actual notice *(i.e. the message)*.
|
37 |
* @param str|array $on_pages Optional. Defaults to any page. String or array of pages to display this notice on.
|
38 |
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
|
39 |
* @param int $time Optional. Unix timestamp indicating when this notice will be displayed.
|
42 |
*/
|
43 |
public static function enqueue_admin_notice ($notice = FALSE, $on_pages = FALSE, $error = FALSE, $time = FALSE, $dismiss = FALSE)
|
44 |
{
|
45 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
46 |
do_action ("ws_plugin__s2member_before_enqueue_admin_notice", get_defined_vars ());
|
47 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
48 |
+
|
49 |
+
if /* If we have a valid string. */(is_string ($notice) && $notice)
|
50 |
{
|
51 |
$notices = (array)get_option ("ws_plugin__s2member_notices");
|
52 |
+
|
53 |
array_push ($notices, array ("notice" => $notice, "on_pages" => $on_pages, "error" => $error, "time" => $time, "dismiss" => $dismiss));
|
54 |
+
|
55 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
56 |
do_action ("ws_plugin__s2member_during_enqueue_admin_notice", get_defined_vars ());
|
57 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
58 |
+
|
59 |
update_option ("ws_plugin__s2member_notices", c_ws_plugin__s2member_utils_arrays::array_unique ($notices));
|
60 |
}
|
|
|
61 |
do_action ("ws_plugin__s2member_after_enqueue_admin_notice", get_defined_vars ());
|
62 |
+
|
63 |
+
return /* Return for uniformity. */;
|
64 |
}
|
65 |
/**
|
66 |
* Displays an administrative notice.
|
68 |
* @package s2Member\Admin_Notices
|
69 |
* @since 3.5
|
70 |
*
|
71 |
+
* @param str $notice String value of actual notice *(i.e. the message)*.
|
72 |
* @param bool $error Optional. True if this notice is regarding an error. Defaults to false.
|
73 |
* @param bool $dismiss Optional. If true, the notice will be displayed with a dismissal link. Defaults to false.
|
74 |
* @return null
|
75 |
*/
|
76 |
public static function display_admin_notice ($notice = FALSE, $error = FALSE, $dismiss = FALSE)
|
77 |
{
|
78 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
79 |
do_action ("ws_plugin__s2member_before_display_admin_notice", get_defined_vars ());
|
80 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
81 |
+
|
82 |
+
if /* Slightly different/special format for errors. */ (is_string ($notice) && $notice && $error)
|
83 |
{
|
84 |
$notice .= ($dismiss) ? ' [ <a href="' . esc_attr(add_query_arg ("ws-plugin--s2member-dismiss-admin-notice", urlencode (md5 ($notice)), $_SERVER["REQUEST_URI"])) . '">dismiss message</a> ]' : '';
|
85 |
+
|
86 |
+
echo /* Error. */ '<div class="error fade"><p>' . $notice . '</p></div>';
|
87 |
}
|
88 |
else if (is_string ($notice) && $notice)
|
89 |
{
|
90 |
$notice .= ($dismiss) ? ' [ <a href="' . esc_attr(add_query_arg ("ws-plugin--s2member-dismiss-admin-notice", urlencode (md5 ($notice)), $_SERVER["REQUEST_URI"])) . '">dismiss message</a> ]' : '';
|
91 |
+
|
92 |
echo '<div class="updated fade"><p>' . $notice . '</p></div>';
|
93 |
}
|
|
|
94 |
do_action ("ws_plugin__s2member_after_display_admin_notice", get_defined_vars ());
|
95 |
+
|
96 |
+
return /* Return for uniformity. */;
|
97 |
}
|
98 |
/**
|
99 |
* Processes all administrative notices.
|
110 |
*/
|
111 |
public static function admin_notices ()
|
112 |
{
|
113 |
+
global /* This holds the current page filename. */ $pagenow;
|
114 |
+
|
115 |
do_action ("ws_plugin__s2member_before_admin_notices", get_defined_vars ());
|
116 |
+
|
117 |
if (is_admin () && is_array ($notices = get_option ("ws_plugin__s2member_notices")) && !empty ($notices))
|
118 |
{
|
119 |
$a = (is_blog_admin ()) ? "blog" : $a;
|
120 |
$a = (is_user_admin ()) ? "user" : $a;
|
121 |
$a = (is_network_admin ()) ? "network" : $a;
|
122 |
+
$a = /* Default Blog Admin. */(!$a) ? "blog" : $a;
|
123 |
+
|
124 |
+
foreach /* Check several things about each Notice. */ ($notices as $i => $notice)
|
125 |
foreach (((!$notice["on_pages"]) ? array ("*"): (array)$notice["on_pages"]) as $page)
|
126 |
{
|
127 |
+
if /* NO prefix? */ (!preg_match ("/^(.+?)\:/", $page))
|
128 |
+
$page = /* `blog:` */ "blog:" . ltrim ($page, ":");
|
129 |
+
|
130 |
$adms = preg_split ("/\|/", preg_replace ("/\:(.*)$/i", "", $page));
|
131 |
$page = preg_replace ("/^([^\:]*)\:/i", "", $page);
|
132 |
+
|
133 |
if (empty ($adms) || in_array ("*", $adms) || in_array ($a, $adms))
|
134 |
if (!$page || "*" === $page || $pagenow === $page || $_GET["page"] === $page)
|
135 |
{
|
136 |
+
if /* Time to show it? */ (strtotime ("now") >= (int)$notice["time"])
|
137 |
{
|
138 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
139 |
do_action ("ws_plugin__s2member_during_admin_notices_before_display", get_defined_vars ());
|
140 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
141 |
+
|
142 |
if (!$notice["dismiss"] || (!empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) && $_GET["ws-plugin--s2member-dismiss-admin-notice"] === md5 ($notice["notice"])))
|
143 |
+
unset /* Clear this administrative notice now? */($notices[$i]);
|
144 |
+
|
145 |
if (!$notice["dismiss"] || empty ($_GET["ws-plugin--s2member-dismiss-admin-notice"]) || $_GET["ws-plugin--s2member-dismiss-admin-notice"] !== md5 ($notice["notice"]))
|
146 |
c_ws_plugin__s2member_admin_notices::display_admin_notice ($notice["notice"], $notice["error"], $notice["dismiss"]);
|
147 |
+
|
148 |
do_action ("ws_plugin__s2member_during_admin_notices_after_display", get_defined_vars ());
|
149 |
}
|
150 |
+
continue /* This Notice processed; continue. */ 2;
|
|
|
151 |
}
|
152 |
}
|
153 |
+
$notices = /* Re-index array. */array_merge ($notices);
|
154 |
+
|
155 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
|
|
156 |
do_action ("ws_plugin__s2member_during_admin_notices", get_defined_vars ());
|
157 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
158 |
+
|
159 |
update_option ("ws_plugin__s2member_notices", $notices);
|
160 |
}
|
|
|
161 |
do_action ("ws_plugin__s2member_after_admin_notices", get_defined_vars ());
|
162 |
+
|
163 |
+
return /* Return for uniformity. */;
|
164 |
}
|
165 |
}
|
166 |
}
|
includes/classes/auto-eots.inc.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's Auto-EOT System *(
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
21 |
{
|
22 |
/**
|
23 |
-
* s2Member's Auto-EOT System *(
|
24 |
*
|
25 |
* @package s2Member\Auto_EOT_System
|
26 |
* @since 3.5
|
@@ -38,18 +38,18 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
38 |
public static function add_auto_eot_system ()
|
39 |
{
|
40 |
do_action ("ws_plugin__s2member_before_add_auto_eot_system", get_defined_vars ());
|
41 |
-
|
42 |
if (!c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ())
|
43 |
{
|
44 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
|
45 |
}
|
46 |
-
else if
|
47 |
{
|
48 |
wp_schedule_event (time (), "every10m", "ws_plugin__s2member_auto_eot_system__schedule");
|
49 |
-
|
50 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", true, get_defined_vars ());
|
51 |
}
|
52 |
-
else
|
53 |
{
|
54 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
|
55 |
}
|
@@ -65,23 +65,23 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
65 |
public static function delete_auto_eot_system ()
|
66 |
{
|
67 |
do_action ("ws_plugin__s2member_before_delete_auto_eot_system", get_defined_vars ());
|
68 |
-
|
69 |
-
if
|
70 |
{
|
71 |
-
wp_clear_scheduled_hook
|
72 |
-
|
73 |
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
|
74 |
}
|
75 |
-
else
|
76 |
{
|
77 |
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", false, get_defined_vars ());
|
78 |
}
|
79 |
}
|
80 |
/**
|
81 |
-
* Processed by WP_Cron; this handles Auto-EOTs *(
|
82 |
*
|
83 |
* If you have a HUGE userbase, increase the max EOTs per process.
|
84 |
-
* But NOTE, this runs ``$per_process`` *(
|
85 |
* To increase, use: ``add_filter ("ws_plugin__s2member_auto_eot_system_per_process");``.
|
86 |
*
|
87 |
* This function makes an important Hook available: `ws_plugin__s2member_after_auto_eot_system`.
|
@@ -97,79 +97,82 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
97 |
*/
|
98 |
public static function auto_eot_system ($per_process = 3)
|
99 |
{
|
100 |
-
global
|
101 |
-
global $current_site, $current_blog;
|
102 |
-
|
103 |
include_once ABSPATH . "wp-admin/includes/admin.php";
|
104 |
-
|
105 |
-
@set_time_limit
|
106 |
@ini_set ("memory_limit", apply_filters ("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
|
107 |
-
|
108 |
-
|
109 |
do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
|
110 |
-
unset
|
111 |
-
|
112 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
|
113 |
{
|
114 |
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
|
115 |
-
|
116 |
if (is_array ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process)))
|
117 |
{
|
118 |
-
foreach
|
119 |
{
|
120 |
if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
|
121 |
{
|
122 |
-
delete_user_option ($user_id, "s2member_auto_eot_time");
|
123 |
-
|
124 |
-
if
|
125 |
{
|
126 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
|
127 |
{
|
128 |
-
$eot_del_type = /* Set EOT/Del type. */
|
129 |
-
|
130 |
-
/**/
|
131 |
$custom = get_user_option ("s2member_custom", $user_id);
|
|
|
132 |
$subscr_id = get_user_option ("s2member_subscr_id", $user_id);
|
133 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
134 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id);
|
135 |
-
|
136 |
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
|
137 |
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
138 |
-
|
139 |
-
|
140 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
|
141 |
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
|
142 |
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
|
143 |
-
unset
|
144 |
-
|
145 |
-
if
|
146 |
-
$user->set_role
|
147 |
-
|
148 |
foreach ($user->allcaps as $cap => $cap_enabled)
|
149 |
if (preg_match ("/^access_s2member_ccap_/", $cap))
|
150 |
$user->remove_cap ($ccap = $cap);
|
151 |
-
|
152 |
delete_user_option ($user_id, "s2member_custom");
|
153 |
delete_user_option ($user_id, "s2member_subscr_id");
|
154 |
delete_user_option ($user_id, "s2member_subscr_gateway");
|
155 |
-
|
156 |
delete_user_option ($user_id, "s2member_ipn_signup_vars");
|
157 |
if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
|
158 |
delete_user_option ($user_id, "s2member_paid_registration_times");
|
159 |
-
|
160 |
delete_user_option ($user_id, "s2member_last_status_scan");
|
161 |
delete_user_option ($user_id, "s2member_first_payment_txn_id");
|
162 |
delete_user_option ($user_id, "s2member_last_payment_time");
|
163 |
delete_user_option ($user_id, "s2member_auto_eot_time");
|
164 |
-
|
165 |
delete_user_option ($user_id, "s2member_file_download_access_log");
|
166 |
-
|
167 |
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
|
168 |
-
|
|
|
|
|
|
|
169 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
|
170 |
{
|
171 |
-
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url)
|
172 |
-
|
173 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ("auto-eot-cancellation-expiration-demotion")), $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url)))
|
174 |
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
|
175 |
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
@@ -179,23 +182,22 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
179 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
180 |
{
|
181 |
if (is_array ($fields) && !empty ($fields))
|
182 |
-
foreach ($fields as $var => $val)
|
183 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
184 |
break;
|
185 |
-
|
186 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
187 |
c_ws_plugin__s2member_utils_urls::remote ($url);
|
188 |
}
|
189 |
}
|
190 |
-
/**/
|
191 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
|
192 |
{
|
193 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
194 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
195 |
-
|
196 |
-
$msg = $sbj = "(
|
197 |
-
$msg .=
|
198 |
-
|
199 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
200 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
201 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
@@ -205,11 +207,11 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
205 |
$msg .= "user_login: %%user_login%%\n";
|
206 |
$msg .= "user_ip: %%user_ip%%\n";
|
207 |
$msg .= "user_id: %%user_id%%\n";
|
208 |
-
|
209 |
if (is_array ($fields) && !empty ($fields))
|
210 |
foreach ($fields as $var => $val)
|
211 |
$msg .= $var . ": %%" . $var . "%%\n";
|
212 |
-
|
213 |
$msg .= "cv0: %%cv0%%\n";
|
214 |
$msg .= "cv1: %%cv1%%\n";
|
215 |
$msg .= "cv2: %%cv2%%\n";
|
@@ -220,7 +222,7 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
220 |
$msg .= "cv7: %%cv7%%\n";
|
221 |
$msg .= "cv8: %%cv8%%\n";
|
222 |
$msg .= "cv9: %%cv9%%";
|
223 |
-
|
224 |
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ("auto-eot-cancellation-expiration-demotion"), $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($subscr_id), $msg)))
|
225 |
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
|
226 |
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
@@ -230,65 +232,61 @@ if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
|
230 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
231 |
{
|
232 |
if (is_array ($fields) && !empty ($fields))
|
233 |
-
foreach ($fields as $var => $val)
|
234 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
235 |
break;
|
236 |
-
|
237 |
-
if ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
238 |
-
|
239 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
240 |
-
wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=
|
241 |
}
|
242 |
-
|
243 |
-
if ($email_configs_were_on) /* Back on? */
|
244 |
c_ws_plugin__s2member_email_configs::email_config ();
|
245 |
}
|
246 |
-
|
247 |
-
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
248 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
|
249 |
-
unset
|
250 |
}
|
251 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
252 |
{
|
253 |
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
|
254 |
-
|
255 |
-
|
256 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
|
257 |
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
|
258 |
-
unset
|
259 |
-
|
260 |
-
if
|
261 |
{
|
262 |
remove_user_from_blog ($user_id, $current_blog->blog_id);
|
263 |
-
|
264 |
c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions ($user_id, $current_blog->blog_id, "s2says");
|
265 |
}
|
266 |
-
|
267 |
-
|
268 |
-
/*
|
269 |
-
|
270 |
-
|
271 |
-
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
272 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
|
273 |
-
unset
|
274 |
}
|
275 |
-
|
276 |
-
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
|
277 |
do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
|
278 |
-
unset
|
279 |
}
|
280 |
}
|
281 |
}
|
282 |
}
|
283 |
}
|
284 |
-
|
285 |
-
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients
|
286 |
-
|
287 |
-
|
288 |
do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
|
289 |
-
unset
|
290 |
-
|
291 |
-
return
|
292 |
}
|
293 |
}
|
294 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's Auto-EOT System *(EOT = End Of Term)*.
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_auto_eots"))
|
21 |
{
|
22 |
/**
|
23 |
+
* s2Member's Auto-EOT System *(EOT = End Of Term)*.
|
24 |
*
|
25 |
* @package s2Member\Auto_EOT_System
|
26 |
* @since 3.5
|
38 |
public static function add_auto_eot_system ()
|
39 |
{
|
40 |
do_action ("ws_plugin__s2member_before_add_auto_eot_system", get_defined_vars ());
|
41 |
+
|
42 |
if (!c_ws_plugin__s2member_auto_eots::delete_auto_eot_system ())
|
43 |
{
|
44 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
|
45 |
}
|
46 |
+
else if /* Otherwise, we can schedule? */ (function_exists ("wp_cron"))
|
47 |
{
|
48 |
wp_schedule_event (time (), "every10m", "ws_plugin__s2member_auto_eot_system__schedule");
|
49 |
+
|
50 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", true, get_defined_vars ());
|
51 |
}
|
52 |
+
else // Otherwise, it would appear that WP-Cron is not available.
|
53 |
{
|
54 |
return apply_filters ("ws_plugin__s2member_add_auto_eot_system", false, get_defined_vars ());
|
55 |
}
|
65 |
public static function delete_auto_eot_system ()
|
66 |
{
|
67 |
do_action ("ws_plugin__s2member_before_delete_auto_eot_system", get_defined_vars ());
|
68 |
+
|
69 |
+
if /* Is `wp_cron()` even available? */ (function_exists ("wp_cron"))
|
70 |
{
|
71 |
+
wp_clear_scheduled_hook /* Since v3.0.3. */ ("ws_plugin__s2member_auto_eot_system__schedule");
|
72 |
+
|
73 |
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", true, get_defined_vars ());
|
74 |
}
|
75 |
+
else // Otherwise, it would appear that WP-Cron is not available.
|
76 |
{
|
77 |
return apply_filters ("ws_plugin__s2member_delete_auto_eot_system", false, get_defined_vars ());
|
78 |
}
|
79 |
}
|
80 |
/**
|
81 |
+
* Processed by WP_Cron; this handles Auto-EOTs *(EOT = End Of Term)*.
|
82 |
*
|
83 |
* If you have a HUGE userbase, increase the max EOTs per process.
|
84 |
+
* But NOTE, this runs ``$per_process`` *(per Blog)* on a Multisite Network.
|
85 |
* To increase, use: ``add_filter ("ws_plugin__s2member_auto_eot_system_per_process");``.
|
86 |
*
|
87 |
* This function makes an important Hook available: `ws_plugin__s2member_after_auto_eot_system`.
|
97 |
*/
|
98 |
public static function auto_eot_system ($per_process = 3)
|
99 |
{
|
100 |
+
global /* Need global DB obj. */ $wpdb;
|
101 |
+
global /* Multisite. */ $current_site, $current_blog;
|
102 |
+
|
103 |
include_once ABSPATH . "wp-admin/includes/admin.php";
|
104 |
+
|
105 |
+
@set_time_limit /* Make time for processing a larger userbase. */ (0);
|
106 |
@ini_set ("memory_limit", apply_filters ("admin_memory_limit", WP_MAX_MEMORY_LIMIT));
|
107 |
+
|
108 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
109 |
do_action ("ws_plugin__s2member_before_auto_eot_system", get_defined_vars ());
|
110 |
+
unset /* Unset defined __refs, __v. */($__refs, $__v);
|
111 |
+
|
112 |
+
if /* Enabled? */($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
|
113 |
{
|
114 |
$per_process = apply_filters ("ws_plugin__s2member_auto_eot_system_per_process", $per_process, get_defined_vars ());
|
115 |
+
|
116 |
if (is_array ($eots = $wpdb->get_results ("SELECT `user_id` AS `ID` FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_auto_eot_time' AND `meta_value` != '' AND `meta_value` <= '" . $wpdb->escape (strtotime ("now")) . "' LIMIT " . $per_process)))
|
117 |
{
|
118 |
+
foreach /* Go through the array of EOTS. We need to (demote|delete) each of them. */ ($eots as $eot)
|
119 |
{
|
120 |
if (($user_id = $eot->ID) && is_object ($user = new WP_User ($user_id)) && $user->ID)
|
121 |
{
|
122 |
+
delete_user_option /* Always delete. */ ($user_id, "s2member_auto_eot_time");
|
123 |
+
|
124 |
+
if /* Do NOT process Administrator accounts. */(!$user->has_cap ("administrator"))
|
125 |
{
|
126 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "demote")
|
127 |
{
|
128 |
+
$eot_del_type = /* Set EOT/Del type. */ "auto-eot-cancellation-expiration-demotion";
|
129 |
+
|
|
|
130 |
$custom = get_user_option ("s2member_custom", $user_id);
|
131 |
+
$subscr_gateway = get_user_option ("s2member_subscr_gateway", $user_id);
|
132 |
$subscr_id = get_user_option ("s2member_subscr_id", $user_id);
|
133 |
$fields = get_user_option ("s2member_custom_fields", $user_id);
|
134 |
$user_reg_ip = get_user_option ("s2member_registration_ip", $user_id);
|
135 |
+
|
136 |
$demotion_role = c_ws_plugin__s2member_option_forces::force_demotion_role ("subscriber");
|
137 |
$existing_role = c_ws_plugin__s2member_user_access::user_access_role ($user);
|
138 |
+
|
139 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
140 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_demote", get_defined_vars ());
|
141 |
do_action ("ws_plugin__s2member_during_collective_mods", $user_id, get_defined_vars (), $eot_del_type, "modification", $demotion_role);
|
142 |
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "modification");
|
143 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
144 |
+
|
145 |
+
if /* Only if NOT the existing Role. */($existing_role !== $demotion_role)
|
146 |
+
$user->set_role /* Give User the demotion Role. */ ($demotion_role);
|
147 |
+
|
148 |
foreach ($user->allcaps as $cap => $cap_enabled)
|
149 |
if (preg_match ("/^access_s2member_ccap_/", $cap))
|
150 |
$user->remove_cap ($ccap = $cap);
|
151 |
+
|
152 |
delete_user_option ($user_id, "s2member_custom");
|
153 |
delete_user_option ($user_id, "s2member_subscr_id");
|
154 |
delete_user_option ($user_id, "s2member_subscr_gateway");
|
155 |
+
|
156 |
delete_user_option ($user_id, "s2member_ipn_signup_vars");
|
157 |
if (!apply_filters ("ws_plugin__s2member_preserve_paid_registration_times", true, get_defined_vars ()))
|
158 |
delete_user_option ($user_id, "s2member_paid_registration_times");
|
159 |
+
|
160 |
delete_user_option ($user_id, "s2member_last_status_scan");
|
161 |
delete_user_option ($user_id, "s2member_first_payment_txn_id");
|
162 |
delete_user_option ($user_id, "s2member_last_payment_time");
|
163 |
delete_user_option ($user_id, "s2member_auto_eot_time");
|
164 |
+
|
165 |
delete_user_option ($user_id, "s2member_file_download_access_log");
|
166 |
+
|
167 |
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Demoted by s2Member: " . date ("D M j, Y g:i a T"));
|
168 |
+
|
169 |
+
if($subscr_gateway && $subscr_id) // Also note the Paid Subscr. Gateway/ID so there is a reference left behind here.
|
170 |
+
c_ws_plugin__s2member_user_notes::append_user_notes ($user_id, "Paid Subscr. ID @ time of demotion: ".$subscr_gateway." -› ".$subscr_id);
|
171 |
+
|
172 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"] && is_array ($cv = preg_split ("/\|/", $custom)))
|
173 |
{
|
174 |
+
foreach (preg_split ("/[\r\n\t]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_urls"]) as $url) // Handle EOT Notifications.
|
175 |
+
|
176 |
if (($url = preg_replace ("/%%cv([0-9]+)%%/ei", 'urlencode(trim($cv[$1]))', $url)) && ($url = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ("auto-eot-cancellation-expiration-demotion")), $url)) && ($url = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($subscr_id)), $url)))
|
177 |
if (($url = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->first_name)), $url)) && ($url = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user->last_name)), $url)))
|
178 |
if (($url = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (trim ($user->first_name . " " . $user->last_name))), $url)))
|
182 |
if (($url = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode ($user_id)), $url)))
|
183 |
{
|
184 |
if (is_array ($fields) && !empty ($fields))
|
185 |
+
foreach /* Custom Registration/Profile Fields. */ ($fields as $var => $val)
|
186 |
if (!($url = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (urlencode (maybe_serialize ($val))), $url)))
|
187 |
break;
|
188 |
+
|
189 |
if (($url = trim (preg_replace ("/%%(.+?)%%/i", "", $url))))
|
190 |
c_ws_plugin__s2member_utils_urls::remote ($url);
|
191 |
}
|
192 |
}
|
|
|
193 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"] && is_array ($cv = preg_split ("/\|/", $custom)))
|
194 |
{
|
195 |
$email_configs_were_on = c_ws_plugin__s2member_email_configs::email_config_status ();
|
196 |
c_ws_plugin__s2member_email_configs::email_config_release ();
|
197 |
+
|
198 |
+
$msg = $sbj = "(s2Member / API Notification Email) - EOT/Deletion";
|
199 |
+
$msg .= /* Spacing in the message body. */"\n\n";
|
200 |
+
|
201 |
$msg .= "eot_del_type: %%eot_del_type%%\n";
|
202 |
$msg .= "subscr_id: %%subscr_id%%\n";
|
203 |
$msg .= "user_first_name: %%user_first_name%%\n";
|
207 |
$msg .= "user_login: %%user_login%%\n";
|
208 |
$msg .= "user_ip: %%user_ip%%\n";
|
209 |
$msg .= "user_id: %%user_id%%\n";
|
210 |
+
|
211 |
if (is_array ($fields) && !empty ($fields))
|
212 |
foreach ($fields as $var => $val)
|
213 |
$msg .= $var . ": %%" . $var . "%%\n";
|
214 |
+
|
215 |
$msg .= "cv0: %%cv0%%\n";
|
216 |
$msg .= "cv1: %%cv1%%\n";
|
217 |
$msg .= "cv2: %%cv2%%\n";
|
222 |
$msg .= "cv7: %%cv7%%\n";
|
223 |
$msg .= "cv8: %%cv8%%\n";
|
224 |
$msg .= "cv9: %%cv9%%";
|
225 |
+
|
226 |
if (($msg = preg_replace ("/%%cv([0-9]+)%%/ei", 'trim($cv[$1])', $msg)) && ($msg = preg_replace ("/%%eot_del_type%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ("auto-eot-cancellation-expiration-demotion"), $msg)) && ($msg = preg_replace ("/%%subscr_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($subscr_id), $msg)))
|
227 |
if (($msg = preg_replace ("/%%user_first_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->first_name), $msg)) && ($msg = preg_replace ("/%%user_last_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user->last_name), $msg)))
|
228 |
if (($msg = preg_replace ("/%%user_full_name%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (trim ($user->first_name . " " . $user->last_name)), $msg)))
|
232 |
if (($msg = preg_replace ("/%%user_id%%/i", c_ws_plugin__s2member_utils_strings::esc_ds ($user_id), $msg)))
|
233 |
{
|
234 |
if (is_array ($fields) && !empty ($fields))
|
235 |
+
foreach /* Custom Registration/Profile Fields. */($fields as $var => $val)
|
236 |
if (!($msg = preg_replace ("/%%" . preg_quote ($var, "/") . "%%/i", c_ws_plugin__s2member_utils_strings::esc_ds (maybe_serialize ($val)), $msg)))
|
237 |
break;
|
238 |
+
|
239 |
+
if /* Still have a ``$sbj`` and a ``$msg``? */ ($sbj && ($msg = trim (preg_replace ("/%%(.+?)%%/i", "", $msg))))
|
240 |
+
|
241 |
foreach (c_ws_plugin__s2member_utils_strings::parse_emails ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["eot_del_notification_recipients"]) as $recipient)
|
242 |
+
wp_mail ($recipient, apply_filters ("ws_plugin__s2member_eot_del_notification_email_sbj", $sbj, get_defined_vars ()), apply_filters ("ws_plugin__s2member_eot_del_notification_email_msg", $msg, get_defined_vars ()), "Content-Type: text/plain; charset=UTF-8");
|
243 |
}
|
244 |
+
if /* Back on? */ ($email_configs_were_on)
|
|
|
245 |
c_ws_plugin__s2member_email_configs::email_config ();
|
246 |
}
|
247 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
|
|
248 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_demote", get_defined_vars ());
|
249 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
250 |
}
|
251 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_eot_behavior"] === "delete")
|
252 |
{
|
253 |
$eot_del_type = $GLOBALS["ws_plugin__s2member_eot_del_type"] = "auto-eot-cancellation-expiration-deletion";
|
254 |
+
|
255 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
256 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_before_delete", get_defined_vars ());
|
257 |
do_action ("ws_plugin__s2member_during_collective_eots", $user_id, get_defined_vars (), $eot_del_type, "removal-deletion");
|
258 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
259 |
+
|
260 |
+
if /* Multisite does NOT actually delete; ONLY removes. */(is_multisite ())
|
261 |
{
|
262 |
remove_user_from_blog ($user_id, $current_blog->blog_id);
|
263 |
+
// This will automatically trigger `eot_del_notification_urls`.
|
264 |
c_ws_plugin__s2member_user_deletions::handle_ms_user_deletions ($user_id, $current_blog->blog_id, "s2says");
|
265 |
}
|
266 |
+
else // Otherwise, we can actually delete them.
|
267 |
+
// This will automatically trigger `eot_del_notification_urls`
|
268 |
+
wp_delete_user /* `c_ws_plugin__s2member_user_deletions::handle_user_deletions()` */ ($user_id);
|
269 |
+
|
270 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
|
|
271 |
do_action ("ws_plugin__s2member_during_auto_eot_system_during_delete", get_defined_vars ());
|
272 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
273 |
}
|
274 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
|
|
275 |
do_action ("ws_plugin__s2member_during_auto_eot_system", get_defined_vars ());
|
276 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
277 |
}
|
278 |
}
|
279 |
}
|
280 |
}
|
281 |
}
|
282 |
+
|
283 |
+
c_ws_plugin__s2member_utils_logs::cleanup_expired_s2m_transients /* Cleanup. */ ();
|
284 |
+
|
285 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
286 |
do_action ("ws_plugin__s2member_after_auto_eot_system", get_defined_vars ());
|
287 |
+
unset /* Unset defined __refs, __v. */($__refs, $__v);
|
288 |
+
|
289 |
+
return /* Return for uniformity. */;
|
290 |
}
|
291 |
}
|
292 |
}
|
includes/classes/brute-force.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_brute_force"))
|
21 |
{
|
22 |
/**
|
@@ -43,22 +43,21 @@ if (!class_exists ("c_ws_plugin__s2member_brute_force"))
|
|
43 |
*/
|
44 |
public static function track_failed_logins ($username = FALSE)
|
45 |
{
|
46 |
-
|
47 |
do_action ("ws_plugin__s2member_before_track_failed_logins", get_defined_vars ());
|
48 |
-
unset
|
49 |
-
|
50 |
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
|
51 |
{
|
52 |
$exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
|
53 |
-
|
54 |
-
|
55 |
$transient = "s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"]);
|
56 |
set_transient ($transient, (int)get_transient ($transient) + 1, $exp_secs);
|
57 |
}
|
58 |
-
/**/
|
59 |
do_action ("ws_plugin__s2member_after_track_failed_logins", get_defined_vars ());
|
60 |
-
|
61 |
-
return
|
62 |
}
|
63 |
/**
|
64 |
* Stops anyone attempting a Brute Force attack.
|
@@ -77,27 +76,26 @@ if (!class_exists ("c_ws_plugin__s2member_brute_force"))
|
|
77 |
*/
|
78 |
public static function stop_brute_force_logins ($user = FALSE)
|
79 |
{
|
80 |
-
|
81 |
do_action ("ws_plugin__s2member_before_stop_brute_force_logins", get_defined_vars ());
|
82 |
-
unset
|
83 |
-
|
84 |
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
|
85 |
{
|
86 |
$exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
|
87 |
-
|
88 |
-
|
89 |
$about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
|
90 |
-
|
91 |
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
|
92 |
{
|
93 |
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
|
94 |
-
|
95 |
-
|
96 |
do_action ("ws_plugin__s2member_during_stop_brute_force_logins", get_defined_vars ());
|
97 |
-
unset
|
98 |
}
|
99 |
}
|
100 |
-
/**/
|
101 |
return apply_filters ("ws_plugin__s2member_stop_brute_force_logins", ((!empty ($errors)) ? $errors : $user), get_defined_vars ());
|
102 |
}
|
103 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_brute_force"))
|
21 |
{
|
22 |
/**
|
43 |
*/
|
44 |
public static function track_failed_logins ($username = FALSE)
|
45 |
{
|
46 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
47 |
do_action ("ws_plugin__s2member_before_track_failed_logins", get_defined_vars ());
|
48 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
49 |
+
|
50 |
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
|
51 |
{
|
52 |
$exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
|
53 |
+
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
|
54 |
+
|
55 |
$transient = "s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"]);
|
56 |
set_transient ($transient, (int)get_transient ($transient) + 1, $exp_secs);
|
57 |
}
|
|
|
58 |
do_action ("ws_plugin__s2member_after_track_failed_logins", get_defined_vars ());
|
59 |
+
|
60 |
+
return /* Return for uniformity. */;
|
61 |
}
|
62 |
/**
|
63 |
* Stops anyone attempting a Brute Force attack.
|
76 |
*/
|
77 |
public static function stop_brute_force_logins ($user = FALSE)
|
78 |
{
|
79 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
80 |
do_action ("ws_plugin__s2member_before_stop_brute_force_logins", get_defined_vars ());
|
81 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
82 |
+
|
83 |
if (($max = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["max_failed_login_attempts"]))
|
84 |
{
|
85 |
$exp_secs = strtotime ("+" . apply_filters ("ws_plugin__s2member_track_failed_logins__exp_time", "30 minutes", get_defined_vars ())) - time ();
|
86 |
+
// If you add Filters to this value, you should use a string that is compatible with PHP's strtotime() function.
|
87 |
+
|
88 |
$about = c_ws_plugin__s2member_utils_time::approx_time_difference (time (), time () + $exp_secs);
|
89 |
+
|
90 |
if ((int)get_transient ("s2m_ipr_" . md5 ("s2member_transient_failed_login_attempts_" . $_SERVER["REMOTE_ADDR"])) > $max)
|
91 |
{
|
92 |
$errors = new WP_Error ("incorrect_password", sprintf (_x ("Max failed logins. Please wait %s and try again.", "s2member-front", "s2member"), $about));
|
93 |
+
|
94 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
95 |
do_action ("ws_plugin__s2member_during_stop_brute_force_logins", get_defined_vars ());
|
96 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
97 |
}
|
98 |
}
|
|
|
99 |
return apply_filters ("ws_plugin__s2member_stop_brute_force_logins", ((!empty ($errors)) ? $errors : $user), get_defined_vars ());
|
100 |
}
|
101 |
}
|
includes/classes/cache.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_cache"))
|
21 |
{
|
22 |
/**
|
@@ -43,65 +43,61 @@ if (!class_exists ("c_ws_plugin__s2member_cache"))
|
|
43 |
public static function cached_page_links ()
|
44 |
{
|
45 |
do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
|
46 |
-
|
47 |
$lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
|
48 |
$mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
|
49 |
$fdlep = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
|
50 |
-
|
51 |
$lwp_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
|
52 |
$mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
|
53 |
$fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
|
54 |
-
|
55 |
$links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
|
56 |
-
|
57 |
if (isset ($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime ("-15 minutes") && $lwp_cache["link"])
|
58 |
{
|
59 |
$links["login_welcome_page"] = $lwp_cache["link"];
|
60 |
}
|
61 |
-
else
|
62 |
{
|
63 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $lwp;
|
64 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
|
65 |
$links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($lwp);
|
66 |
-
|
67 |
-
$cache_needs_updating =
|
68 |
}
|
69 |
-
/**/
|
70 |
if (isset ($mop_cache["page"], $mop_cache["time"], $mop_cache["link"]) && $mop_cache["page"] === $mop && $mop_cache["time"] >= strtotime ("-15 minutes") && $mop_cache["link"])
|
71 |
{
|
72 |
$links["membership_options_page"] = $mop_cache["link"];
|
73 |
}
|
74 |
-
else
|
75 |
{
|
76 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $mop;
|
77 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
|
78 |
$links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($mop);
|
79 |
-
|
80 |
-
$cache_needs_updating =
|
81 |
}
|
82 |
-
/**/
|
83 |
if (isset ($fdlep_cache["page"], $fdlep_cache["time"], $fdlep_cache["link"]) && $fdlep_cache["page"] === $fdlep && $fdlep_cache["time"] >= strtotime ("-15 minutes") && $fdlep_cache["link"])
|
84 |
{
|
85 |
$links["file_download_limit_exceeded_page"] = $fdlep_cache["link"];
|
86 |
}
|
87 |
-
else
|
88 |
{
|
89 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $fdlep;
|
90 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
|
91 |
$links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($fdlep);
|
92 |
-
|
93 |
-
$cache_needs_updating =
|
94 |
}
|
95 |
-
|
96 |
-
if ($cache_needs_updating) /* Cache is also reset dynamically during back-end option updates. */
|
97 |
{
|
98 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
99 |
}
|
100 |
-
|
101 |
-
|
102 |
-
foreach ($links as &$link) /* Conversions for SSL and non-SSL mode. */
|
103 |
$link = preg_replace ("/^https?\:\/\//i", $scheme . "://", $link);
|
104 |
-
|
105 |
return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
|
106 |
}
|
107 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_cache"))
|
21 |
{
|
22 |
/**
|
43 |
public static function cached_page_links ()
|
44 |
{
|
45 |
do_action ("ws_plugin__s2member_before_cached_page_links", get_defined_vars ());
|
46 |
+
|
47 |
$lwp = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
|
48 |
$mop = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
|
49 |
$fdlep = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
|
50 |
+
|
51 |
$lwp_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
|
52 |
$mop_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
|
53 |
$fdlep_cache = @$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
|
54 |
+
|
55 |
$links = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
|
56 |
+
|
57 |
if (isset ($lwp_cache["page"], $lwp_cache["time"], $lwp_cache["link"]) && $lwp_cache["page"] === $lwp && $lwp_cache["time"] >= strtotime ("-15 minutes") && $lwp_cache["link"])
|
58 |
{
|
59 |
$links["login_welcome_page"] = $lwp_cache["link"];
|
60 |
}
|
61 |
+
else // Otherwise, query the database using ``get_page_link()`` and update the cache.
|
62 |
{
|
63 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $lwp;
|
64 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
|
65 |
$links["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($lwp);
|
66 |
+
|
67 |
+
$cache_needs_updating = /* Flag for cache update. */ true;
|
68 |
}
|
|
|
69 |
if (isset ($mop_cache["page"], $mop_cache["time"], $mop_cache["link"]) && $mop_cache["page"] === $mop && $mop_cache["time"] >= strtotime ("-15 minutes") && $mop_cache["link"])
|
70 |
{
|
71 |
$links["membership_options_page"] = $mop_cache["link"];
|
72 |
}
|
73 |
+
else // Otherwise, query the database using ``get_page_link()`` and update the cache.
|
74 |
{
|
75 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $mop;
|
76 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
|
77 |
$links["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($mop);
|
78 |
+
|
79 |
+
$cache_needs_updating = /* Flag for cache update. */ true;
|
80 |
}
|
|
|
81 |
if (isset ($fdlep_cache["page"], $fdlep_cache["time"], $fdlep_cache["link"]) && $fdlep_cache["page"] === $fdlep && $fdlep_cache["time"] >= strtotime ("-15 minutes") && $fdlep_cache["link"])
|
82 |
{
|
83 |
$links["file_download_limit_exceeded_page"] = $fdlep_cache["link"];
|
84 |
}
|
85 |
+
else // Otherwise, query the database using ``get_page_link()`` and update the cache.
|
86 |
{
|
87 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $fdlep;
|
88 |
$GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
|
89 |
$links["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($fdlep);
|
90 |
+
|
91 |
+
$cache_needs_updating = /* Flag for cache update. */ true;
|
92 |
}
|
93 |
+
if /* Cache is also reset dynamically during back-end option updates. */ ($cache_needs_updating)
|
|
|
94 |
{
|
95 |
update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
|
96 |
}
|
97 |
+
$scheme = /* SSL mode? */ (is_ssl ()) ? "https" : "http";
|
98 |
+
foreach /* Conversions for SSL and non-SSL mode. */ ($links as &$link)
|
|
|
99 |
$link = preg_replace ("/^https?\:\/\//i", $scheme . "://", $link);
|
100 |
+
|
101 |
return apply_filters ("ws_plugin__s2member_cached_page_links", $links, get_defined_vars ());
|
102 |
}
|
103 |
}
|
includes/classes/catgs-sp.inc.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's Category protection routines *(
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
|
21 |
{
|
22 |
/**
|
23 |
-
* s2Member's Category protection routines *(
|
24 |
*
|
25 |
* @package s2Member\Categories
|
26 |
* @since 3.5
|
@@ -28,62 +28,60 @@ if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
|
|
28 |
class c_ws_plugin__s2member_catgs_sp
|
29 |
{
|
30 |
/**
|
31 |
-
* Handles Category Level Access *(
|
32 |
*
|
33 |
* @package s2Member\Categories
|
34 |
* @since 3.5
|
35 |
*
|
36 |
* @param int|str $cat_id Numeric Category ID.
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
-
* @return null|array Non-empty array (
|
39 |
*/
|
40 |
public static function check_specific_catg_level_access ($cat_id = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
do_action ("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars ());
|
43 |
-
|
44 |
$excluded = apply_filters ("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
|
45 |
-
|
46 |
if (!$excluded && is_numeric ($cat_id) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
-
$cat_uri =
|
49 |
-
|
50 |
-
if
|
51 |
{
|
52 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
|
53 |
-
|
54 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
|
56 |
-
|
57 |
-
else if
|
58 |
{
|
59 |
-
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
60 |
{
|
61 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
62 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
63 |
-
|
64 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
65 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
66 |
-
|
67 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])
|
68 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
|
69 |
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
70 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
71 |
}
|
72 |
-
|
73 |
-
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
74 |
{
|
75 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
|
76 |
-
|
77 |
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
|
78 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
79 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
80 |
}
|
81 |
}
|
82 |
-
/**/
|
83 |
do_action ("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
|
84 |
}
|
85 |
}
|
86 |
-
/**/
|
87 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars ());
|
88 |
}
|
89 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's Category protection routines *(for specific Categories)*.
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_catgs_sp"))
|
21 |
{
|
22 |
/**
|
23 |
+
* s2Member's Category protection routines *(for specific Categories)*.
|
24 |
*
|
25 |
* @package s2Member\Categories
|
26 |
* @since 3.5
|
28 |
class c_ws_plugin__s2member_catgs_sp
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Category Level Access *(for specific Categories)*.
|
32 |
*
|
33 |
* @package s2Member\Categories
|
34 |
* @since 3.5
|
35 |
*
|
36 |
* @param int|str $cat_id Numeric Category ID.
|
37 |
* @param bool $check_user Test permissions against the current User? Defaults to true.
|
38 |
+
* @return null|array Non-empty array (with details) if access is denied, else null if access is allowed.
|
39 |
*/
|
40 |
public static function check_specific_catg_level_access ($cat_id = FALSE, $check_user = TRUE)
|
41 |
{
|
42 |
do_action ("ws_plugin__s2member_before_check_specific_catg_level_access", get_defined_vars ());
|
43 |
+
|
44 |
$excluded = apply_filters ("ws_plugin__s2member_check_specific_catg_level_access_excluded", false, get_defined_vars ());
|
45 |
+
|
46 |
if (!$excluded && is_numeric ($cat_id) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
+
$cat_uri = /* Get a full valid URI for this Category. */ c_ws_plugin__s2member_utils_urls::parse_uri (get_category_link ($cat_id));
|
49 |
+
|
50 |
+
if /* Do NOT touch WordPress® Systematics. */ (!c_ws_plugin__s2member_systematics_sp::is_wp_systematic_use_specific_page (null, $cat_uri))
|
51 |
{
|
52 |
+
$user = /* Current User's object. */(is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
|
53 |
+
|
54 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level0")))
|
55 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => 0), get_defined_vars ());
|
56 |
+
|
57 |
+
else if /* Never restrict Systematics. However, there is 1 exception ^. */ (!c_ws_plugin__s2member_systematics_sp::is_systematic_use_specific_page (null, $cat_uri))
|
58 |
{
|
59 |
+
for /* Category Level restrictions. Go through each Level. We also check nested Categories. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
60 |
{
|
61 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
62 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
63 |
+
|
64 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
65 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
66 |
+
|
67 |
+
else if /* Check Category ancestry. */ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"])
|
68 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
|
69 |
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
70 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
71 |
}
|
72 |
+
|
73 |
+
for /* URIs. Go through each Level. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
74 |
{
|
75 |
+
if /* URIs configured at this Level? */ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
|
76 |
+
|
77 |
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
|
78 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $cat_uri) && (!$check_user || !$user || !$user->has_cap ("access_s2member_level" . $n)))
|
79 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", array ("s2member_level_req" => $n), get_defined_vars ());
|
80 |
}
|
81 |
}
|
|
|
82 |
do_action ("ws_plugin__s2member_during_check_specific_catg_level_access", get_defined_vars ());
|
83 |
}
|
84 |
}
|
|
|
85 |
return apply_filters ("ws_plugin__s2member_check_specific_catg_level_access", null, get_defined_vars ());
|
86 |
}
|
87 |
}
|
includes/classes/catgs.inc.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's Category protection routines *(
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_catgs"))
|
21 |
{
|
22 |
/**
|
23 |
-
* s2Member's Category protection routines *(
|
24 |
*
|
25 |
* @package s2Member\Categories
|
26 |
* @since 3.5
|
@@ -28,7 +28,7 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
|
|
28 |
class c_ws_plugin__s2member_catgs
|
29 |
{
|
30 |
/**
|
31 |
-
* Handles Category Level Access *(
|
32 |
*
|
33 |
* @package s2Member\Categories
|
34 |
* @since 3.5
|
@@ -37,54 +37,51 @@ if (!class_exists ("c_ws_plugin__s2member_catgs"))
|
|
37 |
*/
|
38 |
public static function check_catg_level_access ()
|
39 |
{
|
40 |
-
global
|
41 |
-
|
42 |
do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
|
43 |
-
|
44 |
$excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
|
45 |
-
|
46 |
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
-
if
|
49 |
{
|
50 |
-
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
|
51 |
-
|
52 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
|
53 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
54 |
-
|
55 |
-
else if
|
56 |
{
|
57 |
-
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
58 |
{
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
60 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
-
|
62 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
63 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
-
|
65 |
-
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]
|
66 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
|
67 |
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
68 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
69 |
}
|
70 |
-
|
71 |
-
for ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--) /* URIs. Go through each Level. */
|
72 |
{
|
73 |
-
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
|
74 |
-
|
75 |
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
|
76 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
77 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
78 |
}
|
79 |
}
|
80 |
-
/**/
|
81 |
do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
|
82 |
}
|
83 |
}
|
84 |
-
/**/
|
85 |
do_action ("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
|
86 |
-
|
87 |
-
return
|
88 |
}
|
89 |
}
|
90 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's Category protection routines *(for current page)*.
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_catgs"))
|
21 |
{
|
22 |
/**
|
23 |
+
* s2Member's Category protection routines *(for current page)*.
|
24 |
*
|
25 |
* @package s2Member\Categories
|
26 |
* @since 3.5
|
28 |
class c_ws_plugin__s2member_catgs
|
29 |
{
|
30 |
/**
|
31 |
+
* Handles Category Level Access *(for current page)*.
|
32 |
*
|
33 |
* @package s2Member\Categories
|
34 |
* @since 3.5
|
37 |
*/
|
38 |
public static function check_catg_level_access ()
|
39 |
{
|
40 |
+
global /* ``get_the_ID()`` is NOT available outside The Loop. */ $post;
|
41 |
+
|
42 |
do_action ("ws_plugin__s2member_before_check_catg_level_access", get_defined_vars ());
|
43 |
+
|
44 |
$excluded = apply_filters ("ws_plugin__s2member_check_catg_level_access_excluded", false, get_defined_vars ());
|
45 |
+
|
46 |
if (!$excluded && is_category () && ($cat_id = get_query_var ("cat")) && ($cat_id = (int)$cat_id) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])
|
47 |
{
|
48 |
+
if /* Do NOT touch WordPress® Systematics. This excludes all WordPress® Systematics. */ (!c_ws_plugin__s2member_systematics::is_wp_systematic_use_page ())
|
49 |
{
|
50 |
+
$user = /* Current User's object. */ (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && !empty ($user->ID)) ? $user : false;
|
51 |
+
|
52 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"] && ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false")) && preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level0")))
|
53 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", 0, $_SERVER["REQUEST_URI"], "sys") . exit ();
|
54 |
+
|
55 |
+
else if /* Do NOT protect Systematics. However, there is 1 exception above. */ (!c_ws_plugin__s2member_systematics::is_systematic_use_page ())
|
56 |
{
|
57 |
+
for /* Category Level restrictions. Go through each Level. We also check nested Categories. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
58 |
{
|
59 |
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] === "all" && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
60 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
61 |
+
|
62 |
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] && in_array ($cat_id, ($catgs = preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]))) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
63 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
64 |
+
|
65 |
+
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"] /* Check Category ancestry. */)
|
66 |
foreach (preg_split ("/[\r\n\t\s;,]+/", $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_catgs"]) as $catg)
|
67 |
if ($catg && cat_is_ancestor_of ($catg, $cat_id) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
68 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"]) . exit ();
|
69 |
}
|
70 |
+
for /* URIs. Go through each Level. */ ($n = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n >= 0; $n--)
|
|
|
71 |
{
|
72 |
+
if /* URIs configured at this Level? */ ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"])
|
73 |
+
|
74 |
foreach (preg_split ("/[\r\n\t]+/", c_ws_plugin__s2member_ruris::fill_ruri_level_access_rc_vars ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $n . "_ruris"], $user)) as $str)
|
75 |
if ($str && preg_match ("/" . preg_quote ($str, "/") . "/", $_SERVER["REQUEST_URI"]) && c_ws_plugin__s2member_no_cache::no_cache_constants (true) && (!$user || !$user->has_cap ("access_s2member_level" . $n)))
|
76 |
c_ws_plugin__s2member_mo_page::wp_redirect_w_mop_vars /* Configure MOP Vars here. */ ("catg", $cat_id, "level", $n, $_SERVER["REQUEST_URI"], "ruri") . exit ();
|
77 |
}
|
78 |
}
|
|
|
79 |
do_action ("ws_plugin__s2member_during_check_catg_level_access", get_defined_vars ());
|
80 |
}
|
81 |
}
|
|
|
82 |
do_action ("ws_plugin__s2member_after_check_catg_level_access", get_defined_vars ());
|
83 |
+
|
84 |
+
return /* For uniformity. */;
|
85 |
}
|
86 |
}
|
87 |
}
|
includes/classes/check-activation.inc.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,7 +16,7 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_check_activation"))
|
21 |
{
|
22 |
/**
|
@@ -37,7 +37,7 @@ if (!class_exists ("c_ws_plugin__s2member_check_activation"))
|
|
37 |
*
|
38 |
* @return null
|
39 |
*/
|
40 |
-
public static function check ()
|
41 |
{
|
42 |
if (!($v = get_option ("ws_plugin__s2member_activated_version")) || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
|
43 |
{
|
@@ -51,8 +51,7 @@ if (!class_exists ("c_ws_plugin__s2member_check_activation"))
|
|
51 |
{
|
52 |
c_ws_plugin__s2member_installation::activate ("levels");
|
53 |
}
|
54 |
-
|
55 |
-
return; /* Return for uniformity. */
|
56 |
}
|
57 |
}
|
58 |
}
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit ("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_check_activation"))
|
21 |
{
|
22 |
/**
|
37 |
*
|
38 |
* @return null
|
39 |
*/
|
40 |
+
public static function check ()
|
41 |
{
|
42 |
if (!($v = get_option ("ws_plugin__s2member_activated_version")) || !version_compare ($v, WS_PLUGIN__S2MEMBER_VERSION, ">="))
|
43 |
{
|
51 |
{
|
52 |
c_ws_plugin__s2member_installation::activate ("levels");
|
53 |
}
|
54 |
+
return /* Return for uniformity. */;
|
|
|
55 |
}
|
56 |
}
|
57 |
}
|
includes/classes/constants.inc.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* s2Member's API Constants *(
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
-
* (
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
@@ -16,11 +16,11 @@
|
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
-
|
20 |
if (!class_exists ("c_ws_plugin__s2member_constants"))
|
21 |
{
|
22 |
/**
|
23 |
-
* s2Member's API Constants *(
|
24 |
*
|
25 |
* @package s2Member\API_Constants
|
26 |
* @since 3.5
|
@@ -44,15 +44,15 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
44 |
public static function constants ()
|
45 |
{
|
46 |
do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
|
47 |
-
|
48 |
$links = c_ws_plugin__s2member_cache::cached_page_links ();
|
49 |
-
|
50 |
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID) ? $user : false;
|
51 |
-
|
52 |
$level = c_ws_plugin__s2member_user_access::user_access_level ($user);
|
53 |
$file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
|
54 |
$login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
|
55 |
-
|
56 |
$custom = ($user) ? get_user_option ("s2member_custom", $user->ID) : "";
|
57 |
$subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
|
58 |
$subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
|
@@ -60,10 +60,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
60 |
$custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
|
61 |
$paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
|
62 |
$login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
|
63 |
-
|
64 |
-
|
65 |
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
|
66 |
-
unset
|
67 |
/**
|
68 |
* Current version of s2Member.
|
69 |
*
|
@@ -250,7 +250,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
250 |
* The current User's Membership Access Label.
|
251 |
*
|
252 |
* As configured by the site owner. Each Membership Level is associated with a Membership Label
|
253 |
-
* *(
|
254 |
*
|
255 |
* An empty string if NOT logged-in.
|
256 |
*
|
@@ -284,7 +284,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
284 |
if (!defined ("S2MEMBER_CURRENT_USER_ACCESS_LABEL"))
|
285 |
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
|
286 |
/**
|
287 |
-
* The current User's Paid Subscription ID (
|
288 |
*
|
289 |
* An empty string if NOT logged-in.
|
290 |
*
|
@@ -322,7 +322,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
322 |
if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_ID"))
|
323 |
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : "")));
|
324 |
/**
|
325 |
-
* The current User's Paid Subscription ID (
|
326 |
* otherwise, this will contain their WordPress® User ID.
|
327 |
*
|
328 |
* An empty string if NOT logged-in.
|
@@ -361,7 +361,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
361 |
if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID"))
|
362 |
define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
|
363 |
/**
|
364 |
-
* The current User's Paid Subscription Gateway Code (
|
365 |
*
|
366 |
* Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
|
367 |
*
|
@@ -822,7 +822,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
822 |
if (!defined ("S2MEMBER_CURRENT_USER_EMAIL"))
|
823 |
define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($user) ? (string)$user->user_email : "")));
|
824 |
/**
|
825 |
-
* The current User's IP Address (
|
826 |
*
|
827 |
* This is the current IP Address, taken from ``$_SERVER["REMOTE_ADDR"]``.
|
828 |
*
|
@@ -1050,7 +1050,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1050 |
*
|
1051 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1052 |
*
|
1053 |
-
* @see `Dashboard
|
1054 |
*/
|
1055 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED"))
|
1056 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
|
@@ -1104,7 +1104,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1104 |
*
|
1105 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1106 |
*
|
1107 |
-
* @see `Dashboard
|
1108 |
*/
|
1109 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED"))
|
1110 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = (($file_downloads["allowed"] >= 999999999) ? true : false)));
|
@@ -1149,7 +1149,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1149 |
*
|
1150 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1151 |
*
|
1152 |
-
* @see `Dashboard
|
1153 |
*/
|
1154 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY"))
|
1155 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", ($c[] = (int)$file_downloads["currently"]));
|
@@ -1194,7 +1194,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1194 |
*
|
1195 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1196 |
*
|
1197 |
-
* @see `Dashboard
|
1198 |
*/
|
1199 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS"))
|
1200 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$file_downloads["allowed_days"]));
|
@@ -1249,7 +1249,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1249 |
*
|
1250 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1251 |
*
|
1252 |
-
* @see `Dashboard
|
1253 |
*/
|
1254 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID"))
|
1255 |
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]));
|
@@ -1289,7 +1289,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1289 |
*
|
1290 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1291 |
*
|
1292 |
-
* @see `Dashboard
|
1293 |
*/
|
1294 |
if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID"))
|
1295 |
define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
|
@@ -1329,14 +1329,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1329 |
*
|
1330 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1331 |
*
|
1332 |
-
* @see `Dashboard
|
1333 |
*/
|
1334 |
if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_ID"))
|
1335 |
define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
|
1336 |
/**
|
1337 |
* A URL, which leads to the Stand-Alone Profile Modification Page.
|
1338 |
*
|
1339 |
-
* This is always a reference to `/?s2member_profile=1` *(
|
1340 |
*
|
1341 |
* ———— Quick PHP Code Sample ————
|
1342 |
* ```
|
@@ -1368,7 +1368,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1368 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
|
1369 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
|
1370 |
*
|
1371 |
-
* @see `Dashboard
|
1372 |
*/
|
1373 |
if (!defined ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL"))
|
1374 |
define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = (string)site_url ("/?s2member_profile=1")));
|
@@ -1423,7 +1423,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1423 |
*
|
1424 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1425 |
*
|
1426 |
-
* @see `Dashboard
|
1427 |
*/
|
1428 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL"))
|
1429 |
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
|
@@ -1463,10 +1463,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1463 |
*
|
1464 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1465 |
*
|
1466 |
-
* @see `Dashboard
|
1467 |
*/
|
1468 |
if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL"))
|
1469 |
-
define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"]));
|
1470 |
/**
|
1471 |
* The URL, which leads to the Login Welcome Page; as configured by the site owner.
|
1472 |
*
|
@@ -1503,7 +1503,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1503 |
*
|
1504 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1505 |
*
|
1506 |
-
* @see `Dashboard
|
1507 |
*/
|
1508 |
if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_URL"))
|
1509 |
define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
|
@@ -1546,7 +1546,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1546 |
* @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
|
1547 |
*/
|
1548 |
if (!defined ("S2MEMBER_LOGOUT_PAGE_URL"))
|
1549 |
-
define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ()));
|
1550 |
/**
|
1551 |
* The URL, where a User can log into their account.
|
1552 |
*
|
@@ -1586,9 +1586,9 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1586 |
* @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
|
1587 |
*/
|
1588 |
if (!defined ("S2MEMBER_LOGIN_PAGE_URL"))
|
1589 |
-
define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url
|
1590 |
/**
|
1591 |
-
* Each Membership Level (
|
1592 |
*
|
1593 |
* The defaults are as follows:
|
1594 |
* o Level #0 ``S2MEMBER_LEVEL0_LABEL`` = Free Subscriber
|
@@ -1625,7 +1625,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1625 |
*
|
1626 |
* @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
|
1627 |
*
|
1628 |
-
* @see `Dashboard
|
1629 |
*/
|
1630 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1631 |
{
|
@@ -1677,7 +1677,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1677 |
*
|
1678 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1679 |
*
|
1680 |
-
* @see `Dashboard
|
1681 |
*/
|
1682 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1683 |
{
|
@@ -1730,7 +1730,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1730 |
*
|
1731 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1732 |
*
|
1733 |
-
* @see `Dashboard
|
1734 |
*/
|
1735 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1736 |
{
|
@@ -1774,7 +1774,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1774 |
* @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
|
1775 |
* @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
|
1776 |
*
|
1777 |
-
* @see `Dashboard
|
1778 |
*/
|
1779 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS"))
|
1780 |
define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]));
|
@@ -1801,7 +1801,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1801 |
*
|
1802 |
* @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_EMAIL
|
1803 |
*
|
1804 |
-
* @see `Dashboard
|
1805 |
*/
|
1806 |
if (!defined ("S2MEMBER_REG_EMAIL_FROM_NAME"))
|
1807 |
define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
|
@@ -1828,7 +1828,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1828 |
*
|
1829 |
* @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_NAME
|
1830 |
*
|
1831 |
-
* @see `Dashboard
|
1832 |
*/
|
1833 |
if (!defined ("S2MEMBER_REG_EMAIL_FROM_EMAIL"))
|
1834 |
define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
|
@@ -1856,7 +1856,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1856 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
|
1857 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
|
1858 |
*
|
1859 |
-
* @see `Dashboard
|
1860 |
*/
|
1861 |
if (!defined ("S2MEMBER_PAYPAL_NOTIFY_URL"))
|
1862 |
define ("S2MEMBER_PAYPAL_NOTIFY_URL", ($c[] = (string)site_url ("/?s2member_paypal_notify=1")));
|
@@ -1884,7 +1884,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1884 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
|
1885 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN
|
1886 |
*
|
1887 |
-
* @see `Dashboard
|
1888 |
*/
|
1889 |
if (!defined ("S2MEMBER_PAYPAL_RETURN_URL"))
|
1890 |
define ("S2MEMBER_PAYPAL_RETURN_URL", ($c[] = (string)site_url ("/?s2member_paypal_return=1")));
|
@@ -1913,12 +1913,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1913 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
|
1914 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
|
1915 |
*
|
1916 |
-
* @see `Dashboard
|
1917 |
*/
|
1918 |
if (!defined ("S2MEMBER_PAYPAL_BUSINESS"))
|
1919 |
define ("S2MEMBER_PAYPAL_BUSINESS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_business"]));
|
1920 |
/**
|
1921 |
-
* PayPal® endpoint domain (
|
1922 |
*
|
1923 |
* o In Sandbox Mode, this is: `www.sandbox.paypal.com`.
|
1924 |
* o In Production Mode, this is: `www.paypal.com`.
|
@@ -1943,12 +1943,12 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1943 |
*
|
1944 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_ENDPOINT
|
1945 |
*
|
1946 |
-
* @see `Dashboard
|
1947 |
*/
|
1948 |
if (!defined ("S2MEMBER_PAYPAL_ENDPOINT"))
|
1949 |
define ("S2MEMBER_PAYPAL_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "www.sandbox.paypal.com" : "www.paypal.com")));
|
1950 |
/**
|
1951 |
-
* PayPal® API endpoint domain (
|
1952 |
*
|
1953 |
* o In Sandbox Mode, this is: `api-3t.sandbox.paypal.com`.
|
1954 |
* o In Production Mode, this is: `api-3t.paypal.com`.
|
@@ -1973,7 +1973,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
1973 |
*
|
1974 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_ENDPOINT
|
1975 |
*
|
1976 |
-
* @see `Dashboard
|
1977 |
*/
|
1978 |
if (!defined ("S2MEMBER_PAYPAL_API_ENDPOINT"))
|
1979 |
define ("S2MEMBER_PAYPAL_API_ENDPOINT", ($c[] = (($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_sandbox"]) ? "api-3t.sandbox.paypal.com" : "api-3t.paypal.com")));
|
@@ -2001,7 +2001,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2001 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
|
2002 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
|
2003 |
*
|
2004 |
-
* @see `Dashboard
|
2005 |
*/
|
2006 |
if (!defined ("S2MEMBER_PAYPAL_API_USERNAME"))
|
2007 |
define ("S2MEMBER_PAYPAL_API_USERNAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"]));
|
@@ -2029,7 +2029,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2029 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
|
2030 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_SIGNATURE
|
2031 |
*
|
2032 |
-
* @see `Dashboard
|
2033 |
*/
|
2034 |
if (!defined ("S2MEMBER_PAYPAL_API_PASSWORD"))
|
2035 |
define ("S2MEMBER_PAYPAL_API_PASSWORD", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"]));
|
@@ -2057,7 +2057,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2057 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_USERNAME
|
2058 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_API_PASSWORD
|
2059 |
*
|
2060 |
-
* @see `Dashboard
|
2061 |
*/
|
2062 |
if (!defined ("S2MEMBER_PAYPAL_API_SIGNATURE"))
|
2063 |
define ("S2MEMBER_PAYPAL_API_SIGNATURE", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"]));
|
@@ -2084,7 +2084,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2084 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_RETURN_URL
|
2085 |
* @see s2Member\API_Constants\S2MEMBER_PAYPAL_NOTIFY_URL
|
2086 |
*
|
2087 |
-
* @see `Dashboard
|
2088 |
*/
|
2089 |
if (!defined ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN"))
|
2090 |
define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
|
@@ -2095,7 +2095,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2095 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2096 |
*
|
2097 |
* Note. This API Constant is excluded from the ``$c[]`` hash calculation used in the generation of {@link s2Member\API_Constants\WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5}.
|
2098 |
-
* It MUST be excluded, because the value of this particular API Constant will change too often *(
|
2099 |
* So, when including this API Constant in the JavaScript API as a Global, care must be taken to build an Invoice, using JavaScript
|
2100 |
* to calculate the unique time-based code, with something like: `Math.round (new Date ().getTime ())`.
|
2101 |
*
|
@@ -2111,10 +2111,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2111 |
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
|
2112 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2113 |
*
|
2114 |
-
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(
|
2115 |
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
|
2116 |
*
|
2117 |
-
* Instead of forcing a Member *(
|
2118 |
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
|
2119 |
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
|
2120 |
* you won't even see these, because they're added internally by the Shortcode processor.
|
@@ -2144,14 +2144,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2144 |
*
|
2145 |
* @see s2Member\API_Functions\s2member_value_for_pp_inv()
|
2146 |
*
|
2147 |
-
* @see `Dashboard
|
2148 |
*/
|
2149 |
if (!defined ("S2MEMBER_VALUE_FOR_PP_INV"))
|
2150 |
define ("S2MEMBER_VALUE_FOR_PP_INV", uniqid () . "~" . S2MEMBER_CURRENT_USER_IP);
|
2151 |
/**
|
2152 |
* PayPal® value for Payment Buttons with input name: `on0`.
|
2153 |
*
|
2154 |
-
* Used in PayPal® Modification Buttons *(
|
2155 |
*
|
2156 |
* This auto-fills the `on0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
|
2157 |
* this will auto-fill the value for the `on0` input variable, with the string: "Referencing Customer ID".
|
@@ -2169,10 +2169,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2169 |
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
|
2170 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2171 |
*
|
2172 |
-
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(
|
2173 |
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
|
2174 |
*
|
2175 |
-
* Instead of forcing a Member *(
|
2176 |
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
|
2177 |
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
|
2178 |
* you won't even see these, because they're added internally by the Shortcode processor.
|
@@ -2202,18 +2202,18 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2202 |
*
|
2203 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0
|
2204 |
*
|
2205 |
-
* @see `Dashboard
|
2206 |
*/
|
2207 |
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0"))
|
2208 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Referencing Customer ID" : "Originating Domain")));
|
2209 |
/**
|
2210 |
* PayPal® value for Payment Buttons with input name: `os0`.
|
2211 |
*
|
2212 |
-
* Used in PayPal® Modification Buttons *(
|
2213 |
*
|
2214 |
* This auto-fills the `os0` value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member,
|
2215 |
* this will auto-fill the value for the `os0` input variable, with the value of {@link s2Member\API_Constants\S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID}.
|
2216 |
-
* Otherwise, it will be set to a default value of ``$_SERVER["HTTP_HOST"]`` *(
|
2217 |
*
|
2218 |
* These five API Constants are special.
|
2219 |
* o {@link s2Member\API_Constants\S2MEMBER_VALUE_FOR_PP_INV}
|
@@ -2227,10 +2227,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2227 |
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
|
2228 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2229 |
*
|
2230 |
-
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(
|
2231 |
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
|
2232 |
*
|
2233 |
-
* Instead of forcing a Member *(
|
2234 |
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
|
2235 |
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
|
2236 |
* you won't even see these, because they're added internally by the Shortcode processor.
|
@@ -2260,7 +2260,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2260 |
*
|
2261 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0
|
2262 |
*
|
2263 |
-
* @see `Dashboard
|
2264 |
*/
|
2265 |
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0"))
|
2266 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : (string)$_SERVER["HTTP_HOST"])));
|
@@ -2282,10 +2282,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2282 |
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
|
2283 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2284 |
*
|
2285 |
-
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(
|
2286 |
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
|
2287 |
*
|
2288 |
-
* Instead of forcing a Member *(
|
2289 |
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
|
2290 |
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
|
2291 |
* you won't even see these, because they're added internally by the Shortcode processor.
|
@@ -2315,7 +2315,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2315 |
*
|
2316 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1
|
2317 |
*
|
2318 |
-
* @see `Dashboard
|
2319 |
*/
|
2320 |
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1"))
|
2321 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1", ($c[] = "Customer IP Address" /* Via $_SERVER["REMOTE_ADDR"] below. */));
|
@@ -2337,10 +2337,10 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2337 |
* The `INV` value can be used to auto-fill the `invoice` for PayPal® Button Codes, with a unique Code~IP combination.
|
2338 |
* However, in cases where multiple Buttons are displayed on the same page, the alternative {@link s2Member\API_Functions\s2member_value_for_pp_inv()} function should be used instead.
|
2339 |
*
|
2340 |
-
* The `ON0/OS0` values, are how s2Member identifies an existing Member *(
|
2341 |
* when they click a PayPal® Modification Button that was generated for you by s2Member's Button Generator.
|
2342 |
*
|
2343 |
-
* Instead of forcing a Member *(
|
2344 |
* s2Member can identify their existing account, and update it; according to the modified terms in your Button Code.
|
2345 |
* These three Button Code parameters: `on0`, `os0`, `modify`, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons,
|
2346 |
* you won't even see these, because they're added internally by the Shortcode processor.
|
@@ -2370,7 +2370,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2370 |
*
|
2371 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON1
|
2372 |
*
|
2373 |
-
* @see `Dashboard
|
2374 |
*/
|
2375 |
if (!defined ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1"))
|
2376 |
define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS1", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
|
@@ -2392,8 +2392,8 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
|
|
2392 |
Calls the after Hook. Do NOT set Constants here.
|
2393 |
*/
|
2394 |
do_action ("ws_plugin__s2member_after_constants", get_defined_vars ());
|
2395 |
-
|
2396 |
-
return
|
2397 |
}
|
2398 |
}
|
2399 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* s2Member's API Constants *(for site owners)*.
|
4 |
*
|
5 |
* Copyright: © 2009-2011
|
6 |
* {@link http://www.websharks-inc.com/ WebSharks, Inc.}
|
7 |
+
* (coded in the USA)
|
8 |
*
|
9 |
* Released under the terms of the GNU General Public License.
|
10 |
* You should have received a copy of the GNU General Public License,
|
16 |
*/
|
17 |
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
|
18 |
exit("Do not access this file directly.");
|
19 |
+
|
20 |
if (!class_exists ("c_ws_plugin__s2member_constants"))
|
21 |
{
|
22 |
/**
|
23 |
+
* s2Member's API Constants *(for site owners)*.
|
24 |
*
|
25 |
* @package s2Member\API_Constants
|
26 |
* @since 3.5
|
44 |
public static function constants ()
|
45 |
{
|
46 |
do_action ("ws_plugin__s2member_before_constants", get_defined_vars ());
|
47 |
+
|
48 |
$links = c_ws_plugin__s2member_cache::cached_page_links ();
|
49 |
+
|
50 |
$user = (is_user_logged_in () && is_object ($user = wp_get_current_user ()) && $user->ID) ? $user : false;
|
51 |
+
|
52 |
$level = c_ws_plugin__s2member_user_access::user_access_level ($user);
|
53 |
$file_downloads = c_ws_plugin__s2member_files::user_downloads ($user);
|
54 |
$login_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user);
|
55 |
+
|
56 |
$custom = ($user) ? get_user_option ("s2member_custom", $user->ID) : "";
|
57 |
$subscr_id = ($user) ? get_user_option ("s2member_subscr_id", $user->ID) : "";
|
58 |
$subscr_gateway = ($user) ? get_user_option ("s2member_subscr_gateway", $user->ID) : "";
|
60 |
$custom_fields = ($user) ? get_user_option ("s2member_custom_fields", $user->ID) : array ();
|
61 |
$paid_registration_times = ($user) ? get_user_option ("s2member_paid_registration_times", $user->ID) : array ();
|
62 |
$login_counter = ($user) ? (int)get_user_option ("s2member_login_counter") : -1;
|
63 |
+
|
64 |
+
foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;
|
65 |
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
|
66 |
+
unset /* Unset defined __refs, __v. */ ($__refs, $__v);
|
67 |
/**
|
68 |
* Current version of s2Member.
|
69 |
*
|
250 |
* The current User's Membership Access Label.
|
251 |
*
|
252 |
* As configured by the site owner. Each Membership Level is associated with a Membership Label
|
253 |
+
* *(i.e. Bronze, Silver, Gold, Platinum)*, or whatever the site owner has configured.
|
254 |
*
|
255 |
* An empty string if NOT logged-in.
|
256 |
*
|
284 |
if (!defined ("S2MEMBER_CURRENT_USER_ACCESS_LABEL"))
|
285 |
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
|
286 |
/**
|
287 |
+
* The current User's Paid Subscription ID (when applicable).
|
288 |
*
|
289 |
* An empty string if NOT logged-in.
|
290 |
*
|
322 |
if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_ID"))
|
323 |
define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($user) ? (string)$subscr_id : "")));
|
324 |
/**
|
325 |
+
* The current User's Paid Subscription ID (when applicable);
|
326 |
* otherwise, this will contain their WordPress® User ID.
|
327 |
*
|
328 |
* An empty string if NOT logged-in.
|
361 |
if (!defined ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID"))
|
362 |
define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($user) ? (($subscr_id) ? (string)$subscr_id : (string)$user->ID) : "")));
|
363 |
/**
|
364 |
+
* The current User's Paid Subscription Gateway Code (when applicable).
|
365 |
*
|
366 |
* Usually one of these values: `paypal`, `authnet`, `clickbank`, `google`, `ccbill`, `alipay`.
|
367 |
*
|
822 |
if (!defined ("S2MEMBER_CURRENT_USER_EMAIL"))
|
823 |
define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($user) ? (string)$user->user_email : "")));
|
824 |
/**
|
825 |
+
* The current User's IP Address (even if/when NOT logged-in).
|
826 |
*
|
827 |
* This is the current IP Address, taken from ``$_SERVER["REMOTE_ADDR"]``.
|
828 |
*
|
1050 |
*
|
1051 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1052 |
*
|
1053 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1054 |
*/
|
1055 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED"))
|
1056 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
|
1104 |
*
|
1105 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1106 |
*
|
1107 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1108 |
*/
|
1109 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED"))
|
1110 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = (($file_downloads["allowed"] >= 999999999) ? true : false)));
|
1149 |
*
|
1150 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1151 |
*
|
1152 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1153 |
*/
|
1154 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY"))
|
1155 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY", ($c[] = (int)$file_downloads["currently"]));
|
1194 |
*
|
1195 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1196 |
*
|
1197 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1198 |
*/
|
1199 |
if (!defined ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS"))
|
1200 |
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS", ($c[] = (int)$file_downloads["allowed_days"]));
|
1249 |
*
|
1250 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1251 |
*
|
1252 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1253 |
*/
|
1254 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID"))
|
1255 |
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"]));
|
1289 |
*
|
1290 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1291 |
*
|
1292 |
+
* @see `Dashboard -› s2Member -› General Options -› Membership Options Page`
|
1293 |
*/
|
1294 |
if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID"))
|
1295 |
define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]));
|
1329 |
*
|
1330 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1331 |
*
|
1332 |
+
* @see `Dashboard -› s2Member -› General Options -› Login Welcome Page`
|
1333 |
*/
|
1334 |
if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_ID"))
|
1335 |
define ("S2MEMBER_LOGIN_WELCOME_PAGE_ID", ($c[] = (int)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
|
1336 |
/**
|
1337 |
* A URL, which leads to the Stand-Alone Profile Modification Page.
|
1338 |
*
|
1339 |
+
* This is always a reference to `/?s2member_profile=1` *(i.e. the Stand-Alone version)*.
|
1340 |
*
|
1341 |
* ———— Quick PHP Code Sample ————
|
1342 |
* ```
|
1368 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID
|
1369 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL
|
1370 |
*
|
1371 |
+
* @see `Dashboard -› s2Member -› General Options -› Profile Modifications`
|
1372 |
*/
|
1373 |
if (!defined ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL"))
|
1374 |
define ("S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL", ($c[] = (string)site_url ("/?s2member_profile=1")));
|
1423 |
*
|
1424 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1425 |
*
|
1426 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1427 |
*/
|
1428 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL"))
|
1429 |
define ("S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL", ($c[] = (string)$links["file_download_limit_exceeded_page"]));
|
1463 |
*
|
1464 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1465 |
*
|
1466 |
+
* @see `Dashboard -› s2Member -› General Options -› Membership Options Page`
|
1467 |
*/
|
1468 |
if (!defined ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL"))
|
1469 |
+
define ("S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL", ($c[] = (string)$links["membership_options_page"])); // Signup page.
|
1470 |
/**
|
1471 |
* The URL, which leads to the Login Welcome Page; as configured by the site owner.
|
1472 |
*
|
1503 |
*
|
1504 |
* @see s2Member\API_Constants\S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL
|
1505 |
*
|
1506 |
+
* @see `Dashboard -› s2Member -› General Options -› Login Welcome Page`
|
1507 |
*/
|
1508 |
if (!defined ("S2MEMBER_LOGIN_WELCOME_PAGE_URL"))
|
1509 |
define ("S2MEMBER_LOGIN_WELCOME_PAGE_URL", ($c[] = (($login_redirection_url) ? (string)$login_redirection_url : (string)$links["login_welcome_page"])));
|
1546 |
* @see http://codex.wordpress.org/Function_Reference/wp_logout_url wp_logout_url()
|
1547 |
*/
|
1548 |
if (!defined ("S2MEMBER_LOGOUT_PAGE_URL"))
|
1549 |
+
define ("S2MEMBER_LOGOUT_PAGE_URL", ($c[] = (string)wp_logout_url ())); // This triggers `wp_nonce_tick()`; watch out for dynamic changes.
|
1550 |
/**
|
1551 |
* The URL, where a User can log into their account.
|
1552 |
*
|
1586 |
* @see http://codex.wordpress.org/Function_Reference/wp_login_url wp_login_url()
|
1587 |
*/
|
1588 |
if (!defined ("S2MEMBER_LOGIN_PAGE_URL"))
|
1589 |
+
define ("S2MEMBER_LOGIN_PAGE_URL", ($c[] = (string)wp_login_url /* Will not trigger `wp_nonce_tick()`, no worries in this case. */ ()));
|
1590 |
/**
|
1591 |
+
* Each Membership Level (Label); as configured by the site owner.
|
1592 |
*
|
1593 |
* The defaults are as follows:
|
1594 |
* o Level #0 ``S2MEMBER_LEVEL0_LABEL`` = Free Subscriber
|
1625 |
*
|
1626 |
* @see http://codex.wordpress.org/Function_Reference/wp_get_current_user wp_get_current_user()
|
1627 |
*
|
1628 |
+
* @see `Dashboard -› s2Member -› General Options -› Membership Level (Labels)`
|
1629 |
*/
|
1630 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1631 |
{
|
1677 |
*
|
1678 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1679 |
*
|
1680 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1681 |
*/
|
1682 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1683 |
{
|
1730 |
*
|
1731 |
* @see s2Member\API_Constants\S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS
|
1732 |
*
|
1733 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1734 |
*/
|
1735 |
for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
|
1736 |
{
|
1774 |
* @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED
|
1775 |
* @see s2Member\API_Constants\S2MEMBER_LEVELn_FILE_DOWNLOADS_ALLOWED_DAYS
|
1776 |
*
|
1777 |
+
* @see `Dashboard -› s2Member -› Download Options`
|
1778 |
*/
|
1779 |
if (!defined ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS"))
|
1780 |
define ("S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_inline_extensions"]));
|
1801 |
*
|
1802 |
* @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_EMAIL
|
1803 |
*
|
1804 |
+
* @see `Dashboard -› s2Member -› General Options`
|
1805 |
*/
|
1806 |
if (!defined ("S2MEMBER_REG_EMAIL_FROM_NAME"))
|
1807 |
define ("S2MEMBER_REG_EMAIL_FROM_NAME", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_name"]));
|
1828 |
*
|
1829 |
* @see s2Member\API_Constants\S2MEMBER_REG_EMAIL_FROM_NAME
|
1830 |
*
|
1831 |
+
* @see `Dashboard -› s2Member -› General Options`
|
1832 |
*/
|
1833 |
if (!defined ("S2MEMBER_REG_EMAIL_FROM_EMAIL"))
|
1834 |
define ("S2MEMBER_REG_EMAIL_FROM_EMAIL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["reg_email_from_email"]));
|
1856 |