PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 110815
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v110815
260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 111220 120213 120219 All 188 releases
s2member / includes / syscon.inc.php

syscon.inc.php in s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions 110815, at includes/syscon.inc.php

500 lines 29.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * System configuration for the s2Member plugin.
4 *
5 * **WARNING:** This is a system configuration file, please DO NOT EDIT this file directly.
6 * Instead, use the plugin options panel in WordPress® to override these settings.
7 *
8 * Copyright: © 2009-2011
9 * {@link http://www.websharks-inc.com/ WebSharks, Inc.}
10 * ( coded in the USA )
11 *
12 * Released under the terms of the GNU General Public License.
13 * You should have received a copy of the GNU General Public License,
14 * along with this software. In the main directory, see: /licensing/
15 * If not, see: {@link http://www.gnu.org/licenses/}.
16 *
17 * @package s2Member
18 * @since 3.0
19 */
20 if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
21 exit("Do not access this file directly.");
22 /*
23 Determine the full URL to the directory this plugin resides in.
24 */
25 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] = (stripos (__FILE__, WP_CONTENT_DIR) !== 0) ? /* Have to assume plugins dir? */
26 plugins_url ("/" . basename (dirname (dirname (__FILE__)))) : /* Otherwise, this gives it a chance to live anywhere in the content dir. */
27 content_url (preg_replace ("/^(.*?)\/" . preg_quote (basename (WP_CONTENT_DIR), "/") . "/", "", str_replace (DIRECTORY_SEPARATOR, "/", dirname (dirname (__FILE__)))));
28 /*
29 Configure the number of Membership Levels being used with s2Member. This is NOT ready ( yet ). Some areas of s2Member are still hard-coded at 4 Levels + Subscribers.
30 */
31 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"] = 4; /* Hard coded in at 4 Levels. This can only be extended when/if s2Member Pro is installed. */
32 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["min_levels"] = 1; /* A lower limit to protect the integrity of the s2Member software application. */
33 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["max_levels"] = apply_filters ("ws_plugin__s2member_max_levels", 100); /* Filterable. */
34 /*
35 Configure regular expression matches for Membership Access Item Numbers ( including those with only Custom Capabilities ).
36 */
37 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_level_regex"] = "/^([1-9][0-9]*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
38 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_wo_level_regex"] = "/^(\*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
39 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["membership_item_number_w_or_wo_level_regex"] = "/^([1-9][0-9]*|\*)(?:(?:\:((?:-all\+|\+-all|-all|\+)?[a-z_0-9,\+]*)?)?(?:\:([0-9]+ [A-Z])?)?)?$/";
40 /*
41 Configure regular expression match for Specific Post/Page Access Item Numbers ( all elements required here ).
42 */
43 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["sp_access_item_number_regex"] = "/^(sp)(?:(?:\:([1-9][0-9,]*))(?:\:([1-9][0-9]*)))$/";
44 /*
45 Configure the directory for files protected by s2Member.
46 */
47 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"] = apply_filters ("ws_plugin__s2member_files_dir", dirname (dirname (__FILE__)) . "-files" . ((preg_match ("/^win/i", PHP_OS)) ? "/app_data" : ""));
48 /*
49 Configure the directory for logs protected by s2Member.
50 */
51 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["logs_dir"] = apply_filters ("ws_plugin__s2member_logs_dir", dirname (dirname (__FILE__)) . "-logs" . ((preg_match ("/^win/i", PHP_OS)) ? "/app_data" : ""));
52 /*
53 Configure the global reCaptcha for ( www.s2-all-domains.com ). These public/private keys work on any installation.
54 */
55 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["recaptcha"] = array ("public_key" => "6LdxxcESAAAAANL7vrhz2glFIhmLGY58hXOhGkE0", "private_key" => "6LdxxcESAAAAAOlXATQTR75735n0eSIcOnp4GeNd", "lang" => "en");
56 /*
57 Configure the right menu options panel for s2Member.
58 */
59 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["menu_pages"] = array ("mlist" => true, "upsell-pro" => true, "installation" => false, "tools" => false, "videos" => true, "support" => true, "donations" => true);
60 /*
61 Check if s2Member has been configured *should be set after the first config via options panel*.
62 */
63 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["configured"] = get_option ("ws_plugin__s2member_configured");
64 /*
65 This is a special option cache that holds some additional information autoloaded into WordPress®.
66 */
67 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["cache"] = get_option ("ws_plugin__s2member_cache");
68 /*
69 Configure checksum time for the syscon.inc.php file.
70 */
71 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] = filemtime (__FILE__);
72 /*
73 Configure an array of pluggable functions handled by s2Member.
74 */
75 $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["pluggables"] = array ();
76 /*
77 Configure & validate all of the s2Member options; and set their defaults.
78 */
79 if (!function_exists ("ws_plugin__s2member_configure_options_and_their_defaults"))
80 {
81 /**
82 * Configures an options array for the s2Member plugin.
83 *
84 * **WARNING:** This is a system configuration function, please DO NOT EDIT this function directly.
85 * Instead, use the plugin options panel in WordPress® to override these settings.
86 *
87 * @package s2Member
88 * @since 3.0
89 *
90 * @param array $options Optional. An array of new options, to be merged with the defaults.
91 * @return array This merged array of options: ``$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]``
92 */
93 function ws_plugin__s2member_configure_options_and_their_defaults ($options = FALSE)
94 {
95 global $current_site, $current_blog;
96 /**/
97 $default_options["options_checksum"] = "";
98 $default_options["options_version"] = "1.0";
99 /**/
100 $default_options["gateway_debug_logs"] = "0";
101 /**/
102 $default_options["sec_encryption_key"] = "";
103 $default_options["sec_encryption_key_history"] = array ();
104 $default_options["s_badge_status_enabled"] = "0";
105 /**/
106 $default_options["max_ip_restriction"] = "5";
107 $default_options["max_ip_restriction_time"] = "3600";
108 $default_options["max_failed_login_attempts"] = "5";
109 /**/
110 $default_options["run_deactivation_routines"] = "0";
111 /**/
112 $default_options["custom_reg_fields"] = "";
113 $default_options["custom_reg_names"] = "1";
114 $default_options["custom_reg_display_name"] = "full";
115 $default_options["custom_reg_password"] = "0";
116 $default_options["custom_reg_opt_in"] = "1";
117 $default_options["custom_reg_opt_in_label"] = "Yes, I want to receive updates via email.";
118 $default_options["custom_reg_auto_opt_outs"] = array ();
119 $default_options["custom_reg_auto_opt_out_transitions"] = "0";
120 $default_options["custom_reg_fields_4bp"] = array ();
121 $default_options["custom_reg_force_personal_emails"] = "";
122 /**/
123 $default_options["allow_subscribers_in"] = "0";
124 $default_options["force_admin_lockouts"] = "0";
125 $default_options["filter_wp_query"] = "none";
126 /**/
127 $default_options["mms_auto_patch"] = "1";
128 $default_options["mms_registration_file"] = "wp-login";
129 $default_options["mms_registration_grants"] = "none";
130 for ($n = 0, $v = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++, $v = $v + 5)
131 $default_options["mms_registration_blogs_level" . $n] = (string)$v;
132 /**/
133 $default_options["login_welcome_page"] = "";
134 $default_options["login_redirection_override"] = "";
135 $default_options["membership_options_page"] = "";
136 /**/
137 $default_options["login_reg_background_color"] = "FFFFFF";
138 $default_options["login_reg_background_image"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/bg.png";
139 $default_options["login_reg_background_image_repeat"] = "repeat";
140 /**/
141 $default_options["login_reg_background_text_color"] = "000000";
142 $default_options["login_reg_background_text_shadow_color"] = "EEEEEE";
143 $default_options["login_reg_background_box_shadow_color"] = "EEEEEE";
144 /**/
145 $default_options["login_reg_logo_src"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"] . "/images/logo.png";
146 $default_options["login_reg_logo_src_width"] = "550";
147 $default_options["login_reg_logo_src_height"] = "100";
148 $default_options["login_reg_logo_url"] = home_url ("/");
149 $default_options["login_reg_logo_title"] = get_bloginfo ("name");
150 /**/
151 $default_options["login_reg_font_size"] = "12px";
152 $default_options["login_reg_font_family"] = "'Verdana', 'Arial', sans-serif";
153 $default_options["login_reg_font_field_size"] = "18px";
154 /**/
155 $default_options["login_reg_footer_design"] = "";
156 /**/
157 $default_options["reg_email_from_name"] = get_bloginfo ("name");
158 $default_options["reg_email_from_email"] = get_bloginfo ("admin_email");
159 $default_options["reg_email_support_link"] = "mailto:" . get_bloginfo ("admin_email");
160 /**/
161 $default_options["new_user_emails_enabled"] = "0";
162 /**/
163 $default_options["new_user_email_subject"] = "[" . get_bloginfo ("name") . "] Username/Password";
164 $default_options["new_user_email_message"] = "Your Username/Password for:\n" . get_bloginfo ("name") . "\n\nUsername: %%user_login%%\nPassword: %%user_pass%%\n%%wp_login_url%%";
165 /**/
166 $default_options["new_user_admin_email_recipients"] = get_bloginfo ("admin_email");
167 $default_options["new_user_admin_email_subject"] = "[" . get_bloginfo ("name") . "] New User Registration";
168 $default_options["new_user_admin_email_message"] = "New User Registration on your site:\n" . get_bloginfo ("name") . "\n\nUser ID: %%user_id%%\nUsername: %%user_login%%\nEmail: %%user_email%%\nIP Address: %%user_ip%%";
169 /**/
170 $default_options["paypal_sandbox"] = "0";
171 $default_options["paypal_business"] = "";
172 $default_options["paypal_api_username"] = "";
173 $default_options["paypal_api_password"] = "";
174 $default_options["paypal_api_signature"] = "";
175 $default_options["paypal_identity_token"] = "";
176 $default_options["paypal_btn_encryption"] = "0";
177 /**/
178 $default_options["signup_tracking_codes"] = "";
179 $default_options["modification_tracking_codes"] = "";
180 $default_options["ccap_tracking_codes"] = "";
181 $default_options["sp_tracking_codes"] = "";
182 /**/
183 $default_options["signup_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
184 $default_options["signup_email_subject"] = "Congratulations! ( your membership has been approved )";
185 $default_options["signup_email_message"] = "Thanks %%first_name%%! Your membership has been approved.\n\nIf you haven't already done so, the next step is to Register a Username.\n\nComplete your registration here:\n%%registration_url%%\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name");
186 /**/
187 $default_options["sp_email_recipients"] = '"%%full_name%%" <%%payer_email%%>';
188 $default_options["sp_email_subject"] = "Thank You! ( instructions for access )";
189 $default_options["sp_email_message"] = "Thanks %%first_name%%!\n\n%%item_name%%\n\nYour order can be retrieved here:\n%%sp_access_url%%\n( link expires in %%sp_access_exp%% )\n\nIf you have any trouble, please feel free to contact us.\n\nBest Regards,\n" . get_bloginfo ("name");
190 /**/
191 $default_options["mailchimp_api_key"] = "";
192 /**/
193 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
194 $default_options["level" . $n . "_mailchimp_list_ids"] = "";
195 /**/
196 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
197 $default_options["level" . $n . "_aweber_list_ids"] = "";
198 /**/
199 $default_options["signup_notification_urls"] = "";
200 $default_options["registration_notification_urls"] = "";
201 $default_options["payment_notification_urls"] = "";
202 $default_options["modification_notification_urls"] = "";
203 $default_options["cancellation_notification_urls"] = "";
204 $default_options["eot_del_notification_urls"] = "";
205 $default_options["ref_rev_notification_urls"] = "";
206 $default_options["sp_sale_notification_urls"] = "";
207 $default_options["sp_ref_rev_notification_urls"] = "";
208 /**/
209 $default_options["signup_notification_recipients"] = "";
210 $default_options["registration_notification_recipients"] = "";
211 $default_options["payment_notification_recipients"] = "";
212 $default_options["modification_notification_recipients"] = "";
213 $default_options["cancellation_notification_recipients"] = "";
214 $default_options["eot_del_notification_recipients"] = "";
215 $default_options["ref_rev_notification_recipients"] = "";
216 $default_options["sp_sale_notification_recipients"] = "";
217 $default_options["sp_ref_rev_notification_recipients"] = "";
218 /**/
219 for ($n = 0, $l = array ("Free Subscriber", "Bronze Member", "Silver Member", "Gold Member", "Platinum Member"); $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
220 $default_options["level" . $n . "_label"] = (!empty ($l[$n])) ? $l[$n] : "Level " . $n . " Member";
221 /**/
222 $default_options["apply_label_translations"] = "0";
223 /**/
224 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
225 $default_options["level" . $n . "_file_downloads_allowed"] = "";
226 /**/
227 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
228 $default_options["level" . $n . "_file_downloads_allowed_days"] = "";
229 /**/
230 $default_options["file_download_limit_exceeded_page"] = "";
231 $default_options["file_download_inline_extensions"] = "";
232 /**/
233 $default_options["amazon_s3_files_bucket"] = "";
234 $default_options["amazon_s3_files_access_key"] = "";
235 $default_options["amazon_s3_files_secret_key"] = "";
236 /**/
237 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
238 $default_options["level" . $n . "_ruris"] = "";
239 /**/
240 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
241 $default_options["level" . $n . "_catgs"] = "";
242 /**/
243 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
244 $default_options["level" . $n . "_ptags"] = "";
245 /**/
246 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
247 $default_options["level" . $n . "_posts"] = "";
248 /**/
249 for ($n = 0; $n <= $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["levels"]; $n++)
250 $default_options["level" . $n . "_pages"] = "";
251 /**/
252 $default_options["specific_ids"] = "";
253 /**/
254 $default_options["triggers_immediate_eot"] = "refunds,reversals";
255 $default_options["membership_eot_behavior"] = "demote";
256 $default_options["eot_time_ext_behavior"] = "extend";
257 $default_options["auto_eot_system_enabled"] = "1";
258 /**/
259 $default_options["wp_footer_code"] = "";
260 /**/
261 $default_options = apply_filters ("ws_plugin__s2member_default_options", $default_options);
262 /**/
263 unset ($n, $v, $l); /* Unset/cleanup these working variables from the routines above. */
264 /*
265 Here they are merged. User options will overwrite some or all default values.
266 */
267 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = array_merge ($default_options, (($options !== false) ? (array)$options : (array)get_option ("ws_plugin__s2member_options")));
268 /**/
269 /* Backward compatibility for PayPal® API Credentials. Starting with v3.5+, this info is stored by the free version of s2Member. */
270 if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_username"])
271 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_username"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_username"];
272 /**/
273 if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_password"])
274 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_password"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_password"];
275 /**/
276 if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"])
277 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["paypal_api_signature"] = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["pro_paypal_api_signature"];
278 /**/
279 /* Backward compatibility for old logo image width of 500 pixels. Changed in v110604. */
280 if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src"] === $default_options["login_reg_logo_src"])
281 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_reg_logo_src_width"] = $default_options["login_reg_logo_src_width"];
282 /*
283 This builds an MD5 checksum for the full array of options. This also includes the config checksum and the current set of default options.
284 */
285 $checksum = md5 (($checksum_prefix = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["checksum"] . serialize ($default_options)) . serialize (array_merge ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"], array ("options_checksum" => 0))));
286 /*
287 Validate each option, possibly reverting back to the default value in some cases.
288 */
289 if ($options !== false || ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] !== $checksum && $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] !== $default_options))
290 {
291 foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $key => &$value)
292 {
293 if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key))
294 unset($GLOBALS["WS_PLUGIN__"]["s2member"]["o"][$key]);
295 /**/
296 else if ($key === "options_checksum" && (!is_string ($value) || !strlen ($value)))
297 $value = $default_options[$key];
298 /**/
299 else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value)))
300 $value = $default_options[$key];
301 /**/
302 else if ($key === "gateway_debug_logs" && (!is_string ($value) || !is_numeric ($value)))
303 $value = $default_options[$key];
304 /**/
305 else if ($key === "sec_encryption_key" && (!is_string ($value) || !strlen ($value)))
306 $value = $default_options[$key];
307 /**/
308 else if ($key === "sec_encryption_key_history" && (!is_array ($value) || empty ($value)))
309 $value = $default_options[$key];
310 /**/
311 else if ($key === "s_badge_status_enabled" && (!is_string ($value) || !is_numeric ($value)))
312 $value = $default_options[$key];
313 /**/
314 else if ($key === "max_ip_restriction" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
315 $value = $default_options[$key];
316 /**/
317 else if ($key === "max_ip_restriction_time" && (!is_string ($value) || !is_numeric ($value) || $value < 900 || $value > 31556926))
318 $value = $default_options[$key];
319 /**/
320 else if ($key === "max_failed_login_attempts" && (!is_string ($value) || !is_numeric ($value) || $value < 0 || $value > 100))
321 $value = $default_options[$key];
322 /**/
323 else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value)))
324 $value = $default_options[$key];
325 /**/
326 else if ($key === "custom_reg_fields" && (!is_string ($value) || !strlen ($value)))
327 $value = $default_options[$key];
328 /**/
329 else if (preg_match ("/^custom_reg_(names|password|opt_in|auto_opt_out_transitions)$/", $key) && (!is_string ($value) || !is_numeric ($value)))
330 $value = $default_options[$key];
331 /**/
332 else if ($key === "custom_reg_display_name" && (!is_string ($value) || !preg_match ("/^(full|first|last|login|0)$/", $value)))
333 $value = $default_options[$key];
334 /**/
335 else if ($key === "custom_reg_opt_in_label" && (!is_string ($value) || !strlen ($value)))
336 $value = $default_options[$key];
337 /**/
338 else if ($key === "custom_reg_auto_opt_outs" && (!is_array ($value) || empty ($value)))
339 $value = $default_options[$key];
340 /**/
341 else if ($key === "custom_reg_fields_4bp" && (!is_array ($value) || empty ($value)))
342 $value = $default_options[$key];
343 /**/
344 else if ($key === "custom_reg_force_personal_emails" && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
345 $value = $default_options[$key];
346 /**/
347 else if ($key === "allow_subscribers_in" && (!is_string ($value) || !is_numeric ($value)))
348 $value = $default_options[$key];
349 /**/
350 else if ($key === "mms_auto_patch" && (!is_string ($value) || !is_numeric ($value)))
351 $value = $default_options[$key];
352 /**/
353 else if ($key === "mms_registration_file" && (!is_string ($value) || !preg_match ("/^(wp-login|wp-signup)$/", $value)))
354 $value = $default_options[$key];
355 /**/
356 else if ($key === "mms_registration_grants" && (!is_string ($value) || !preg_match ("/^(none|user|all)$/", $value)))
357 $value = $default_options[$key];
358 /**/
359 else if (preg_match ("/^mms_registration_blogs_level[0-9]+$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
360 $value = $default_options[$key];
361 /**/
362 else if ($key === "force_admin_lockouts" && (!is_string ($value) || !is_numeric ($value)))
363 $value = $default_options[$key];
364 /**/
365 else if ($key === "filter_wp_query" && (!is_string ($value) || !preg_match ("/^(none|searches|feeds|searches,feeds|all)$/", $value)))
366 $value = $default_options[$key];
367 /**/
368 else if ($key === "login_welcome_page" && (!is_string ($value) || !is_numeric ($value)))
369 $value = $default_options[$key];
370 /**/
371 else if ($key === "login_redirection_override" && (!is_string ($value) || !strlen ($value)))
372 $value = $default_options[$key];
373 /**/
374 else if ($key === "membership_options_page" && (!is_string ($value) || !is_numeric ($value)))
375 $value = $default_options[$key];
376 /**/
377 else if ($key === "login_reg_background_image" && !is_string ($value)) /* This is optional. */
378 $value = $default_options[$key];
379 /**/
380 else if ($key === "login_reg_background_image_repeat" && (!is_string ($value) || !preg_match ("/^(repeat|repeat-x|repeat-y|no-repeat)$/", $value)))
381 $value = $default_options[$key];
382 /**/
383 else if (preg_match ("/^login_reg_(background|logo|font|footer)_/", $key) && !preg_match ("/background_image/", $key) && (!is_string ($value) || !strlen ($value)))
384 $value = $default_options[$key];
385 /**/
386 else if (preg_match ("/^reg_email_(from_name|from_email|support_link)$/", $key) && (!is_string ($value) || !strlen ($value)))
387 $value = $default_options[$key];
388 /**/
389 else if ($key === "new_user_emails_enabled" && (!is_string ($value) || !is_numeric ($value)))
390 $value = $default_options[$key];
391 /**/
392 else if (preg_match ("/^new_user_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
393 $value = $default_options[$key];
394 /**/
395 else if (preg_match ("/^new_user_admin_email_(recipients|subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
396 $value = $default_options[$key];
397 /**/
398 else if ($key === "paypal_sandbox" && (!is_string ($value) || !is_numeric ($value)))
399 $value = $default_options[$key];
400 /**/
401 else if (preg_match ("/^paypal_(business|api_username|api_password|api_signature|identity_token)$/", $key) && (!is_string ($value) || !strlen ($value)))
402 $value = $default_options[$key];
403 /**/
404 else if ($key === "paypal_btn_encryption" && (!is_string ($value) || !is_numeric ($value)))
405 $value = $default_options[$key];
406 /**/
407 else if (preg_match ("/^(signup|modification|ccap|sp)_tracking_codes$/", $key) && (!is_string ($value) || !strlen ($value)))
408 $value = $default_options[$key];
409 /**/
410 else if (preg_match ("/^(signup|sp)_email_recipients$/", $key) && !is_string ($value)) /* Can be empty. */
411 $value = $default_options[$key];
412 /**/
413 else if (preg_match ("/^(signup|sp)_email_(subject|message)$/", $key) && (!is_string ($value) || !strlen ($value)))
414 $value = $default_options[$key];
415 /**/
416 else if ($key === "mailchimp_api_key" && (!is_string ($value) || !strlen ($value)))
417 $value = $default_options[$key];
418 /**/
419 else if (preg_match ("/^level[0-9]+_mailchimp_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/[\r\n\t]+/", "", $value))))
420 $value = $default_options[$key];
421 /**/
422 else if (preg_match ("/^level[0-9]+_aweber_list_ids$/", $key) && (!is_string ($value) || !strlen ($value = preg_replace ("/\s+/", "", $value))))
423 $value = $default_options[$key];
424 /**/
425 else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_urls$/", $key) && (!is_string ($value) || !strlen ($value)))
426 $value = $default_options[$key];
427 /**/
428 else if (preg_match ("/^(signup|registration|payment|modification|cancellation|eot_del|ref_rev|sp_sale|sp_ref_rev)_notification_recipients$/", $key) && (!is_string ($value) || !strlen ($value)))
429 $value = $default_options[$key];
430 /**/
431 else if (preg_match ("/^level[0-9]+_label$/", $key) && (!is_string ($value) || !strlen ($value)))
432 $value = $default_options[$key];
433 /**/
434 else if ($key === "apply_label_translations" && (!is_string ($value) || !is_numeric ($value)))
435 $value = $default_options[$key];
436 /**/
437 else if (preg_match ("/^level[0-9]+_file_downloads_allowed$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
438 $value = $default_options[$key];
439 /**/
440 else if (preg_match ("/^level[0-9]+_file_downloads_allowed_days$/", $key) && (!is_string ($value) || !is_numeric ($value) || $value < 0))
441 $value = $default_options[$key];
442 /**/
443 else if ($key === "file_download_limit_exceeded_page" && (!is_string ($value) || !is_numeric ($value)))
444 $value = $default_options[$key];
445 /**/
446 else if ($key === "file_download_inline_extensions" && (!is_string ($value) || !($value = strtolower (preg_replace ("/\s+/", "", $value)))))
447 $value = $default_options[$key];
448 /**/
449 else if (preg_match ("/^amazon_s3_files_(bucket|access_key|secret_key)$/", $key) && (!is_string ($value) || !strlen ($value)))
450 $value = $default_options[$key];
451 /**/
452 else if (preg_match ("/^level[0-9]+_ruris$/", $key) && (!is_string ($value) || !strlen ($value)))
453 $value = $default_options[$key];
454 /**/
455 else if (preg_match ("/^level[0-9]+_catgs$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
456 $value = $default_options[$key];
457 /**/
458 else if (preg_match ("/^level[0-9]+_ptags$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/( +)/", " ", trim (preg_replace ("/( *),( *)/", ",", $value))), ",")))))
459 $value = $default_options[$key];
460 /**/
461 else if (preg_match ("/^level[0-9]+_posts$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
462 $value = $default_options[$key];
463 /**/
464 else if (preg_match ("/^level[0-9]+_pages$/", $key) && (!is_string ($value) || !($value = (($value === "all") ? $value : trim (preg_replace ("/[^0-9,]/", "", $value), ",")))))
465 $value = $default_options[$key];
466 /**/
467 else if ($key === "specific_ids" && (!is_string ($value) || !($value = trim (preg_replace ("/[^0-9,]/", "", $value), ","))))
468 $value = $default_options[$key];
469 /**/
470 else if ($key === "triggers_immediate_eot" && (!is_string ($value) || !preg_match ("/^(none|refunds|reversals|refunds,reversals)$/", $value)))
471 $value = $default_options[$key];
472 /**/
473 else if ($key === "membership_eot_behavior" && (!is_string ($value) || !preg_match ("/^(demote|delete)$/", $value)))
474 $value = $default_options[$key];
475 /**/
476 else if ($key === "eot_time_ext_behavior" && (!is_string ($value) || !preg_match ("/^(extend|reset)$/", $value)))
477 $value = $default_options[$key];
478 /**/
479 else if ($key === "auto_eot_system_enabled" && (!is_string ($value) || !is_numeric ($value)))
480 $value = $default_options[$key];
481 /**/
482 else if ($key === "wp_footer_code" && (!is_string ($value) || !strlen ($value)))
483 $value = $default_options[$key];
484 }
485 /**/
486 if ($options !== false && is_string ($options["sec_encryption_key"]) && strlen ($options["sec_encryption_key"]) && !in_array ($options["sec_encryption_key"], $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"]))
487 {
488 array_unshift ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], $options["sec_encryption_key"]);
489 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"] = array_slice ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["sec_encryption_key_history"], 0, 10);
490 }
491 /**/
492 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"] = apply_filters_ref_array ("ws_plugin__s2member_options_before_checksum", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
493 /**/
494 $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["options_checksum"] = md5 ($checksum_prefix . serialize (array_merge ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"], array ("options_checksum" => 0))));
495 }
496 /**/
497 return apply_filters_ref_array ("ws_plugin__s2member_options", array (&$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]));
498 }
499 }
500 ?>