function cptch_settings() { global $cptch_options, $cptch_plugin_info, $cptch_option_defaults; $cptch_option_defaults = array('plugin_option_version' => $cptch_plugin_info["Version"], 'cptch_str_key' => array('time' => '', 'key' => ''), 'cptch_login_form' => '1', 'cptch_register_form' => '1', 'cptch_lost_password_form' => '1', 'cptch_comments_form' => '1', 'cptch_hide_register' => '1', 'cptch_contact_form' => '0', 'cptch_math_action_plus' => '1', 'cptch_math_action_minus' => '1', 'cptch_math_action_increase' => '1', 'cptch_label_form' => '', 'cptch_required_symbol' => '*', 'cptch_error_empty_value' => __('Please enter a CAPTCHA value.', 'captcha'), 'cptch_error_incorrect_value' => __('Please enter a valid CAPTCHA value.', 'captcha'), 'cptch_difficulty_number' => '1', 'cptch_difficulty_word' => '1'); /* Install the option defaults */ if (!get_option('cptch_options')) { add_option('cptch_options', $cptch_option_defaults); } /* Get options from the database */ $cptch_options = get_option('cptch_options'); /* Array merge incase this version has added new options */ if (!isset($cptch_options['plugin_option_version']) || $cptch_options['plugin_option_version'] != $cptch_plugin_info["Version"]) { cptch_create_table(); $cptch_options = array_merge($cptch_option_defaults, $cptch_options); $cptch_options['plugin_option_version'] = $cptch_plugin_info["Version"]; update_option('cptch_options', $cptch_options); } }
function cptch_settings() { global $cptch_options, $cptch_plugin_info, $cptch_option_defaults, $wpdb; $db_version = '1.2'; $cptch_option_defaults = array('plugin_option_version' => $cptch_plugin_info["Version"], 'plugin_db_version' => $db_version, 'cptch_str_key' => array('time' => '', 'key' => ''), 'cptch_login_form' => '1', 'cptch_register_form' => '1', 'cptch_lost_password_form' => '1', 'cptch_comments_form' => '1', 'cptch_hide_register' => '1', 'cptch_contact_form' => '0', 'cptch_math_action_plus' => '1', 'cptch_math_action_minus' => '1', 'cptch_math_action_increase' => '1', 'cptch_label_form' => '', 'cptch_required_symbol' => '*', 'cptch_error_empty_value' => __('Please enter a CAPTCHA value.', 'captcha'), 'cptch_error_incorrect_value' => __('Please enter a valid CAPTCHA value.', 'captcha'), 'cptch_error_time_limit' => __('Time limit is exhausted. Please enter CAPTCHA value again.', 'captcha'), 'whitelist_message' => __('You are in the white list', 'captcha'), 'cptch_difficulty_number' => '1', 'cptch_difficulty_word' => '1', 'cptch_difficulty_image' => '0', 'first_install' => strtotime("now"), 'display_settings_notice' => 1, 'display_notice_about_images' => 1, 'use_limit_attempts_whitelist' => 0, 'display_reload_button' => 1, 'used_packages' => array(), 'enlarge_images' => 0, 'whitelist_is_empty' => true, 'use_time_limit' => 1, 'time_limit' => 120); /* Install the option defaults */ if (!get_option('cptch_options')) { add_option('cptch_options', $cptch_option_defaults); } /* Get options from the database */ $cptch_options = get_option('cptch_options'); /* Array merge incase this version has added new options */ if (!isset($cptch_options['plugin_option_version']) || $cptch_options['plugin_option_version'] != $cptch_plugin_info["Version"]) { $cptch_option_defaults['display_settings_notice'] = 0; $cptch_option_defaults['display_notice_about_images'] = 0; if (!isset($cptch_option_defaults['cptch_difficulty_image'])) { $cptch_option_defaults['cptch_difficulty_image'] = 0; } $cptch_options = array_merge($cptch_option_defaults, $cptch_options); $cptch_options['hide_premium_options'] = 0; $cptch_options['plugin_option_version'] = $cptch_plugin_info["Version"]; $update_option = true; } /* Update tables when update plugin and tables changes*/ if (!isset($cptch_options['plugin_db_version']) || $cptch_options['plugin_db_version'] != $db_version) { cptch_create_table(); if (!class_exists('Cptch_package_loader')) { require_once dirname(__FILE__) . '/includes/package_loader.php'; } $package_loader = new Cptch_package_loader(); $package_loader->parse_packages(dirname(__FILE__) . '/images/package'); if (!is_null($wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}cptch_whitelist` LIMIT 1"))) { $cptch_options['whitelist_is_empty'] = false; } /* update DB version */ $cptch_options['plugin_db_version'] = $db_version; $update_option = true; } if (isset($update_option)) { update_option('cptch_options', $cptch_options); } }
function cptch_settings() { global $cptch_options, $cptch_plugin_info, $cptch_option_defaults; $db_version = '1.1'; $cptch_option_defaults = array('plugin_option_version' => $cptch_plugin_info["Version"], 'cptch_str_key' => array('time' => '', 'key' => ''), 'cptch_login_form' => '1', 'cptch_register_form' => '1', 'cptch_lost_password_form' => '1', 'cptch_comments_form' => '1', 'cptch_hide_register' => '1', 'cptch_contact_form' => '0', 'cptch_math_action_plus' => '1', 'cptch_math_action_minus' => '1', 'cptch_math_action_increase' => '1', 'cptch_label_form' => '', 'cptch_required_symbol' => '*', 'cptch_error_empty_value' => __('Please enter a CAPTCHA value.', 'captcha'), 'cptch_error_incorrect_value' => __('Please enter a valid CAPTCHA value.', 'captcha'), 'cptch_difficulty_number' => '1', 'cptch_difficulty_word' => '1', 'first_install' => strtotime("now"), 'display_settings_notice' => 1, 'whitelist_message' => __('You are in the white list', 'captcha')); /* Install the option defaults */ if (!get_option('cptch_options')) { add_option('cptch_options', $cptch_option_defaults); } /* Get options from the database */ $cptch_options = get_option('cptch_options'); /* Array merge incase this version has added new options */ if (!isset($cptch_options['plugin_option_version']) || $cptch_options['plugin_option_version'] != $cptch_plugin_info["Version"]) { $cptch_option_defaults['display_settings_notice'] = 0; $cptch_options = array_merge($cptch_option_defaults, $cptch_options); $cptch_options['plugin_option_version'] = $cptch_plugin_info["Version"]; $update_option = true; } /* Update tables when update plugin and tables changes*/ if (!isset($cptch_options['plugin_db_version']) || $cptch_options['plugin_db_version'] != $db_version) { cptch_create_table(); /* update DB version */ $cptch_options['plugin_db_version'] = $db_version; $update_option = true; } if (isset($update_option)) { update_option('cptch_options', $cptch_options); } }