PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.13
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.13
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 +53 -15 6.3.26.13 View file →
@@ -48,9 +48,9 @@
48 48 'email' => 'FrmEmailAction',
49 49 'wppost' => 'FrmDefPostAction',
50 50 'register' => 'FrmDefRegAction',
51 51 'paypal' => 'FrmDefPayPalAction',
52 - 'payment' => 'FrmDefHrsAction',
52 + 'payment' => 'FrmTransLiteAction',
53 53 'quiz' => 'FrmDefQuizAction',
54 54 'quiz_outcome' => 'FrmDefQuizOutcomeAction',
55 55 'mailchimp' => 'FrmDefMlcmpAction',
56 56 'api' => 'FrmDefApiAction',
@@ -63,8 +63,9 @@
63 63 'twilio' => 'FrmDefTwilioAction',
64 64 'highrise' => 'FrmDefHighriseAction',
65 65 'mailpoet' => 'FrmDefMailpoetAction',
66 66 'aweber' => 'FrmDefAweberAction',
67 + 'convertkit' => 'FrmDefConvertKitAction',
67 68 'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction',
68 69 );
69 70
70 71 $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
@@ -240,9 +241,9 @@
240 241 $requires = FrmFormsHelper::get_plan_required( $upgrading );
241 242 if ( $requires && 'free' !== $requires ) {
242 243 $data['data-requires'] = $requires;
243 244 }
244 - }
245 + }//end if
245 246
246 247 // HTML to include on the icon.
247 248 $icon_atts = array();
248 249 if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
@@ -253,8 +254,11 @@
253 254
254 255 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
255 256 }
256 257
258 + /**
259 + * @param string $action
260 + */
257 261 public static function get_form_actions( $action = 'all' ) {
258 262 $temp_actions = self::$registered_actions;
259 263 if ( empty( $temp_actions ) ) {
260 264 self::actions_init();
@@ -265,9 +269,9 @@
265 269
266 270 $actions = array();
267 271
268 272 foreach ( $temp_actions as $a ) {
269 - if ( 'all' != $action && $a->id_base == $action ) {
273 + if ( 'all' !== $action && $a->id_base == $action ) {
270 274 return $a;
271 275 }
272 276
273 277 $actions[ $a->id_base ] = $a;
@@ -374,9 +378,9 @@
374 378 * @return bool
375 379 */
376 380 private static function should_show_log_message( $action_type ) {
377 381 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
378 - return in_array( $action_type, $logging ) && ! function_exists( 'frm_log_autoloader' );
382 + return in_array( $action_type, $logging, true ) && ! function_exists( 'frm_log_autoloader' );
379 383 }
380 384
381 385 private static function fields_to_values( $form_id, array &$values ) {
382 386 $form = FrmForm::getOne( $form_id );
@@ -409,9 +413,22 @@
409 413 FrmAppHelper::permission_check( 'frm_edit_forms' );
410 414 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
411 415 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
412 416 $frm_settings = FrmAppHelper::get_settings();
413 - wp_die( esc_html( $frm_settings->admin_permission ) );
417 + $error_args = array(
418 + 'title' => __( 'Verification failed', 'formidable' ),
419 + 'body' => $frm_settings->admin_permission,
420 + 'cancel_url' => add_query_arg(
421 + array(
422 + 'page' => 'formidable',
423 + 'frm_action' => 'settings',
424 + 'id' => $form_id,
425 + ),
426 + admin_url( 'admin.php?' )
427 + ),
428 + );
429 + FrmAppController::show_error_modal( $error_args );
430 + return;
414 431 }
415 432
416 433 global $wpdb;
417 434
@@ -458,9 +475,16 @@
458 475 $filter_args = $args;
459 476 $filter_args['entry_id'] = $entry_id;
460 477 $filter_args['form_id'] = $form_id;
461 478
462 - $event = apply_filters( 'frm_trigger_create_action', 'create', $args );
479 + /**
480 + * @since 2.0.23
481 + * @since 6.11.2 $filter_args is now passed instead of $args. It includes additional ID data.
482 + *
483 + * @param string $event 'create' by default. Pro may filter this value to 'draft' instead.
484 + * @param array $filter_args
485 + */
486 + $event = apply_filters( 'frm_trigger_create_action', 'create', $filter_args );
463 487
464 488 self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
465 489 }
466 490
@@ -486,9 +510,9 @@
486 510
487 511 $stored_actions = array();
488 512 $action_priority = array();
489 513
490 - if ( in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
514 + if ( in_array( $event, array( 'create', 'update' ), true ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
491 515 $this_event = 'import';
492 516 } else {
493 517 $this_event = $event;
494 518 }
@@ -504,9 +528,9 @@
504 528 if ( ! is_object( $entry ) ) {
505 529 $entry = FrmEntry::getOne( $entry, true );
506 530 }
507 531
508 - if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
532 + if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
509 533 continue;
510 534 }
511 535
512 536 $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'] ) );
@@ -529,9 +553,9 @@
529 553 $stored_actions[ $action->ID ] = $action;
530 554 $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
531 555
532 556 unset( $action );
533 - }
557 + }//end foreach
534 558
535 559 if ( ! empty( $stored_actions ) ) {
536 560 asort( $action_priority );
537 561
@@ -539,21 +563,35 @@
539 563 new FrmNotification();
540 564
541 565 foreach ( $action_priority as $action_id => $priority ) {
542 566 $action = $stored_actions[ $action_id ];
543 - do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
544 - do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
545 567
568 + /**
569 + * Allows custom form action trigger.
570 + *
571 + * @since 6.10
572 + *
573 + * @param bool $skip Skip default trigger.
574 + * @param object $action Action object.
575 + * @param object $entry Entry object.
576 + * @param object $form Form object.
577 + * @param string $event Event ('create' or 'update').
578 + */
579 + if ( false === apply_filters( 'frm_custom_trigger_action', false, $action, $entry, $form, $event ) ) {
580 + do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
581 + do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
582 + }
583 +
546 584 // If post is created, get updated $entry object.
547 - if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
585 + if ( $action->post_excerpt === 'wppost' && $event === 'create' ) {
548 586 $entry = FrmEntry::getOne( $entry->id, true );
549 587 }
550 - }
551 - }
588 + }//end foreach
589 + }//end if
552 590 }
553 591
554 592 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
555 - if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
593 + if ( empty( $args['old_id'] ) ) {
556 594 // Continue if we know which actions to copy.
557 595 return;
558 596 }
559 597