| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | 3 | Plugin Name: HTML Forms |
| 4 | -Plugin URI: https://www.htmlforms.io/#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.3.12 | |
| 7 | -Author: ibericode | |
| 8 | -Author URI: https://ibericode.com/ | |
| 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/ | |
| 9 | 9 | License: GPL v3 |
| 10 | 10 | Text Domain: html-forms |
| 11 | 11 | |
| 12 | -HTML Forms | |
| 13 | -Copyright (C) 2017-2019, Danny van Kooten, danny@ibericode.com | |
| 12 | +HTML Forms | |
| 13 | +Copyright (C) 2017-2024, Link Software LLC <support@linksoftwarellc.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,29 +27,16 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | namespace HTML_Forms; |
| 30 | 30 | |
| 31 | -use wpdb; | |
| 32 | - | |
| 33 | 31 | function _bootstrap() { |
| 34 | - load_plugin_textdomain( 'html-forms', '', dirname( __FILE__ ) . '/languages' ); | |
| 35 | - | |
| 36 | 32 | $settings = hf_get_settings(); |
| 37 | 33 | |
| 38 | 34 | $forms = new Forms( __FILE__, $settings ); |
| 39 | 35 | $forms->hook(); |
| 40 | 36 | |
| 41 | - // hook actions | |
| 42 | - $email_action = new Actions\Email(); | |
| 43 | - $email_action->hook(); | |
| 44 | - | |
| 45 | - if( class_exists( 'MC4WP_MailChimp' ) ) { | |
| 46 | - $mailchimp_action = new Actions\MailChimp(); | |
| 47 | - $mailchimp_action->hook(); | |
| 48 | - } | |
| 49 | - | |
| 50 | 37 | if( is_admin() ) { |
| 51 | - if( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { | |
| 38 | + if( ! \defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { | |
| 52 | 39 | $admin = new Admin\Admin( __FILE__ ); |
| 53 | 40 | $admin->hook(); |
| 54 | 41 | } |
| 55 | 42 | |
| @@ -54,37 +41,44 @@ | ||
| 54 | 41 | } |
| 55 | 42 | |
| 56 | 43 | $gdpr = new Admin\GDPR(); |
| 57 | 44 | $gdpr->hook(); |
| 45 | + | |
| 46 | + if( function_exists('hcaptcha') ) { | |
| 47 | + $hcaptcha = new Admin\Hcaptcha(); | |
| 48 | + $hcaptcha->hook(); | |
| 49 | + } | |
| 58 | 50 | } |
| 51 | + | |
| 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 | + } | |
| 59 | 57 | } |
| 60 | 58 | |
| 61 | -function _install() { | |
| 62 | - /** @var wpdb */ | |
| 63 | - global $wpdb; | |
| 59 | +function _hf_actions() { | |
| 60 | + $email_action = new Actions\Email(); | |
| 61 | + $email_action->hook(); | |
| 64 | 62 | |
| 65 | - // create table for storing submissions | |
| 66 | - $table = $wpdb->prefix . 'hf_submissions'; | |
| 67 | - $wpdb->query("CREATE TABLE IF NOT EXISTS {$table}( | |
| 68 | - `id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
| 69 | - `form_id` INT UNSIGNED NOT NULL, | |
| 70 | - `data` TEXT NOT NULL, | |
| 71 | - `user_agent` TEXT NULL, | |
| 72 | - `ip_address` VARCHAR(255) NULL, | |
| 73 | - `referer_url` VARCHAR(255) NULL, | |
| 74 | - `submitted_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP | |
| 75 | -);"); | |
| 76 | - | |
| 77 | - // add "edit_forms" cap to user that activated the plugin | |
| 78 | - $user = wp_get_current_user(); | |
| 79 | - $user->add_cap('edit_forms', true); | |
| 63 | + if( \class_exists( 'MC4WP_MailChimp' ) ) { | |
| 64 | + $mailchimp_action = new Actions\MailChimp(); | |
| 65 | + $mailchimp_action->hook(); | |
| 66 | + } | |
| 80 | 67 | } |
| 81 | 68 | |
| 82 | -define('HTML_FORMS_VERSION', '1.3.12'); | |
| 69 | +define('HTML_FORMS_VERSION', '1.6.5'); | |
| 83 | 70 | |
| 84 | 71 | if( ! function_exists( 'hf_get_form' ) ) { |
| 85 | 72 | require __DIR__ . '/vendor/autoload.php'; |
| 86 | 73 | } |
| 87 | 74 | |
| 88 | -register_activation_hook( __FILE__, 'HTML_Forms\\_install'); | |
| 89 | 75 | add_action( 'plugins_loaded', 'HTML_Forms\\_bootstrap', 10 ); |
| 76 | +add_action( 'init', 'HTML_Forms\\_hf_actions', 10 ); | |
| 90 | 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'); | |