diff --git a/plugins/xtxpatch/html/admin_menu.html b/plugins/xtxpatch/html/admin_menu.html index a8f295c..f337e4f 100644 --- a/plugins/xtxpatch/html/admin_menu.html +++ b/plugins/xtxpatch/html/admin_menu.html @@ -34,16 +34,16 @@
- /> + />
- /> + />
---> diff --git a/plugins/xtxpatch/php/classes/plgntls_class.php b/plugins/xtxpatch/php/classes/plgntls_class.php index 0d6887b..f285edf 100644 --- a/plugins/xtxpatch/php/classes/plgntls_class.php +++ b/plugins/xtxpatch/php/classes/plgntls_class.php @@ -329,7 +329,6 @@ class Plgntls_xtx { $function = $trace[1]['function']; $file = $trace[0]['file']; $line = $trace[0]['line']; - error_log("-debug: function '".$function."' (in ".$file.", line ".$line .')'); } @@ -1086,7 +1085,6 @@ class Plgntls_xtx { * */ $option_data = get_option($option_name); -error_log("get option safe: " . json_encode($option_data)); $false_serialized = serialize(false); $option_unserialized = @unserialize($option_data); if ($option_unserialized === false && $option_data != $false_serialized) { @@ -1096,12 +1094,10 @@ error_log("get option safe: " . json_encode($option_data)); $ret_option = $option_unserialized; } -error_log("get option safe: " . json_encode($ret_option)); return $ret_option; } public static function update_option_safe($option, $option_data) { -error_log("- inside update option safe"); /* * first init option, in case it was not already * it will returns the option name or false @@ -1112,12 +1108,10 @@ error_log("- inside update option safe"); if (false === $option_name) { return; } -error_log("update option safe: " . json_encode($option_data)); if (!is_string($option_data)) { $option_data = serialize($option_data); } -error_log("update option safe: " . json_encode($option_data)); update_option($option_name, $option_data); } diff --git a/plugins/xtxpatch/php/classes/xtxpatch_class.php b/plugins/xtxpatch/php/classes/xtxpatch_class.php index 2c3e23a..e997430 100644 --- a/plugins/xtxpatch/php/classes/xtxpatch_class.php +++ b/plugins/xtxpatch/php/classes/xtxpatch_class.php @@ -18,6 +18,7 @@ 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 0755b1c..28ef171 100644 --- a/plugins/xtxpatch/php/menu/admin_menu.php +++ b/plugins/xtxpatch/php/menu/admin_menu.php @@ -46,6 +46,42 @@ function menu_content() { +function define_register_email($request, $option_name, $option_value, $option_default) { + /* + * email + * + */ + $email = ''; + if (isset($request['email'])) { + $email = $request['email']; + } + + /* + * is email ? + * + */ + $is_email_prof = false; + if (isset($request['is_email_prof']) && $request['is_email_prof'] === 'on') { + $is_email_prof = true; + } + $is_email_partner = false; + if (isset($request['is_email_partner']) && $request['is_email_partner'] === 'on') { + $is_email_partner = true; + } + + + /* + * update the option with new values + * + */ + $option_data = array( + 'email' => $email, + 'is_email_prof' => $is_email_prof, + 'is_email_partner' => $is_email_partner, + ); + \Plgntls_xtx::update_option_safe($option_name, $option_data); +} +