admin_url( 'admin-ajax.php' ), 'action' => self::AJAX, 'nonce' => wp_create_nonce( self::NONCE ), 'plugin' => plugin_basename( AIOU_FILE ), 'choice' => 'delete' === get_option( self::OPTION ) ? 'delete' : 'keep', 'forced' => defined( 'AIOU_UNINSTALL_DELETE_DATA' ) && AIOU_UNINSTALL_DELETE_DATA, 'i18n' => array( 'title' => __( 'Deactivate All-in-One Utilities', 'all-in-one-utilities' ), 'intro' => __( 'Deactivating keeps everything. If you delete the plugin later, what should happen to its settings and data?', 'all-in-one-utilities' ), 'keep' => __( 'Keep my settings and data', 'all-in-one-utilities' ), 'keepHelp' => __( 'Your settings, Email Log and login history stay in the database even after you delete the plugin. Install it again and everything is as you left it.', 'all-in-one-utilities' ), 'delete' => __( 'Delete all settings and data', 'all-in-one-utilities' ), 'deleteHelp' => __( 'When you delete the plugin, every setting (including those add-ons save on its tabs), the Email Log, login history, lockouts and everything else it stored is removed. This can\'t be undone.', 'all-in-one-utilities' ), 'untouched' => __( 'Your posts, pages, media and users are never touched.', 'all-in-one-utilities' ), 'forced' => __( 'AIOU_UNINSTALL_DELETE_DATA is set in wp-config.php, so all settings and data will be deleted.', 'all-in-one-utilities' ), 'cancel' => __( 'Cancel', 'all-in-one-utilities' ), 'confirmKeep' => __( 'Deactivate', 'all-in-one-utilities' ), 'confirmAll' => __( 'Deactivate', 'all-in-one-utilities' ), 'saving' => __( 'Saving your choice…', 'all-in-one-utilities' ), 'failed' => __( 'Your choice could not be saved, so the plugin is still active. Reload the page and try again.', 'all-in-one-utilities' ), ), ) ); } /** * AJAX: save the answer. * * @return void */ public static function save(): void { check_ajax_referer( self::NONCE ); if ( ! current_user_can( 'delete_plugins' ) ) { wp_send_json_error( null, 403 ); } $choice = isset( $_POST['choice'] ) && 'delete' === sanitize_key( wp_unslash( $_POST['choice'] ) ) ? 'delete' : 'keep'; update_option( self::OPTION, $choice, false ); wp_send_json_success( array( 'choice' => $choice ) ); } }