PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.19
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.19
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 +48 -200 6.276.19 View file →
@@ -3,12 +3,8 @@
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 8
13 9 /**
14 10 * @var array|null
@@ -67,9 +63,8 @@
67 63 'constantcontact' => 'FrmDefConstContactAction',
68 64 'getresponse' => 'FrmDefGetResponseAction',
69 65 'hubspot' => 'FrmDefHubspotAction',
70 66 'zapier' => 'FrmDefZapierAction',
71 - 'n8n' => 'FrmDefN8NAction',
72 67 'twilio' => 'FrmDefTwilioAction',
73 68 'highrise' => 'FrmDefHighriseAction',
74 69 'mailpoet' => 'FrmDefMailpoetAction',
75 70 'aweber' => 'FrmDefAweberAction',
@@ -76,14 +71,9 @@
76 71 'convertkit' => 'FrmDefConvertKitAction',
77 72 'googlespreadsheet' => 'FrmDefGoogleSpreadsheetAction',
78 73 );
79 74
80 - if ( ! FrmAppHelper::show_new_feature( 'n8n' ) ) {
81 - unset( $action_classes['n8n'] );
82 - }
83 -
84 75 $action_classes = apply_filters( 'frm_registered_form_actions', $action_classes );
85 - $action_classes = self::maybe_unset_highrise( $action_classes );
86 76
87 77 include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/email_action.php';
88 78 include_once FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/default_actions.php';
89 79
@@ -92,31 +82,16 @@
92 82 }
93 83 }
94 84
95 85 /**
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 86 * @since 4.0
113 87 *
114 88 * @param array $values
115 89 */
116 90 public static function email_settings( $values ) {
117 - $form = FrmForm::getOne( $values['id'] );
118 - $groups = self::form_action_groups();
91 + $form = FrmForm::getOne( $values['id'] );
92 + $groups = self::form_action_groups();
93 +
119 94 $action_controls = self::get_form_actions();
120 95 self::maybe_add_action_to_group( $action_controls, $groups );
121 96
122 97 $allowed = self::active_actions( $action_controls );
@@ -127,17 +102,11 @@
127 102 /**
128 103 * Add unknown actions to a group.
129 104 *
130 105 * @since 4.0
131 - *
132 - * @param array $action_controls
133 - * @param array $groups
134 - *
135 - * @return void
136 106 */
137 107 private static function maybe_add_action_to_group( $action_controls, &$groups ) {
138 108 $grouped = array();
139 -
140 109 foreach ( $groups as $group ) {
141 110 if ( isset( $group['actions'] ) ) {
142 111 $grouped = array_merge( $grouped, $group['actions'] );
143 112 }
@@ -143,14 +112,13 @@
143 112 }
144 113 }
145 114
146 115 foreach ( $action_controls as $action ) {
147 - if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped, true ) ) {
116 + if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) {
148 117 continue;
149 118 }
150 119
151 120 $this_group = $action->action_options['group'];
152 -
153 121 if ( ! isset( $groups[ $this_group ] ) ) {
154 122 $this_group = 'misc';
155 123 }
156 124
@@ -171,9 +139,9 @@
171 139 public static function form_action_groups() {
172 140 $groups = array(
173 141 'misc' => array(
174 142 'name' => '',
175 - 'icon' => 'frmfont frm_shuffle_icon',
143 + 'icon' => 'frm_icon_font frm_shuffle_icon',
176 144 'actions' => array(
177 145 'email',
178 146 'wppost',
179 147 'register',
@@ -183,9 +151,9 @@
183 151 ),
184 152 ),
185 153 'payment' => array(
186 154 'name' => __( 'eCommerce', 'formidable' ),
187 - 'icon' => 'frmfont frm_credit_card_alt_icon',
155 + 'icon' => 'frm_icon_font frm_credit_card_alt_icon',
188 156 'actions' => array(
189 157 'paypal',
190 158 'payment',
191 159 ),
@@ -191,9 +159,9 @@
191 159 ),
192 160 ),
193 161 'marketing' => array(
194 162 'name' => __( 'Email Marketing', 'formidable' ),
195 - 'icon' => 'frmfont frm_mail_bulk_icon',
163 + 'icon' => 'frm_icon_font frm_mail_bulk_icon',
196 164 'actions' => array(
197 165 'mailchimp',
198 166 'activecampaign',
199 167 'constantcontact',
@@ -199,15 +167,18 @@
199 167 'constantcontact',
200 168 'getresponse',
201 169 'aweber',
202 170 'mailpoet',
203 - 'convertkit',
204 171 ),
205 172 ),
206 173 'crm' => array(
207 174 'name' => __( 'CRM', 'formidable' ),
208 - 'icon' => 'frmfont frm_address_card_icon',
209 - 'actions' => self::get_crm_actions(),
175 + 'icon' => 'frm_icon_font frm_address_card_icon',
176 + 'actions' => array(
177 + 'salesforce',
178 + 'hubspot',
179 + 'highrise',
180 + ),
210 181 ),
211 182 );
212 183
213 184 return apply_filters( 'frm_action_groups', $groups );
@@ -213,47 +184,21 @@
213 184 return apply_filters( 'frm_action_groups', $groups );
214 185 }
215 186
216 187 /**
217 - * Get the actions to include in the CRM section.
218 - *
219 - * @since 6.23
220 - *
221 - * @return array
222 - */
223 - private static function get_crm_actions() {
224 - $crm_actions = array(
225 - 'salesforce',
226 - 'hubspot',
227 - );
228 -
229 - // Only include Highrise when the add-on is active.
230 - // This is because Highrise is deprecated. We don't want to show it in Lite.
231 - if ( class_exists( 'FrmHrsSettings' ) ) {
232 - $crm_actions[] = 'highrise';
233 - }
234 -
235 - return $crm_actions;
236 - }
237 -
238 - /**
239 188 * Get the number of currently active form actions.
240 189 *
241 190 * @since 4.0
242 191 *
243 - * @param array $action_controls
244 - *
245 192 * @return array
246 193 */
247 194 private static function active_actions( $action_controls ) {
248 195 $allowed = array();
249 -
250 196 foreach ( $action_controls as $action_control ) {
251 - if ( ! empty( $action_control->action_options['active'] ) ) {
197 + if ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) {
252 198 $allowed[] = $action_control->id_base;
253 199 }
254 200 }
255 -
256 201 return $allowed;
257 202 }
258 203
259 204 /**
@@ -259,15 +204,15 @@
259 204 /**
260 205 * For each add-on, add an li, class, and javascript function. If active, add an additional class.
261 206 *
262 207 * @since 4.0
263 - *
264 208 * @param object $action_control
265 209 * @param array $allowed
266 210 */
267 211 public static function show_action_icon_link( $action_control, $allowed ) {
268 - $data = array();
269 - $classes = ' frm_' . $action_control->id_base . '_action frm_single_action';
212 + $data = array();
213 + $classes = ' frm_' . $action_control->id_base . '_action frm_single_action';
214 +
270 215 $group_class = ' frm-group-' . $action_control->action_options['group'];
271 216
272 217 /* translators: %s: Name of form action */
273 218 $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] );
@@ -273,16 +218,15 @@
273 218 $upgrade_label = sprintf( esc_html__( '%s form actions', 'formidable' ), $action_control->action_options['tooltip'] );
274 219
275 220 $default_shown = array( 'wppost', 'register', 'payment', 'quiz', 'hubspot' );
276 221 $default_shown = array_values( array_diff( $default_shown, $allowed ) );
277 - $default_position = array_search( $action_control->id_base, $default_shown, true );
222 + $default_position = array_search( $action_control->id_base, $default_shown );
278 223 $allowed_count = count( $allowed );
279 224
280 - if ( ! empty( $action_control->action_options['active'] ) ) {
225 + if ( isset( $action_control->action_options['active'] ) && $action_control->action_options['active'] ) {
281 226 $classes .= ' frm_active_action';
282 227 } else {
283 228 $classes .= ' frm_inactive_action';
284 -
285 229 if ( $default_position !== false && ( $allowed_count + $default_position ) < 6 ) {
286 230 $group_class .= ' frm-default-show';
287 231 }
288 232
@@ -289,9 +233,8 @@
289 233 $data['data-upgrade'] = $upgrade_label;
290 234 $data['data-medium'] = 'settings-' . $action_control->id_base;
291 235
292 236 $upgrading = FrmAddonsController::install_link( $action_control->action_options['plugin'] );
293 -
294 237 if ( isset( $upgrading['url'] ) ) {
295 238 $data['data-oneclick'] = json_encode( $upgrading );
296 239 }
297 240
@@ -299,9 +242,8 @@
299 242 $data['data-message'] = $action_control->action_options['message'];
300 243 }
301 244
302 245 $requires = FrmFormsHelper::get_plan_required( $upgrading );
303 -
304 246 if ( $requires && 'free' !== $requires ) {
305 247 $data['data-requires'] = $requires;
306 248 }
307 249 }//end if
@@ -307,9 +249,8 @@
307 249 }//end if
308 250
309 251 // HTML to include on the icon.
310 252 $icon_atts = array();
311 -
312 253 if ( $action_control->action_options['color'] !== 'var(--primary-700)' ) {
313 254 $icon_atts = array(
314 255 'style' => '--primary-700:' . $action_control->action_options['color'],
315 256 );
@@ -319,15 +260,13 @@
319 260 }
320 261
321 262 /**
322 263 * @param string $action
323 - *
324 264 * @return array|FrmFormAction A single form action is returned when a specific $action value is requested.
325 265 */
326 266 public static function get_form_actions( $action = 'all' ) {
327 267 $temp_actions = self::$registered_actions;
328 -
329 - if ( ! $temp_actions ) {
268 + if ( empty( $temp_actions ) ) {
330 269 self::actions_init();
331 270 $temp_actions = self::$registered_actions->actions;
332 271 } else {
333 272 $temp_actions = $temp_actions->actions;
@@ -335,9 +274,9 @@
335 274
336 275 $actions = array();
337 276
338 277 foreach ( $temp_actions as $a ) {
339 - if ( 'all' !== $action && $a->id_base === $action ) {
278 + if ( 'all' !== $action && $a->id_base == $action ) {
340 279 return $a;
341 280 }
342 281
343 282 $actions[ $a->id_base ] = $a;
@@ -347,16 +286,11 @@
347 286 }
348 287
349 288 /**
350 289 * @since 2.0
351 - *
352 - * @param object $form
353 - * @param array $values
354 - *
355 - * @return void
356 290 */
357 291 public static function list_actions( $form, $values ) {
358 - if ( ! $form ) {
292 + if ( empty( $form ) ) {
359 293 return;
360 294 }
361 295
362 296 /**
@@ -401,20 +335,17 @@
401 335 * @since 6.17
402 336 *
403 337 * @param int|string $form_id
404 338 * @param array $form_actions
405 - *
406 339 * @return void
407 340 */
408 341 private static function maybe_show_limit_warning( $form_id, $form_actions ) {
409 342 $count = count( $form_actions );
410 -
411 343 if ( $count < 99 ) {
412 344 return;
413 345 }
414 346
415 347 $limit = FrmFormAction::get_action_limit( $form_id );
416 -
417 348 if ( $limit < 99 || $count < $limit ) {
418 349 return;
419 350 }
420 351
@@ -420,9 +351,9 @@
420 351
421 352 $documentation_url = 'https://formidableforms.com/knowledgebase/frm_form_action_limit/#kb-increase-limit-of-form-actions';
422 353
423 354 echo '<div class="frm_warning_style">';
424 - FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon' );
355 + FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon' );
425 356 echo '&nbsp;';
426 357 printf(
427 358 // translators: %s: URL to documentation
428 359 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,17 +361,8 @@
430 361 );
431 362 echo '</div>';
432 363 }
433 364
434 - /**
435 - * @param WP_Post $form_action
436 - * @param object $form
437 - * @param int $action_key Action ID.
438 - * @param FrmFormAction $action_control
439 - * @param array $values
440 - *
441 - * @return void
442 - */
443 365 public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
444 366 $action_control->_set( $action_key );
445 367
446 368 $use_logging = self::should_show_log_message( $form_action->post_excerpt );
@@ -462,14 +384,16 @@
462 384 */
463 385 $action_control = self::get_form_actions( $action_type );
464 386 $action_control->_set( $action_key );
465 387
466 - $form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
388 + $form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
389 +
467 390 $form_action = $action_control->prepare_new( $form_id );
468 391 $use_logging = self::should_show_log_message( $action_type );
469 - $values = array();
470 - $form = self::fields_to_values( $form_id, $values );
471 392
393 + $values = array();
394 + $form = self::fields_to_values( $form_id, $values );
395 +
472 396 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
473 397 wp_die();
474 398 }
475 399
@@ -476,19 +400,21 @@
476 400 public static function fill_action() {
477 401 FrmAppHelper::permission_check( 'frm_edit_forms' );
478 402 check_ajax_referer( 'frm_ajax', 'nonce' );
479 403
480 - $action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
481 - $action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
404 + $action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
405 + $action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
406 +
482 407 $action_control = self::get_form_actions( $action_type );
483 -
484 - if ( ! $action_control ) {
408 + if ( empty( $action_control ) ) {
485 409 wp_die();
486 410 }
487 411
488 412 $form_action = $action_control->get_single_action( $action_key );
489 - $values = array();
490 - $form = self::fields_to_values( $form_action->menu_order, $values );
413 +
414 + $values = array();
415 + $form = self::fields_to_values( $form_action->menu_order, $values );
416 +
491 417 $use_logging = self::should_show_log_message( $action_type );
492 418
493 419 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
494 420 wp_die();
@@ -495,11 +421,8 @@
495 421 }
496 422
497 423 /**
498 424 * @since 3.06.04
499 - *
500 - * @param string $action_type
501 - *
502 425 * @return bool
503 426 */
504 427 private static function should_show_log_message( $action_type ) {
505 428 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
@@ -505,14 +428,8 @@
505 428 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
506 429 return in_array( $action_type, $logging, true ) && ! function_exists( 'frm_log_autoloader' );
507 430 }
508 431
509 - /**
510 - * @param int|string $form_id
511 - * @param array $values
512 - *
513 - * @return object
514 - */
515 432 private static function fields_to_values( $form_id, array &$values ) {
516 433 $form = FrmForm::getOne( $form_id );
517 434
518 435 $values = array(
@@ -520,14 +437,12 @@
520 437 'id' => $form->id,
521 438 );
522 439
523 440 $fields = FrmField::get_all_for_form( $form->id );
524 -
525 441 foreach ( $fields as $k => $f ) {
526 442 $f = (array) $f;
527 443 $opts = (array) $f['field_options'];
528 444 $f = array_merge( $opts, $f );
529 -
530 445 if ( ! isset( $f['post_field'] ) ) {
531 446 $f['post_field'] = '';
532 447 }
533 448 $values['fields'][] = $f;
@@ -538,15 +453,13 @@
538 453 }
539 454
540 455 /**
541 456 * @param int $form_id
542 - *
543 457 * @return void
544 458 */
545 459 public static function update_settings( $form_id ) {
546 460 FrmAppHelper::permission_check( 'frm_edit_forms' );
547 461 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
548 -
549 462 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
550 463 $frm_settings = FrmAppHelper::get_settings();
551 464 $error_args = array(
552 465 'title' => __( 'Verification failed', 'formidable' ),
@@ -579,19 +492,17 @@
579 492 $new_actions = array();
580 493
581 494 foreach ( $registered_actions as $registered_action ) {
582 495 $action_ids = $registered_action->update_callback( $form_id );
583 -
584 - if ( $action_ids ) {
496 + if ( ! empty( $action_ids ) ) {
585 497 $new_actions[] = $action_ids;
586 498 }
587 499 }
588 500
589 501 // Only use array_merge if there are new actions.
590 - if ( $new_actions ) {
502 + if ( ! empty( $new_actions ) ) {
591 503 $new_actions = call_user_func_array( 'array_merge', $new_actions );
592 504 }
593 -
594 505 $old_actions = array_diff( $old_actions, $new_actions );
595 506
596 507 self::delete_missing_actions( $old_actions );
597 508
@@ -597,15 +508,10 @@
597 508
598 509 FrmOnSubmitHelper::save_on_submit_settings( $form_id );
599 510 }
600 511
601 - /**
602 - * @param array $old_actions
603 - *
604 - * @return void
605 - */
606 512 public static function delete_missing_actions( $old_actions ) {
607 - if ( $old_actions ) {
513 + if ( ! empty( $old_actions ) ) {
608 514 foreach ( $old_actions as $old_id ) {
609 515 wp_delete_post( $old_id );
610 516 }
611 517 FrmDb::cache_delete_group( 'frm_actions' );
@@ -611,15 +517,8 @@
611 517 FrmDb::cache_delete_group( 'frm_actions' );
612 518 }
613 519 }
614 520
615 - /**
616 - * @param int|string $entry_id
617 - * @param int|string $form_id
618 - * @param array $args
619 - *
620 - * @return void
621 - */
622 521 public static function trigger_create_actions( $entry_id, $form_id, $args = array() ) {
623 522 $filter_args = $args;
624 523 $filter_args['entry_id'] = $entry_id;
625 524 $filter_args['form_id'] = $form_id;
@@ -636,34 +535,23 @@
636 535 self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
637 536 }
638 537
639 538 /**
640 - * @param string $event
641 - * @param int|object|string $form
642 - * @param int|string $entry
643 - * @param string $type
644 - * @param array $args
645 - *
646 - * @return void
539 + * @param string $event
647 540 */
648 - public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
541 + public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
649 542 $action_status = array(
650 543 'post_status' => 'publish',
651 544 );
652 545 $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
653 546
654 - if ( ! $form_actions ) {
547 + if ( empty( $form_actions ) ) {
655 548 return;
656 549 }
657 550
658 551 FrmForm::maybe_get_form( $form );
659 552
660 - if ( ! is_object( $form ) ) {
661 - return;
662 - }
663 -
664 553 $link_settings = self::get_form_actions( $type );
665 -
666 554 if ( 'all' !== $type ) {
667 555 $link_settings = array( $type => $link_settings );
668 556 }
669 557
@@ -676,11 +564,11 @@
676 564 $this_event = $event;
677 565 }
678 566
679 567 foreach ( $form_actions as $action ) {
568 +
680 569 $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt;
681 570 $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
682 -
683 571 if ( $skip_this_action ) {
684 572 continue;
685 573 }
686 574
@@ -687,18 +575,17 @@
687 575 if ( ! is_object( $entry ) ) {
688 576 $entry = FrmEntry::getOne( $entry, true );
689 577 }
690 578
691 - if ( ! $entry || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
579 + if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
692 580 continue;
693 581 }
694 582
695 - $child_entry = ( is_numeric( $form->parent_form_id ) && $form->parent_form_id ) || ( $entry && ( (int) $entry->form_id !== (int) $form->id || $entry->parent_item_id ) ) || ! empty( $args['is_child'] ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
583 + $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'] ) );
696 584
697 585 if ( $child_entry ) {
698 586 // maybe trigger actions for sub forms
699 587 $trigger_children = apply_filters( 'frm_use_embedded_form_actions', false, compact( 'form', 'entry' ) );
700 -
701 588 if ( ! $trigger_children ) {
702 589 continue;
703 590 }
704 591 }
@@ -704,9 +591,8 @@
704 591 }
705 592
706 593 // Check conditional logic.
707 594 $stop = FrmFormAction::action_conditions_met( $action, $entry );
708 -
709 595 if ( $stop ) {
710 596 continue;
711 597 }
712 598
@@ -716,9 +602,9 @@
716 602
717 603 unset( $action );
718 604 }//end foreach
719 605
720 - if ( $stored_actions ) {
606 + if ( ! empty( $stored_actions ) ) {
721 607 asort( $action_priority );
722 608
723 609 // Make sure hooks are loaded.
724 610 new FrmNotification();
@@ -749,15 +635,8 @@
749 635 }//end foreach
750 636 }//end if
751 637 }
752 638
753 - /**
754 - * @param int|string $form_id
755 - * @param array $values
756 - * @param array $args
757 - *
758 - * @return void
759 - */
760 639 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
761 640 if ( empty( $args['old_id'] ) ) {
762 641 // Continue if we know which actions to copy.
763 642 return;
@@ -773,13 +652,8 @@
773 652 unset( $action_control );
774 653 }
775 654 }
776 655
777 - /**
778 - * @param string $where
779 - *
780 - * @return string
781 - */
782 656 public static function limit_by_type( $where ) {
783 657 global $frm_vars, $wpdb;
784 658
785 659 if ( ! isset( $frm_vars['action_type'] ) ) {
@@ -785,31 +659,15 @@
785 659 if ( ! isset( $frm_vars['action_type'] ) ) {
786 660 return $where;
787 661 }
788 662
789 - return $where . $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
790 - }
663 + $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
791 664
792 - /**
793 - * Prevent WPML from filtering form actions based on the active language.
794 - *
795 - * @since 6.20
796 - *
797 - * @param bool|null $null
798 - * @param string $post_type
799 - *
800 - * @return bool|null
801 - */
802 - public static function prevent_wpml_translations( $null, $post_type ) {
803 - return self::$action_post_type === $post_type ? false : $null;
665 + return $where;
804 666 }
805 667 }
806 668
807 669 class Frm_Form_Action_Factory {
808 -
809 - /**
810 - * @var array
811 - */
812 670 public $actions = array();
813 671
814 672 public function __construct() {
815 673 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
@@ -814,22 +672,12 @@
814 672 public function __construct() {
815 673 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
816 674 }
817 675
818 - /**
819 - * @param string $action_class
820 - *
821 - * @return void
822 - */
823 676 public function register( $action_class ) {
824 677 $this->actions[ $action_class ] = new $action_class();
825 678 }
826 679
827 - /**
828 - * @param string $action_class
829 - *
830 - * @return void
831 - */
832 680 public function unregister( $action_class ) {
833 681 if ( isset( $this->actions[ $action_class ] ) ) {
834 682 unset( $this->actions[ $action_class ] );
835 683 }