| @@ -1,14 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: Bit Form |
| 5 | - * Plugin URI: bitpress.pro | |
| 6 | - * Description: Wordpress form builder plugin | |
| 7 | - * Version: 1.2 | |
| 8 | - * Author: BitPress | |
| 9 | - * Author URI: https://www.bitpress.pro | |
| 10 | - * Text Domain: bitform | |
| 5 | + * Plugin URI: https://www.bitapps.pro/bit-form | |
| 6 | + * Description: Contact Form Builder: Multi Step Contact form, Payment form, WPForm Calculator form, Registration Form & WP Forms with form integrations | |
| 7 | + * Version: 2.7.0 | |
| 8 | + * Author: Contact Form Builder Plugin - WPForm by Bit Form | |
| 9 | + * Author URI: https://www.bitapps.pro | |
| 10 | + * Text Domain: bit-form | |
| 11 | + * Requires PHP: 5.6 | |
| 11 | 12 | * Domain Path: /languages |
| 12 | 13 | * License: GPLv2 or later |
| 13 | 14 | */ |
| 14 | 15 | |
| @@ -15,34 +16,54 @@ | ||
| 15 | 16 | /*** |
| 16 | 17 | * If try to direct access plugin folder it will Exit |
| 17 | 18 | **/ |
| 18 | 19 | if (!defined('ABSPATH')) { |
| 19 | - exit; | |
| 20 | + exit; | |
| 20 | 21 | } |
| 21 | 22 | |
| 22 | - | |
| 23 | 23 | // Define most essential constants. |
| 24 | -define('BITFORMS_VERSION', '1.2'); | |
| 24 | +define('BITFORMS_VERSION', '2.7.0'); | |
| 25 | 25 | define('BITFORMS_PLUGIN_MAIN_FILE', __FILE__); |
| 26 | 26 | |
| 27 | 27 | global $bitforms_db_version; |
| 28 | -$bitforms_db_version = '1.2'; | |
| 28 | +$bitforms_db_version = '2.2'; | |
| 29 | 29 | |
| 30 | +if (version_compare(PHP_VERSION, '5.6.0', '>=')) { | |
| 31 | + $rootVersionFolder = ''; | |
| 32 | + $olderVersion = get_option('bitforms_version'); | |
| 33 | + if ('2.0-beta.1' === $olderVersion) { | |
| 34 | + update_option('bitforms_migrated_to_v2', true); | |
| 35 | + update_option('bitforms_migrating_to_v2', false); | |
| 36 | + } | |
| 37 | + $isMigratedToV2 = get_option('bitforms_migrated_to_v2'); | |
| 38 | + $isMigratingToV2 = get_option('bitforms_migrating_to_v2'); | |
| 39 | + | |
| 40 | + if (!$isMigratingToV2 && !$isMigratedToV2) { | |
| 41 | + global $wpdb; | |
| 42 | + $oldForms = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}bitforms_form"); | |
| 43 | + if (count($oldForms) > 0) { | |
| 44 | + $rootVersionFolder = 'v1/'; | |
| 45 | + } else { | |
| 46 | + update_option('bitforms_migrated_to_v2', true); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + require_once plugin_dir_path(__FILE__) . $rootVersionFolder . 'includes/loader.php'; | |
| 50 | +} | |
| 30 | 51 | /** |
| 31 | 52 | * Handles plugin activation. |
| 32 | 53 | * |
| 33 | - * Throws an error if the plugin is activated on an older version than PHP 5.4. | |
| 54 | + * Throws an error if the plugin is activated on an older version than PHP 5.6. | |
| 34 | 55 | */ |
| 35 | 56 | function bitforms_activate_plugin($network_wide) |
| 36 | 57 | { |
| 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 | - } | |
| 58 | + if (version_compare(PHP_VERSION, '5.6.0', '<')) { | |
| 59 | + wp_die( | |
| 60 | + esc_html__('bitforms requires PHP version 5.6.', 'bit-form'), | |
| 61 | + esc_html__('Error Activating', 'bit-form') | |
| 62 | + ); | |
| 63 | + } | |
| 43 | 64 | |
| 44 | - do_action('bitforms_activation', $network_wide); | |
| 65 | + do_action('bitforms_activation', $network_wide); | |
| 45 | 66 | } |
| 46 | 67 | |
| 47 | 68 | register_activation_hook(__FILE__, 'bitforms_activate_plugin'); |
| 48 | 69 | |
| @@ -50,13 +71,13 @@ | ||
| 50 | 71 | * Handles plugin deactivation. |
| 51 | 72 | */ |
| 52 | 73 | function bitforms_deactivate_plugin($network_wide) |
| 53 | 74 | { |
| 54 | - if (version_compare(PHP_VERSION, '5.4.0', '<')) { | |
| 55 | - return; | |
| 56 | - } | |
| 75 | + if (version_compare(PHP_VERSION, '5.6.0', '<')) { | |
| 76 | + return; | |
| 77 | + } | |
| 57 | 78 | |
| 58 | - do_action('bitforms_deactivation', $network_wide); | |
| 79 | + do_action('bitforms_deactivation', $network_wide); | |
| 59 | 80 | } |
| 60 | 81 | |
| 61 | 82 | register_deactivation_hook(__FILE__, 'bitforms_deactivate_plugin'); |
| 62 | 83 | |
| @@ -66,40 +87,11 @@ | ||
| 66 | 87 | * @access private |
| 67 | 88 | */ |
| 68 | 89 | function bitforms_uninstall_plugin() |
| 69 | 90 | { |
| 70 | - if (version_compare(PHP_VERSION, '5.6.0', '<')) { | |
| 71 | - return; | |
| 72 | - } | |
| 91 | + if (version_compare(PHP_VERSION, '5.6.0', '<')) { | |
| 92 | + return; | |
| 93 | + } | |
| 73 | 94 | |
| 74 | - do_action('bitforms_uninstall'); | |
| 95 | + do_action('bitforms_uninstall'); | |
| 75 | 96 | } |
| 76 | 97 | 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'); | |