| @@ -131,14 +131,26 @@ | ||
| 131 | 131 | $default_options['gateway_debug_logs'] = '0'; |
| 132 | 132 | $default_options['gateway_debug_logs_extensive'] = '0'; |
| 133 | 133 | |
| 134 | 134 | $default_options['lazy_load_css_js'] = '0'; |
| 135 | + $default_options['static_css'] = '0'; //260903.0612 Generated static CSS delivery remains opt-in while frontend asset generation is beta. | |
| 136 | + $default_options['static_css_minify'] = '0'; //260902.2107 Static CSS minification is independently opt-in while generated asset delivery is beta. | |
| 137 | + $default_options['static_js'] = '0'; //260903.0437 Static frontend JavaScript delivery remains opt-in while generated assets are beta. | |
| 138 | + $default_options['static_js_text'] = 'static'; //260906.2049 Keep JavaScript text in cacheable static files by default; multilingual sites can load it with each WordPress page instead. | |
| 139 | + $default_options['static_js_minify'] = '0'; //260903.0437 Static JavaScript minification is independently opt-in and uses readable source files. | |
| 140 | + $default_options['static_assets_combine'] = '0'; //260903.1918 Keep Framework/Pro generated files separate by default; combining is an explicit request-reduction optimization. | |
| 141 | + $default_options['asset_health_wait_seconds'] = '3'; //260912.0522 Wait briefly after page load before treating an asset that cannot be confirmed active as Late. | |
| 142 | + //260904.1923 Keep the repaired s2Member Dynamic Loader as the default; WordPress routing is an explicit compatibility option. | |
| 143 | + $default_options['dynamic_asset_loader'] = 's2o'; //260910.0724 In current terminology, that established default is the s2Member-Only Dynamic Loader served by s2member-o.php. | |
| 135 | 144 | $default_options['no_cache_headers_mode'] = 'always'; //260308 No-cache headers mode: `always`, `selective`, `evaluative`. |
| 136 | 145 | $default_options['no_cache_headers_debug'] = '0'; //260308 Adds Server-Timing no-cache debug header (support use only). |
| 137 | 146 | $default_options['sc_conds_allow_arbitrary_php'] = '0'; |
| 138 | 147 | $default_options['sc_conds_whitelist'] = ''; |
| 139 | - $default_options['sc_s2get_userid_whitelist'] = ''; //260322 Comma-delimited s2Get user_field values allowed to use user_id="". | |
| 140 | 148 | |
| 149 | + //260812 New shared whitelist; keep the old s2Get option synchronized temporarily for rollback compatibility. | |
| 150 | + $default_options['sc_user_fields_whitelist'] = ''; | |
| 151 | + $default_options['sc_s2get_userid_whitelist'] = ''; | |
| 152 | + | |
| 141 | 153 | $default_options['sec_encryption_key'] = ''; |
| 142 | 154 | $default_options['sec_encryption_key_history'] = array(); |
| 143 | 155 | |
| 144 | 156 | $default_options['def_combo_encryption_key'] = ''; |
| @@ -144,8 +156,13 @@ | ||
| 144 | 156 | $default_options['def_combo_encryption_key'] = ''; |
| 145 | 157 | $default_options['def_combo_encryption_key_history'] = array(); |
| 146 | 158 | $default_options['def_custom_combo_encryption_keys'] = array(); |
| 147 | 159 | |
| 160 | + //260809 Store new Defuse key mappings by one-way hashes instead of raw secret keys. | |
| 161 | + $default_options['secret_key_to_defuse_key'] = array(); | |
| 162 | + $default_options['secret_key_to_defuse_key_history'] = array(); | |
| 163 | + $default_options['custom_secret_key_to_defuse_key'] = array(); | |
| 164 | + | |
| 148 | 165 | $default_options['s_badge_status_enabled'] = '0'; |
| 149 | 166 | |
| 150 | 167 | $default_options['max_ip_restriction'] = '5'; |
| 151 | 168 | $default_options['max_ip_restriction_time'] = '3600'; |
| @@ -167,10 +184,11 @@ | ||
| 167 | 184 | |
| 168 | 185 | $default_options['custom_reg_auto_opt_outs'] = array(); |
| 169 | 186 | $default_options['custom_reg_auto_opt_out_transitions'] = '0'; |
| 170 | 187 | |
| 171 | - $default_options['custom_reg_fields_4bp'] = array(); | |
| 172 | - $default_options['custom_reg_force_personal_emails'] = ''; | |
| 188 | + $default_options['custom_reg_fields_4bp'] = array(); | |
| 189 | + $default_options['custom_reg_force_personal_emails'] = ''; | |
| 190 | + $default_options['custom_reg_require_valid_email_domain'] = '0'; //261005.0548 Opt-in DNS mail-domain validation during account creation and s2Member Profile email changes. | |
| 173 | 191 | |
| 174 | 192 | $default_options['allow_subscribers_in'] = '0'; |
| 175 | 193 | $default_options['force_admin_lockouts'] = '0'; |
| 176 | 194 | $default_options['filter_wp_query'] = array('all'); |
| @@ -365,14 +383,18 @@ | ||
| 365 | 383 | $default_options['level'.$n.'_pages'] = ''; |
| 366 | 384 | |
| 367 | 385 | $default_options['specific_ids'] = ''; |
| 368 | 386 | |
| 369 | - $default_options['triggers_immediate_eot'] = 'reversals'; | |
| 370 | - $default_options['membership_eot_behavior'] = 'demote'; | |
| 371 | - $default_options['eot_time_ext_behavior'] = 'extend'; | |
| 372 | - $default_options['auto_eot_system_enabled'] = '1'; | |
| 373 | - $default_options['eots_remove_ccaps'] = '1'; | |
| 374 | - $default_options['eot_grace_time'] = '86400'; | |
| 387 | + $default_options['triggers_immediate_eot'] = 'reversals'; | |
| 388 | + $default_options['membership_eot_behavior'] = 'demote'; | |
| 389 | + $default_options['eot_demotion_to_role'] = 'subscriber'; | |
| 390 | + $default_options['eot_demotion_from'] = 'all'; //260916.2137 Missing options must preserve legacy behavior until a fresh activation explicitly stores the new Level-only default. | |
| 391 | + $default_options['eot_time_ext_behavior'] = 'extend'; | |
| 392 | + $default_options['auto_eot_system_enabled'] = '1'; | |
| 393 | + $default_options['auto_eot_system_runtime_mode'] = 'auto'; | |
| 394 | + $default_options['auto_eot_system_runtime_custom'] = '30'; | |
| 395 | + $default_options['eots_remove_ccaps'] = '1'; | |
| 396 | + $default_options['eot_grace_time'] = '86400'; | |
| 375 | 397 | |
| 376 | 398 | $default_options['wp_footer_code'] = ''; |
| 377 | 399 | |
| 378 | 400 | $default_options = apply_filters('ws_plugin__s2member_default_options', $default_options); |
| @@ -380,9 +402,21 @@ | ||
| 380 | 402 | unset($n, $v, $l); // Unset/cleanup these working variables from the routines above. |
| 381 | 403 | /* |
| 382 | 404 | Here they are merged. User options will overwrite some or all default values. |
| 383 | 405 | */ |
| 384 | - $GLOBALS['WS_PLUGIN__']['s2member']['o'] = array_merge($default_options, (($options !== FALSE) ? (array)$options : (array)get_option('ws_plugin__s2member_options'))); | |
| 406 | + $_stored_options = (($options !== FALSE) ? (array)$options : (array)get_option('ws_plugin__s2member_options')); | |
| 407 | + $GLOBALS['WS_PLUGIN__']['s2member']['o'] = array_merge($default_options, $_stored_options); | |
| 408 | + | |
| 409 | + //260812 Keep both whitelist option names synchronized, with the legacy value taking precedence after a rollback. | |
| 410 | + if(isset($_stored_options['sc_s2get_userid_whitelist']) && is_string($_stored_options['sc_s2get_userid_whitelist'])) | |
| 411 | + { | |
| 412 | + if(!array_key_exists('sc_user_fields_whitelist', $_stored_options) || $GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_user_fields_whitelist'] !== $_stored_options['sc_s2get_userid_whitelist']) | |
| 413 | + $GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_user_fields_whitelist'] = $_stored_options['sc_s2get_userid_whitelist']; | |
| 414 | + } | |
| 415 | + else if(isset($_stored_options['sc_user_fields_whitelist']) && is_string($_stored_options['sc_user_fields_whitelist'])) | |
| 416 | + $GLOBALS['WS_PLUGIN__']['s2member']['o']['sc_s2get_userid_whitelist'] = $_stored_options['sc_user_fields_whitelist']; | |
| 417 | + unset($_stored_options); | |
| 418 | + | |
| 385 | 419 | /* |
| 386 | 420 | * Ditch this old option key; no longer in use. |
| 387 | 421 | */ |
| 388 | 422 | if(isset($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_deactivation_routines'])) unset($GLOBALS['WS_PLUGIN__']['s2member']['o']['run_deactivation_routines']); |
| @@ -411,8 +445,16 @@ | ||
| 411 | 445 | |
| 412 | 446 | else if($key === 'lazy_load_css_js' && (!is_string($value) || !is_numeric($value))) |
| 413 | 447 | $value = $default_options[$key]; |
| 414 | 448 | |
| 449 | + else if(preg_match('/^static_(?:css|js)(?:_minify)?$/', $key) && (!is_string($value) || !is_numeric($value))) //260903.0437 | |
| 450 | + $value = $default_options[$key]; | |
| 451 | + | |
| 452 | + //260912.0522 Keep the operator-facing wait bounded so an accidental value cannot effectively disable health checking. | |
| 453 | + //260911.0010 Here, bounded means the explicit 1–60-second range exposed by the setting. | |
| 454 | + else if($key === 'asset_health_wait_seconds') | |
| 455 | + $value = (!is_string($value) || !is_numeric($value) || (int)$value < 1 || (int)$value > 60) ? $default_options[$key] : (string)(int)$value; | |
| 456 | + | |
| 415 | 457 | else if($key === 'no_cache_headers_mode' && (!is_string($value) || !in_array($value, array('always', 'selective', 'evaluative'), TRUE))) |
| 416 | 458 | $value = $default_options[$key]; |
| 417 | 459 | |
| 418 | 460 | else if($key === 'no_cache_headers_debug' && (!is_string($value) || !is_numeric($value))) |
| @@ -422,8 +464,10 @@ | ||
| 422 | 464 | $value = $default_options[$key]; |
| 423 | 465 | |
| 424 | 466 | else if($key === 'sc_s2get_userid_whitelist' && !is_string($value)) //260324 |
| 425 | 467 | $value = $default_options[$key]; |
| 468 | + else if($key === 'sc_user_fields_whitelist' && !is_string($value)) //260812 | |
| 469 | + $value = $default_options[$key]; | |
| 426 | 470 | |
| 427 | 471 | else if($key === 'sec_encryption_key' && (!is_string($value) || !strlen($value))) |
| 428 | 472 | $value = $default_options[$key]; |
| 429 | 473 | |
| @@ -438,8 +482,12 @@ | ||
| 438 | 482 | |
| 439 | 483 | else if($key === 'def_custom_combo_encryption_keys' && (!is_array($value) || empty($value))) |
| 440 | 484 | $value = $default_options[$key]; |
| 441 | 485 | |
| 486 | + //260809 Validate the hashed Defuse key mappings independently of the legacy options. | |
| 487 | + else if(preg_match('/^(?:secret_key_to_defuse_key|secret_key_to_defuse_key_history|custom_secret_key_to_defuse_key)$/', $key) && (!is_array($value) || empty($value))) | |
| 488 | + $value = $default_options[$key]; | |
| 489 | + | |
| 442 | 490 | else if($key === 's_badge_status_enabled' && (!is_string($value) || !is_numeric($value))) |
| 443 | 491 | $value = $default_options[$key]; |
| 444 | 492 | |
| 445 | 493 | else if($key === 'max_ip_restriction' && (!is_string($value) || !is_numeric($value) || $value < 0 || $value > 100)) |
| @@ -462,9 +510,9 @@ | ||
| 462 | 510 | |
| 463 | 511 | else if($key === 'custom_reg_fields' && (!is_string($value) || !strlen($value))) |
| 464 | 512 | $value = $default_options[$key]; |
| 465 | 513 | |
| 466 | - else if(preg_match('/^custom_reg_(?:names|password|password_min_length|opt_in|auto_opt_out_transitions)$/', $key) && (!is_string($value) || !is_numeric($value))) | |
| 514 | + else if(preg_match('/^custom_reg_(?:names|password|password_min_length|opt_in|auto_opt_out_transitions|require_valid_email_domain)$/', $key) && (!is_string($value) || !is_numeric($value))) | |
| 467 | 515 | $value = $default_options[$key]; |
| 468 | 516 | |
| 469 | 517 | else if($key === 'custom_reg_password_min_strength' && (!is_string($value) || !strlen($value))) |
| 470 | 518 | $value = $default_options[$key]; |
| @@ -648,11 +696,24 @@ | ||
| 648 | 696 | |
| 649 | 697 | else if($key === 'membership_eot_behavior' && (!is_string($value) || !preg_match('/^(?:demote|delete)$/', $value))) |
| 650 | 698 | $value = $default_options[$key]; |
| 651 | 699 | |
| 700 | + //260916.2306 Keep bootstrap validation side-effect free; role existence is checked later when the EOT demotion role is resolved, after s2Member is fully loaded. | |
| 701 | + else if($key === 'eot_demotion_to_role' && (!is_string($value) || !$value || in_array($value, array('administrator', 'editor', 'author', 'contributor', 's2member_pending_deletion'), TRUE))) | |
| 702 | + $value = $default_options[$key]; | |
| 703 | + | |
| 704 | + else if($key === 'eot_demotion_from' && (!is_string($value) || !preg_match('/^(?:s2member_level|all)$/', $value))) | |
| 705 | + $value = $default_options[$key]; | |
| 706 | + | |
| 652 | 707 | else if($key === 'eot_time_ext_behavior' && (!is_string($value) || !preg_match('/^(?:extend|reset)$/', $value))) |
| 653 | 708 | $value = $default_options[$key]; |
| 654 | 709 | |
| 710 | + else if($key === 'auto_eot_system_runtime_mode' && (!is_string($value) || !preg_match('/^(?:auto|custom)$/', $value))) | |
| 711 | + $value = $default_options[$key]; | |
| 712 | + | |
| 713 | + else if($key === 'auto_eot_system_runtime_custom' && (!is_string($value) || !is_numeric($value) || (float)$value < 1 || (float)$value > 3600)) | |
| 714 | + $value = $default_options[$key]; | |
| 715 | + | |
| 655 | 716 | else if(preg_match('/^(?:auto_eot_system_enabled|eot_grace_time|eots_remove_ccaps)$/', $key) && (!is_string($value) || !is_numeric($value))) |
| 656 | 717 | $value = $default_options[$key]; |
| 657 | 718 | |
| 658 | 719 | else if($key === 'wp_footer_code' && (!is_string($value) || !strlen($value))) |
| @@ -664,8 +725,13 @@ | ||
| 664 | 725 | } |
| 665 | 726 | if($options !== FALSE && is_string($options['def_combo_encryption_key']) && strlen($options['def_combo_encryption_key']) && !in_array($options['def_combo_encryption_key'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'])) { |
| 666 | 727 | array_unshift($GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'], $options['def_combo_encryption_key']); |
| 667 | 728 | $GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'] = array_slice($GLOBALS['WS_PLUGIN__']['s2member']['o']['def_combo_encryption_key_history'], 0, 10); |
| 729 | + } | |
| 730 | + //260809 Keep a recovery-only history of default hashed Defuse key mappings. | |
| 731 | + if($options !== FALSE && is_array($options['secret_key_to_defuse_key']) && !empty($options['secret_key_to_defuse_key']) && !in_array($options['secret_key_to_defuse_key'], $GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], TRUE)) { | |
| 732 | + array_unshift($GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], $options['secret_key_to_defuse_key']); | |
| 733 | + $GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'] = array_slice($GLOBALS['WS_PLUGIN__']['s2member']['o']['secret_key_to_defuse_key_history'], 0, 10); | |
| 668 | 734 | } |
| 669 | 735 | $GLOBALS['WS_PLUGIN__']['s2member']['o'] = apply_filters_ref_array('ws_plugin__s2member_options_before_checksum', array(&$GLOBALS['WS_PLUGIN__']['s2member']['o'])); |
| 670 | 736 | |
| 671 | 737 | $GLOBALS['WS_PLUGIN__']['s2member']['o']['options_checksum'] = md5($checksum_prefix.serialize(array_merge($GLOBALS['WS_PLUGIN__']['s2member']['o'], array('options_checksum' => 0)))); |