| @@ -240,9 +240,9 @@ | ||
| 240 | 240 | $requires = FrmFormsHelper::get_plan_required( $upgrading ); |
| 241 | 241 | if ( $requires && 'free' !== $requires ) { |
| 242 | 242 | $data['data-requires'] = $requires; |
| 243 | 243 | } |
| 244 | - } | |
| 244 | + }//end if | |
| 245 | 245 | |
| 246 | 246 | // HTML to include on the icon. |
| 247 | 247 | $icon_atts = array(); |
| 248 | 248 | if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) { |
| @@ -253,8 +253,11 @@ | ||
| 253 | 253 | |
| 254 | 254 | include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php'; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | + /** | |
| 258 | + * @param string $action | |
| 259 | + */ | |
| 257 | 260 | public static function get_form_actions( $action = 'all' ) { |
| 258 | 261 | $temp_actions = self::$registered_actions; |
| 259 | 262 | if ( empty( $temp_actions ) ) { |
| 260 | 263 | self::actions_init(); |
| @@ -265,9 +268,9 @@ | ||
| 265 | 268 | |
| 266 | 269 | $actions = array(); |
| 267 | 270 | |
| 268 | 271 | foreach ( $temp_actions as $a ) { |
| 269 | - if ( 'all' != $action && $a->id_base == $action ) { | |
| 272 | + if ( 'all' !== $action && $a->id_base == $action ) { | |
| 270 | 273 | return $a; |
| 271 | 274 | } |
| 272 | 275 | |
| 273 | 276 | $actions[ $a->id_base ] = $a; |
| @@ -374,9 +377,9 @@ | ||
| 374 | 377 | * @return bool |
| 375 | 378 | */ |
| 376 | 379 | private static function should_show_log_message( $action_type ) { |
| 377 | 380 | $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' ); |
| 378 | - return in_array( $action_type, $logging ) && ! function_exists( 'frm_log_autoloader' ); | |
| 381 | + return in_array( $action_type, $logging, true ) && ! function_exists( 'frm_log_autoloader' ); | |
| 379 | 382 | } |
| 380 | 383 | |
| 381 | 384 | private static function fields_to_values( $form_id, array &$values ) { |
| 382 | 385 | $form = FrmForm::getOne( $form_id ); |
| @@ -409,9 +412,22 @@ | ||
| 409 | 412 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 410 | 413 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 411 | 414 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 412 | 415 | $frm_settings = FrmAppHelper::get_settings(); |
| 413 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 416 | + $error_args = array( | |
| 417 | + 'title' => __( 'Verification failed', 'formidable' ), | |
| 418 | + 'body' => $frm_settings->admin_permission, | |
| 419 | + 'cancel_url' => add_query_arg( | |
| 420 | + array( | |
| 421 | + 'page' => 'formidable', | |
| 422 | + 'frm_action' => 'settings', | |
| 423 | + 'id' => $form_id, | |
| 424 | + ), | |
| 425 | + admin_url( 'admin.php?' ) | |
| 426 | + ), | |
| 427 | + ); | |
| 428 | + FrmAppController::show_error_modal( $error_args ); | |
| 429 | + return; | |
| 414 | 430 | } |
| 415 | 431 | |
| 416 | 432 | global $wpdb; |
| 417 | 433 | |
| @@ -529,9 +545,9 @@ | ||
| 529 | 545 | $stored_actions[ $action->ID ] = $action; |
| 530 | 546 | $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
| 531 | 547 | |
| 532 | 548 | unset( $action ); |
| 533 | - } | |
| 549 | + }//end foreach | |
| 534 | 550 | |
| 535 | 551 | if ( ! empty( $stored_actions ) ) { |
| 536 | 552 | asort( $action_priority ); |
| 537 | 553 | |
| @@ -539,17 +555,31 @@ | ||
| 539 | 555 | new FrmNotification(); |
| 540 | 556 | |
| 541 | 557 | foreach ( $action_priority as $action_id => $priority ) { |
| 542 | 558 | $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 | 559 | |
| 560 | + /** | |
| 561 | + * Allows custom form action trigger. | |
| 562 | + * | |
| 563 | + * @since 6.10 | |
| 564 | + * | |
| 565 | + * @param bool $skip Skip default trigger. | |
| 566 | + * @param object $action Action object. | |
| 567 | + * @param object $entry Entry object. | |
| 568 | + * @param object $form Form object. | |
| 569 | + * @param string $event Event ('create' or 'update'). | |
| 570 | + */ | |
| 571 | + if ( false === apply_filters( 'frm_custom_trigger_action', false, $action, $entry, $form, $event ) ) { | |
| 572 | + do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event ); | |
| 573 | + do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form ); | |
| 574 | + } | |
| 575 | + | |
| 546 | 576 | // If post is created, get updated $entry object. |
| 547 | 577 | if ( $action->post_excerpt === 'wppost' && $event === 'create' ) { |
| 548 | 578 | $entry = FrmEntry::getOne( $entry->id, true ); |
| 549 | 579 | } |
| 550 | - } | |
| 551 | - } | |
| 580 | + }//end foreach | |
| 581 | + }//end if | |
| 552 | 582 | } |
| 553 | 583 | |
| 554 | 584 | public static function duplicate_form_actions( $form_id, $values, $args = array() ) { |
| 555 | 585 | if ( empty( $args['old_id'] ) ) { |