PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.0
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.0
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 +23 -275 6.266.0 View file →
@@ -3,17 +3,9 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 class FrmFormActionsController {
7 -
8 - /**
9 - * @var string
10 - */
11 7 public static $action_post_type = 'frm_form_actions';
12 -
13 - /**
14 - * @var array|null
15 - */
16 8 public static $registered_actions;
17 9
18 10 /**
19 11 * Variables saved in the post:
@@ -56,9 +48,9 @@
56 48 'email' => 'FrmEmailAction',
57 49 'wppost' => 'FrmDefPostAction',
58 50 'register' => 'FrmDefRegAction',
59 51 'paypal' => 'FrmDefPayPalAction',
60 - 'payment' => 'FrmTransLiteAction',
52 + 'payment' => 'FrmDefHrsAction',
61 53 'quiz' => 'FrmDefQuizAction',
62 54 'quiz_outcome' => 'FrmDefQuizOutcomeAction',
63 55 'mailchimp' => 'FrmDefMlcmpAction',
64 56 'api' => 'FrmDefApiAction',
@@ -67,23 +59,16 @@
67 59 'constantcontact' => 'FrmDefConstContactAction',
68 60 'getresponse' => 'FrmDefGetResponseAction',
69 61 'hubspot' => 'FrmDefHubspotAction',
70 62 'zapier' => 'FrmDefZapierAction',
71 - 'n8n' => 'FrmDefN8NAction',
72 63 'twilio' => 'FrmDefTwilioAction',
73 64 'highrise' => 'FrmDefHighriseAction',
74 65 'mailpoet' => 'FrmDefMailpoetAction',
75 66 'aweber' => 'FrmDefAweberAction',
76 - 'convertkit' => 'FrmDefConvertKitAction',
77 67 'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction',
78 68 );
79 69
80 - if ( ! FrmAppHelper::show_new_feature( 'n8n' ) ) {
81 - unset( $action_classes['n8n'] );
82 - }
83 -
84 70 $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
85 - $action_classes = self::maybe_unset_highrise( $action_classes );
86 71
87 72 include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php';
88 73 include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php';
89 74
@@ -92,24 +77,8 @@
92 77 }
93 78 }
94 79
95 80 /**
96 - * Remove the Highrise action if it is not registered.
97 - *
98 - * @since 6.23
99 - *
100 - * @param array $action_classes
101 - *
102 - * @return array
103 - */
104 - private static function maybe_unset_highrise( $action_classes ) {
105 - if ( 'FrmDefHighriseAction' === ( $action_classes['highrise'] ?? '' ) ) {
106 - unset( $action_classes['highrise'] );
107 - }
108 - return $action_classes;
109 - }
110 -
111 - /**
112 81 * @since 4.0
113 82 *
114 83 * @param array $values
115 84 */
@@ -128,17 +97,11 @@
128 97 /**
129 98 * Add unknown actions to a group.
130 99 *
131 100 * @since 4.0
132 - *
133 - * @param array $action_controls
134 - * @param array $groups
135 - *
136 - * @return void
137 101 */
138 102 private static function maybe_add_action_to_group( $action_controls, &$groups ) {
139 103 $grouped = array();
140 -
141 104 foreach ( $groups as $group ) {
142 105 if ( isset( $group['actions'] ) ) {
143 106 $grouped = array_merge( $grouped, $group['actions'] );
144 107 }
@@ -149,9 +112,8 @@
149 112 continue;
150 113 }
151 114
152 115 $this_group = $action->action_options['group'];
153 -
154 116 if ( ! isset( $groups[ $this_group ] ) ) {
155 117 $this_group = 'misc';
156 118 }
157 119
@@ -200,15 +162,18 @@
200 162 'constantcontact',
201 163 'getresponse',
202 164 'aweber',
203 165 'mailpoet',
204 - 'convertkit',
205 166 ),
206 167 ),
207 168 'crm' => array(
208 169 'name' => __( 'CRM', 'formidable' ),
209 170 'icon' => 'frm_icon_font frm_address_card_icon',
210 - 'actions' => self::get_crm_actions(),
171 + 'actions' => array(
172 + 'salesforce',
173 + 'hubspot',
174 + 'highrise',
175 + ),
211 176 ),
212 177 );
213 178
214 179 return apply_filters( 'frm_action_groups', $groups );
@@ -214,41 +179,16 @@
214 179 return apply_filters( 'frm_action_groups', $groups );
215 180 }
216 181
217 182 /**
218 - * Get the actions to include in the CRM section.
219 - *
220 - * @since 6.23
221 - *
222 - * @return array
223 - */
224 - private static function get_crm_actions() {
225 - $crm_actions = array(
226 - 'salesforce',
227 - 'hubspot',
228 - );
229 -
230 - // Only include Highrise when the add-on is active.
231 - // This is because Highrise is deprecated. We don't want to show it in Lite.
232 - if ( class_exists( 'FrmHrsSettings' ) ) {
233 - $crm_actions[] = 'highrise';
234 - }
235 -
236 - return $crm_actions;
237 - }
238 -
239 - /**
240 183 * Get the number of currently active form actions.
241 184 *
242 185 * @since 4.0
243 186 *
244 - * @param array $action_controls
245 - *
246 187 * @return array
247 188 */
248 189 private static function active_actions( $action_controls ) {
249 190 $allowed = array();
250 -
251 191 foreach ( $action_controls as $action_control ) {
252 192 if ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) {
253 193 $allowed[] = $action_control->id_base;
254 194 }
@@ -259,9 +199,8 @@
259 199 /**
260 200 * For each add-on, add an li, class, and javascript function. If active, add an additional class.
261 201 *
262 202 * @since 4.0
263 - *
264 203 * @param object $action_control
265 204 * @param array $allowed
266 205 */
267 206 public static function show_action_icon_link( $action_control, $allowed ) {
@@ -281,9 +220,8 @@
281 220 if ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) {
282 221 $classes .= ' frm_active_action';
283 222 } else {
284 223 $classes .= ' frm_inactive_action';
285 -
286 224 if ( $default_position !== false && ( $allowed_count + $default_position ) < 6 ) {
287 225 $group_class .= ' frm-default-show';
288 226 }
289 227
@@ -290,9 +228,8 @@
290 228 $data['data-upgrade'] = $upgrade_label;
291 229 $data['data-medium'] = 'settings-' . $action_control->id_base;
292 230
293 231 $upgrading = FrmAddonsController::install_link( $action_control->action_options['plugin'] );
294 -
295 232 if ( isset( $upgrading['url'] ) ) {
296 233 $data['data-oneclick'] = json_encode( $upgrading );
297 234 }
298 235
@@ -300,17 +237,15 @@
300 237 $data['data-message'] = $action_control->action_options['message'];
301 238 }
302 239
303 240 $requires = FrmFormsHelper::get_plan_required( $upgrading );
304 -
305 241 if ( $requires && 'free' !== $requires ) {
306 242 $data['data-requires'] = $requires;
307 243 }
308 - }//end if
244 + }
309 245
310 246 // HTML to include on the icon.
311 247 $icon_atts = array();
312 -
313 248 if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
314 249 $icon_atts = array(
315 250 'style' => '--primary-700:' . $action_control->action_options['color'],
316 251 );
@@ -318,16 +253,10 @@
318 253
319 254 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_icon.php';
320 255 }
321 256
322 - /**
323 - * @param string $action
324 - *
325 - * @return array|FrmFormAction A single form action is returned when a specific $action value is requested.
326 - */
327 257 public static function get_form_actions( $action = 'all' ) {
328 258 $temp_actions = self::$registered_actions;
329 -
330 259 if ( empty( $temp_actions ) ) {
331 260 self::actions_init();
332 261 $temp_actions = self::$registered_actions->actions;
333 262 } else {
@@ -336,9 +265,9 @@
336 265
337 266 $actions = array();
338 267
339 268 foreach ( $temp_actions as $a ) {
340 - if ( 'all' !== $action && $a->id_base == $action ) {
269 + if ( 'all' != $action && $a->id_base == $action ) {
341 270 return $a;
342 271 }
343 272
344 273 $actions[ $a->id_base ] = $a;
@@ -348,13 +277,8 @@
348 277 }
349 278
350 279 /**
351 280 * @since 2.0
352 - *
353 - * @param object $form
354 - * @param array $values
355 - *
356 - * @return void
357 281 */
358 282 public static function list_actions( $form, $values ) {
359 283 if ( empty( $form ) ) {
360 284 return;
@@ -371,11 +295,8 @@
371 295 'post_status' => 'all',
372 296 );
373 297 $form_actions = FrmFormAction::get_action_for_form( $form->id, 'all', $filters );
374 298
375 - /**
376 - * @var array
377 - */
378 299 $action_controls = self::get_form_actions();
379 300
380 301 $action_map = array();
381 302
@@ -382,10 +303,8 @@
382 303 foreach ( $action_controls as $key => $control ) {
383 304 $action_map[ $control->id_base ] = $key;
384 305 }
385 306
386 - self::maybe_show_limit_warning( $form->id, $form_actions );
387 -
388 307 foreach ( $form_actions as $action ) {
389 308 if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
390 309 // don't try and show settings if action no longer exists
391 310 continue;
@@ -394,54 +313,8 @@
394 313 self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
395 314 }
396 315 }
397 316
398 - /**
399 - * Show a warning before the form actions list if there are 99 actions, and the limit is set to 99.
400 - * If it is filtered, the warning is still shown when applicable, just using the new limit.
401 - *
402 - * @since 6.17
403 - *
404 - * @param int|string $form_id
405 - * @param array $form_actions
406 - *
407 - * @return void
408 - */
409 - private static function maybe_show_limit_warning( $form_id, $form_actions ) {
410 - $count = count( $form_actions );
411 -
412 - if ( $count < 99 ) {
413 - return;
414 - }
415 -
416 - $limit = FrmFormAction::get_action_limit( $form_id );
417 -
418 - if ( $limit < 99 || $count < $limit ) {
419 - return;
420 - }
421 -
422 - $documentation_url = 'https://formidableforms.com/knowledgebase/frm_form_action_limit/#kb-increase-limit-of-form-actions';
423 -
424 - echo '<div class="frm_warning_style">';
425 - FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon' );
426 - echo '&nbsp;';
427 - printf(
428 - // translators: %s: URL to documentation
429 - esc_html__( 'You have reached your form action limit. To increase this limit, you will require additional code. Visit our documentation at %s.', 'formidable' ),
430 - '<a href="' . esc_url( $documentation_url ) . '" target="_blank">' . esc_html( $documentation_url ) . '</a>'
431 - );
432 - echo '</div>';
433 - }
434 -
435 - /**
436 - * @param WP_Post $form_action
437 - * @param object $form
438 - * @param int $action_key Action ID.
439 - * @param FrmFormAction $action_control
440 - * @param array $values
441 - *
442 - * @return void
443 - */
444 317 public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
445 318 $action_control->_set( $action_key );
446 319
447 320 $use_logging = self::should_show_log_message( $form_action->post_excerpt );
@@ -457,11 +330,8 @@
457 330
458 331 $action_key = FrmAppHelper::get_param( 'list_id', '', 'post', 'absint' );
459 332 $action_type = FrmAppHelper::get_param( 'type', '', 'post', 'sanitize_text_field' );
460 333
461 - /**
462 - * @var FrmFormAction
463 - */
464 334 $action_control = self::get_form_actions( $action_type );
465 335 $action_control->_set( $action_key );
466 336
467 337 $form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
@@ -483,9 +353,8 @@
483 353 $action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
484 354 $action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
485 355
486 356 $action_control = self::get_form_actions( $action_type );
487 -
488 357 if ( empty( $action_control ) ) {
489 358 wp_die();
490 359 }
491 360
@@ -501,24 +370,15 @@
501 370 }
502 371
503 372 /**
504 373 * @since 3.06.04
505 - *
506 - * @param string $action_type
507 - *
508 374 * @return bool
509 375 */
510 376 private static function should_show_log_message( $action_type ) {
511 377 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
512 - return in_array( $action_type, $logging, true ) && ! function_exists( 'frm_log_autoloader' );
378 + return in_array( $action_type, $logging ) && ! function_exists( 'frm_log_autoloader' );
513 379 }
514 380
515 - /**
516 - * @param int|string $form_id
517 - * @param array $values
518 - *
519 - * @return object
520 - */
521 381 private static function fields_to_values( $form_id, array &$values ) {
522 382 $form = FrmForm::getOne( $form_id );
523 383
524 384 $values = array(
@@ -526,14 +386,12 @@
526 386 'id' => $form->id,
527 387 );
528 388
529 389 $fields = FrmField::get_all_for_form( $form->id );
530 -
531 390 foreach ( $fields as $k => $f ) {
532 391 $f = (array) $f;
533 392 $opts = (array) $f['field_options'];
534 393 $f = array_merge( $opts, $f );
535 -
536 394 if ( ! isset( $f['post_field'] ) ) {
537 395 $f['post_field'] = '';
538 396 }
539 397 $values['fields'][] = $f;
@@ -544,31 +402,16 @@
544 402 }
545 403
546 404 /**
547 405 * @param int $form_id
548 - *
549 406 * @return void
550 407 */
551 408 public static function update_settings( $form_id ) {
552 409 FrmAppHelper::permission_check( 'frm_edit_forms' );
553 410 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
554 -
555 411 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
556 412 $frm_settings = FrmAppHelper::get_settings();
557 - $error_args = array(
558 - 'title' => __( 'Verification failed', 'formidable' ),
559 - 'body' => $frm_settings->admin_permission,
560 - 'cancel_url' => add_query_arg(
561 - array(
562 - 'page' => 'formidable',
563 - 'frm_action' => 'settings',
564 - 'id' => $form_id,
565 - ),
566 - admin_url( 'admin.php?' )
567 - ),
568 - );
569 - FrmAppController::show_error_modal( $error_args );
570 - return;
413 + wp_die( esc_html( $frm_settings->admin_permission ) );
571 414 }
572 415
573 416 global $wpdb;
574 417
@@ -585,9 +428,8 @@
585 428 $new_actions = array();
586 429
587 430 foreach ( $registered_actions as $registered_action ) {
588 431 $action_ids = $registered_action->update_callback( $form_id );
589 -
590 432 if ( ! empty( $action_ids ) ) {
591 433 $new_actions[] = $action_ids;
592 434 }
593 435 }
@@ -595,9 +437,8 @@
595 437 // Only use array_merge if there are new actions.
596 438 if ( ! empty( $new_actions ) ) {
597 439 $new_actions = call_user_func_array( 'array_merge', $new_actions );
598 440 }
599 -
600 441 $old_actions = array_diff( $old_actions, $new_actions );
601 442
602 443 self::delete_missing_actions( $old_actions );
603 444
@@ -603,13 +444,8 @@
603 444
604 445 FrmOnSubmitHelper::save_on_submit_settings( $form_id );
605 446 }
606 447
607 - /**
608 - * @param array $old_actions
609 - *
610 - * @return void
611 - */
612 448 public static function delete_missing_actions( $old_actions ) {
613 449 if ( ! empty( $old_actions ) ) {
614 450 foreach ( $old_actions as $old_id ) {
615 451 wp_delete_post( $old_id );
@@ -617,40 +453,20 @@
617 453 FrmDb::cache_delete_group( 'frm_actions' );
618 454 }
619 455 }
620 456
621 - /**
622 - * @param int|string $entry_id
623 - * @param int|string $form_id
624 - * @param array $args
625 - *
626 - * @return void
627 - */
628 457 public static function trigger_create_actions( $entry_id, $form_id, $args = array() ) {
629 458 $filter_args = $args;
630 459 $filter_args['entry_id'] = $entry_id;
631 460 $filter_args['form_id'] = $form_id;
632 461
633 - /**
634 - * @since 2.0.23
635 - * @since 6.11.2 $filter_args is now passed instead of $args. It includes additional ID data.
636 - *
637 - * @param string $event 'create' by default. Pro may filter this value to 'draft' instead.
638 - * @param array $filter_args
639 - */
640 - $event = apply_filters( 'frm_trigger_create_action', 'create', $filter_args );
462 + $event = apply_filters( 'frm_trigger_create_action', 'create', $args );
641 463
642 464 self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
643 465 }
644 466
645 467 /**
646 - * @param string $event
647 - * @param int|object|string $form
648 - * @param int|string $entry
649 - * @param string $type
650 - * @param array $args
651 - *
652 - * @return void
468 + * @param string $event
653 469 */
654 470 public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
655 471 $action_status = array(
656 472 'post_status' => 'publish',
@@ -662,15 +478,10 @@
662 478 }
663 479
664 480 FrmForm::maybe_get_form( $form );
665 481
666 - if ( ! is_object( $form ) ) {
667 - return;
668 - }
669 -
670 482 $link_settings = self::get_form_actions( $type );
671 -
672 - if ( 'all' !== $type ) {
483 + if ( 'all' != $type ) {
673 484 $link_settings = array( $type => $link_settings );
674 485 }
675 486
676 487 $stored_actions = array();
@@ -675,9 +486,9 @@
675 486
676 487 $stored_actions = array();
677 488 $action_priority = array();
678 489
679 - if ( in_array( $event, array( 'create', 'update' ), true ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
490 + if ( in_array( $event, array( 'create', 'update' ) ) && defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
680 491 $this_event = 'import';
681 492 } else {
682 493 $this_event = $event;
683 494 }
@@ -685,9 +496,8 @@
685 496 foreach ( $form_actions as $action ) {
686 497
687 498 $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt;
688 499 $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
689 -
690 500 if ( $skip_this_action ) {
691 501 continue;
692 502 }
693 503
@@ -694,18 +504,17 @@
694 504 if ( ! is_object( $entry ) ) {
695 505 $entry = FrmEntry::getOne( $entry, true );
696 506 }
697 507
698 - if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
508 + if ( empty( $entry ) || ( $entry->is_draft && $event != 'draft' ) ) {
699 509 continue;
700 510 }
701 511
702 - $child_entry = ( is_numeric( $form->parent_form_id ) && $form->parent_form_id ) || ( $entry && ( $entry->form_id != $form->id || $entry->parent_item_id ) ) || ! empty( $args['is_child'] );
512 + $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'] ) );
703 513
704 514 if ( $child_entry ) {
705 515 // maybe trigger actions for sub forms
706 516 $trigger_children = apply_filters( 'frm_use_embedded_form_actions', false, compact( 'form', 'entry' ) );
707 -
708 517 if ( ! $trigger_children ) {
709 518 continue;
710 519 }
711 520 }
@@ -711,9 +520,8 @@
711 520 }
712 521
713 522 // Check conditional logic.
714 523 $stop = FrmFormAction::action_conditions_met( $action, $entry );
715 -
716 524 if ( $stop ) {
717 525 continue;
718 526 }
719 527
@@ -721,9 +529,9 @@
721 529 $stored_actions[ $action->ID ] = $action;
722 530 $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority'];
723 531
724 532 unset( $action );
725 - }//end foreach
533 + }
726 534
727 535 if ( ! empty( $stored_actions ) ) {
728 536 asort( $action_priority );
729 537
@@ -731,49 +539,25 @@
731 539 new FrmNotification();
732 540
733 541 foreach ( $action_priority as $action_id => $priority ) {
734 542 $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 );
735 545
736 - /**
737 - * Allows custom form action trigger.
738 - *
739 - * @since 6.10
740 - *
741 - * @param bool $skip Skip default trigger.
742 - * @param object $action Action object.
743 - * @param object $entry Entry object.
744 - * @param object $form Form object.
745 - * @param string $event Event ('create' or 'update').
746 - */
747 - if ( false === apply_filters( 'frm_custom_trigger_action', false, $action, $entry, $form, $event ) ) {
748 - do_action( 'frm_trigger_' . $action->post_excerpt . '_action', $action, $entry, $form, $event );
749 - do_action( 'frm_trigger_' . $action->post_excerpt . '_' . $event . '_action', $action, $entry, $form );
750 - }
751 -
752 546 // If post is created, get updated $entry object.
753 - if ( $action->post_excerpt === 'wppost' && $event === 'create' ) {
547 + if ( $action->post_excerpt == 'wppost' && $event == 'create' ) {
754 548 $entry = FrmEntry::getOne( $entry->id, true );
755 549 }
756 - }//end foreach
757 - }//end if
550 + }
551 + }
758 552 }
759 553
760 - /**
761 - * @param int|string $form_id
762 - * @param array $values
763 - * @param array $args
764 - *
765 - * @return void
766 - */
767 554 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
768 - if ( empty( $args['old_id'] ) ) {
555 + if ( ! isset( $args['old_id'] ) || empty( $args['old_id'] ) ) {
769 556 // Continue if we know which actions to copy.
770 557 return;
771 558 }
772 559
773 - /**
774 - * @var array
775 - */
776 560 $action_controls = self::get_form_actions();
777 561
778 562 foreach ( $action_controls as $action_control ) {
779 563 $action_control->duplicate_form_actions( $form_id, $args['old_id'] );
@@ -780,13 +564,8 @@
780 564 unset( $action_control );
781 565 }
782 566 }
783 567
784 - /**
785 - * @param string $where
786 - *
787 - * @return string
788 - */
789 568 public static function limit_by_type( $where ) {
790 569 global $frm_vars, $wpdb;
791 570
792 571 if ( ! isset( $frm_vars['action_type'] ) ) {
@@ -796,32 +575,11 @@
796 575 $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
797 576
798 577 return $where;
799 578 }
800 -
801 - /**
802 - * Prevent WPML from filtering form actions based on the active language.
803 - *
804 - * @since 6.20
805 - *
806 - * @param bool|null $null
807 - * @param string $post_type
808 - *
809 - * @return bool|null
810 - */
811 - public static function prevent_wpml_translations( $null, $post_type ) {
812 - if ( self::$action_post_type === $post_type ) {
813 - return false;
814 - }
815 - return $null;
816 - }
817 579 }
818 580
819 581 class Frm_Form_Action_Factory {
820 -
821 - /**
822 - * @var array
823 - */
824 582 public $actions = array();
825 583
826 584 public function __construct() {
827 585 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
@@ -826,22 +584,12 @@
826 584 public function __construct() {
827 585 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
828 586 }
829 587
830 - /**
831 - * @param string $action_class
832 - *
833 - * @return void
834 - */
835 588 public function register( $action_class ) {
836 589 $this->actions[ $action_class ] = new $action_class();
837 590 }
838 591
839 - /**
840 - * @param string $action_class
841 - *
842 - * @return void
843 - */
844 592 public function unregister( $action_class ) {
845 593 if ( isset( $this->actions[ $action_class ] ) ) {
846 594 unset( $this->actions[ $action_class ] );
847 595 }