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

Version Description

  • Framework updated; general cleanup.
  • (s2Member/s2Member Pro). Optimizations. Further internal optimizations applied through configuration checksums that allow s2Member and s2Member Pro to load with even less overhead now.
  • (s2Member/s2Member Pro). Optimizations. Further internal optimizations applied with Hook priorities that allow s2Member and s2Member Pro to load dynamic CSS/JS files with even less overhead now.
  • (s2Member). Bug fix. Due to changes in WordPress 3.1+, s2Member was including it's JavaScript routines twice on the /wp-login.php page. This has been resolved in s2Member v3.5.2+.
  • **(s2Member). Hook change. Attn WP developers: s2Member's Hook _ws_plugin__s2member_force_ssl_buffer_tags is now _ws_plugin__s2member_force_ssl_buffer_tags_array.
  • **(s2Member). API Constant change. Attn WP developers: s2Member's API Constant S2MEMBER_CURRENT_USER_SUBSCR_ID is now accompanied with a new API Constant S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID. The values returned by these API Constants have changed (slightly). For further details, check your Dashboard under: s2Member -> API Scripting -> API Constants.
  • (s2Member Pro). Bug fix. s2Member's ccBill DataLink routines were sometimes generating the error Too Many Connections due to an invalid data storage routine under a delayed scenario. This has been resolved in s2Member v3.5.2+.
Download this release

Release Info

Developer PriMoThemes
Plugin Icon 128x128 s2Member Framework (Member Roles, Capabilities, Membership, PayPal Members)
Version 3.5.2
Comparing to
See all releases

Code changes from version 3.5.1 to 3.5.2

Files changed (49) hide show
  1. includes/classes/admin-css-js-in.inc.php +89 -0
  2. includes/classes/admin-css-js.inc.php +4 -48
  3. includes/classes/constants.inc.php +72 -72
  4. includes/classes/cron-jobs-in.inc.php +59 -0
  5. includes/classes/cron-jobs.inc.php +5 -25
  6. includes/classes/css-js-in.inc.php +157 -0
  7. includes/classes/css-js-themes.inc.php +73 -0
  8. includes/classes/css-js.inc.php +4 -164
  9. includes/classes/files-checks.inc.php +34 -0
  10. includes/classes/files.inc.php +0 -11
  11. includes/classes/installation.inc.php +6 -15
  12. includes/classes/labels.inc.php +1 -1
  13. includes/classes/login-customizations.inc.php +8 -5
  14. includes/classes/login-redirects-r.inc.php +35 -0
  15. includes/classes/login-redirects.inc.php +1 -13
  16. includes/classes/menu-pages.inc.php +4 -4
  17. includes/classes/meta-box-saves.inc.php +2 -2
  18. includes/classes/meta-boxes.inc.php +6 -5
  19. includes/classes/{misc-redirects.inc.php → mo-page-in.inc.php} +8 -7
  20. includes/classes/mo-page.inc.php +39 -0
  21. includes/classes/nocache.inc.php +5 -4
  22. includes/classes/op-notices.inc.php +5 -4
  23. includes/classes/profile-in.inc.php +40 -0
  24. includes/classes/profile-mods-in.inc.php +3 -3
  25. includes/classes/profile.inc.php +3 -11
  26. includes/classes/sc-paypal-button-e.inc.php +2 -2
  27. includes/classes/sc-paypal-button-in.inc.php +6 -3
  28. includes/classes/ssl-in.inc.php +121 -0
  29. includes/classes/ssl.inc.php +3 -64
  30. includes/classes/tracking-cookies-in.inc.php +61 -0
  31. includes/classes/tracking-cookies.inc.php +4 -20
  32. includes/classes/user-access.inc.php +3 -3
  33. includes/classes/user-new.inc.php +1 -1
  34. includes/classes/utilities.inc.php +11 -0
  35. includes/classes/utils-arrays.inc.php +2 -4
  36. includes/classes/utils-css.inc.php +2 -2
  37. includes/classes/utils-users.inc.php +23 -7
  38. includes/funcs.inc.php +1 -1
  39. includes/functions/class-autoloader.inc.php +17 -18
  40. includes/hooks.inc.php +30 -25
  41. includes/menu-pages/code-samples/api-mop-vars.php +3 -0
  42. includes/menu-pages/code-samples/current-user-fields.php +4 -1
  43. includes/menu-pages/code-samples/current-user-subscr-id.php +5 -4
  44. includes/menu-pages/code-samples/current-user-subscr-or-wp-id.php +11 -0
  45. includes/menu-pages/scripting.inc.php +15 -6
  46. includes/profile.inc.php +3 -1
  47. includes/syscon.inc.php +187 -175
  48. readme.txt +13 -4
  49. s2member.php +12 -8
includes/classes/admin-css-js-in.inc.php ADDED
@@ -0,0 +1,89 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_admin_css_js_in"))
18
+ {
19
+ class c_ws_plugin__s2member_admin_css_js_in
20
+ {
21
+ /*
22
+ Function that outputs the CSS for menu pages.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function menu_pages_css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_menu_pages_css", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
30
+ {
31
+ header ("Content-Type: text/css; charset=utf-8");
32
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
33
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
35
+ header ("Pragma: no-cache");
36
+ /**/
37
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
+ /**/
40
+ ob_start ("c_ws_plugin__s2member_utils_css::compress_css"); /* Compress. */
41
+ /**/
42
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
43
+ /**/
44
+ echo "\n"; /* Add a line break before inclusion of this file. */
45
+ /**/
46
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.css";
47
+ /**/
48
+ do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
49
+ /**/
50
+ exit (); /* Clean exit. */
51
+ }
52
+ /**/
53
+ do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
54
+ }
55
+ /*
56
+ Function that outputs the JS for menu pages.
57
+ Attach to: add_action("init");
58
+ */
59
+ public static function menu_pages_js ()
60
+ {
61
+ do_action ("ws_plugin__s2member_before_menu_pages_js", get_defined_vars ());
62
+ /**/
63
+ if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
64
+ {
65
+ header ("Content-Type: text/javascript; charset=utf-8");
66
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
67
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
68
+ header ("Cache-Control: no-cache, must-revalidate, max-age=0");
69
+ header ("Pragma: no-cache");
70
+ /**/
71
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
72
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
73
+ /**/
74
+ include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-min.js";
75
+ /**/
76
+ echo "\n"; /* Add a line break before inclusion of this file. */
77
+ /**/
78
+ @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s-min.js";
79
+ /**/
80
+ do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
81
+ /**/
82
+ exit (); /* Clean exit. */
83
+ }
84
+ /**/
85
+ do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
86
+ }
87
+ }
88
+ }
89
+ ?>
includes/classes/admin-css-js.inc.php CHANGED
@@ -24,33 +24,10 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
24
*/
25
public static function menu_pages_css ()
26
{
27
- do_action ("ws_plugin__s2member_before_menu_pages_css", get_defined_vars ());
28
- /**/
29
- if ($_GET["ws_plugin__s2member_menu_pages_css"] && is_user_logged_in () && current_user_can ("create_users"))
30
{
31
- header ("Content-Type: text/css; charset=utf-8");
32
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
33
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
35
- header ("Pragma: no-cache");
36
- /**/
37
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
- /**/
40
- ob_start ("c_ws_plugin__s2member_utils_css::compress_css"); /* Compress. */
41
- /**/
42
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages.css";
43
- /**/
44
- echo "\n"; /* Add a line break before inclusion of this file. */
45
- /**/
46
- @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s.css";
47
- /**/
48
- do_action ("ws_plugin__s2member_during_menu_pages_css", get_defined_vars ());
49
- /**/
50
- exit ();
51
}
52
- /**/
53
- do_action ("ws_plugin__s2member_after_menu_pages_css", get_defined_vars ());
54
}
55
/*
56
Function that outputs the JS for menu pages.
@@ -58,31 +35,10 @@ if (!class_exists ("c_ws_plugin__s2member_admin_css_js"))
58
*/
59
public static function menu_pages_js ()
60
{
61
- do_action ("ws_plugin__s2member_before_menu_pages_js", get_defined_vars ());
62
- /**/
63
- if ($_GET["ws_plugin__s2member_menu_pages_js"] && is_user_logged_in () && current_user_can ("create_users"))
64
{
65
- header ("Content-Type: text/javascript; charset=utf-8");
66
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("-1 week")) . " GMT");
67
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
68
- header ("Cache-Control: no-cache, must-revalidate, max-age=0");
69
- header ("Pragma: no-cache");
70
- /**/
71
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
72
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
73
- /**/
74
- include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-min.js";
75
- /**/
76
- echo "\n"; /* Add a line break before inclusion of this file. */
77
- /**/
78
- @include_once dirname (dirname (__FILE__)) . "/menu-pages/menu-pages-s-min.js";
79
- /**/
80
- do_action ("ws_plugin__s2member_during_menu_pages_js", get_defined_vars ());
81
- /**/
82
- exit ();
83
}
84
- /**/
85
- do_action ("ws_plugin__s2member_after_menu_pages_js", get_defined_vars ());
86
}
87
}
88
}
24
*/
25
public static function menu_pages_css ()
26
{
27
+ if ($_GET["ws_plugin__s2member_menu_pages_css"]) /* Call inner function? */
28
{
29
+ return c_ws_plugin__s2member_admin_css_js_in::menu_pages_css ();
30
}
31
}
32
/*
33
Function that outputs the JS for menu pages.
35
*/
36
public static function menu_pages_js ()
37
{
38
+ if ($_GET["ws_plugin__s2member_menu_pages_js"]) /* Call inner function? */
39
{
40
+ return c_ws_plugin__s2member_admin_css_js_in::menu_pages_js ();
41
}
42
}
43
}
44
}
includes/classes/constants.inc.php CHANGED
@@ -19,6 +19,71 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
19
class c_ws_plugin__s2member_constants
20
{
21
/*
22
Define several API Constants for s2Member.
23
Note that these are duplicated into the JavaScript API as well.
24
Attach to: add_action("init");
@@ -42,13 +107,14 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
42
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
43
unset ($__refs, $__v); /* Unset defined __refs, __v. */
44
/**/
45
- define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION)); /* Since 3.0. */
46
/**/
47
define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
48
define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($current_user && $level >= 1) ? true : false)));
49
define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
50
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
51
- define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
52
define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($current_user) ? (string)$subscr_gateway : "")));
53
define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
54
define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)strtotime ($current_user->user_registered) : 0)));
@@ -62,7 +128,7 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
62
define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
63
define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
64
define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
65
- define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
66
/**/
67
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
68
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
@@ -115,83 +181,17 @@ if (!class_exists ("c_ws_plugin__s2member_constants"))
115
/**/
116
define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
117
/**/
118
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_ID) ? "Updating Subscr. ID" : "")));
119
- define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) ? S2MEMBER_CURRENT_USER_SUBSCR_ID : "")));
120
/**/
121
$c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ()); /* Allows other Constants to be calculated nicely. */
122
/**/
123
- define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c))); /* Used as a Checksum against the state of these Constants. */
124
/**/
125
do_action ("ws_plugin__s2member_after_constants", get_defined_vars ()); /* Calls the after Hook. Do NOT set Constants here. */
126
/**/
127
return; /* Return for uniformity. */
128
}
129
- /*
130
- This function pulls all of the Page links needed for Constants.
131
- Page links are cached into the s2Member options on 15 min intervals.
132
- This allows the API Constants to provide quick access to them without being
133
- forced to execute get_page_link() all the time, which piles up DB queries.
134
- */
135
- public static function constant_links ()
136
- {
137
- do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
138
- /**/
139
- $l = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
140
- /**/
141
- $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
142
- $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
143
- $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
144
- /**/
145
- $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
146
- $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
147
- $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
148
- /**/
149
- if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
150
- {
151
- $l["login_welcome_page"] = $login_welcome_page_cache["link"];
152
- }
153
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
154
- {
155
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = strtotime ("now");
156
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
157
- $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
158
- /**/
159
- $cache_needs_updating = true;
160
- }
161
- /**/
162
- if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
163
- {
164
- $l["membership_options_page"] = $membership_options_page_cache["link"];
165
- }
166
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
167
- {
168
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = strtotime ("now");
169
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
170
- $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
171
- /**/
172
- $cache_needs_updating = true;
173
- }
174
- /**/
175
- if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
176
- {
177
- $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
178
- }
179
- else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
180
- {
181
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = strtotime ("now");
182
- $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
183
- $l["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
184
- /**/
185
- $cache_needs_updating = true;
186
- }
187
- /**/
188
- if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
189
- {
190
- update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
191
- }
192
- /**/
193
- return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
194
- }
195
}
196
}
197
?>
19
class c_ws_plugin__s2member_constants
20
{
21
/*
22
+ This function pulls all of the Page links needed for Constants.
23
+ Page links are cached into the s2Member options on 15 min intervals.
24
+ This allows the API Constants to provide quick access to them without being forced to execute get_page_link() all the time, which piles up DB queries.
25
+ */
26
+ public static function constant_links ()
27
+ {
28
+ do_action ("ws_plugin__s2member_before_constant_links", get_defined_vars ());
29
+ /**/
30
+ $l = array ("login_welcome_page" => "", "membership_options_page" => "", "file_download_limit_exceeded_page" => "");
31
+ /**/
32
+ $login_welcome_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"];
33
+ $membership_options_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"];
34
+ $file_download_limit_exceeded_page = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["file_download_limit_exceeded_page"];
35
+ /**/
36
+ $login_welcome_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"];
37
+ $membership_options_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"];
38
+ $file_download_limit_exceeded_page_cache = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"];
39
+ /**/
40
+ if ($login_welcome_page_cache["page"] === $login_welcome_page && $login_welcome_page_cache["time"] >= strtotime ("-15 minutes"))
41
+ {
42
+ $l["login_welcome_page"] = $login_welcome_page_cache["link"];
43
+ }
44
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
45
+ {
46
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["time"] = time ();
47
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["page"] = $login_welcome_page;
48
+ $l["login_welcome_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["login_welcome_page"]["link"] = get_page_link ($login_welcome_page);
49
+ /**/
50
+ $cache_needs_updating = true;
51
+ }
52
+ /**/
53
+ if ($membership_options_page_cache["page"] === $membership_options_page && $membership_options_page_cache["time"] >= strtotime ("-15 minutes"))
54
+ {
55
+ $l["membership_options_page"] = $membership_options_page_cache["link"];
56
+ }
57
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
58
+ {
59
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["time"] = time ();
60
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["page"] = $membership_options_page;
61
+ $l["membership_options_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["membership_options_page"]["link"] = get_page_link ($membership_options_page);
62
+ /**/
63
+ $cache_needs_updating = true;
64
+ }
65
+ /**/
66
+ if ($file_download_limit_exceeded_page_cache["page"] === $file_download_limit_exceeded_page && $file_download_limit_exceeded_page_cache["time"] >= strtotime ("-15 minutes"))
67
+ {
68
+ $l["file_download_limit_exceeded_page"] = $file_download_limit_exceeded_page_cache["link"];
69
+ }
70
+ else /* Otherwise, we need to query the database using get_page_link() and update the cache. */
71
+ {
72
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["time"] = time ();
73
+ $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["page"] = $file_download_limit_exceeded_page;
74
+ $l["file_download_limit_exceeded_page"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]["file_download_limit_exceeded_page"]["link"] = get_page_link ($file_download_limit_exceeded_page);
75
+ /**/
76
+ $cache_needs_updating = true;
77
+ }
78
+ /**/
79
+ if ($cache_needs_updating) /* The cache is also reset when options are updated from a menu page. */
80
+ {
81
+ update_option ("ws_plugin__s2member_cache", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"]);
82
+ }
83
+ /**/
84
+ return apply_filters ("ws_plugin__s2member_constant_links", $l, get_defined_vars ());
85
+ }
86
+ /*
87
Define several API Constants for s2Member.
88
Note that these are duplicated into the JavaScript API as well.
89
Attach to: add_action("init");
107
do_action ("ws_plugin__s2member_during_constants", get_defined_vars ());
108
unset ($__refs, $__v); /* Unset defined __refs, __v. */
109
/**/
110
+ define ("S2MEMBER_VERSION", ($c[] = WS_PLUGIN__S2MEMBER_VERSION));
111
/**/
112
define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN", ($c[] = (($current_user) ? true : false)));
113
define ("S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER", ($c[] = ( ($current_user && $level >= 1) ? true : false)));
114
define ("S2MEMBER_CURRENT_USER_ACCESS_LEVEL", ($c[] = (int)$level));
115
define ("S2MEMBER_CURRENT_USER_ACCESS_LABEL", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $level . "_label"]));
116
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_ID", ($c[] = ( ($current_user && $subscr_id) ? (string)$subscr_id : "")));
117
+ define ("S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID", ($c[] = (($current_user) ? (($subscr_id) ? (string)$subscr_id : (string)$current_user->ID) : "")));
118
define ("S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY", ($c[] = (($current_user) ? (string)$subscr_gateway : "")));
119
define ("S2MEMBER_CURRENT_USER_CUSTOM", ($c[] = (string)$custom));
120
define ("S2MEMBER_CURRENT_USER_REGISTRATION_TIME", ($c[] = ( ($current_user && $current_user->user_registered) ? (int)strtotime ($current_user->user_registered) : 0)));
128
define ("S2MEMBER_CURRENT_USER_EMAIL", ($c[] = (($current_user) ? (string)$current_user->user_email : "")));
129
define ("S2MEMBER_CURRENT_USER_IP", ($c[] = (string)$_SERVER["REMOTE_ADDR"]));
130
define ("S2MEMBER_CURRENT_USER_ID", ($c[] = (($current_user) ? (int)$current_user->ID : 0)));
131
+ define ("S2MEMBER_CURRENT_USER_FIELDS", ($c[] = (($current_user) ? json_encode (array_merge (array ("id" => S2MEMBER_CURRENT_USER_ID, "ip" => S2MEMBER_CURRENT_USER_IP, "email" => S2MEMBER_CURRENT_USER_EMAIL, "login" => S2MEMBER_CURRENT_USER_LOGIN, "first_name" => S2MEMBER_CURRENT_USER_FIRST_NAME, "last_name" => S2MEMBER_CURRENT_USER_LAST_NAME, "display_name" => S2MEMBER_CURRENT_USER_DISPLAY_NAME, "subscr_id" => S2MEMBER_CURRENT_USER_SUBSCR_ID, "subscr_or_wp_id" => S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID, "subscr_gateway" => S2MEMBER_CURRENT_USER_SUBSCR_GATEWAY, "custom" => S2MEMBER_CURRENT_USER_CUSTOM), (array)$custom_fields)) : json_encode (array ()))));
132
/**/
133
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED", ($c[] = (int)$file_downloads["allowed"]));
134
define ("S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED", ($c[] = ( ($file_downloads["allowed"] >= 999999999) ? true : false)));
181
/**/
182
define ("S2MEMBER_PAYPAL_PDT_IDENTITY_TOKEN", ($c[] = (string)$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_identity_token"]));
183
/**/
184
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? "Updating Subscr. ID" : "")));
185
+ define ("S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0", ($c[] = ((S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) ? S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID : "")));
186
/**/
187
$c = apply_filters ("ws_plugin__s2member_during_constants_c", $c, get_defined_vars ()); /* Allows other Constants to be calculated nicely. */
188
/**/
189
+ define ("WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5", md5 (serialize ($c) . c_ws_plugin__s2member_utilities::ver_checksum ())); /* Checksum. */
190
/**/
191
do_action ("ws_plugin__s2member_after_constants", get_defined_vars ()); /* Calls the after Hook. Do NOT set Constants here. */
192
/**/
193
return; /* Return for uniformity. */
194
}
195
}
196
}
197
?>
includes/classes/cron-jobs-in.inc.php ADDED
@@ -0,0 +1,59 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_cron_jobs_in"))
18
+ {
19
+ class c_ws_plugin__s2member_cron_jobs_in
20
+ {
21
+ /*
22
+ Extends the WP-Cron schedules to support 10 minute intervals.
23
+ Attach to: add_filter("cron_schedules");
24
+ */
25
+ public static function extend_cron_schedules ($schedules = array ())
26
+ {
27
+ eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
28
+ do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
29
+ unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
+ /**/
31
+ $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
32
+ /**/
33
+ return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
34
+ }
35
+ /*
36
+ This function allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
37
+ Attach to: add_action("init");
38
+ */
39
+ public static function auto_eot_system_via_cron ()
40
+ {
41
+ do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
42
+ /**/
43
+ if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
44
+ {
45
+ if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
46
+ {
47
+ c_ws_plugin__s2member_auto_eots::auto_eot_system (); /* Process Auto EOTs now. */
48
+ /**/
49
+ do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
50
+ }
51
+ /**/
52
+ exit (); /* Clean exit. */
53
+ }
54
+ /**/
55
+ do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
56
+ }
57
+ }
58
+ }
59
+ ?>
includes/classes/cron-jobs.inc.php CHANGED
@@ -22,40 +22,20 @@ if (!class_exists ("c_ws_plugin__s2member_cron_jobs"))
22
Extends the WP-Cron schedules to support 10 minute intervals.
23
Attach to: add_filter("cron_schedules");
24
*/
25
- public static function extend_cron_schedules ($schedules = array ())
26
{
27
- eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
28
- do_action ("ws_plugin__s2member_before_extend_cron_schedules", get_defined_vars ());
29
- unset ($__refs, $__v); /* Unset defined __refs, __v. */
30
- /**/
31
- $array = array ("every10m" => array ("interval" => 600, "display" => "Every 10 Minutes"));
32
- /**/
33
- return apply_filters ("ws_plugin__s2member_extend_cron_schedules", array_merge ($array, $schedules), get_defined_vars ());
34
}
35
/*
36
- This function allows the Auto-EOT Sytem to be
37
- processed through a server-side Cron Job.
38
Attach to: add_action("init");
39
*/
40
public static function auto_eot_system_via_cron ()
41
{
42
- do_action ("ws_plugin__s2member_before_auto_eot_system_via_cron", get_defined_vars ());
43
- /**/
44
- if ($_GET["s2member_auto_eot_system_via_cron"]) /* Being called through HTTP? */
45
{
46
- if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["auto_eot_system_enabled"])
47
- {
48
- c_ws_plugin__s2member_auto_eots::auto_eot_system (); /* Process Auto EOTs now. */
49
- /**/
50
- do_action ("ws_plugin__s2member_during_auto_eot_system_via_cron", get_defined_vars ());
51
- }
52
- /**/
53
- exit (); /* Clean exit. */
54
}
55
- /**/
56
- do_action ("ws_plugin__s2member_after_auto_eot_system_via_cron", get_defined_vars ());
57
- /**/
58
- return; /* Return for uniformity. */
59
}
60
}
61
}
22
Extends the WP-Cron schedules to support 10 minute intervals.
23
Attach to: add_filter("cron_schedules");
24
*/
25
+ public static function extend_cron_schedules ($schedules = array ()) /* Call inner function? */
26
{
27
+ return c_ws_plugin__s2member_cron_jobs_in::extend_cron_schedules ($schedules);
28
}
29
/*
30
+ This function allows the Auto-EOT Sytem to be processed through a server-side Cron Job.
31
Attach to: add_action("init");
32
*/
33
public static function auto_eot_system_via_cron ()
34
{
35
+ if ($_GET["s2member_auto_eot_system_via_cron"]) /* Call inner function? */
36
{
37
+ return c_ws_plugin__s2member_cron_jobs_in::auto_eot_system_via_cron ();
38
}
39
}
40
}
41
}
includes/classes/css-js-in.inc.php ADDED
@@ -0,0 +1,157 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_css_js_in"))
18
+ {
19
+ class c_ws_plugin__s2member_css_js_in
20
+ {
21
+ /*
22
+ Builds CSS files.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["ws_plugin__s2member_css"])
30
+ {
31
+ header ("Content-Type: text/css; charset=utf-8");
32
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
33
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
34
+ header ("Cache-Control: max-age=604800");
35
+ header ("Pragma: public");
36
+ /**/
37
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
38
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
39
+ /**/
40
+ ob_start ("c_ws_plugin__s2member_utils_css::compress_css");
41
+ /**/
42
+ include_once dirname (dirname (__FILE__)) . "/s2member.css";
43
+ /**/
44
+ do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
45
+ /**/
46
+ exit (); /* Clean exit. */
47
+ }
48
+ /**/
49
+ do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
50
+ }
51
+ /*
52
+ Builds JavaScript files.
53
+ Attach to: add_action("init");
54
+ * Be sure s2Member's API Constants are already defined before firing this.
55
+ */
56
+ public static function js_w_globals ()
57
+ {
58
+ do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
59
+ /**/
60
+ if ($_GET["ws_plugin__s2member_js_w_globals"])
61
+ {
62
+ header ("Content-Type: text/javascript; charset=utf-8");
63
+ header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
64
+ header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
65
+ header ("Cache-Control: max-age=604800");
66
+ header ("Pragma: public");
67
+ /**/
68
+ $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
69
+ /**/
70
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
71
+ $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
72
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
73
+ $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
74
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
75
+ $g .= "S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID) . "',";
76
+ $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
77
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
78
+ $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME . ",";
79
+ $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS . ",";
80
+ $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
81
+ $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
82
+ $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
83
+ $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
84
+ $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
85
+ $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
86
+ $g .= "S2MEMBER_CURRENT_USER_IP = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
87
+ $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
88
+ $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
89
+ /**/
90
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
91
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
92
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
93
+ $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
94
+ /**/
95
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
96
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
97
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
98
+ /**/
99
+ $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
100
+ $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
101
+ $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
102
+ $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
103
+ $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
104
+ $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
105
+ /**/
106
+ $g .= "S2MEMBER_LEVEL0_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
107
+ $g .= "S2MEMBER_LEVEL1_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
108
+ $g .= "S2MEMBER_LEVEL2_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
109
+ $g .= "S2MEMBER_LEVEL3_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
110
+ $g .= "S2MEMBER_LEVEL4_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
111
+ /**/
112
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
113
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
114
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
115
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
116
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
117
+ /**/
118
+ $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
119
+ $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
120
+ $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
121
+ $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
122
+ $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
123
+ /**/
124
+ $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
125
+ /**/
126
+ $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
127
+ $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
128
+ /**/
129
+ $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
130
+ $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
131
+ /**/
132
+ $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
133
+ $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
134
+ $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
135
+ /**/
136
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
137
+ $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
138
+ /**/
139
+ $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
140
+ /**/
141
+ $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
142
+ $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
143
+ /**/
144
+ echo $g . "\n"; /* Add a line break before inclusion. */
145
+ /**/
146
+ include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
147
+ /**/
148
+ do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
149
+ /**/
150
+ exit (); /* Clean exit. */
151
+ }
152
+ /**/
153
+ do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
154
+ }
155
+ }
156
+ }
157
+ ?>
includes/classes/css-js-themes.inc.php ADDED
@@ -0,0 +1,73 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_css_js_themes"))
18
+ {
19
+ class c_ws_plugin__s2member_css_js_themes
20
+ {
21
+ /*
22
+ Adds CSS files.
23
+ Attach to: add_action("wp_print_styles");
24
+ */
25
+ public static function add_css ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
28
+ /**/
29
+ if (!is_admin ()) /* Not in the admin. */
30
+ {
31
+ wp_enqueue_style ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_css=1&qcABC=1"), array (), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
32
+ /**/
33
+ do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
37
+ /**/
38
+ return; /* Return for uniformity. */
39
+ }
40
+ /*
41
+ Adds JavaScript files.
42
+ Attach to: add_action("wp_print_scripts");
43
+ */
44
+ public static function add_js_w_globals ()
45
+ {
46
+ global $pagenow; /* Need this for comparisons. */
47
+ /**/
48
+ do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
49
+ /**/
50
+ if (!is_admin () || (c_ws_plugin__s2member_utils_conds::is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
51
+ {
52
+ if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
53
+ {
54
+ $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
55
+ /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
56
+ /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
57
+ wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=" . urlencode ($md5) . "&qcABC=1"), array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
58
+ }
59
+ else /* Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5. */
60
+ { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
61
+ wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=1&qcABC=1"), array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
62
+ }
63
+ /**/
64
+ do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
65
+ }
66
+ /**/
67
+ do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
68
+ /**/
69
+ return; /* Return for uniformity. */
70
+ }
71
+ }
72
+ }
73
+ ?>
includes/classes/css-js.inc.php CHANGED
@@ -19,84 +19,15 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
19
class c_ws_plugin__s2member_css_js
20
{
21
/*
22
- Adds CSS files.
23
- Attach to: add_action("wp_print_styles");
24
- */
25
- public static function add_css ()
26
- {
27
- do_action ("ws_plugin__s2member_before_add_css", get_defined_vars ());
28
- /**/
29
- if (!is_admin ()) /* Not in the admin. */
30
- {
31
- wp_enqueue_style ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_css=1&qcABC=1"), array (), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
32
- /**/
33
- do_action ("ws_plugin__s2member_during_add_css", get_defined_vars ());
34
- }
35
- /**/
36
- do_action ("ws_plugin__s2member_after_add_css", get_defined_vars ());
37
- /**/
38
- return; /* Return for uniformity. */
39
- }
40
- /*
41
Builds CSS files.
42
Attach to: add_action("init");
43
*/
44
public static function css ()
45
{
46
- do_action ("ws_plugin__s2member_before_css", get_defined_vars ());
47
- /**/
48
- if ($_GET["ws_plugin__s2member_css"])
49
- {
50
- header ("Content-Type: text/css; charset=utf-8");
51
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
52
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
53
- header ("Cache-Control: max-age=604800");
54
- header ("Pragma: public");
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"); /* Compress. */
60
- /**/
61
- include_once dirname (dirname (__FILE__)) . "/s2member.css";
62
- /**/
63
- do_action ("ws_plugin__s2member_during_css", get_defined_vars ());
64
- /**/
65
- exit (); /* Clean exit. */
66
- }
67
- /**/
68
- do_action ("ws_plugin__s2member_after_css", get_defined_vars ());
69
- }
70
- /*
71
- Adds JavaScript files.
72
- Attach to: add_action("wp_print_scripts");
73
- */
74
- public static function add_js_w_globals ()
75
- {
76
- global $pagenow; /* Need this for comparisons. */
77
- /**/
78
- do_action ("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars ());
79
- /**/
80
- if (!is_admin () || (c_ws_plugin__s2member_utils_conds::is_user_admin () && $pagenow === "profile.php" && !current_user_can ("edit_users")))
81
{
82
- if (is_user_logged_in ()) /* Separate version for logged-in Users/Members. */
83
- {
84
- $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5; /* An MD5 hash based on global key => values. */
85
- /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
86
- /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
87
- wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=1&qcABC=1&" . $md5), array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
88
- }
89
- else /* Else if they are not logged in, we distinguish the JavaScript file by NOT including $md5. */
90
- { /* This essentially creates 2 versions of the script. One while logged in & another when not. */
91
- wp_enqueue_script ("ws-plugin--s2member", site_url ("/?ws_plugin__s2member_js_w_globals=1&qcABC=1"), array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
92
- }
93
- /**/
94
- do_action ("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars ());
95
}
96
- /**/
97
- do_action ("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars ());
98
- /**/
99
- return; /* Return for uniformity. */
100
}
101
/*
102
Builds JavaScript files.
@@ -104,101 +35,10 @@ if (!class_exists ("c_ws_plugin__s2member_css_js"))
104
*/
105
public static function js_w_globals ()
106
{
107
- do_action ("ws_plugin__s2member_before_js_w_globals", get_defined_vars ());
108
- /**/
109
- if ($_GET["ws_plugin__s2member_js_w_globals"])
110
{
111
- header ("Content-Type: text/javascript; charset=utf-8");
112
- header ("Expires: " . gmdate ("D, d M Y H:i:s", strtotime ("+1 week")) . " GMT");
113
- header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
114
- header ("Cache-Control: max-age=604800");
115
- header ("Pragma: public");
116
- /**/
117
- $g = "var S2MEMBER_VERSION = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_VERSION) . "',"; /* Since 3.0. */
118
- /**/
119
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN) ? "true" : "false") . ",";
120
- $g .= "S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER = " . ((S2MEMBER_CURRENT_USER_IS_LOGGED_IN_AS_MEMBER) ? "true" : "false") . ",";
121
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LEVEL = " . S2MEMBER_CURRENT_USER_ACCESS_LEVEL . ",";
122
- $g .= "S2MEMBER_CURRENT_USER_ACCESS_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_ACCESS_LABEL) . "',";
123
- $g .= "S2MEMBER_CURRENT_USER_SUBSCR_ID = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_SUBSCR_ID) . "',";
124
- $g .= "S2MEMBER_CURRENT_USER_CUSTOM = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_CUSTOM) . "',";
125
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_REGISTRATION_TIME . ",";
126
- $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME . ",";
127
- $g .= "S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS . ",";
128
- $g .= "S2MEMBER_CURRENT_USER_REGISTRATION_DAYS = " . S2MEMBER_CURRENT_USER_REGISTRATION_DAYS . ",";
129
- $g .= "S2MEMBER_CURRENT_USER_DISPLAY_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_DISPLAY_NAME) . "',";
130
- $g .= "S2MEMBER_CURRENT_USER_FIRST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_FIRST_NAME) . "',";
131
- $g .= "S2MEMBER_CURRENT_USER_LAST_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LAST_NAME) . "',";
132
- $g .= "S2MEMBER_CURRENT_USER_LOGIN = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_LOGIN) . "',";
133
- $g .= "S2MEMBER_CURRENT_USER_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_EMAIL) . "',";
134
- $g .= "S2MEMBER_CURRENT_USER_IP = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_IP) . "',";
135
- $g .= "S2MEMBER_CURRENT_USER_ID = " . S2MEMBER_CURRENT_USER_ID . ",";
136
- $g .= "S2MEMBER_CURRENT_USER_FIELDS = " . S2MEMBER_CURRENT_USER_FIELDS . ",";
137
- /**/
138
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED . ",";
139
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED = " . ((S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_IS_UNLIMITED) ? "true" : "false") . ",";
140
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY = " . S2MEMBER_CURRENT_USER_DOWNLOADS_CURRENTLY . ",";
141
- $g .= "S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_CURRENT_USER_DOWNLOADS_ALLOWED_DAYS . ",";
142
- /**/
143
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID = " . S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_ID . ",";
144
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID = " . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_ID . ",";
145
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_ID = " . S2MEMBER_LOGIN_WELCOME_PAGE_ID . ",";
146
- /**/
147
- $g .= "S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_PROFILE_MODIFICATION_PAGE_URL) . "',";
148
- $g .= "S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_LIMIT_EXCEEDED_PAGE_URL) . "',";
149
- $g .= "S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL) . "',";
150
- $g .= "S2MEMBER_LOGIN_WELCOME_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_WELCOME_PAGE_URL) . "',";
151
- $g .= "S2MEMBER_LOGOUT_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGOUT_PAGE_URL) . "',";
152
- $g .= "S2MEMBER_LOGIN_PAGE_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LOGIN_PAGE_URL) . "',";
153
- /**/
154
- $g .= "S2MEMBER_LEVEL0_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL0_LABEL) . "',";
155
- $g .= "S2MEMBER_LEVEL1_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL1_LABEL) . "',";
156
- $g .= "S2MEMBER_LEVEL2_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL2_LABEL) . "',";
157
- $g .= "S2MEMBER_LEVEL3_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL3_LABEL) . "',";
158
- $g .= "S2MEMBER_LEVEL4_LABEL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_LEVEL4_LABEL) . "',";
159
- /**/
160
- $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED . ",";
161
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED . ",";
162
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED . ",";
163
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED . ",";
164
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED . ",";
165
- /**/
166
- $g .= "S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL0_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
167
- $g .= "S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL1_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
168
- $g .= "S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL2_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
169
- $g .= "S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL3_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
170
- $g .= "S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS = " . S2MEMBER_LEVEL4_FILE_DOWNLOADS_ALLOWED_DAYS . ",";
171
- /**/
172
- $g .= "S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_FILE_DOWNLOAD_INLINE_EXTENSIONS) . "',";
173
- /**/
174
- $g .= "S2MEMBER_REG_EMAIL_FROM_NAME = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_NAME) . "',";
175
- $g .= "S2MEMBER_REG_EMAIL_FROM_EMAIL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_REG_EMAIL_FROM_EMAIL) . "',";
176
- /**/
177
- $g .= "S2MEMBER_PAYPAL_NOTIFY_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_NOTIFY_URL) . "',";
178
- $g .= "S2MEMBER_PAYPAL_RETURN_URL = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_RETURN_URL) . "',";
179
- /**/
180
- $g .= "S2MEMBER_PAYPAL_BUSINESS = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_BUSINESS) . "',";
181
- $g .= "S2MEMBER_PAYPAL_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_ENDPOINT) . "',";
182
- $g .= "S2MEMBER_PAYPAL_API_ENDPOINT = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_PAYPAL_API_ENDPOINT) . "',";
183
- /**/
184
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0) . "',";
185
- $g .= "S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 = '" . c_ws_plugin__s2member_utils_strings::esc_sq (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0) . "',";
186
- /**/
187
- $g = trim ($g, " ,") . ";"; /* Trim & add semicolon. */
188
- /**/
189
- $u = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"];
190
- $i = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images";
191
- /**/
192
- echo $g . "\n"; /* Add a line break before inclusion. */
193
- /**/
194
- include_once dirname (dirname (__FILE__)) . "/s2member-min.js";
195
- /**/
196
- do_action ("ws_plugin__s2member_during_js_w_globals", get_defined_vars ());
197
- /**/
198
- exit (); /* Clean exit. */
199
}
200
- /**/
201
- do_action ("ws_plugin__s2member_after_js_w_globals", get_defined_vars ());
202
}
203
}
204
}
19
class c_ws_plugin__s2member_css_js
20
{
21
/*
22
Builds CSS files.
23
Attach to: add_action("init");
24
*/
25
public static function css ()
26
{
27
+ if ($_GET["ws_plugin__s2member_css"]) /* Call inner function? */
28
{
29
+ return c_ws_plugin__s2member_css_js_in::css ();
30
}
31
}
32
/*
33
Builds JavaScript files.
35
*/
36
public static function js_w_globals ()
37
{
38
+ if ($_GET["ws_plugin__s2member_js_w_globals"]) /* Call inner function? */
39
{
40
+ return c_ws_plugin__s2member_css_js_in::js_w_globals ();
41
}
42
}
43
}
44
}
includes/classes/files-checks.inc.php ADDED
@@ -0,0 +1,34 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_files_checks"))
18
+ {
19
+ class c_ws_plugin__s2member_files_checks
20
+ {
21
+ /*
22
+ Function for handling download access permissions.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function check_file_download_access ()
26
+ {
27
+ if ($_GET["s2member_file_download"]) /* Call inner function? */
28
+ {
29
+ return c_ws_plugin__s2member_files_in::check_file_download_access ();
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ?>
includes/classes/files.inc.php CHANGED
@@ -19,17 +19,6 @@ if (!class_exists ("c_ws_plugin__s2member_files"))
19
class c_ws_plugin__s2member_files
20
{
21
/*
22
- Function for handling download access permissions.
23
- Attach to: add_action("init");
24
- */
25
- public static function check_file_download_access ()
26
- {
27
- if ($_GET["s2member_file_download"]) /* Call inner function? */
28
- {
29
- return c_ws_plugin__s2member_files_in::check_file_download_access ();
30
- }
31
- }
32
- /*
33
Function creates a special File Download Key.
34
Uses: date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file.
35
19
class c_ws_plugin__s2member_files
20
{
21
/*
22
Function creates a special File Download Key.
23
Uses: date("Y-m-d") . $_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . $file.
24
includes/classes/installation.inc.php CHANGED
@@ -19,14 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
19
class c_ws_plugin__s2member_installation
20
{
21
/*
22
- Function for handling activation routines.
23
- This function should match the array key for this plugin:
24
- ws_plugin__$plugin_key_activate() is called by our themes.
25
-
26
- We also initialize some option values here.
27
- Initializing these options will force them to be
28
- autoloaded into WordPress® instead of generating
29
- extra queries before they are set.
30
*/
31
public static function activate ()
32
{
@@ -225,9 +218,7 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
225
return; /* Return for uniformity. */
226
}
227
/*
228
- Function for handling de-activation cleanup routines.
229
- This function should match the array key for this plugin:
230
- ws_plugin__$plugin_key_deactivate() is called by our themes.
231
*/
232
public static function deactivate ()
233
{
@@ -288,9 +279,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
288
{
289
if (file_exists ($htaccess = $files_dir . "/.htaccess"))
290
if (is_writable ($htaccess))
291
- unlink($htaccess);
292
/**/
293
- @rmdir($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
294
}
295
/**/
296
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
@@ -298,9 +289,9 @@ if (!class_exists ("c_ws_plugin__s2member_installation"))
298
foreach (scandir ($logs_dir) as $log_file)
299
if (is_file ($log_file = $logs_dir . "/" . $log_file))
300
if (is_writable ($log_file))
301
- unlink($log_file);
302
/**/
303
- @rmdir($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
304
}
305
/**/
306
delete_option ("ws_plugin__s2member_cache");
19
class c_ws_plugin__s2member_installation
20
{
21
/*
22
+ Handles activation routines.
23
*/
24
public static function activate ()
25
{
218
return; /* Return for uniformity. */
219
}
220
/*
221
+ Handles de-activation / cleanup routines.
222
*/
223
public static function deactivate ()
224
{
279
{
280
if (file_exists ($htaccess = $files_dir . "/.htaccess"))
281
if (is_writable ($htaccess))
282
+ unlink ($htaccess);
283
/**/
284
+ @rmdir ($files_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($files_dir));
285
}
286
/**/
287
if (is_dir ($logs_dir = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"]))
289
foreach (scandir ($logs_dir) as $log_file)
290
if (is_file ($log_file = $logs_dir . "/" . $log_file))
291
if (is_writable ($log_file))
292
+ unlink ($log_file);
293
/**/
294
+ @rmdir ($logs_dir) . @rmdir (c_ws_plugin__s2member_utils_dirs::strip_dir_app_data ($logs_dir));
295
}
296
/**/
297
delete_option ("ws_plugin__s2member_cache");
includes/classes/labels.inc.php CHANGED
@@ -39,7 +39,7 @@ if (!class_exists ("c_ws_plugin__s2member_labels"))
39
*/
40
public static function _label_translations ($translation = FALSE, $text = FALSE, $context = FALSE)
41
{
42
- if ($text && $context && preg_match ("/^User role#x2F;i", $context) && ($role = $text))
43
{
44
if (preg_match ("/^(Free )?Subscriber#x2F;i", $role) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"])
45
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
39
*/
40
public static function _label_translations ($translation = FALSE, $text = FALSE, $context = FALSE)
41
{
42
+ if ($text && $context && stripos ($context, "User role") === 0 && ($role = $text))
43
{
44
if (preg_match ("/^(Free )?Subscriber#x2F;i", $role) && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"])
45
$translation = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level0_label"];
includes/classes/login-customizations.inc.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
19
class c_ws_plugin__s2member_login_customizations
20
{
21
/*
22
- Function filters the Login/Registration Logo Url.
23
Attach to: add_filter("login_headerurl");
24
*/
25
public static function login_header_url ($url = FALSE)
@@ -31,7 +31,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
31
return apply_filters ("ws_plugin__s2member_login_header_url", $url, get_defined_vars ());
32
}
33
/*
34
- Function filters the Login/Registration Logo Title.
35
Attach to: add_filter("login_headertitle");
36
*/
37
public static function login_header_title ($title = FALSE)
@@ -43,7 +43,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
43
return apply_filters ("ws_plugin__s2member_login_header_title", $title, get_defined_vars ());
44
}
45
/*
46
- Function creates styles for the Login/Registration panel.
47
Attach to: add_action("login_head");
48
*/
49
public static function login_header_styles ()
@@ -57,8 +57,11 @@ if (!class_exists ("c_ws_plugin__s2member_login_customizations"))
57
/* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
58
$important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
59
/**/
60
- $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>' . "\n";
61
- $s .= '<script type="text/javascript" src="' . esc_attr (site_url ("/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=" . urlencode (md5 (mt_rand ())))) . '"></script>' . "\n";
62
/**/
63
$s .= "\n" . '<style type="text/css">' . "\n";
64
/**/
19
class c_ws_plugin__s2member_login_customizations
20
{
21
/*
22
+ Filters the Login/Registration Logo Url.
23
Attach to: add_filter("login_headerurl");
24
*/
25
public static function login_header_url ($url = FALSE)
31
return apply_filters ("ws_plugin__s2member_login_header_url", $url, get_defined_vars ());
32
}
33
/*
34
+ Filters the Login/Registration Logo Title.
35
Attach to: add_filter("login_headertitle");
36
*/
37
public static function login_header_title ($title = FALSE)
43
return apply_filters ("ws_plugin__s2member_login_header_title", $title, get_defined_vars ());
44
}
45
/*
46
+ Creates styles for the Login/Registration panel.
47
Attach to: add_action("login_head");
48
*/
49
public static function login_header_styles ()
57
/* The !important declarations can be disabled here if you need to apply other hard-coded styles. */
58
$important = $i = apply_filters ("ws_plugin__s2member_login_header_styles_important", " !important", get_defined_vars ());
59
/**/
60
+ if (!version_compare (get_bloginfo ("version"), "3.1-RC", ">=")) /* No longer required with WordPress® 3.1+. */
61
+ {
62
+ $s .= "\n" . '<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>' . "\n";
63
+ $s .= '<script type="text/javascript" src="' . esc_attr (site_url ("/?ws_plugin__s2member_js_w_globals=1&amp;no-cache=" . urlencode (md5 (mt_rand ())))) . '"></script>' . "\n";
64
+ }
65
/**/
66
$s .= "\n" . '<style type="text/css">' . "\n";
67
/**/
includes/classes/login-redirects-r.inc.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_login_redirects_r"))
18
+ {
19
+ class c_ws_plugin__s2member_login_redirects_r
20
+ {
21
+ /*
22
+ This function removes login_redirect Filters to prevent conflicts with s2Member.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function remove_login_redirect_filters () /* For compatibility. */
26
+ {
27
+ do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
+ /**/
29
+ remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
30
+ /**/
31
+ do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
32
+ }
33
+ }
34
+ }
35
+ ?>
includes/classes/login-redirects.inc.php CHANGED
@@ -19,18 +19,6 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
19
class c_ws_plugin__s2member_login_redirects
20
{
21
/*
22
- This function removes login_redirect Filters to prevent conflicts with s2Member.
23
- Attach to: add_action("init");
24
- */
25
- public static function remove_login_redirect_filters () /* For compatibility. */
26
- {
27
- do_action ("ws_plugin__s2member_before_remove_login_redirect_filters", get_defined_vars ());
28
- /**/
29
- remove_all_filters ("login_redirect"); /* Removes ALL `login_redirect` Filters. */
30
- /**/
31
- do_action ("ws_plugin__s2member_after_remove_login_redirect_filters", get_defined_vars ());
32
- }
33
- /*
34
Function for handling login redirections.
35
Attach to: add_action("wp_login");
36
*/
@@ -59,7 +47,7 @@ if (!class_exists ("c_ws_plugin__s2member_login_redirects"))
59
unset ($__refs, $__v); /* Unset defined __refs, __v. */
60
/**/
61
if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
62
- wp_redirect($special_redirection_url); /* Special Redirection. */
63
/**/
64
else /* Else we use the Login Welcome Page configured for s2Member. */
65
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
19
class c_ws_plugin__s2member_login_redirects
20
{
21
/*
22
Function for handling login redirections.
23
Attach to: add_action("wp_login");
24
*/
47
unset ($__refs, $__v); /* Unset defined __refs, __v. */
48
/**/
49
if ($special_redirection_url = c_ws_plugin__s2member_login_redirects::login_redirection_url ($user))
50
+ wp_redirect ($special_redirection_url); /* Special Redirection. */
51
/**/
52
else /* Else we use the Login Welcome Page configured for s2Member. */
53
wp_redirect (get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_welcome_page"]));
includes/classes/menu-pages.inc.php CHANGED
@@ -228,9 +228,9 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
228
wp_enqueue_script ("thickbox");
229
wp_enqueue_script ("media-upload");
230
wp_enqueue_script ("jquery-ui-core");
231
- wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-json-ps-min.js", array ("jquery"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
232
- wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
233
- wp_enqueue_script ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_js=" . urlencode (mt_rand ())), array ("jquery", "thickbox", "media-upload", "jquery-json-ps", "jquery-ui-core", "jquery-ui-effects"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"]);
234
/**/
235
do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
236
}
@@ -250,7 +250,7 @@ if (!class_exists ("c_ws_plugin__s2member_menu_pages"))
250
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
251
{
252
wp_enqueue_style ("thickbox");
253
- wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"], "all");
254
/**/
255
do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
256
}
228
wp_enqueue_script ("thickbox");
229
wp_enqueue_script ("media-upload");
230
wp_enqueue_script ("jquery-ui-core");
231
+ wp_enqueue_script ("jquery-json-ps", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-json-ps-min.js", array ("jquery"), c_ws_plugin__s2member_utilities::ver_checksum ());
232
+ wp_enqueue_script ("jquery-ui-effects", $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/includes/menu-pages/jquery-ui-effects.js", array ("jquery", "jquery-ui-core"), c_ws_plugin__s2member_utilities::ver_checksum ());
233
+ wp_enqueue_script ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_js=" . urlencode (mt_rand ())), array ("jquery", "thickbox", "media-upload", "jquery-json-ps", "jquery-ui-core", "jquery-ui-effects"), c_ws_plugin__s2member_utilities::ver_checksum ());
234
/**/
235
do_action ("ws_plugin__s2member_during_add_admin_scripts", get_defined_vars ());
236
}
250
if ($_GET["page"] && preg_match ("/ws-plugin--s2member-/", $_GET["page"]))
251
{
252
wp_enqueue_style ("thickbox");
253
+ wp_enqueue_style ("ws-plugin--s2member-menu-pages", site_url ("/?ws_plugin__s2member_menu_pages_css=" . urlencode (mt_rand ())), array ("thickbox"), c_ws_plugin__s2member_utilities::ver_checksum (), "all");
254
/**/
255
do_action ("ws_plugin__s2member_during_add_admin_styles", get_defined_vars ());
256
}
includes/classes/meta-box-saves.inc.php CHANGED
@@ -62,7 +62,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
62
if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
/**/
65
- $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages[0]), "ws_plugin__s2member_level1_pages" => implode (",", $pages[1]), "ws_plugin__s2member_level2_pages" => implode (",", $pages[2]), "ws_plugin__s2member_level3_pages" => implode (",", $pages[3]), "ws_plugin__s2member_level4_pages" => implode (",", $pages[4])));
66
/**/
67
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
68
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
@@ -97,7 +97,7 @@ if (!class_exists ("c_ws_plugin__s2member_meta_box_saves"))
97
if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
/**/
100
- $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts[0]), "ws_plugin__s2member_level1_posts" => implode (",", $posts[1]), "ws_plugin__s2member_level2_posts" => implode (",", $posts[2]), "ws_plugin__s2member_level3_posts" => implode (",", $posts[3]), "ws_plugin__s2member_level4_posts" => implode (",", $posts[4])));
101
/**/
102
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
103
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
62
if (!$pages[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
63
array_push ($pages[$_p["ws_plugin__s2member_security_meta_box_level"]], $page_id);
64
/**/
65
+ $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_pages" => implode (",", $pages["0"]), "ws_plugin__s2member_level1_pages" => implode (",", $pages["1"]), "ws_plugin__s2member_level2_pages" => implode (",", $pages["2"]), "ws_plugin__s2member_level3_pages" => implode (",", $pages["3"]), "ws_plugin__s2member_level4_pages" => implode (",", $pages["4"])));
66
/**/
67
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
68
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
97
if (!$posts[$_p["ws_plugin__s2member_security_meta_box_level"]] !== array ("all"))
98
array_push ($posts[$_p["ws_plugin__s2member_security_meta_box_level"]], $post_id);
99
/**/
100
+ $new_options = array_merge ((array)$new_options, array ("ws_plugin__s2member_level0_posts" => implode (",", $posts["0"]), "ws_plugin__s2member_level1_posts" => implode (",", $posts["1"]), "ws_plugin__s2member_level2_posts" => implode (",", $posts["2"]), "ws_plugin__s2member_level3_posts" => implode (",", $posts["3"]), "ws_plugin__s2member_level4_posts" => implode (",", $posts["4"])));
101
/**/
102
eval ('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$__v;');
103
do_action ("ws_plugin__s2member_during_save_meta_boxes", get_defined_vars ());
includes/classes/meta-boxes.inc.php CHANGED
@@ -20,15 +20,16 @@ if (!class_exists ("c_ws_plugin__s2member_meta_boxes"))
20
{
21
/*
22
Function adds meta boxes to Post/Page editing stations.
23
- Attach to: add_action("admin_menu");
24
*/
25
- public static function add_meta_boxes ()
26
{
27
do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
28
/**/
29
- foreach (get_post_types () as $type) /* Handles Custom Post Types as well. */
30
- if (!in_array ($type, array ("revision", "attachment", "nav_menu_item"))) /* But NOT on these Post Types. */
31
- add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
32
/**/
33
do_action ("ws_plugin__s2member_after_add_meta_boxes", get_defined_vars ());
34
/**/
20
{
21
/*
22
Function adds meta boxes to Post/Page editing stations.
23
+ * Note: WordPress® also calls this Hook with $type set to: `link` and `comment` Possibly others.
24
+ Thus, the need for: `in_array ($type, array_keys (get_post_types ()))`.
25
+ Attach to: add_action("add_meta_boxes");
26
*/
27
+ public static function add_meta_boxes ($type = FALSE)
28
{
29
do_action ("ws_plugin__s2member_before_add_meta_boxes", get_defined_vars ());
30
/**/
31
+ if (in_array ($type, array_keys (get_post_types ())) && !in_array ($type, array ("link", "comment", "revision", "attachment", "nav_menu_item")))
32
+ add_meta_box ("ws-plugin--s2member-security", "s2Member", "c_ws_plugin__s2member_meta_box_security::security_meta_box", $type, "side", "high");
33
/**/
34
do_action ("ws_plugin__s2member_after_add_meta_boxes", get_defined_vars ());
35
/**/
includes/classes/{misc-redirects.inc.php → mo-page-in.inc.php} RENAMED
@@ -14,33 +14,34 @@ Direct access denial.
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
exit ("Do not access this file directly.");
16
/**/
17
- if (!class_exists ("c_ws_plugin__s2member_misc_redirects"))
18
{
19
- class c_ws_plugin__s2member_misc_redirects
20
{
21
/*
22
This forces a redirection to the Membership Options Page for s2Member.
23
- This can be used by 3rd party applications that are not aware of which
24
- Page is currently set as the Membership Options Page.
25
26
This is used by s2Member's bbPress Bridge integration.
27
28
- Attach to: add_action("template_redirect");
29
Example usage: http://example.com/?s2member_membership_options_page=1
30
*/
31
public static function membership_options_page () /* Force a redirection. */
32
{
33
do_action ("ws_plugin__s2member_before_membership_options_page", get_defined_vars ());
34
/**/
35
- if ($_GET["s2member_membership_options_page"] && !is_page ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"]))
36
{
37
$query_args = array (); /* Initialize array. */
38
foreach ($_GET as $var => $val) /* Include any s2member_ vars. */
39
if (preg_match ("/^s2member_/", $var) && $var !== "s2member_membership_options_page")
40
$query_args[$var] = $val;
41
/**/
42
wp_redirect (add_query_arg (urlencode_deep ($query_args), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), 301);
43
- exit ();
44
}
45
/**/
46
do_action ("ws_plugin__s2member_after_membership_options_page", get_defined_vars ());
14
if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
exit ("Do not access this file directly.");
16
/**/
17
+ if (!class_exists ("c_ws_plugin__s2member_mo_page_in"))
18
{
19
+ class c_ws_plugin__s2member_mo_page_in
20
{
21
/*
22
This forces a redirection to the Membership Options Page for s2Member.
23
+ This can be used by 3rd party applications that are not aware of which Page is currently set as the Membership Options Page.
24
25
This is used by s2Member's bbPress Bridge integration.
26
27
+ Attach to: add_action("init");
28
Example usage: http://example.com/?s2member_membership_options_page=1
29
*/
30
public static function membership_options_page () /* Force a redirection. */
31
{
32
do_action ("ws_plugin__s2member_before_membership_options_page", get_defined_vars ());
33
/**/
34
+ if ($_GET["s2member_membership_options_page"]) /* An incoming request? */
35
{
36
$query_args = array (); /* Initialize array. */
37
foreach ($_GET as $var => $val) /* Include any s2member_ vars. */
38
if (preg_match ("/^s2member_/", $var) && $var !== "s2member_membership_options_page")
39
$query_args[$var] = $val;
40
+ /* Do NOT include `s2member_membership_options_page` as that could create a redirect loop. */
41
/**/
42
wp_redirect (add_query_arg (urlencode_deep ($query_args), get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["membership_options_page"])), 301);
43
+ /**/
44
+ exit (); /* Clean exit. */
45
}
46
/**/
47
do_action ("ws_plugin__s2member_after_membership_options_page", get_defined_vars ());
includes/classes/mo-page.inc.php ADDED
@@ -0,0 +1,39 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_mo_page"))
18
+ {
19
+ class c_ws_plugin__s2member_mo_page
20
+ {
21
+ /*
22
+ This forces a redirection to the Membership Options Page for s2Member.
23
+ This can be used by 3rd party applications that are not aware of which Page is currently set as the Membership Options Page.
24
+
25
+ This is used by s2Member's bbPress Bridge integration.
26
+
27
+ Attach to: add_action("init");
28
+ Example usage: http://example.com/?s2member_membership_options_page=1
29
+ */
30
+ public static function membership_options_page () /* Force a redirection. */
31
+ {
32
+ if ($_GET["s2member_membership_options_page"]) /* Call inner function? */
33
+ {
34
+ return c_ws_plugin__s2member_mo_page_in::membership_options_page ();
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ?>
includes/classes/nocache.inc.php CHANGED
@@ -27,7 +27,8 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
27
{
28
do_action ("ws_plugin__s2member_before_nocache", get_defined_vars ());
29
/**/
30
- c_ws_plugin__s2member_nocache::nocache_constants () . c_ws_plugin__s2member_nocache::nocache_headers ();
31
/**/
32
do_action ("ws_plugin__s2member_after_nocache", get_defined_vars ());
33
/**/
@@ -40,7 +41,7 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
40
Actually, Quick Cache is compatible with either of these defined constants.
41
42
Always disallow caching for logged in users and GET requests with /?s2member systematic use.
43
- For clarity on the systematic use with s2member in the request, see: is-systematic.inc.php.
44
- Also disallow caching if the $nocache param is passed in as true by other routines.
45
* BUT, always obey the qcAC param that specifically allows caching.
46
@@ -102,8 +103,8 @@ if (!class_exists ("c_ws_plugin__s2member_nocache"))
102
if (!$once && !$_GET["qcABC"] && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_nocache_headers", false, get_defined_vars ()))
103
{
104
if (is_array ($headers = headers_list ()))
105
- foreach ($headers as $k => $header)
106
- if (preg_match ("/no-cache/i", $header))
107
$no_cache_already_sent = true;
108
/**/
109
if (!$no_cache_already_sent)
27
{
28
do_action ("ws_plugin__s2member_before_nocache", get_defined_vars ());
29
/**/
30
+ c_ws_plugin__s2member_nocache::nocache_constants (); /* This first. */
31
+ c_ws_plugin__s2member_nocache::nocache_headers (); /* Now run headers. */
32
/**/
33
do_action ("ws_plugin__s2member_after_nocache", get_defined_vars ());
34
/**/
41
Actually, Quick Cache is compatible with either of these defined constants.
42
43
Always disallow caching for logged in users and GET requests with /?s2member systematic use.
44
+ For clarity on the systematic use with s2member in the request, see: /classes/systematics.inc.php.
45
- Also disallow caching if the $nocache param is passed in as true by other routines.
46
* BUT, always obey the qcAC param that specifically allows caching.
47
103
if (!$once && !$_GET["qcABC"] && (!$using_selective_behavior || $selective) && !apply_filters ("ws_plugin__s2member_disable_nocache_headers", false, get_defined_vars ()))
104
{
105
if (is_array ($headers = headers_list ()))
106
+ foreach ($headers as $header) /* Already? */
107
+ if (stripos ($header, "no-cache") !== false)
108
$no_cache_already_sent = true;
109
/**/
110
if (!$no_cache_already_sent)
includes/classes/op-notices.inc.php CHANGED
@@ -20,7 +20,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
20
{
21
/*
22
Function that describes the General Option overrides for clarity.
23
- Attach to: add_action("admin_init");
24
*/
25
public static function general_ops_notice ()
26
{
@@ -47,7 +47,8 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
47
}
48
/*
49
Function that describes the Multisite Option overrides for clarity.
50
- Attach to: add_action("admin_init");
51
*/
52
public static function multisite_ops_notice ()
53
{
@@ -65,7 +66,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
65
$js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
66
$js .= '</script>';
67
}
68
- else /* Else we use the old WordPress® v3.0.x method of disabling these important options. */
69
{
70
$notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
71
/**/
@@ -85,7 +86,7 @@ if (!class_exists ("c_ws_plugin__s2member_op_notices"))
85
}
86
/*
87
Function that deals with Reading Option conflicts.
88
- Attach to: add_action("admin_init");
89
*/
90
public static function reading_ops_notice ()
91
{
20
{
21
/*
22
Function that describes the General Option overrides for clarity.
23
+ Attach to: add_action("load-options-general.php");
24
*/
25
public static function general_ops_notice ()
26
{
47
}
48
/*
49
Function that describes the Multisite Option overrides for clarity.
50
+ Attach to: add_action("load-ms-options.php");
51
+ Attach to: add_action("load-settings.php");
52
*/
53
public static function multisite_ops_notice ()
54
{
66
$js .= "jQuery('input[name=registration], input#add_new_users').attr('disabled', 'disabled');";
67
$js .= '</script>';
68
}
69
+ else /* Else we use the old WordPress® v3.0.x method of disabling these important options on the `ms-options.php` page. */
70
{
71
$notice = "<em>* Note: The s2Member plugin has control over four options on this page.<br /><code>Dashboard Blog = " . esc_html (get_site_option ("dashboard_blog")) . " / Main Site</code>, <code>Default Role = " . esc_html (get_site_option ("default_user_role")) . "</code>, <code>Allow Open Registration = " . esc_html (get_site_option ("registration")) . "</code>, and <code>Add New Users = " . esc_html (get_site_option ("add_new_users")) . "</code>.<br />In your Dashboard ( on the Main Site ), see: <code>s2Member -> Multisite ( Config )</code>.";
72
/**/
86
}
87
/*
88
Function that deals with Reading Option conflicts.
89
+ Attach to: add_action("load-options-reading.php");
90
*/
91
public static function reading_ops_notice ()
92
{
includes/classes/profile-in.inc.php ADDED
@@ -0,0 +1,40 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_profile_in"))
18
+ {
19
+ class c_ws_plugin__s2member_profile_in
20
+ {
21
+ /*
22
+ Function that displays a Profile Modification Form.
23
+ Attach to: add_action("init");
24
+ */
25
+ public static function profile ()
26
+ {
27
+ do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
28
+ /**/
29
+ if ($_GET["s2member_profile"] && is_user_logged_in ()) /* Logged in? */
30
+ {
31
+ include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
32
+ /* Additional Hooks/Filters inside profile.inc.php. */
33
+ exit (); /* Clean exit. */
34
+ }
35
+ /**/
36
+ do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
37
+ }
38
+ }
39
+ }
40
+ ?>
includes/classes/profile-mods-in.inc.php CHANGED
@@ -24,7 +24,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
24
*/
25
public static function handle_profile_modifications ()
26
{
27
- global $current_user; /* We'll need to update this object. */
28
/**/
29
do_action ("ws_plugin__s2member_before_handle_profile_modifications", get_defined_vars ());
30
/**/
@@ -36,7 +36,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
36
/**/
37
$_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
/**/
39
- $userdata["ID"] = $user_id = $current_user->ID;
40
/**/
41
include_once ABSPATH . WPINC . "/registration.php";
42
/**/
@@ -57,7 +57,7 @@ if (!class_exists ("c_ws_plugin__s2member_profile_mods_in"))
57
if ($_POST["ws_plugin__s2member_profile_last_name"])
58
$userdata["last_name"] = $_POST["ws_plugin__s2member_profile_last_name"];
59
/**/
60
- wp_update_user($userdata); /* OK. Now send this array for an update. */
61
/**/
62
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
24
*/
25
public static function handle_profile_modifications ()
26
{
27
+ global $current_user; /* We'll need to update this global object. */
28
/**/
29
do_action ("ws_plugin__s2member_before_handle_profile_modifications", get_defined_vars ());
30
/**/
36
/**/
37
$_POST = c_ws_plugin__s2member_utils_strings::trim_deep (stripslashes_deep ($_POST)); /* Clean POST vars. */
38
/**/
39
+ $userdata["ID"] = $user_id = $current_user->ID; /* Needed for database update. */
40
/**/
41
include_once ABSPATH . WPINC . "/registration.php";
42
/**/
57
if ($_POST["ws_plugin__s2member_profile_last_name"])
58
$userdata["last_name"] = $_POST["ws_plugin__s2member_profile_last_name"];
59
/**/
60
+ wp_update_user ($userdata); /* OK. Now send this array for an update. */
61
/**/
62
if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["custom_reg_fields"])
63
if ($fields_applicable = c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level ("auto-detection"))
includes/classes/profile.inc.php CHANGED
@@ -20,22 +20,14 @@ if (!class_exists ("c_ws_plugin__s2member_profile"))
20
{
21
/*
22
Function that displays a Profile Modification Form.
23
- Attach to: add_action("template_redirect");
24
*/
25
public static function profile ()
26
{
27
- do_action ("ws_plugin__s2member_before_profile", get_defined_vars ());
28
- /**/
29
- if ($_GET["s2member_profile"] && is_user_logged_in ()) /* Logged in? */
30
{
31
- include_once dirname (dirname (__FILE__)) . "/profile.inc.php";
32
- /* Additional Hooks/Filters inside profile.inc.php. */
33
- exit (); /* Clean exit. */
34
}
35
- /**/
36
- do_action ("ws_plugin__s2member_after_profile", get_defined_vars ());
37
- /**/
38
- return; /* Return for uniformity. */
39
}
40
}
41
}
20
{
21
/*
22
Function that displays a Profile Modification Form.
23
+ Attach to: add_action("init");
24
*/
25
public static function profile ()
26
{
27
+ if ($_GET["s2member_profile"]) /* Call inner function? */
28
{
29
+ return c_ws_plugin__s2member_profile_in::profile ();
30
}
31
}
32
}
33
}
includes/classes/sc-paypal-button-e.inc.php CHANGED
@@ -35,8 +35,8 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_e"))
35
/**/
36
eval ('$_code = $vars["_code"]; $attr = $vars["attr"];'); /* Let's unpack ( i.e. use shorter references ) to these two important data vars. */
37
/**/
38
- if ($cache && ($transient = "s2m_btn_" . md5 ($code . $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_version"] . $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["filemtime"])) && ($cache = get_transient ($transient)))
39
- $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code; just in case a different `output=""` format was requested. */
40
/**/
41
else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse the hidden inputs variables? */
42
{
35
/**/
36
eval ('$_code = $vars["_code"]; $attr = $vars["attr"];'); /* Let's unpack ( i.e. use shorter references ) to these two important data vars. */
37
/**/
38
+ if ($cache && ($transient = "s2m_btn_" . md5 ($code . c_ws_plugin__s2member_utilities::ver_checksum ())) && ($cache = get_transient ($transient)))
39
+ $code = $cache; /* Great, so we can use the cached version here to save processing time. Notice the MD5 hash uses $code and NOT $_code. */
40
/**/
41
else if (is_array ($inputs = c_ws_plugin__s2member_utils_forms::form_whips_2_array ($_code)) && !empty ($inputs)) /* Were we able to parse the hidden inputs variables? */
42
{
includes/classes/sc-paypal-button-in.inc.php CHANGED
@@ -103,6 +103,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
103
{
104
$default_image = "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"; /* Default PayPal® Image. */
105
/**/
106
$attr["desc"] = (!$attr["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
107
/**/
108
$attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
@@ -134,9 +137,9 @@ if (!class_exists ("c_ws_plugin__s2member_sc_paypal_button_in"))
134
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ps"])) . '"', $code);
135
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["cc"])) . '"', $code);
136
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["custom"])) . '"', $code);
137
- $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0)) . '"', $code);
138
- $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0)) . '"', $code);
139
- $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr (($attr["modify"]) ? "1" : "0")) . '"', $code);
140
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ra"])) . '"', $code);
141
$code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["rr"])) . '"', $code);
142
$code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ta"])) . '"', $code);
103
{
104
$default_image = "https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"; /* Default PayPal® Image. */
105
/**/
106
+ $paypal_on0_input_value = ($updating = c_ws_plugin__s2member_utils_users::get_user_subscr_or_wp_id ()) ? "Updating Subscr. ID" : "";
107
+ $paypal_os0_input_value = ($updating) ? $updating : ""; /* Current User's Paid Subscr. ID. Their WP® User ID will also suffice. */
108
+ /**/
109
$attr["desc"] = (!$attr["desc"]) ? $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level" . $attr["level"] . "_label"] : $attr["desc"];
110
/**/
111
$attr["level_ccaps_eotper"] = ($attr["rr"] === "BN" && $attr["rt"] !== "L") ? $attr["level"] . ":" . $attr["ccaps"] . ":" . $attr["rp"] . " " . $attr["rt"] : $attr["level"] . ":" . $attr["ccaps"];
137
$code = preg_replace ('/ name\="page_style" value\="(.*?)"/', ' name="page_style" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ps"])) . '"', $code);
138
$code = preg_replace ('/ name\="currency_code" value\="(.*?)"/', ' name="currency_code" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["cc"])) . '"', $code);
139
$code = preg_replace ('/ name\="custom" value\="(.*?)"/', ' name="custom" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["custom"])) . '"', $code);
140
+ $code = preg_replace ('/ name\="on0" value\="(.*?)"/', ' name="on0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($paypal_on0_input_value)) . '"', $code);
141
+ $code = preg_replace ('/ name\="os0" value\="(.*?)"/', ' name="os0" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($paypal_os0_input_value)) . '"', $code);
142
+ $code = preg_replace ('/ name\="modify" value\="(.*?)"/', ' name="modify" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["modify"])) . '"', $code);
143
$code = preg_replace ('/ name\="amount" value\="(.*?)"/', ' name="amount" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ra"])) . '"', $code);
144
$code = preg_replace ('/ name\="src" value\="(.*?)"/', ' name="src" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["rr"])) . '"', $code);
145
$code = preg_replace ('/ name\="a1" value\="(.*?)"/', ' name="a1" value="' . c_ws_plugin__s2member_utils_strings::esc_ds (esc_attr ($attr["ta"])) . '"', $code);
includes/classes/ssl-in.inc.php ADDED
@@ -0,0 +1,121 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/
17
+ if (!class_exists ("c_ws_plugin__s2member_ssl_in"))
18
+ {
19
+ class c_ws_plugin__s2member_ssl_in
20
+ {
21
+ /*
22
+ Function that forces SSL on specific Posts/Pages.
23
+ Attach to: add_action("template_redirect");
24
+
25
+ Triggered by Custom Field:
26
+ s2member_force_ssl = yes
27
+ ( i.e. https://www.example.com/ )
28
+
29
+ Or with a specific port number:
30
+ s2member_force_ssl = 443 ( or whatever port you require )
31
+ ( i.e. https://www.example.com:443/ )
32
+
33
+ * Phase 2 of `c_ws_plugin__s2member_ssl::check_force_ssl()`.
34
+ */
35
+ public static function force_ssl ($vars = array ()) /* Phase 2 of `c_ws_plugin__s2member_ssl::check_force_ssl()`. */
36
+ {
37
+ extract ($vars); /* Extract vars passed in from `c_ws_plugin__s2member_ssl::check_force_ssl()`. */
38
+ /**/
39
+ if (!is_ssl ()) /* SSL must be enabled here. Redirect to the equivalent https:// scheme. */
40
+ {
41
+ $ssl_host = preg_replace ("/\:[0-9]+#x2F;", "", $_SERVER["HTTP_HOST"]);
42
+ $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false;
43
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
44
+ /**/
45
+ wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
46
+ /**/
47
+ exit (); /* Clean exit. Redirecting to SSL version of the page. */
48
+ }
49
+ else /* Otherwise, we buffer all output, and switch all content over to https. */
50
+ {
51
+ add_filter ("redirect_canonical", "__return_false");
52
+ /**/
53
+ $ssl_host = preg_replace ("/\:[0-9]+#x2F;", "", $_SERVER["HTTP_HOST"]);
54
+ $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : false;
55
+ $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
56
+ /**/
57
+ define ("_ws_plugin__s2member_force_ssl_host", $ssl_host);
58
+ define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
59
+ define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
60
+ /**/
61
+ /* Except these. We do NOT want to create a sitewide https conversion! */
62
+ add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
63
+ add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
64
+ add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
65
+ add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
66
+ /**/
67
+ if (!function_exists ("_ws_plugin__s2member_force_non_ssl_scheme"))
68
+ {
69
+ function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
70
+ {
71
+ return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
72
+ }
73
+ }
74
+ /**/
75
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer"))
76
+ {
77
+ function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
+ {
79
+ $o_pcre = @ini_get ("pcre.backtrack_limit");
80
+ /**/
81
+ @ini_set ("pcre.backtrack_limit", 10000000);
82
+ /**/
83
+ $tags = array ("script", "style", "link", "img", "input", "iframe", "object", "embed");
84
+ $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags_array", $tags, get_defined_vars ());
85
+ $tags = array_unique (array_map ("strtolower", $tags)); /* This array should be lowercase / unique. */
86
+ /**/
87
+ $regex_tags = implode ("|", array_map ("preg_quote", $tags)); /* Prepare for regex. */
88
+ /**/
89
+ $buffer = ($regex_tags) ? preg_replace_callback ("/\<(" . $regex_tags . ")[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
90
+ $buffer = (in_array ("script", $tags)) ? preg_replace_callback ("/\<script[^\>]*\>(.+?)\<\/script\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
91
+ $buffer = (in_array ("style", $tags)) ? preg_replace_callback ("/\<style[^\>]*\>(.+?)\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer) : $buffer;
92
+ /**/
93
+ @ini_set ("pcre.backtrack_limit", $o_pcre);
94
+ /**/
95
+ return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
96
+ }
97
+ }
98
+ /**/
99
+ if (!function_exists ("_ws_plugin__s2member_force_ssl_buffer_callback"))
100
+ {
101
+ function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
102
+ {
103
+ $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
104
+ /**/
105
+ if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Need port conversions? */
106
+ $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
107
+ /**/
108
+ $c = (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $c; /* Alternates are fine to leave like they are. */
109
+ /**/
110
+ return $c; /* Return string with conversions. */
111
+ }
112
+ }
113
+ /**/
114
+ ob_start ("_ws_plugin__s2member_force_ssl_buffer");
115
+ }
116
+ /**/
117
+ return; /* Return for uniformity. */
118
+ }
119
+ }
120
+ }
121
+ ?>
includes/classes/ssl.inc.php CHANGED
@@ -38,72 +38,11 @@ if (!class_exists ("c_ws_plugin__s2member_ssl"))
38
/**/
39
$force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", false, get_defined_vars ());
40
/**/
41
- if (($force_ssl || (is_singular () && is_object ($post) && ($__id = $post->ID))) && strtolower ($force_ssl) !== "no")
42
/**/
43
- if (($force_ssl || ($force_ssl = get_post_meta ($__id, "s2member_force_ssl", true))) && strtolower ($force_ssl) !== "no")
44
{
45
- if (!is_ssl ()) /* SSL must be enabled here. Redirect to the equivalent https:// scheme. */
46
- {
47
- $ssl_host = preg_replace ("/\:[0-9]+#x2F;", "", $_SERVER["HTTP_HOST"]);
48
- $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : 0;
49
- $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
50
- /**/
51
- wp_redirect ("https://" . $ssl_host_port . $_SERVER["REQUEST_URI"]);
52
- exit (); /* ^ So let's redirect to the SSL enabled version. */
53
- }
54
- else /* Otherwise, we buffer all output, and switch all content over to https. */
55
- {
56
- add_filter ("redirect_canonical", "__return_false");
57
- /**/
58
- $ssl_host = preg_replace ("/\:[0-9]+#x2F;", "", $_SERVER["HTTP_HOST"]);
59
- $ssl_port = (is_numeric ($force_ssl) && $force_ssl > 1) ? $force_ssl : 0;
60
- $ssl_host_port = $ssl_host . (($ssl_port) ? ":" . $ssl_port : "");
61
- /**/
62
- define ("_ws_plugin__s2member_force_ssl_host", $ssl_host);
63
- define ("_ws_plugin__s2member_force_ssl_port", $ssl_port);
64
- define ("_ws_plugin__s2member_force_ssl_host_port", $ssl_host_port);
65
- /**/
66
- /* Except these. We do NOT want to create a sitewide https conversion! */
67
- add_filter ("home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
68
- add_filter ("network_home_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
69
- add_filter ("site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
70
- add_filter ("network_site_url", "_ws_plugin__s2member_force_non_ssl_scheme", 10, 3);
71
- /**/
72
- function _ws_plugin__s2member_force_non_ssl_scheme ($url = FALSE, $path = FALSE, $scheme = FALSE)
73
- {
74
- return ($scheme) ? $url : preg_replace ("/^https\:\/\//i", "http://", $url);
75
- }
76
- /**/
77
- function _ws_plugin__s2member_force_ssl_buffer ($buffer = FALSE)
78
- {
79
- $o_pcre = @ini_get ("pcre.backtrack_limit");
80
- /**/
81
- @ini_set ("pcre.backtrack_limit", 10000000);
82
- /**/
83
- $tags = "script|style|link|img|input|iframe|object|embed"; /* Specific tags. */
84
- /**/
85
- $tags = apply_filters ("_ws_plugin__s2member_force_ssl_buffer_tags", $tags, get_defined_vars ());
86
- /**/
87
- $buffer = preg_replace_callback ("/\<(" . $tags . ")[^\>]+\>/i", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
88
- $buffer = preg_replace_callback ("/\<style[^\>]*\>(.+?)\<\/style\>/is", "_ws_plugin__s2member_force_ssl_buffer_callback", $buffer);
89
- /**/
90
- @ini_set ("pcre.backtrack_limit", $o_pcre);
91
- /**/
92
- return apply_filters ("_ws_plugin__s2member_force_ssl_buffer", $buffer, get_defined_vars ());
93
- }
94
- /**/
95
- function _ws_plugin__s2member_force_ssl_buffer_callback ($m = FALSE)
96
- {
97
- $c = preg_replace ("/http\:\/\//i", "https://", $m[0]);
98
- /**/
99
- if (_ws_plugin__s2member_force_ssl_port && _ws_plugin__s2member_force_ssl_host && _ws_plugin__s2member_force_ssl_host_port) /* Do we ALSO need port conversions? */
100
- $c = preg_replace ("/\/" . preg_quote (_ws_plugin__s2member_force_ssl_host, "/") . "(\:[0-9]+)?\//i", "/" . _ws_plugin__s2member_force_ssl_host_port . "/", $c);
101
- /**/
102
- return (strtolower ($m[1]) === "link" && preg_match ("/['\"]alternate['\"]/i", $m[0])) ? $m[0] : $c; /* Return string with conversions. */
103
- }
104
- /**/
105
- ob_start ("_ws_plugin__s2member_force_ssl_buffer");
106
- }
107
}
108
/**/
109
do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
38
/**/
39
$force_ssl = apply_filters ("ws_plugin__s2member_check_force_ssl", false, get_defined_vars ());
40
/**/
41
+ if (($force_ssl || (is_singular () && is_object ($post) && ($__id = $post->ID))) && !preg_match ("/^(no|false)#x2F;i", $force_ssl))
42
/**/
43
+ if (($force_ssl || ($force_ssl = get_post_meta ($__id, "s2member_force_ssl", true))) && !preg_match ("/^(no|false)#x2F;i", $force_ssl))
44
{
45
+ c_ws_plugin__s2member_ssl_in::force_ssl (get_defined_vars ()); /* Call inner function now. */
46
}
47
/**/
48
do_action ("ws_plugin__s2member_after_check_force_ssl", get_defined_vars ());
includes/classes/tracking-cookies-in.inc.php ADDED
@@ -0,0 +1,61 @@
1
+ <?php
2
+ /*
3
+ Copyright: © 2009 WebSharks, Inc. ( coded in the USA )
4
+ <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
5
+
6
+ Released under the terms of the GNU General Public License.
7
+ You should have received a copy of the GNU General Public License,
8
+ along with this software. In the main directory, see: /licensing/
9
+ If not, see: <http://www.gnu.org/licenses/>.
10
+ */
11
+ /*
12
+ Direct access denial.
13
+ */
14
+ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
15
+ exit ("Do not access this file directly.");
16
+ /**/