PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmHooksController.php +38 -78 6.306.7 View file →
@@ -12,16 +12,16 @@
12 12 *
13 13 * @return void
14 14 */
15 15 public static function trigger_load_hook( $hooks = 'load_hooks' ) {
16 - $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
16 + $controllers = apply_filters( 'frm_load_controllers', array( 'FrmHooksController' ) );
17 +
17 18 $trigger_hooks = $hooks;
18 19 $hooks = (array) $hooks;
19 20
20 - if ( 'load_hooks' === $trigger_hooks ) {
21 + if ( 'load_hooks' == $trigger_hooks ) {
21 22 if ( is_admin() ) {
22 23 $hooks[] = 'load_admin_hooks';
23 -
24 24 if ( defined( 'DOING_AJAX' ) ) {
25 25 $hooks[] = 'load_ajax_hooks';
26 26 $hooks[] = 'load_form_hooks';
27 27 }
@@ -35,9 +35,9 @@
35 35 add_filter( 'frm' . str_replace( 'load', '', $trigger_hooks ) . '_loaded', '__return_true' );
36 36 }
37 37 unset( $trigger_hooks );
38 38
39 - // Instantiate Controllers.
39 + // Instansiate Controllers.
40 40 foreach ( $controllers as $c ) {
41 41 foreach ( $hooks as $hook ) {
42 42 if ( is_callable( array( $c, $hook ) ) ) {
43 43 call_user_func( array( $c, $hook ) );
@@ -45,8 +45,9 @@
45 45 unset( $hook );
46 46 }
47 47 unset( $c );
48 48 }
49 +
49 50 }
50 51
51 52 /**
52 53 * @return void
@@ -58,12 +59,10 @@
58 59 /**
59 60 * @return void
60 61 */
61 62 public static function load_hooks() {
62 - // Use 0 so this gets triggered before FrmFormActionsController::register_post_types.
63 - add_action( 'init', 'FrmAppController::load_lang', 0 );
64 -
65 63 add_action( 'rest_api_init', 'FrmAppController::create_rest_routes', 0 );
64 + add_action( 'plugins_loaded', 'FrmAppController::load_lang' );
66 65 add_filter( 'widget_text', 'do_shortcode' );
67 66
68 67 // Entries controller.
69 68 add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 );
@@ -71,9 +70,8 @@
71 70
72 71 // Form Actions Controller.
73 72 add_action( 'init', 'FrmFormActionsController::register_post_types', 1 );
74 73 add_action( 'frm_after_create_entry', 'FrmFormActionsController::trigger_create_actions', 20, 3 );
75 - add_filter( 'pre_wpml_is_translated_post_type', 'FrmFormActionsController::prevent_wpml_translations', 10, 2 );
76 74
77 75 // Forms Controller.
78 76 add_action( 'widgets_init', 'FrmFormsController::register_widgets' );
79 77 add_action( 'init', 'FrmFormsController::front_head' );
@@ -80,9 +78,8 @@
80 78 add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 );
81 79 add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 );
82 80 add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' );
83 81 add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 );
84 - add_action( 'wp_footer', 'FrmHoneypot::maybe_print_honeypot_js', 99 );
85 82
86 83 add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' );
87 84
88 85 // Form Shortcodes.
@@ -107,8 +104,9 @@
107 104 add_filter( 'frm_keep_name_value_array', '__return_true' );
108 105
109 106 // Elementor.
110 107 add_action( 'elementor/widgets/register', 'FrmElementorController::register_elementor_hooks' );
108 + add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields', 10, 2 );
111 109
112 110 // Summary emails.
113 111 add_action( 'frm_daily_event', 'FrmEmailSummaryController::maybe_send_emails' );
114 112
@@ -113,12 +111,8 @@
113 111 add_action( 'frm_daily_event', 'FrmEmailSummaryController::maybe_send_emails' );
114 112
115 113 FrmTransLiteHooksController::load_hooks();
116 114 FrmStrpLiteHooksController::load_hooks();
117 - FrmSquareLiteHooksController::load_hooks();
118 -
119 - // GDPR
120 - add_filter( 'frm_is_field_required', 'FrmFieldGdpr::force_required_field', 10, 2 );
121 115 }
122 116
123 117 /**
124 118 * @return void
@@ -131,10 +125,14 @@
131 125 add_action( 'admin_enqueue_scripts', 'FrmAppController::admin_enqueue_scripts' );
132 126 add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' );
133 127 add_filter( 'admin_footer_text', 'FrmAppController::set_footer_text' );
134 128 add_action( 'admin_footer', 'FrmAppController::add_admin_footer_links' );
135 - add_action( 'current_screen', 'FrmAppController::handle_current_screen' );
129 + add_action( 'wp_ajax_frm_dismiss_review', 'FrmAppController::dismiss_review' );
136 130
131 + // Addons Controller.
132 + add_action( 'admin_menu', 'FrmAddonsController::menu', 100 );
133 + add_filter( 'pre_set_site_transient_update_plugins', 'FrmAddonsController::check_update' );
134 +
137 135 // Entries Controller.
138 136 add_action( 'admin_menu', 'FrmEntriesController::menu', 12 );
139 137 add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 );
140 138 add_filter( 'update_user_metadata', 'FrmEntriesController::check_hidden_cols', 10, 5 );
@@ -142,20 +140,16 @@
142 140
143 141 // Form Actions Controller.
144 142 if ( FrmAppHelper::is_admin_page( 'formidable' ) ) {
145 143 add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' );
144 + add_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' );
146 145 }
147 -
148 146 add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 );
149 147
150 - // Fields Model.
151 - add_filter( 'frm_pro_available_fields', 'FrmField::show_update_for_pro_fields' );
152 -
153 148 // Forms Controller.
154 149 add_action( 'admin_menu', 'FrmFormsController::menu', 10 );
155 150 add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' );
156 151 add_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' );
157 - add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields' );
158 152
159 153 add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 );
160 154 add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' );
161 155
@@ -167,19 +161,23 @@
167 161
168 162 // Forms Model.
169 163 add_action( 'frm_after_duplicate_form', 'FrmForm::after_duplicate', 10, 2 );
170 164
165 + // Inbox Controller.
166 + add_action( 'admin_menu', 'FrmInboxController::menu', 50 );
167 +
171 168 // Settings Controller.
172 169 add_action( 'admin_menu', 'FrmSettingsController::menu', 45 );
173 170 add_action( 'frm_before_settings', 'FrmSettingsController::license_box' );
174 - add_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' );
171 + add_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' );
172 + add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' );
173 + add_action( 'wp_ajax_frm_page_search', 'FrmSettingsController::page_search' );
175 174
176 175 // Styles Controller.
177 176 add_action( 'admin_menu', 'FrmStylesController::menu', 14 );
178 177 add_action( 'plugins_loaded', 'FrmStylesController::plugins_loaded' );
179 178 add_action( 'admin_init', 'FrmStylesController::admin_init' );
180 - // Use 11 so it happens after add_action( 'wp_default_styles', 'wp_default_styles' ); where edit.css is added.
181 - add_action( 'wp_default_styles', 'FrmStylesController::disable_conflicting_wp_admin_css', 11 );
179 + add_action( 'wp_default_styles', 'FrmStylesController::disable_conflicting_wp_admin_css', 11 ); // Use 11 so it happens after add_action( 'wp_default_styles', 'wp_default_styles' ); where edit.css is added.
182 180
183 181 // XML Controller.
184 182 add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
185 183
@@ -184,16 +182,15 @@
184 182 add_action( 'admin_menu', 'FrmXMLController::menu', 41 );
185 183
186 184 // Simple Blocks Controller.
187 185 add_action( 'enqueue_block_editor_assets', 'FrmSimpleBlocksController::block_editor_assets' );
188 - add_action( 'enqueue_block_assets', 'FrmSimpleBlocksController::block_assets' );
189 186
190 187 add_action( 'admin_init', 'FrmUsageController::schedule_send' );
191 188
192 189 // Applications Controller.
193 - // Use the same priority as styles so Applications appear directly under Styles.
194 - add_action( 'admin_menu', 'FrmApplicationsController::menu', 14 );
190 + add_action( 'admin_menu', 'FrmApplicationsController::menu', 14 ); // Use the same priority as styles so Applications appear directly under Styles.
195 191 add_action( 'admin_enqueue_scripts', 'FrmApplicationsController::dequeue_scripts', 15 );
192 + add_action( 'wp_ajax_frm_get_applications_data', 'FrmApplicationsController::get_applications_data' );
196 193
197 194 // CAPTCHA
198 195 add_filter( 'frm_setup_edit_field_vars', 'FrmFieldCaptcha::update_field_name' );
199 196
@@ -202,27 +199,12 @@
202 199
203 200 // Cronjob.
204 201 add_action( 'admin_init', 'FrmCronController::schedule_events' );
205 202
206 - // Cross sell.
207 - add_action( 'admin_menu', 'FrmSalesApi::menu', 1000 );
208 -
209 - // Deactivation feedback.
210 - add_action( 'admin_enqueue_scripts', 'FrmDeactivationFeedbackController::enqueue_assets' );
211 - add_action( 'admin_footer', 'FrmDeactivationFeedbackController::footer_html' );
212 - add_action( 'deactivated_plugin', 'FrmDeactivationFeedbackController::set_feedback_expired_date' );
213 -
214 - add_action( 'frm_email_styles_extra_settings', 'FrmEmailStylesController::show_upsell_settings' );
215 -
216 - add_action( 'admin_init', 'FrmWelcomeTourController::admin_init' );
217 -
218 - FrmDashboardController::load_admin_hooks();
219 203 FrmTransLiteHooksController::load_admin_hooks();
220 204 FrmStrpLiteHooksController::load_admin_hooks();
221 - FrmSquareLiteHooksController::load_admin_hooks();
222 205 FrmSMTPController::load_hooks();
223 - FrmOnboardingWizardController::load_admin_hooks();
224 - FrmAddonsController::load_admin_hooks();
206 + FrmWelcomeController::load_hooks();
225 207 new FrmPluginSearch();
226 208 }
227 209
228 210 /**
@@ -232,22 +214,14 @@
232 214 add_action( 'wp_ajax_frm_install', 'FrmAppController::ajax_install' );
233 215 add_action( 'wp_ajax_frm_uninstall', 'FrmAppController::uninstall' );
234 216 add_action( 'wp_ajax_frm_deauthorize', 'FrmAppController::deauthorize' );
235 217
236 - // Onboarding Wizard Controller.
237 - add_action( 'wp_ajax_frm_onboarding_consent_tracking', 'FrmOnboardingWizardController::ajax_consent_tracking' );
238 - add_action( 'wp_ajax_frm_onboarding_setup_usage_data', 'FrmOnboardingWizardController::setup_usage_data' );
239 -
240 218 // Addons.
241 219 add_action( 'wp_ajax_frm_addon_activate', 'FrmAddon::activate' );
242 220 add_action( 'wp_ajax_frm_addon_deactivate', 'FrmAddon::deactivate' );
243 221 add_action( 'wp_ajax_frm_activate_addon', 'FrmAddonsController::ajax_activate_addon' );
244 - add_action( 'wp_ajax_frm_deactivate_addon', 'FrmAddonsController::ajax_deactivate_addon' );
222 + add_action( 'wp_ajax_frm_connect', 'FrmAddonsController::connect_pro' );
245 223 add_action( 'wp_ajax_frm_install_addon', 'FrmAddonsController::ajax_install_addon' );
246 - add_action( 'wp_ajax_frm_uninstall_addon', 'FrmAddonsController::ajax_uninstall_addon' );
247 - // Plugin.
248 - add_action( 'wp_ajax_frm_install_plugin', 'FrmInstallPlugin::ajax_install_plugin' );
249 - add_action( 'wp_ajax_frm_check_plugin_activation', 'FrmInstallPlugin::ajax_check_plugin_activation' );
250 224
251 225 // Fields Controller.
252 226 add_action( 'wp_ajax_frm_load_field', 'FrmFieldsController::load_field' );
253 227 add_action( 'wp_ajax_frm_insert_field', 'FrmFieldsController::create' );
@@ -275,9 +249,8 @@
275 249
276 250 // Form Templates Controller.
277 251 add_action( 'wp_ajax_frm_add_or_remove_favorite_template', 'FrmFormTemplatesController::ajax_add_or_remove_favorite' );
278 252 add_action( 'wp_ajax_frm_create_template', 'FrmFormTemplatesController::ajax_create_template' );
279 - add_action( 'wp_ajax_frm_get_free_templates', 'FrmFormTemplatesController::ajax_get_free_templates' );
280 253
281 254 // Inbox.
282 255 add_action( 'wp_ajax_frm_inbox_dismiss', 'FrmInboxController::dismiss_message' );
283 256
@@ -282,10 +255,8 @@
282 255 add_action( 'wp_ajax_frm_inbox_dismiss', 'FrmInboxController::dismiss_message' );
283 256
284 257 // Settings.
285 258 add_action( 'wp_ajax_frm_lite_settings_upgrade', 'FrmSettingsController::settings_cta_dismiss' );
286 - add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' );
287 - add_action( 'wp_ajax_frm_page_search', 'FrmSettingsController::page_search' );
288 259
289 260 // Styles Controller.
290 261 add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' );
291 262 add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' );
@@ -300,32 +271,13 @@
300 271 add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' );
301 272 add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' );
302 273 add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' );
303 274
304 - // Dashboard Controller.
305 - add_action( 'wp_ajax_dashboard_ajax_action', 'FrmDashboardController::ajax_requests' );
275 + // Templates API.
276 + add_action( 'wp_ajax_template_api_signup', 'FrmFormTemplateApi::signup' );
306 277
307 278 // Submit with AJAX.
308 - // Trigger before process_entry.
309 - add_action( 'wp_loaded', 'FrmEntriesAJAXSubmitController::ajax_create', 5 );
310 -
311 - // Track the flows usage data.
312 - add_action( 'wp_ajax_frm_track_flows', 'FrmUsageController::ajax_track_flows' );
313 -
314 - // Applications.
315 - add_action( 'wp_ajax_frm_get_applications_data', 'FrmApplicationsController::get_applications_data' );
316 -
317 - // Reviews.
318 - add_action( 'wp_ajax_frm_dismiss_review', 'FrmAppController::dismiss_review' );
319 - add_action( 'wp_ajax_frm_small_screen_proceed', 'FrmAppController::small_screen_proceed' );
320 - add_action( 'wp_ajax_frm_sale_banner_dismiss', 'FrmSalesApi::dismiss_banner' );
321 -
322 - add_action( 'wp_ajax_frm_email_style_preview', 'FrmEmailStylesController::ajax_preview' );
323 - add_action( 'wp_ajax_frm_send_test_email', 'FrmEmailStylesController::ajax_send_test_email' );
324 -
325 - // Welcome Tour.
326 - add_action( 'wp_ajax_frm_mark_checklist_step_as_completed', 'FrmWelcomeTourController::ajax_mark_checklist_step_as_completed' );
327 - add_action( 'wp_ajax_frm_dismiss_welcome_tour', 'FrmWelcomeTourController::ajax_dismiss_welcome_tour' );
279 + add_action( 'wp_loaded', 'FrmEntriesAJAXSubmitController::ajax_create', 5 ); // Trigger before process_entry.
328 280 }
329 281
330 282 /**
331 283 * @return void
@@ -337,14 +289,12 @@
337 289 add_filter( 'frm_field_value_saved', 'FrmFieldsController::check_value', 50, 3 );
338 290 add_filter( 'frm_field_label_seen', 'FrmFieldsController::check_label' );
339 291
340 292 // Forms Controller.
341 - add_action( 'frm_form_classes', 'FrmFormsController::form_classes' );
293 + add_filter( 'frm_form_classes', 'FrmFormsController::form_classes' );
342 294 add_filter( 'frm_submit_button_class', 'FrmFormsController::update_button_classes' );
343 295 add_filter( 'frm_back_button_class', 'FrmFormsController::update_button_classes' );
344 296
345 - add_filter( 'frm_pre_display_form', 'FrmSubmitHelper::copy_submit_field_settings_to_form' );
346 -
347 297 // Styles Controller.
348 298 add_filter( 'frm_use_important_width', 'FrmStylesController::important_style', 10, 2 );
349 299 }
350 300
@@ -362,6 +312,16 @@
362 312 add_action( 'wpmu_upgrade_site', 'FrmAppController::network_upgrade_site' );
363 313
364 314 // Drop tables when mu site is deleted.
365 315 add_filter( 'wpmu_drop_tables', 'FrmAppController::drop_tables' );
316 + }
317 +
318 + /**
319 + * @deprecated 5.0.06 use FrmElementorController::register_elementor_hooks directly.
320 + *
321 + * @return void
322 + */
323 + public static function register_elementor_hooks() {
324 + _deprecated_function( __FUNCTION__, '5.0.06', 'FrmElementorController::register_elementor_hooks' );
325 + FrmElementorController::register_elementor_hooks();
366 326 }
367 327 }