| 1 |
<?php |
| 2 |
/* |
| 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.15 |
| 7 |
Author: ibericode |
| 8 |
Author URI: https://ibericode.com/ |
| 9 |
License: GPL v3 |
| 10 |
Text Domain: html-forms |
| 11 |
|
| 12 |
HTML Forms |
| 13 |
Copyright (C) 2017-2020, Danny van Kooten, danny@ibericode.com |
| 14 |
|
| 15 |
This program is free software: you can redistribute it and/or modify |
| 16 |
it under the terms of the GNU General Public License as published by |
| 17 |
the Free Software Foundation, either version 3 of the License, or |
| 18 |
(at your option) any later version. |
| 19 |
|
| 20 |
This program is distributed in the hope that it will be useful, |
| 21 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 |
GNU General Public License for more details. |
| 24 |
|
| 25 |
You should have received a copy of the GNU General Public License |
| 26 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 27 |
*/ |
| 28 |
|
| 29 |
namespace HTML_Forms; |
| 30 |
|
| 31 |
use wpdb; |
| 32 |
|
| 33 |
function _bootstrap() { |
| 34 |
$settings = hf_get_settings(); |
| 35 |
|
| 36 |
$forms = new Forms( __FILE__, $settings ); |
| 37 |
$forms->hook(); |
| 38 |
|
| 39 |
// hook actions |
| 40 |
$email_action = new Actions\Email(); |
| 41 |
$email_action->hook(); |
| 42 |
|
| 43 |
if( class_exists( 'MC4WP_MailChimp' ) ) { |
| 44 |
$mailchimp_action = new Actions\MailChimp(); |
| 45 |
$mailchimp_action->hook(); |
| 46 |
} |
| 47 |
|
| 48 |
if( is_admin() ) { |
| 49 |
if( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { |
| 50 |
$admin = new Admin\Admin( __FILE__ ); |
| 51 |
$admin->hook(); |
| 52 |
} |
| 53 |
|
| 54 |
$gdpr = new Admin\GDPR(); |
| 55 |
$gdpr->hook(); |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
function _install() { |
| 60 |
/** @var wpdb */ |
| 61 |
global $wpdb; |
| 62 |
|
| 63 |
// create table for storing submissions |
| 64 |
$table = $wpdb->prefix . 'hf_submissions'; |
| 65 |
$wpdb->query("CREATE TABLE IF NOT EXISTS {$table}( |
| 66 |
`id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, |
| 67 |
`form_id` INT UNSIGNED NOT NULL, |
| 68 |
`data` TEXT NOT NULL, |
| 69 |
`user_agent` TEXT NULL, |
| 70 |
`ip_address` VARCHAR(255) NULL, |
| 71 |
`referer_url` VARCHAR(255) NULL, |
| 72 |
`submitted_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP |
| 73 |
) ENGINE=INNODB CHARACTER SET={$wpdb->charset};"); |
| 74 |
|
| 75 |
// add "edit_forms" cap to user that activated the plugin |
| 76 |
$user = wp_get_current_user(); |
| 77 |
$user->add_cap('edit_forms', true); |
| 78 |
} |
| 79 |
|
| 80 |
define('HTML_FORMS_VERSION', '1.3.15'); |
| 81 |
|
| 82 |
if( ! function_exists( 'hf_get_form' ) ) { |
| 83 |
require __DIR__ . '/vendor/autoload.php'; |
| 84 |
} |
| 85 |
|
| 86 |
register_activation_hook( __FILE__, 'HTML_Forms\\_install'); |
| 87 |
add_action( 'plugins_loaded', 'HTML_Forms\\_bootstrap', 10 ); |
| 88 |
|
| 89 |
|