public function save_excluded_contexts() { $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : ''; $is_valid = wp_verify_nonce($nonce, 'wpml-st-cancel-button'); if ($is_valid) { $settings = array(); if (isset($_POST[self::SETTING_KEY]) && is_array($_POST[self::SETTING_KEY])) { $settings = array_map('stripslashes', $_POST[self::SETTING_KEY]); } $this->settings->update_setting(self::SETTING_KEY, $settings, true); wp_send_json_success(); } else { wp_send_json_error(__('Nonce value is invalid', 'wpml-string-translation')); } }
public function reset() { $this->settings->delete_settings(); // remove tables at the end to avoid errors in ST due to last actions invoked by hooks add_action('shutdown', array($this, 'remove_db_tables'), PHP_INT_MAX - 1); }