PluginProbe
Hash Form – Drag & Drop Form Builder / trunk
Hash Form – Drag & Drop Form Builder vtrunk
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 trunk, at hash-form.php

145 lines 5.0 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.4
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.4');
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 . 'includes/HashFormCapabilities.php';
25 require HASHFORM_PATH . 'includes/HashFormSerializedStrParser.php';
26 require HASHFORM_PATH . 'includes/HashFormStrReader.php';
27 require HASHFORM_PATH . 'includes/HashFormBlock.php';
28 require HASHFORM_PATH . 'includes/HashFormUploader.php';
29 require HASHFORM_PATH . 'includes/HashFormCreateTable.php';
30 require HASHFORM_PATH . 'includes/HashFormMigrations.php';
31 require HASHFORM_PATH . 'includes/HashFormCron.php';
32 // Must load before the classes that compose it.
33 require HASHFORM_PATH . 'includes/HashFormListActions.php';
34 require HASHFORM_PATH . 'includes/HashFormBuilder.php';
35 require HASHFORM_PATH . 'includes/HashFormHelper.php';
36 require HASHFORM_PATH . 'includes/HashFormFields.php';
37 require HASHFORM_PATH . 'includes/HashFormFieldIcons.php';
38 require HASHFORM_PATH . 'includes/HashFormLoader.php';
39 require HASHFORM_PATH . 'includes/HashFormSmtp.php';
40 require HASHFORM_PATH . 'includes/HashFormEntry.php';
41 require HASHFORM_PATH . 'includes/HashFormImportExport.php';
42 require HASHFORM_PATH . 'includes/HashFormListing.php';
43 require HASHFORM_PATH . 'includes/HashFormEntryListing.php';
44 require HASHFORM_PATH . 'includes/HashFormValidate.php';
45 require HASHFORM_PATH . 'includes/HashFormRestrictions.php';
46 require HASHFORM_PATH . 'includes/HashFormPreview.php';
47 require HASHFORM_PATH . 'includes/HashFormShortcode.php';
48 require HASHFORM_PATH . 'includes/HashFormSettings.php';
49 require HASHFORM_PATH . 'includes/HashFormStyles.php';
50 require HASHFORM_PATH . 'includes/HashFormStyleBuilder.php';
51 require HASHFORM_PATH . 'includes/HashFormGridHelper.php';
52 require HASHFORM_PATH . 'includes/HashFormEmail.php';
53 require HASHFORM_PATH . 'includes/HashFormPrivacy.php';
54
55 /**
56 * Bring the schema up to date after a plugin update, not just on activation.
57 */
58 add_action('plugins_loaded', array('HashFormCreateTable', 'maybe_upgrade'));
59
60 /**
61 * Register widget.
62 */
63 add_action('elementor/widgets/register', 'hashform_elementor_widget_register');
64
65 function hashform_elementor_widget_register($widgets_manager) {
66 // require_once, because this hook can fire more than once in a request -
67 // the editor re-registers widgets, and other plugins trigger it. A plain
68 // require made the second pass a fatal: "Cannot declare class".
69 require_once HASHFORM_PATH . 'includes/HashFormElement.php';
70
71 $widgets_manager->register(new \HashFormElement());
72
73 // The same widget under the name it had before, so pages already built with
74 // it keep rendering. Hidden from the panel.
75 $widgets_manager->register(new \HashFormElementLegacy());
76 }
77
78 /**
79 * Plugin Activation.
80 */
81 register_activation_hook(HASHFORM_FILE, 'hashform_network_create_table');
82
83 function hashform_network_create_table($network_wide) {
84 global $wpdb;
85
86 if (is_multisite() && $network_wide) {
87 // Get all blogs in the network and activate plugin on each one
88 $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
89 foreach ($blog_ids as $blog_id) {
90 switch_to_blog($blog_id);
91 $db = new HashFormCreateTable();
92 $db->upgrade();
93 restore_current_blog();
94 }
95 } else {
96 $db = new HashFormCreateTable();
97 $db->upgrade();
98 }
99 }
100
101 /**
102 * Plugin Deactivation.
103 *
104 * A scheduled event that outlives the plugin keeps firing against a hook
105 * nothing answers, so the event goes when the plugin does.
106 */
107 register_deactivation_hook(HASHFORM_FILE, 'hashform_on_deactivate');
108
109 function hashform_on_deactivate() {
110 if (class_exists('HashFormCron')) {
111 HashFormCron::unschedule();
112 }
113 }
114
115 /**
116 * Create form tables on multisite creation.
117 */
118 add_action('wp_insert_site', 'hashform_on_create_blog');
119
120 function hashform_on_create_blog($data) {
121 if (is_plugin_active_for_network('hash-form/hash-form.php')) {
122 switch_to_blog($data->blog_id);
123 $db = new HashFormCreateTable();
124 $db->upgrade();
125 restore_current_blog();
126 }
127 }
128
129 /**
130 * Drop form tables on multisite deletion.
131 */
132 add_filter('wpmu_drop_tables', 'hashform_on_delete_blog');
133
134 function hashform_on_delete_blog($tables) {
135 global $wpdb;
136 $id = HashFormHelper::get_request('id');
137
138 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_fields';
139 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_forms';
140 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_entries';
141 $tables[] = $wpdb->get_blog_prefix($id) . 'hashform_entry_meta';
142
143 return $tables;
144 }
145