hideSubmitButton( true ); } /** * Save on form submit */ private function maybeCleanDatabase() { // Check if the form is posted and the nonce is valid if ( ( isset( $_POST['doi-clean-submit'] ) || isset( $_POST['doi-clean-confirmed-submit'] ) || isset( $_POST['doi-clean-unconfirmed-submit'] ) ) ) { $CleanUp = new CleanUp(); if ( isset( $_POST['doi-clean-submit'] ) || isset( $_POST['doi-clean-confirmed-submit'] ) ) { $CleanUp->removeConfirmedOptins( true ); } if ( isset( $_POST['doi-clean-submit'] ) || isset( $_POST['doi-clean-unconfirmed-submit'] ) ) { $CleanUp->removeUnconfirmedOptins( true ); } Messages::getInstance()->add( __( 'Database cleaned.', 'double-opt-in' ), 'success' ); } } /** * Reset the database deleting all entries. */ private function maybeResetDatabase() { // Check if the form is posted and the nonce is valid if ( isset( $_POST['doi-reset-submit'] ) ) { $CleanUp = new CleanUp(); $CleanUp->reset(); Messages::getInstance()->add( __( 'Database reset finished.', 'double-opt-in' ), 'success' ); } } /** * Render the license subpage content */ protected function theContent( $slug, $page, $settings ) { ?>

maybeCleanDatabase(); // Check if the user wants to reset the database manually $this->maybeResetDatabase(); return $settings; } } }