PluginProbe
Hash Form – Drag & Drop Form Builder / 1.4.3
Hash Form – Drag & Drop Form Builder v1.4.3
1.4.4 1.4.3 1.4.2 1.4.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.6.1 1.2.7 1.2.8 1.2.9 1.3.0 All 47 releases
hash-form / hash-form.php

hash-form.php in Hash Form – Drag & Drop Form Builder 1.4.3, at hash-form.php

136 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Plugin Name: Hash Form - Drag & Drop Form Builder
5 * Description: Design, Embed, Connect: Your Ultimate Form Companion for WordPress
6 * Version: 1.4.3
7 * Author: HashThemes
8 * Author URI: https://hashthemes.com/
9 * Text Domain: hash-form
10 * License: GPL-2.0+
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 * Domain Path: /languages
13 */
14
15
16 defined('ABSPATH') || die();
17
18 define('HASHFORM_VERSION', '1.4.3');
19 define('HASHFORM_FILE', __FILE__);
20 define('HASHFORM_PATH', plugin_dir_path(HASHFORM_FILE));
21 define('HASHFORM_URL', plugin_dir_url(HASHFORM_FILE));
22 define('HASHFORM_UPLOAD_DIR', '/hashform');
23
24 require HASHFORM_PATH . 'admin/classes/HashFormCapabilities.php';
25 require HASHFORM_PATH . 'admin/classes/HashFormSerializedStrParser.php';
26 require HASHFORM_PATH . 'admin/classes/HashFormStrReader.php';
27 require HASHFORM_PATH . 'admin/classes/HashFormBlock.php';
28 require HASHFORM_PATH . 'admin/classes/HashFormUploader.php';
29 require HASHFORM_PATH . 'admin/classes/HashFormCreateTable.php';
30 require HASHFORM_PATH . 'admin/classes/HashFormMigrations.php';
31 require HASHFORM_PATH . 'admin/classes/HashFormCron.php';
32 // Must load before the classes that compose it.
33 require HASHFORM_PATH . 'admin/classes/HashFormListActions.php';
34 require HASHFORM_PATH . 'admin/classes/HashFormBuilder.php';
35 require HASHFORM_PATH . 'admin/classes/HashFormHelper.php';
36 require HASHFORM_PATH . 'admin/classes/HashFormFields.php';
37 require HASHFORM_PATH . 'admin/classes/HashFormFieldIcons.php';
38 require HASHFORM_PATH . 'admin/classes/HashFormLoader.php';
39 require HASHFORM_PATH . 'admin/classes/HashFormSmtp.php';
40 require HASHFORM_PATH . 'admin/classes/HashFormEntry.php';
41 require HASHFORM_PATH . 'admin/classes/HashFormImportExport.php';
42 require HASHFORM_PATH . 'admin/classes/HashFormListing.php';
43 require HASHFORM_PATH . 'admin/classes/HashFormEntryListing.php';
44 require HASHFORM_PATH . 'admin/classes/HashFormValidate.php';
45 require HASHFORM_PATH . 'admin/classes/HashFormRestrictions.php';
46 require HASHFORM_PATH . 'admin/classes/HashFormPreview.php';
47 require HASHFORM_PATH . 'admin/classes/HashFormShortcode.php';
48 require HASHFORM_PATH . 'admin/classes/HashFormSettings.php';
49 require HASHFORM_PATH . 'admin/classes/HashFormStyles.php';
50 require HASHFORM_PATH . 'admin/classes/HashFormGridHelper.php';
51 require HASHFORM_PATH . 'admin/classes/HashFormEmail.php';
52 require HASHFORM_PATH . 'admin/classes/HashFormPrivacy.php';
53
54 /**
55 * Bring the schema up to date after a plugin update, not just on activation.
56 */
57 add_action('plugins_loaded', array('HashFormCreateTable', 'maybe_upgrade'));
58
59 /**
60 * Register widget.
61 */
62 add_action('elementor/widgets/register', 'hashform_elementor_widget_register');
63
64 function hashform_elementor_widget_register($widgets_manager) {
65 require HASHFORM_PATH . 'admin/classes/HashFormElement.php';
66 $widgets_manager->register(new \HashFormElement());
67 }
68
69 /**
70 * Plugin Activation.
71 */
72 register_activation_hook(HASHFORM_FILE, 'hashform_network_create_table');
73
74 function hashform_network_create_table($network_wide) {
75 global $wpdb;
76
77 if (is_multisite() && $network_wide) {
78 // Get all blogs in the network and activate plugin on each one
79 $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
80 foreach ($blog_ids as $blog_id) {
81 switch_to_blog($blog_id);
82 $db = new HashFormCreateTable();
83 $db->upgrade();
84 restore_current_blog();
85 }
86 } else {
87 $db = new HashFormCreateTable();
88 $db->upgrade();
89 }
90 }
91
92 /**
93 * Plugin Deactivation.
94 *
95 * A scheduled event that outlives the plugin keeps firing against a hook
96 * nothing answers, so the event goes when the plugin does.
97 */
98 register_deactivation_hook(HASHFORM_FILE, 'hashform_on_deactivate');
99
100 function hashform_on_deactivate() {
101 if (class_exists('HashFormCron')) {
102 HashFormCron::unschedule();
103 }
104 }
105
106 /**
107 * Create form tables on multisite creation.
108 */
109 add_action('wp_insert_site', 'hashform_on_create_blog');
110
111 function hashform_on_create_blog($data) {
112 if (is_plugin_active_for_network('hash-form/hash-form.php')) {
113 switch_to_blog($data->blog_id);
114 $db = new HashFormCreateTable();
115 $db->upgrade();
116 restore_current_blog();
117 }
118 }
119
120 /**
121 * Drop form tables on multisite deletion.
122 */
123 add_filter('wpmu_drop_tables', 'hashform_on_delete_blog');
124
125 function hashform_on_delete_blog($tables) {
126 global $wpdb;
127 $id = HashFormHelper::get_request('id');
128
129 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_fields';
130 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_forms';
131 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_entries';
132 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_entry_meta';
133
134 return $tables;
135 }
136