PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 1.9
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v1.9
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Core / Util / Uninstallation.php

Uninstallation.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 1.9, at includes/Core/Util/Uninstallation.php

59 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace BitCode\BitForm\Core\Util;
3
4 /**
5 * Class handling plugin uninstallation.
6 *
7 * @since 1.0.0
8 * @access private
9 * @ignore
10 */
11 final class Uninstallation {
12 /**
13 * Registers functionality through WordPress hooks.
14 *
15 * @since 1.0.0
16 */
17 public function register() {
18 add_action( 'bitforms_uninstall', [$this, 'uninstall'] );
19 }
20
21 public function uninstall() {
22 flush_rewrite_rules();
23 $routes = get_option( 'bitforms_routes' );
24 if ( $routes && isset( $routes['root'] ) ) {
25 $this->deletePosts( $routes['root'] );
26 $this->deletePosts( $routes['file'] );
27 $this->deleteOptions( 'bitforms_routes' );
28 }
29 global $wpdb;
30 $tableArray = [
31 $wpdb->prefix . "bitforms_email_template",
32 $wpdb->prefix . "bitforms_form",
33 $wpdb->prefix . "bitforms_form_entries",
34 $wpdb->prefix . "bitforms_form_entrymeta",
35 $wpdb->prefix . "bitforms_form_entry_log",
36 $wpdb->prefix . "bitforms_form_log_details",
37 $wpdb->prefix . "bitforms_integration",
38 $wpdb->prefix . "bitforms_reports",
39 $wpdb->prefix . "bitforms_success_messages",
40 $wpdb->prefix . "bitforms_workflows",
41 $wpdb->prefix . "bitforms_form_entry_relatedinfo",
42 ];
43
44 foreach ( $tableArray as $tablename ) {
45 $wpdb->query( "DROP TABLE IF EXISTS $tablename" );
46 }
47
48 $columns = ["bitforms_db_version", "bitforms_installed", "bitforms_version", "bitforms_routes", "bitform_secret_api_key"];
49
50 foreach ( $columns as $column ) {
51 delete_option( $column );
52 }
53
54 }
55 private function deletePosts( $id ) {
56 wp_delete_post( $id );
57 }
58 }
59