| @@ -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 | |
| @@ -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,17 +563,31 @@ | ||
| 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 | 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 | 593 | if ( empty( $args['old_id'] ) ) { |