PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.1
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/FrmFormActionsController.php +35 -50 6.55.1 View file →
@@ -38,40 +38,34 @@
38 38 self::register_actions();
39 39 do_action( 'frm_form_actions_init' );
40 40 }
41 41
42 - /**
43 - * @return void
44 - */
45 42 public static function register_actions() {
46 43 $action_classes = array(
47 - 'on_submit' => 'FrmOnSubmitAction',
48 - 'email' => 'FrmEmailAction',
49 - 'wppost' => 'FrmDefPostAction',
50 - 'register' => 'FrmDefRegAction',
51 - 'paypal' => 'FrmDefPayPalAction',
52 - 'payment' => 'FrmTransLiteAction',
53 - 'quiz' => 'FrmDefQuizAction',
54 - 'quiz_outcome' => 'FrmDefQuizOutcomeAction',
55 - 'mailchimp' => 'FrmDefMlcmpAction',
56 - 'api' => 'FrmDefApiAction',
57 - 'salesforce' => 'FrmDefSalesforceAction',
58 - 'activecampaign' => 'FrmDefActiveCampaignAction',
59 - 'constantcontact' => 'FrmDefConstContactAction',
60 - 'getresponse' => 'FrmDefGetResponseAction',
61 - 'hubspot' => 'FrmDefHubspotAction',
62 - 'zapier' => 'FrmDefZapierAction',
63 - 'twilio' => 'FrmDefTwilioAction',
64 - 'highrise' => 'FrmDefHighriseAction',
65 - 'mailpoet' => 'FrmDefMailpoetAction',
66 - 'aweber' => 'FrmDefAweberAction',
67 - 'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction',
44 + 'email' => 'FrmEmailAction',
45 + 'wppost' => 'FrmDefPostAction',
46 + 'register' => 'FrmDefRegAction',
47 + 'paypal' => 'FrmDefPayPalAction',
48 + 'payment' => 'FrmDefHrsAction',
49 + 'mailchimp' => 'FrmDefMlcmpAction',
50 + 'api' => 'FrmDefApiAction',
51 +
52 + 'salesforce' => 'FrmDefSalesforceAction',
53 + 'activecampaign' => 'FrmDefActiveCampaignAction',
54 + 'constantcontact' => 'FrmDefConstContactAction',
55 + 'getresponse' => 'FrmDefGetResponseAction',
56 + 'hubspot' => 'FrmDefHubspotAction',
57 + 'zapier' => 'FrmDefZapierAction',
58 + 'twilio' => 'FrmDefTwilioAction',
59 + 'highrise' => 'FrmDefHighriseAction',
60 + 'mailpoet' => 'FrmDefMailpoetAction',
61 + 'aweber' => 'FrmDefAweberAction',
68 62 );
69 63
70 64 $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
71 65
72 - include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php';
73 - include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php';
66 + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
67 + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
74 68
75 69 foreach ( $action_classes as $action_class ) {
76 70 self::$registered_actions->register( $action_class );
77 71 }
@@ -90,9 +84,9 @@
90 84 self::maybe_add_action_to_group( $action_controls, $groups );
91 85
92 86 $allowed = self::active_actions( $action_controls );
93 87
94 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php';
88 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php' );
95 89 }
96 90
97 91 /**
98 92 * Add unknown actions to a group.
@@ -132,9 +126,9 @@
132 126 * @return array
133 127 */
134 128 public static function form_action_groups() {
135 129 $groups = array(
136 - 'misc' => array(
130 + 'misc' => array(
137 131 'name' => '',
138 132 'icon' => 'frm_icon_font frm_shuffle_icon',
139 133 'actions' => array(
140 134 'email',
@@ -139,10 +133,8 @@
139 133 'actions' => array(
140 134 'email',
141 135 'wppost',
142 136 'register',
143 - 'quiz',
144 - 'quiz_outcome',
145 137 'twilio',
146 138 ),
147 139 ),
148 140 'payment' => array(
@@ -211,9 +203,9 @@
211 203
212 204 /* translators: %s: Name of form action */
213 205 $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] );
214 206
215 - $default_shown = array( 'wppost', 'register', 'payment', 'quiz', 'hubspot' );
207 + $default_shown = array( 'wppost', 'register', 'paypal', 'payment', 'hubspot' );
216 208 $default_shown = array_values( array_diff( $default_shown, $allowed ) );
217 209 $default_position = array_search( $action_control->id_base, $default_shown );
218 210 $allowed_count = count( $allowed );
219 211
@@ -244,11 +236,11 @@
244 236 }
245 237
246 238 // HTML to include on the icon.
247 239 $icon_atts = array();
248 - if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
240 + if ( $action_control->action_options['color'] !== 'var(--primary-hover)' ) {
249 241 $icon_atts = array(
250 - 'style' => '--primary-700:' . $action_control->action_options['color'],
242 + 'style' => '--primary-hover:' . $action_control->action_options['color'],
251 243 );
252 244 }
253 245
254 246 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
@@ -318,9 +310,9 @@
318 310 $action_control->_set( $action_key );
319 311
320 312 $use_logging = self::should_show_log_message( $form_action->post_excerpt );
321 313
322 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
314 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
323 315 }
324 316
325 317 public static function add_form_action() {
326 318 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -341,9 +333,9 @@
341 333
342 334 $values = array();
343 335 $form = self::fields_to_values( $form_id, $values );
344 336
345 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
337 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
346 338 wp_die();
347 339 }
348 340
349 341 public static function fill_action() {
@@ -364,9 +356,9 @@
364 356 $form = self::fields_to_values( $form_action->menu_order, $values );
365 357
366 358 $use_logging = self::should_show_log_message( $action_type );
367 359
368 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
360 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
369 361 wp_die();
370 362 }
371 363
372 364 /**
@@ -400,18 +392,13 @@
400 392
401 393 return $form;
402 394 }
403 395
404 - /**
405 - * @param int $form_id
406 - * @return void
407 - */
408 396 public static function update_settings( $form_id ) {
409 397 FrmAppHelper::permission_check( 'frm_edit_forms' );
410 398 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
411 399 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
412 - $frm_settings = FrmAppHelper::get_settings();
413 - wp_die( esc_html( $frm_settings->admin_permission ) );
400 + wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) );
414 401 }
415 402
416 403 global $wpdb;
417 404
@@ -440,10 +427,8 @@
440 427 }
441 428 $old_actions = array_diff( $old_actions, $new_actions );
442 429
443 430 self::delete_missing_actions( $old_actions );
444 -
445 - FrmOnSubmitHelper::save_on_submit_settings( $form_id );
446 431 }
447 432
448 433 public static function delete_missing_actions( $old_actions ) {
449 434 if ( ! empty( $old_actions ) ) {
@@ -470,9 +455,9 @@
470 455 public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
471 456 $action_status = array(
472 457 'post_status' => 'publish',
473 458 );
474 - $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
459 + $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
475 460
476 461 if ( empty( $form_actions ) ) {
477 462 return;
478 463 }
@@ -486,9 +471,9 @@
486 471
487 472 $stored_actions = array();
488 473 $action_priority = array();
489 474
490 - if ( in_array( $event, array( 'create', 'update' ), true ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
475 + if ( in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
491 476 $this_event = 'import';
492 477 } else {
493 478 $this_event = $event;
494 479 }
@@ -494,9 +479,9 @@
494 479 }
495 480
496 481 foreach ( $form_actions as $action ) {
497 482
498 - $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt;
483 + $skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
499 484 $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
500 485 if ( $skip_this_action ) {
501 486 continue;
502 487 }
@@ -504,9 +489,9 @@
504 489 if ( ! is_object( $entry ) ) {
505 490 $entry = FrmEntry::getOne( $entry, true );
506 491 }
507 492
508 - if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
493 + if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
509 494 continue;
510 495 }
511 496
512 497 $child_entry = ( ( is_object( $form ) && is_numeric( $form->parent_form_id ) && $form->parent_form_id ) || ( $entry && ( $entry->form_id != $form->id || $entry->parent_item_id ) ) || ( isset( $args['is_child'] ) && $args['is_child'] ) );
@@ -543,9 +528,9 @@
543 528 do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
544 529 do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
545 530
546 531 // If post is created, get updated $entry object.
547 - if ( $action->post_excerpt === 'wppost' && $event === 'create' ) {
532 + if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
548 533 $entry = FrmEntry::getOne( $entry->id, true );
549 534 }
550 535 }
551 536 }
@@ -551,9 +536,9 @@
551 536 }
552 537 }
553 538
554 539 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
555 - if ( empty( $args['old_id'] ) ) {
540 + if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
556 541 // Continue if we know which actions to copy.
557 542 return;
558 543 }
559 544