getAllintegrations(); if ($allIntegrations) { wp_send_json_success($allIntegrations, 200); } else { wp_send_json_error( __('No Integration Found', 'bitform'), 404 ); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function templates() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $templateProvider = new TemplateProvider(); $status = $templateProvider->getAllTemplates(); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getTemplate() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getTemplate($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getAllForms() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $formHandler = FormHandler::getInstance(); $all_forms = $formHandler->admin->getAllForm(); if (is_wp_error($all_forms)) { wp_send_json_error($all_forms->get_error_message(), 411); } else { wp_send_json_success($all_forms, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function importDataStore() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); echo json_encode($input); die; // $formHandler = FormHandler::getInstance(); // $status = $formHandler->admin->getFormEntryLabelAndCount($_REQUEST, $input); // if (is_wp_error($status)) { // wp_send_json_error($status->get_error_message(), 411); // } else { // wp_send_json_success($status, 200); // } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getFormEntryLabelAndCount() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getFormEntryLabelAndCount($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getFormEntry() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getFormEntry($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error(__('Token expired', 'bitform'), 401); } } public function filterExportEntry() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = true; $status = $formHandler->admin->getExportEntry($input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error(__('Token expired', 'bitform'), 401); } } /** * Undocumented function * * @return void */ public function updateForm() { \ignore_user_abort(); if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->updateForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function createNewForm() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->createNewForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function changeFormStatus() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->changeFormStatus($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function changeBulkFormStatus() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->changeBulkFormStatus($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getAForm() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getAForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function duplicateAForm() { \ignore_user_abort(); if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->duplicateAForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteAForm() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteAForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteBlukForm() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteBlukForm($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteBlukFormEntries() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteBlukFormEntries($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function duplicateFormEntry() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->duplicateFormEntry($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function editFormEntry() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->editFormEntry($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getLogHistory() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getLogHistory($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function updateFormEntry() { \ignore_user_abort(); if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->updateFormEntry($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getAllWPPages() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->getAllWPPages($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteSuccessMessage() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteSuccessMessage($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteAIntegration() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteAIntegration($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteAWorkflow() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteAWorkflow($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function deleteAMailTemplate() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->deleteAMailTemplate($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function duplicateAMailTemplate() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->duplicateAMailTemplate($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function setAllFormsReport() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->setAllFormsReport($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function savegReCaptcha() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); $formHandler = FormHandler::getInstance(); $status = $formHandler->admin->savegReCaptcha($_REQUEST, $input); if (is_wp_error($status)) { wp_send_json_error($status->get_error_message(), 411); } else { wp_send_json_success($status, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function saveApiKey() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $inputJSON = file_get_contents('php://input'); $input = json_decode($inputJSON); if (empty($input->api_key)) { $api_key = get_option('bitform_secret_api_key'); } else if (!empty($input->api_key)) { update_option('bitform_secret_api_key', hash('sha1', base64_encode($input->api_key))); $api_key = get_option('bitform_secret_api_key'); } if ($api_key == false) { $api_key = hash('sha1', base64_encode(12345)); update_option('bitform_secret_api_key', $api_key); wp_send_json_success($api_key, 200); } else { wp_send_json_success($api_key, 200); } } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } public function getPostType() { if (wp_verify_nonce(sanitize_text_field($_REQUEST['_ajax_nonce']), 'bitforms_save')) { $post_types = get_post_types(array( 'public' => TRUE, 'capability_type' => 'post', )); $array = array_keys($post_types); wp_send_json_success($array, 200); } else { wp_send_json_error( __( 'Token expired', 'bitform' ), 401 ); } } }