| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: HTML Forms |
| 4 | -Plugin URI: https://htmlformsplugin.com/ | |
| 5 | -Description: A simpler, faster, and smarter WordPress forms plugin. | |
| 6 | -Version: 1.6.5 | |
| 7 | -Author: HTML Forms | |
| 8 | -Author URI: https://htmlformsplugin.com/ | |
| 4 | +Plugin URI: https://htmlformsplus.com/#utm_source=wp-plugin&utm_medium=html-forms&utm_campaign=plugins-page | |
| 5 | +Description: Not just another forms plugin. Simple and flexible. | |
| 6 | +Version: 1.1 | |
| 7 | +Author: ibericode | |
| 8 | +Author URI: https://ibericode.com/ | |
| 9 | 9 | License: GPL v3 |
| 10 | 10 | Text Domain: html-forms |
| 11 | 11 | |
| 12 | -HTML Forms | |
| 13 | -Copyright (C) 2017-2024, Link Software LLC <support@linksoftwarellc.com> | |
| 12 | +HTML Forms Plus | |
| 13 | +Copyright (C) 2017, Danny van Kooten, danny@ibericode.com | |
| 14 | 14 | |
| 15 | 15 | This program is free software: you can redistribute it and/or modify |
| 16 | 16 | it under the terms of the GNU General Public License as published by |
| 17 | 17 | the Free Software Foundation, either version 3 of the License, or |
| @@ -27,58 +27,52 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | namespace HTML_Forms; |
| 30 | 30 | |
| 31 | +use wpdb; | |
| 32 | + | |
| 31 | 33 | function _bootstrap() { |
| 34 | + load_plugin_textdomain( 'html-forms', '', dirname( __FILE__ ) . '/languages' ); | |
| 35 | + | |
| 32 | 36 | $settings = hf_get_settings(); |
| 33 | 37 | |
| 34 | 38 | $forms = new Forms( __FILE__, $settings ); |
| 35 | 39 | $forms->hook(); |
| 36 | 40 | |
| 41 | + // hook actions | |
| 42 | + $email_action = new Actions\Email(); | |
| 43 | + $email_action->hook(); | |
| 44 | + | |
| 37 | 45 | if( is_admin() ) { |
| 38 | - if( ! \defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { | |
| 46 | + if( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { | |
| 39 | 47 | $admin = new Admin\Admin( __FILE__ ); |
| 40 | 48 | $admin->hook(); |
| 41 | 49 | } |
| 50 | + } | |
| 51 | +} | |
| 42 | 52 | |
| 43 | - $gdpr = new Admin\GDPR(); | |
| 44 | - $gdpr->hook(); | |
| 53 | +function _install() { | |
| 54 | + /** @var wpdb */ | |
| 55 | + global $wpdb; | |
| 45 | 56 | |
| 46 | - if( function_exists('hcaptcha') ) { | |
| 47 | - $hcaptcha = new Admin\Hcaptcha(); | |
| 48 | - $hcaptcha->hook(); | |
| 49 | - } | |
| 50 | - } | |
| 57 | + $table = $wpdb->prefix . 'hf_submissions'; | |
| 51 | 58 | |
| 52 | - // Initialize Google reCAPTCHA v3 (needs to run on both frontend and backend) | |
| 53 | - if( \class_exists( 'HTML_Forms\Admin\Recaptcha' ) ) { | |
| 54 | - $recaptcha = new Admin\Recaptcha(); | |
| 55 | - $recaptcha->hook(); | |
| 56 | - } | |
| 57 | -} | |
| 59 | + $wpdb->query("CREATE TABLE IF NOT EXISTS {$table}( | |
| 60 | + `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
| 61 | + `form_id` INT UNSIGNED NOT NULL, | |
| 62 | + `data` TEXT NOT NULL, | |
| 63 | + `user_agent` TEXT NULL, | |
| 64 | + `ip_address` VARCHAR(255) NULL, | |
| 65 | + `referer_url` VARCHAR(255) NULL, | |
| 66 | + `submitted_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | |
| 67 | +);"); | |
| 58 | 68 | |
| 59 | -function _hf_actions() { | |
| 60 | - $email_action = new Actions\Email(); | |
| 61 | - $email_action->hook(); | |
| 62 | - | |
| 63 | - if( \class_exists( 'MC4WP_MailChimp' ) ) { | |
| 64 | - $mailchimp_action = new Actions\MailChimp(); | |
| 65 | - $mailchimp_action->hook(); | |
| 66 | - } | |
| 67 | 69 | } |
| 68 | 70 | |
| 69 | -define('HTML_FORMS_VERSION', '1.6.5'); | |
| 71 | +define( 'HTML_FORMS_VERSION', '1.1' ); | |
| 70 | 72 | |
| 71 | 73 | if( ! function_exists( 'hf_get_form' ) ) { |
| 72 | 74 | require __DIR__ . '/vendor/autoload.php'; |
| 73 | 75 | } |
| 74 | 76 | |
| 77 | +register_activation_hook( __FILE__, 'HTML_Forms\\_install'); | |
| 75 | 78 | add_action( 'plugins_loaded', 'HTML_Forms\\_bootstrap', 10 ); |
| 76 | -add_action( 'init', 'HTML_Forms\\_hf_actions', 10 ); | |
| 77 | - | |
| 78 | -register_activation_hook( __FILE__, '_hf_on_plugin_activation'); | |
| 79 | - | |
| 80 | -// add cap to site admin after being added to blog | |
| 81 | -add_action('add_user_to_blog', '_hf_on_add_user_to_blog', 10, 3); | |
| 82 | - | |
| 83 | -// install db table for newly added sites | |
| 84 | -add_action('wp_insert_site', '_hf_on_wp_insert_site'); | |