| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Bit Form |
| 5 |
* Plugin URI: bitpress.pro |
| 6 |
* Description: Wordpress form builder plugin |
| 7 |
* Version: 1.1 |
| 8 |
* Author: BitPress |
| 9 |
* Author URI: https://www.bitpress.pro |
| 10 |
* Text Domain: bitform |
| 11 |
* Domain Path: /languages |
| 12 |
* License: GPLv2 or later |
| 13 |
*/ |
| 14 |
|
| 15 |
/*** |
| 16 |
* If try to direct access plugin folder it will Exit |
| 17 |
**/ |
| 18 |
if (!defined('ABSPATH')) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
// Define most essential constants. |
| 24 |
define('BITFORMS_VERSION', '1.1'); |
| 25 |
define('BITFORMS_PLUGIN_MAIN_FILE', __FILE__); |
| 26 |
|
| 27 |
global $bitforms_db_version; |
| 28 |
$bitforms_db_version = '1.2'; |
| 29 |
|
| 30 |
/** |
| 31 |
* Handles plugin activation. |
| 32 |
* |
| 33 |
* Throws an error if the plugin is activated on an older version than PHP 5.4. |
| 34 |
*/ |
| 35 |
function bitforms_activate_plugin($network_wide) |
| 36 |
{ |
| 37 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) { |
| 38 |
wp_die( |
| 39 |
esc_html__('bitforms requires PHP version 5.4.', 'bitform'), |
| 40 |
esc_html__('Error Activating', 'bitform') |
| 41 |
); |
| 42 |
} |
| 43 |
|
| 44 |
do_action('bitforms_activation', $network_wide); |
| 45 |
} |
| 46 |
|
| 47 |
register_activation_hook(__FILE__, 'bitforms_activate_plugin'); |
| 48 |
|
| 49 |
/** |
| 50 |
* Handles plugin deactivation. |
| 51 |
*/ |
| 52 |
function bitforms_deactivate_plugin($network_wide) |
| 53 |
{ |
| 54 |
if (version_compare(PHP_VERSION, '5.4.0', '<')) { |
| 55 |
return; |
| 56 |
} |
| 57 |
|
| 58 |
do_action('bitforms_deactivation', $network_wide); |
| 59 |
} |
| 60 |
|
| 61 |
register_deactivation_hook(__FILE__, 'bitforms_deactivate_plugin'); |
| 62 |
|
| 63 |
/** |
| 64 |
* Handles plugin uninstall. |
| 65 |
* |
| 66 |
* @access private |
| 67 |
*/ |
| 68 |
function bitforms_uninstall_plugin() |
| 69 |
{ |
| 70 |
if (version_compare(PHP_VERSION, '5.6.0', '<')) { |
| 71 |
return; |
| 72 |
} |
| 73 |
|
| 74 |
do_action('bitforms_uninstall'); |
| 75 |
} |
| 76 |
register_uninstall_hook(__FILE__, 'bitforms_uninstall_plugin'); |
| 77 |
|
| 78 |
if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
| 79 |
require_once plugin_dir_path(__FILE__) . 'includes/loader.php'; |
| 80 |
} |
| 81 |
function bitform_delete_plugin_database_tables() |
| 82 |
{ |
| 83 |
global $wpdb; |
| 84 |
$tableArray = [ |
| 85 |
$wpdb->prefix . "bitforms_email_template", |
| 86 |
$wpdb->prefix . "bitforms_form", |
| 87 |
$wpdb->prefix . "bitforms_form_entries", |
| 88 |
$wpdb->prefix . "bitforms_form_entrymeta", |
| 89 |
$wpdb->prefix . "bitforms_form_entry_log", |
| 90 |
$wpdb->prefix . "bitforms_form_entry_relatedinfo", |
| 91 |
$wpdb->prefix . "bitforms_form_log_details", |
| 92 |
$wpdb->prefix . "bitforms_integration", |
| 93 |
$wpdb->prefix . "bitforms_reports", |
| 94 |
$wpdb->prefix . "bitforms_success_messages", |
| 95 |
$wpdb->prefix . "bitforms_workflows", |
| 96 |
|
| 97 |
]; |
| 98 |
|
| 99 |
foreach ($tableArray as $tablename) { |
| 100 |
$wpdb->query("DROP TABLE IF EXISTS $tablename"); |
| 101 |
} |
| 102 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}options` WHERE option_name LIKE '%bitforms%'"); |
| 103 |
} |
| 104 |
|
| 105 |
register_uninstall_hook(__FILE__, 'bitform_delete_plugin_database_tables'); |
| 106 |
|