PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.07.01
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.07.01
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 -60 6.54.07.01 View file →
@@ -38,40 +38,33 @@
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 + 'twilio' => 'FrmDefTwilioAction',
58 + 'highrise' => 'FrmDefHighriseAction',
59 + 'mailpoet' => 'FrmDefMailpoetAction',
60 + 'aweber' => 'FrmDefAweberAction',
68 61 );
69 62
70 63 $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
71 64
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';
65 + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php' );
66 + include_once( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php' );
74 67
75 68 foreach ( $action_classes as $action_class ) {
76 69 self::$registered_actions->register( $action_class );
77 70 }
@@ -90,9 +83,9 @@
90 83 self::maybe_add_action_to_group( $action_controls, $groups );
91 84
92 85 $allowed = self::active_actions( $action_controls );
93 86
94 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php';
87 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/settings.php' );
95 88 }
96 89
97 90 /**
98 91 * Add unknown actions to a group.
@@ -132,9 +125,9 @@
132 125 * @return array
133 126 */
134 127 public static function form_action_groups() {
135 128 $groups = array(
136 - 'misc' => array(
129 + 'misc' => array(
137 130 'name' => '',
138 131 'icon' => 'frm_icon_font frm_shuffle_icon',
139 132 'actions' => array(
140 133 'email',
@@ -139,10 +132,8 @@
139 132 'actions' => array(
140 133 'email',
141 134 'wppost',
142 135 'register',
143 - 'quiz',
144 - 'quiz_outcome',
145 136 'twilio',
146 137 ),
147 138 ),
148 139 'payment' => array(
@@ -211,9 +202,9 @@
211 202
212 203 /* translators: %s: Name of form action */
213 204 $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] );
214 205
215 - $default_shown = array( 'wppost', 'register', 'payment', 'quiz', 'hubspot' );
206 + $default_shown = array( 'wppost', 'register', 'paypal', 'payment', 'mailchimp' );
216 207 $default_shown = array_values( array_diff( $default_shown, $allowed ) );
217 208 $default_position = array_search( $action_control->id_base, $default_shown );
218 209 $allowed_count = count( $allowed );
219 210
@@ -231,28 +222,19 @@
231 222 $upgrading = FrmAddonsController::install_link( $action_control->action_options['plugin'] );
232 223 if ( isset( $upgrading['url'] ) ) {
233 224 $data['data-oneclick'] = json_encode( $upgrading );
234 225 }
235 -
236 - if ( isset( $action_control->action_options['message'] ) ) {
237 - $data['data-message'] = $action_control->action_options['message'];
238 - }
239 -
240 - $requires = FrmFormsHelper::get_plan_required( $upgrading );
241 - if ( $requires && 'free' !== $requires ) {
242 - $data['data-requires'] = $requires;
243 - }
244 226 }
245 227
246 228 // HTML to include on the icon.
247 229 $icon_atts = array();
248 - if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
230 + if ( $action_control->action_options['color'] !== 'var(--primary-hover)' ) {
249 231 $icon_atts = array(
250 - 'style' => '--primary-700:' . $action_control->action_options['color'],
232 + 'style' => '--primary-hover:' . $action_control->action_options['color'],
251 233 );
252 234 }
253 235
254 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
236 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php' );
255 237 }
256 238
257 239 public static function get_form_actions( $action = 'all' ) {
258 240 $temp_actions = self::$registered_actions;
@@ -318,9 +300,9 @@
318 300 $action_control->_set( $action_key );
319 301
320 302 $use_logging = self::should_show_log_message( $form_action->post_excerpt );
321 303
322 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
304 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
323 305 }
324 306
325 307 public static function add_form_action() {
326 308 FrmAppHelper::permission_check( 'frm_edit_forms' );
@@ -341,9 +323,9 @@
341 323
342 324 $values = array();
343 325 $form = self::fields_to_values( $form_id, $values );
344 326
345 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
327 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php' );
346 328 wp_die();
347 329 }
348 330
349 331 public static function fill_action() {
@@ -364,9 +346,9 @@
364 346 $form = self::fields_to_values( $form_action->menu_order, $values );
365 347
366 348 $use_logging = self::should_show_log_message( $action_type );
367 349
368 - include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
350 + include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php' );
369 351 wp_die();
370 352 }
371 353
372 354 /**
@@ -400,18 +382,13 @@
400 382
401 383 return $form;
402 384 }
403 385
404 - /**
405 - * @param int $form_id
406 - * @return void
407 - */
408 386 public static function update_settings( $form_id ) {
409 387 FrmAppHelper::permission_check( 'frm_edit_forms' );
410 388 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
411 389 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
412 - $frm_settings = FrmAppHelper::get_settings();
413 - wp_die( esc_html( $frm_settings->admin_permission ) );
390 + wp_die( esc_html__( 'You do not have permission to do that', 'formidable' ) );
414 391 }
415 392
416 393 global $wpdb;
417 394
@@ -440,10 +417,8 @@
440 417 }
441 418 $old_actions = array_diff( $old_actions, $new_actions );
442 419
443 420 self::delete_missing_actions( $old_actions );
444 -
445 - FrmOnSubmitHelper::save_on_submit_settings( $form_id );
446 421 }
447 422
448 423 public static function delete_missing_actions( $old_actions ) {
449 424 if ( ! empty( $old_actions ) ) {
@@ -470,9 +445,9 @@
470 445 public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
471 446 $action_status = array(
472 447 'post_status' => 'publish',
473 448 );
474 - $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
449 + $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
475 450
476 451 if ( empty( $form_actions ) ) {
477 452 return;
478 453 }
@@ -486,9 +461,9 @@
486 461
487 462 $stored_actions = array();
488 463 $action_priority = array();
489 464
490 - if ( in_array( $event, array( 'create', 'update' ), true ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
465 + if ( in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
491 466 $this_event = 'import';
492 467 } else {
493 468 $this_event = $event;
494 469 }
@@ -494,9 +469,9 @@
494 469 }
495 470
496 471 foreach ( $form_actions as $action ) {
497 472
498 - $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt;
473 + $skip_this_action = ( ! in_array( $this_event, $action->post_content['event'] ) );
499 474 $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
500 475 if ( $skip_this_action ) {
501 476 continue;
502 477 }
@@ -504,9 +479,9 @@
504 479 if ( ! is_object( $entry ) ) {
505 480 $entry = FrmEntry::getOne( $entry, true );
506 481 }
507 482
508 - if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
483 + if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
509 484 continue;
510 485 }
511 486
512 487 $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 +518,9 @@
543 518 do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
544 519 do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
545 520
546 521 // If post is created, get updated $entry object.
547 - if ( $action->post_excerpt === 'wppost' && $event === 'create' ) {
522 + if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
548 523 $entry = FrmEntry::getOne( $entry->id, true );
549 524 }
550 525 }
551 526 }
@@ -551,9 +526,9 @@
551 526 }
552 527 }
553 528
554 529 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
555 - if ( empty( $args['old_id'] ) ) {
530 + if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
556 531 // Continue if we know which actions to copy.
557 532 return;
558 533 }
559 534