| @@ -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 | } |
| @@ -58,12 +58,10 @@ | ||
| 58 | 58 | /** |
| 59 | 59 | * @return void |
| 60 | 60 | */ |
| 61 | 61 | 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 | 62 | add_action( 'rest_api_init', 'FrmAppController::create_rest_routes', 0 ); |
| 63 | + add_action( 'plugins_loaded', 'FrmAppController::load_lang' ); | |
| 66 | 64 | add_filter( 'widget_text', 'do_shortcode' ); |
| 67 | 65 | |
| 68 | 66 | // Entries controller. |
| 69 | 67 | add_action( 'wp_loaded', 'FrmEntriesController::process_entry', 10, 0 ); |
| @@ -71,9 +69,8 @@ | ||
| 71 | 69 | |
| 72 | 70 | // Form Actions Controller. |
| 73 | 71 | add_action( 'init', 'FrmFormActionsController::register_post_types', 1 ); |
| 74 | 72 | 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 | 73 | |
| 77 | 74 | // Forms Controller. |
| 78 | 75 | add_action( 'widgets_init', 'FrmFormsController::register_widgets' ); |
| 79 | 76 | add_action( 'init', 'FrmFormsController::front_head' ); |
| @@ -80,15 +77,11 @@ | ||
| 80 | 77 | add_filter( 'frm_content', 'FrmFormsController::filter_content', 10, 3 ); |
| 81 | 78 | add_filter( 'frm_replace_content_shortcodes', 'FrmFormsController::replace_content_shortcodes', 20, 3 ); |
| 82 | 79 | add_action( 'admin_bar_init', 'FrmFormsController::admin_bar_css' ); |
| 83 | 80 | add_action( 'wp_footer', 'FrmFormsController::footer_js', 1, 0 ); |
| 84 | - add_action( 'wp_footer', 'FrmHoneypot::maybe_print_honeypot_js', 99 ); | |
| 85 | 81 | |
| 86 | 82 | add_action( 'wp_scheduled_delete', 'FrmForm::scheduled_delete' ); |
| 87 | 83 | |
| 88 | - // Clear embed posts transient when posts are updated. | |
| 89 | - add_action( 'wp_insert_post', 'FrmFormsListHelper::maybe_clear_embed_posts_transient', 10, 2 ); | |
| 90 | - | |
| 91 | 84 | // Form Shortcodes. |
| 92 | 85 | add_shortcode( 'formidable', 'FrmFormsController::get_form_shortcode' ); |
| 93 | 86 | |
| 94 | 87 | // Styles Controller. |
| @@ -110,33 +103,15 @@ | ||
| 110 | 103 | add_filter( 'frm_keep_name_value_array', '__return_true' ); |
| 111 | 104 | |
| 112 | 105 | // Elementor. |
| 113 | 106 | add_action( 'elementor/widgets/register', 'FrmElementorController::register_elementor_hooks' ); |
| 107 | + add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields', 10, 2 ); | |
| 114 | 108 | |
| 115 | 109 | // Summary emails. |
| 116 | 110 | add_action( 'frm_daily_event', 'FrmEmailSummaryController::maybe_send_emails' ); |
| 117 | 111 | |
| 118 | - // Gated Content — daily cleanup of expired tokens. | |
| 119 | - add_action( 'frm_daily_event', 'FrmGatedTokenHelper::cleanup_expired' ); | |
| 120 | - | |
| 121 | - // Gated Content Controller. | |
| 122 | - add_action( 'frm_trigger_gated_content_action', 'FrmGatedContentController::trigger', 10, 4 ); | |
| 123 | - // pre_get_posts: allows private posts into the query when a valid token is present. | |
| 124 | - add_action( 'pre_get_posts', 'FrmGatedContentController::maybe_include_private_posts' ); | |
| 125 | - // 'wp' fires after WP::query_posts() so get_queried_object_id() is available. | |
| 126 | - add_action( 'wp', 'FrmGatedContentController::maybe_unlock_post' ); | |
| 127 | - add_action( 'save_post_frm_form_actions', 'FrmGatedContentController::on_action_updated', 10, 3 ); | |
| 128 | - add_action( 'before_delete_post', 'FrmGatedContentController::on_action_deleted', 10, 2 ); | |
| 129 | - add_shortcode( 'frm_gated_content', 'FrmGatedContentShortcodeController::shortcode' ); | |
| 130 | - add_filter( 'frm_helper_shortcodes', 'FrmGatedContentController::add_shortcode_helper', 10, 3 ); | |
| 131 | - | |
| 132 | 112 | FrmTransLiteHooksController::load_hooks(); |
| 133 | 113 | FrmStrpLiteHooksController::load_hooks(); |
| 134 | - FrmSquareLiteHooksController::load_hooks(); | |
| 135 | - FrmPayPalLiteHooksController::load_hooks(); | |
| 136 | - | |
| 137 | - // GDPR | |
| 138 | - add_filter( 'frm_is_field_required', 'FrmFieldGdpr::force_required_field', 10, 2 ); | |
| 139 | 114 | } |
| 140 | 115 | |
| 141 | 116 | /** |
| 142 | 117 | * @return void |
| @@ -149,9 +124,10 @@ | ||
| 149 | 124 | add_action( 'admin_enqueue_scripts', 'FrmAppController::admin_enqueue_scripts' ); |
| 150 | 125 | add_filter( 'plugin_action_links_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'FrmAppController::settings_link' ); |
| 151 | 126 | add_filter( 'admin_footer_text', 'FrmAppController::set_footer_text' ); |
| 152 | 127 | add_action( 'admin_footer', 'FrmAppController::add_admin_footer_links' ); |
| 153 | - add_action( 'current_screen', 'FrmAppController::handle_current_screen' ); | |
| 128 | + add_action( 'wp_ajax_frm_dismiss_review', 'FrmAppController::dismiss_review' ); | |
| 129 | + add_action( 'current_screen', 'FrmAppController::filter_admin_notices' ); | |
| 154 | 130 | |
| 155 | 131 | // Entries Controller. |
| 156 | 132 | add_action( 'admin_menu', 'FrmEntriesController::menu', 12 ); |
| 157 | 133 | add_filter( 'set-screen-option', 'FrmEntriesController::save_per_page', 10, 3 ); |
| @@ -160,24 +136,19 @@ | ||
| 160 | 136 | |
| 161 | 137 | // Form Actions Controller. |
| 162 | 138 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
| 163 | 139 | add_action( 'frm_before_update_form_settings', 'FrmFormActionsController::update_settings' ); |
| 140 | + add_action( 'frm_add_form_style_tab_options', 'FrmFormsController::add_form_style_tab_options' ); | |
| 164 | 141 | } |
| 165 | - | |
| 166 | 142 | add_action( 'frm_after_duplicate_form', 'FrmFormActionsController::duplicate_form_actions', 20, 3 ); |
| 167 | 143 | |
| 168 | - // Fields Model. | |
| 169 | - add_filter( 'frm_pro_available_fields', 'FrmField::show_update_for_pro_fields' ); | |
| 170 | - | |
| 171 | 144 | // Forms Controller. |
| 172 | 145 | add_action( 'admin_menu', 'FrmFormsController::menu', 10 ); |
| 173 | 146 | add_action( 'admin_head-toplevel_page_formidable', 'FrmFormsController::head' ); |
| 174 | 147 | add_action( 'frm_after_field_options', 'FrmFormsController::logic_tip' ); |
| 175 | - add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields' ); | |
| 176 | 148 | |
| 177 | 149 | add_filter( 'set-screen-option', 'FrmFormsController::save_per_page', 10, 3 ); |
| 178 | 150 | add_action( 'admin_footer', 'FrmFormsController::insert_form_popup' ); |
| 179 | - add_action( 'admin_footer', 'FrmFormsController::print_forms_list_templates' ); | |
| 180 | 151 | |
| 181 | 152 | // Elementor. |
| 182 | 153 | add_action( 'elementor/editor/footer', 'FrmElementorController::admin_init' ); |
| 183 | 154 | |
| @@ -189,9 +160,11 @@ | ||
| 189 | 160 | |
| 190 | 161 | // Settings Controller. |
| 191 | 162 | add_action( 'admin_menu', 'FrmSettingsController::menu', 45 ); |
| 192 | 163 | add_action( 'frm_before_settings', 'FrmSettingsController::license_box' ); |
| 193 | - add_action( 'frm_after_settings_tabs', 'FrmSettingsController::settings_cta' ); | |
| 164 | + add_action( 'frm_after_settings', 'FrmSettingsController::settings_cta' ); | |
| 165 | + add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' ); | |
| 166 | + add_action( 'wp_ajax_frm_page_search', 'FrmSettingsController::page_search' ); | |
| 194 | 167 | |
| 195 | 168 | // Styles Controller. |
| 196 | 169 | add_action( 'admin_menu', 'FrmStylesController::menu', 14 ); |
| 197 | 170 | add_action( 'plugins_loaded', 'FrmStylesController::plugins_loaded' ); |
| @@ -203,9 +176,8 @@ | ||
| 203 | 176 | add_action( 'admin_menu', 'FrmXMLController::menu', 41 ); |
| 204 | 177 | |
| 205 | 178 | // Simple Blocks Controller. |
| 206 | 179 | add_action( 'enqueue_block_editor_assets', 'FrmSimpleBlocksController::block_editor_assets' ); |
| 207 | - add_action( 'enqueue_block_assets', 'FrmSimpleBlocksController::block_assets' ); | |
| 208 | 180 | |
| 209 | 181 | add_action( 'admin_init', 'FrmUsageController::schedule_send' ); |
| 210 | 182 | |
| 211 | 183 | // Applications Controller. |
| @@ -211,8 +183,9 @@ | ||
| 211 | 183 | // Applications Controller. |
| 212 | 184 | // Use the same priority as styles so Applications appear directly under Styles. |
| 213 | 185 | add_action( 'admin_menu', 'FrmApplicationsController::menu', 14 ); |
| 214 | 186 | add_action( 'admin_enqueue_scripts', 'FrmApplicationsController::dequeue_scripts', 15 ); |
| 187 | + add_action( 'wp_ajax_frm_get_applications_data', 'FrmApplicationsController::get_applications_data' ); | |
| 215 | 188 | |
| 216 | 189 | // CAPTCHA |
| 217 | 190 | add_filter( 'frm_setup_edit_field_vars', 'FrmFieldCaptcha::update_field_name' ); |
| 218 | 191 | |
| @@ -226,17 +199,11 @@ | ||
| 226 | 199 | add_action( 'admin_enqueue_scripts', 'FrmDeactivationFeedbackController::enqueue_assets' ); |
| 227 | 200 | add_action( 'admin_footer', 'FrmDeactivationFeedbackController::footer_html' ); |
| 228 | 201 | add_action( 'deactivated_plugin', 'FrmDeactivationFeedbackController::set_feedback_expired_date' ); |
| 229 | 202 | |
| 230 | - add_action( 'frm_email_styles_extra_settings', 'FrmEmailStylesController::show_upsell_settings' ); | |
| 231 | - | |
| 232 | - add_action( 'admin_init', 'FrmWelcomeTourController::admin_init' ); | |
| 233 | - | |
| 234 | 203 | FrmDashboardController::load_admin_hooks(); |
| 235 | 204 | FrmTransLiteHooksController::load_admin_hooks(); |
| 236 | 205 | FrmStrpLiteHooksController::load_admin_hooks(); |
| 237 | - FrmSquareLiteHooksController::load_admin_hooks(); | |
| 238 | - FrmPayPalLiteHooksController::load_admin_hooks(); | |
| 239 | 206 | FrmSMTPController::load_hooks(); |
| 240 | 207 | FrmOnboardingWizardController::load_admin_hooks(); |
| 241 | 208 | FrmAddonsController::load_admin_hooks(); |
| 242 | 209 | new FrmPluginSearch(); |
| @@ -292,9 +259,8 @@ | ||
| 292 | 259 | |
| 293 | 260 | // Form Templates Controller. |
| 294 | 261 | add_action( 'wp_ajax_frm_add_or_remove_favorite_template', 'FrmFormTemplatesController::ajax_add_or_remove_favorite' ); |
| 295 | 262 | add_action( 'wp_ajax_frm_create_template', 'FrmFormTemplatesController::ajax_create_template' ); |
| 296 | - add_action( 'wp_ajax_frm_get_free_templates', 'FrmFormTemplatesController::ajax_get_free_templates' ); | |
| 297 | 263 | |
| 298 | 264 | // Inbox. |
| 299 | 265 | add_action( 'wp_ajax_frm_inbox_dismiss', 'FrmInboxController::dismiss_message' ); |
| 300 | 266 | |
| @@ -299,10 +265,8 @@ | ||
| 299 | 265 | add_action( 'wp_ajax_frm_inbox_dismiss', 'FrmInboxController::dismiss_message' ); |
| 300 | 266 | |
| 301 | 267 | // Settings. |
| 302 | 268 | add_action( 'wp_ajax_frm_lite_settings_upgrade', 'FrmSettingsController::settings_cta_dismiss' ); |
| 303 | - add_action( 'wp_ajax_frm_settings_tab', 'FrmSettingsController::load_settings_tab' ); | |
| 304 | - add_action( 'wp_ajax_frm_page_search', 'FrmSettingsController::page_search' ); | |
| 305 | 269 | |
| 306 | 270 | // Styles Controller. |
| 307 | 271 | add_action( 'wp_ajax_frm_settings_reset', 'FrmStylesController::reset_styling' ); |
| 308 | 272 | add_action( 'wp_ajax_frm_change_styling', 'FrmStylesController::change_styling' ); |
| @@ -317,8 +281,11 @@ | ||
| 317 | 281 | add_action( 'wp_ajax_frm_entries_csv', 'FrmXMLController::csv' ); |
| 318 | 282 | add_action( 'wp_ajax_nopriv_frm_entries_csv', 'FrmXMLController::csv' ); |
| 319 | 283 | add_action( 'wp_ajax_frm_export_xml', 'FrmXMLController::export_xml' ); |
| 320 | 284 | |
| 285 | + // Templates API. | |
| 286 | + add_action( 'wp_ajax_template_api_signup', 'FrmFormTemplateApi::signup' ); | |
| 287 | + | |
| 321 | 288 | // Dashboard Controller. |
| 322 | 289 | add_action( 'wp_ajax_dashboard_ajax_action', 'FrmDashboardController::ajax_requests' ); |
| 323 | 290 | |
| 324 | 291 | // Submit with AJAX. |
| @@ -323,26 +290,8 @@ | ||
| 323 | 290 | |
| 324 | 291 | // Submit with AJAX. |
| 325 | 292 | // Trigger before process_entry. |
| 326 | 293 | add_action( 'wp_loaded', 'FrmEntriesAJAXSubmitController::ajax_create', 5 ); |
| 327 | - | |
| 328 | - // Track the flows usage data. | |
| 329 | - add_action( 'wp_ajax_frm_track_flows', 'FrmUsageController::ajax_track_flows' ); | |
| 330 | - | |
| 331 | - // Applications. | |
| 332 | - add_action( 'wp_ajax_frm_get_applications_data', 'FrmApplicationsController::get_applications_data' ); | |
| 333 | - | |
| 334 | - // Reviews. | |
| 335 | - add_action( 'wp_ajax_frm_dismiss_review', 'FrmAppController::dismiss_review' ); | |
| 336 | - add_action( 'wp_ajax_frm_small_screen_proceed', 'FrmAppController::small_screen_proceed' ); | |
| 337 | - add_action( 'wp_ajax_frm_sale_banner_dismiss', 'FrmSalesApi::dismiss_banner' ); | |
| 338 | - | |
| 339 | - add_action( 'wp_ajax_frm_email_style_preview', 'FrmEmailStylesController::ajax_preview' ); | |
| 340 | - add_action( 'wp_ajax_frm_send_test_email', 'FrmEmailStylesController::ajax_send_test_email' ); | |
| 341 | - | |
| 342 | - // Welcome Tour. | |
| 343 | - add_action( 'wp_ajax_frm_mark_checklist_step_as_completed', 'FrmWelcomeTourController::ajax_mark_checklist_step_as_completed' ); | |
| 344 | - add_action( 'wp_ajax_frm_dismiss_welcome_tour', 'FrmWelcomeTourController::ajax_dismiss_welcome_tour' ); | |
| 345 | 294 | } |
| 346 | 295 | |
| 347 | 296 | /** |
| 348 | 297 | * @return void |