diff --git a/plugins/xtxpatch/php/classes/plgntls_class.php b/plugins/xtxpatch/php/classes/plgntls_class.php index 65f6a4f..d10e46d 100644 --- a/plugins/xtxpatch/php/classes/plgntls_class.php +++ b/plugins/xtxpatch/php/classes/plgntls_class.php @@ -1076,11 +1076,26 @@ class Plgntls_xtx { return; } + /* + * get option + * try to unserialize it + * if unserialization failed, it means it was not serialized + * - unserialize returns false if cannot unserialize, + * - which can also means it unserialized successfully the value 'false' + * - so checking for this special case with the serialized value of 'false' + * + */ $option_data = get_option($option_name); - if (!is_string($option_data)) { - $option_data = serialize($option_data); + $false_serialized = serialize(false); + $option_unserialized = @unserialize($option_data); + if ($option_unserialized === false && $option_data != $false_serialized) { + $ret_option = $option_data; } - return $option_data; + else { + $ret_option = $options_unserialized; + } + + return $ret_option; } public static function update_option_safe($option, $option_data) { diff --git a/plugins/xtxpatch/php/classes/xtxpatch_class.php b/plugins/xtxpatch/php/classes/xtxpatch_class.php index e997430..2c3e23a 100644 --- a/plugins/xtxpatch/php/classes/xtxpatch_class.php +++ b/plugins/xtxpatch/php/classes/xtxpatch_class.php @@ -18,7 +18,6 @@ if (!defined('ABSPATH')) { class Xtxpatch { const OPTION_REGISTER_EMAIL = [ '_name'=>'define_email_at_register_xtxpatch', - '_callback'=>__NAMESPACE__.'\define_register_email', '_default'=>[ 'email'=> 'Bonjour, diff --git a/plugins/xtxpatch/php/menu/admin_menu.php b/plugins/xtxpatch/php/menu/admin_menu.php index 6937538..0755b1c 100644 --- a/plugins/xtxpatch/php/menu/admin_menu.php +++ b/plugins/xtxpatch/php/menu/admin_menu.php @@ -46,38 +46,6 @@ function menu_content() { -function define_register_email($request, $option_name, $option_value) { - /* - * email - * - */ - $email = ''; - if (isset($request['email'])) { - $option_value['email'] = $request['email']; - } - - /* - * is email ? - * - $is_email_prof = false; - if (isset($post['is_email_prof']) && $post['is_email_prof'] === 'on') { - $is_email_prof = true; - } - $is_email_partner = false; - if (isset($post['is_email_partner']) && $post['is_email_partner'] === 'on') { - $is_email_partner = true; - } - */ - - - /* - * update the option with new values - * - */ -// Plgntls_xtx::update_option_safe($option_name, $email); - -} -