PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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 2.0, at includes/Core/Util/Uninstallation.php

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