PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.16.3
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.16.3
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 +47 -235 6.276.16.3 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 /**
@@ -381,10 +315,8 @@
381 315 foreach ( $action_controls as $key => $control ) {
382 316 $action_map[ $control->id_base ] = $key;
383 317 }
384 318
385 - self::maybe_show_limit_warning( $form->id, $form_actions );
386 -
387 319 foreach ( $form_actions as $action ) {
388 320 if ( ! isset( $action_map[ $action->post_excerpt ] ) ) {
389 321 // don't try and show settings if action no longer exists
390 322 continue;
@@ -393,54 +325,8 @@
393 325 self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values );
394 326 }
395 327 }
396 328
397 - /**
398 - * Show a warning before the form actions list if there are 99 actions, and the limit is set to 99.
399 - * If it is filtered, the warning is still shown when applicable, just using the new limit.
400 - *
401 - * @since 6.17
402 - *
403 - * @param int|string $form_id
404 - * @param array $form_actions
405 - *
406 - * @return void
407 - */
408 - private static function maybe_show_limit_warning( $form_id, $form_actions ) {
409 - $count = count( $form_actions );
410 -
411 - if ( $count < 99 ) {
412 - return;
413 - }
414 -
415 - $limit = FrmFormAction::get_action_limit( $form_id );
416 -
417 - if ( $limit < 99 || $count < $limit ) {
418 - return;
419 - }
420 -
421 - $documentation_url = 'https://formidableforms.com/knowledgebase/frm_form_action_limit/#kb-increase-limit-of-form-actions';
422 -
423 - echo '<div class="frm_warning_style">';
424 - FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon' );
425 - echo '&nbsp;';
426 - printf(
427 - // translators: %s: URL to documentation
428 - esc_html__( 'You have reached your form action limit. To increase this limit, you will require additional code. Visit our documentation at %s.', 'formidable' ),
429 - '<a href="' . esc_url( $documentation_url ) . '" target="_blank">' . esc_html( $documentation_url ) . '</a>'
430 - );
431 - echo '</div>';
432 - }
433 -
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 329 public static function action_control( $form_action, $form, $action_key, $action_control, $values ) {
444 330 $action_control->_set( $action_key );
445 331
446 332 $use_logging = self::should_show_log_message( $form_action->post_excerpt );
@@ -462,14 +348,16 @@
462 348 */
463 349 $action_control = self::get_form_actions( $action_type );
464 350 $action_control->_set( $action_key );
465 351
466 - $form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
352 + $form_id = FrmAppHelper::get_param( 'form_id', '', 'post', 'absint' );
353 +
467 354 $form_action = $action_control->prepare_new( $form_id );
468 355 $use_logging = self::should_show_log_message( $action_type );
469 - $values = array();
470 - $form = self::fields_to_values( $form_id, $values );
471 356
357 + $values = array();
358 + $form = self::fields_to_values( $form_id, $values );
359 +
472 360 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/form_action.php';
473 361 wp_die();
474 362 }
475 363
@@ -476,19 +364,21 @@
476 364 public static function fill_action() {
477 365 FrmAppHelper::permission_check( 'frm_edit_forms' );
478 366 check_ajax_referer( 'frm_ajax', 'nonce' );
479 367
480 - $action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
481 - $action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
368 + $action_key = FrmAppHelper::get_param( 'action_id', '', 'post', 'absint' );
369 + $action_type = FrmAppHelper::get_param( 'action_type', '', 'post', 'sanitize_text_field' );
370 +
482 371 $action_control = self::get_form_actions( $action_type );
483 -
484 - if ( ! $action_control ) {
372 + if ( empty( $action_control ) ) {
485 373 wp_die();
486 374 }
487 375
488 376 $form_action = $action_control->get_single_action( $action_key );
489 - $values = array();
490 - $form = self::fields_to_values( $form_action->menu_order, $values );
377 +
378 + $values = array();
379 + $form = self::fields_to_values( $form_action->menu_order, $values );
380 +
491 381 $use_logging = self::should_show_log_message( $action_type );
492 382
493 383 include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
494 384 wp_die();
@@ -495,11 +385,8 @@
495 385 }
496 386
497 387 /**
498 388 * @since 3.06.04
499 - *
500 - * @param string $action_type
501 - *
502 389 * @return bool
503 390 */
504 391 private static function should_show_log_message( $action_type ) {
505 392 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
@@ -505,14 +392,8 @@
505 392 $logging = array( 'api', 'salesforce', 'constantcontact', 'activecampaign' );
506 393 return in_array( $action_type, $logging, true ) && ! function_exists( 'frm_log_autoloader' );
507 394 }
508 395
509 - /**
510 - * @param int|string $form_id
511 - * @param array $values
512 - *
513 - * @return object
514 - */
515 396 private static function fields_to_values( $form_id, array &$values ) {
516 397 $form = FrmForm::getOne( $form_id );
517 398
518 399 $values = array(
@@ -520,14 +401,12 @@
520 401 'id' => $form->id,
521 402 );
522 403
523 404 $fields = FrmField::get_all_for_form( $form->id );
524 -
525 405 foreach ( $fields as $k => $f ) {
526 406 $f = (array) $f;
527 407 $opts = (array) $f['field_options'];
528 408 $f = array_merge( $opts, $f );
529 -
530 409 if ( ! isset( $f['post_field'] ) ) {
531 410 $f['post_field'] = '';
532 411 }
533 412 $values['fields'][] = $f;
@@ -538,15 +417,13 @@
538 417 }
539 418
540 419 /**
541 420 * @param int $form_id
542 - *
543 421 * @return void
544 422 */
545 423 public static function update_settings( $form_id ) {
546 424 FrmAppHelper::permission_check( 'frm_edit_forms' );
547 425 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
548 -
549 426 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
550 427 $frm_settings = FrmAppHelper::get_settings();
551 428 $error_args = array(
552 429 'title' => __( 'Verification failed', 'formidable' ),
@@ -579,19 +456,17 @@
579 456 $new_actions = array();
580 457
581 458 foreach ( $registered_actions as $registered_action ) {
582 459 $action_ids = $registered_action->update_callback( $form_id );
583 -
584 - if ( $action_ids ) {
460 + if ( ! empty( $action_ids ) ) {
585 461 $new_actions[] = $action_ids;
586 462 }
587 463 }
588 464
589 465 // Only use array_merge if there are new actions.
590 - if ( $new_actions ) {
466 + if ( ! empty( $new_actions ) ) {
591 467 $new_actions = call_user_func_array( 'array_merge', $new_actions );
592 468 }
593 -
594 469 $old_actions = array_diff( $old_actions, $new_actions );
595 470
596 471 self::delete_missing_actions( $old_actions );
597 472
@@ -597,15 +472,10 @@
597 472
598 473 FrmOnSubmitHelper::save_on_submit_settings( $form_id );
599 474 }
600 475
601 - /**
602 - * @param array $old_actions
603 - *
604 - * @return void
605 - */
606 476 public static function delete_missing_actions( $old_actions ) {
607 - if ( $old_actions ) {
477 + if ( ! empty( $old_actions ) ) {
608 478 foreach ( $old_actions as $old_id ) {
609 479 wp_delete_post( $old_id );
610 480 }
611 481 FrmDb::cache_delete_group( 'frm_actions' );
@@ -611,15 +481,8 @@
611 481 FrmDb::cache_delete_group( 'frm_actions' );
612 482 }
613 483 }
614 484
615 - /**
616 - * @param int|string $entry_id
617 - * @param int|string $form_id
618 - * @param array $args
619 - *
620 - * @return void
621 - */
622 485 public static function trigger_create_actions( $entry_id, $form_id, $args = array() ) {
623 486 $filter_args = $args;
624 487 $filter_args['entry_id'] = $entry_id;
625 488 $filter_args['form_id'] = $form_id;
@@ -636,34 +499,23 @@
636 499 self::trigger_actions( $event, $form_id, $entry_id, 'all', $args );
637 500 }
638 501
639 502 /**
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
503 + * @param string $event
647 504 */
648 - public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) { // phpcs:ignore SlevomatCodingStandard.Complexity.Cognitive.ComplexityTooHigh
505 + public static function trigger_actions( $event, $form, $entry, $type = 'all', $args = array() ) {
649 506 $action_status = array(
650 507 'post_status' => 'publish',
651 508 );
652 509 $form_actions = FrmFormAction::get_action_for_form( ( is_object( $form ) ? $form->id : $form ), $type, $action_status );
653 510
654 - if ( ! $form_actions ) {
511 + if ( empty( $form_actions ) ) {
655 512 return;
656 513 }
657 514
658 515 FrmForm::maybe_get_form( $form );
659 516
660 - if ( ! is_object( $form ) ) {
661 - return;
662 - }
663 -
664 517 $link_settings = self::get_form_actions( $type );
665 -
666 518 if ( 'all' !== $type ) {
667 519 $link_settings = array( $type => $link_settings );
668 520 }
669 521
@@ -676,11 +528,11 @@
676 528 $this_event = $event;
677 529 }
678 530
679 531 foreach ( $form_actions as $action ) {
532 +
680 533 $skip_this_action = ! in_array( $this_event, $action->post_content['event'], true ) || FrmOnSubmitAction::$slug === $action->post_excerpt;
681 534 $skip_this_action = apply_filters( 'frm_skip_form_action', $skip_this_action, compact( 'action', 'entry', 'form', 'event' ) );
682 -
683 535 if ( $skip_this_action ) {
684 536 continue;
685 537 }
686 538
@@ -687,18 +539,17 @@
687 539 if ( ! is_object( $entry ) ) {
688 540 $entry = FrmEntry::getOne( $entry, true );
689 541 }
690 542
691 - if ( ! $entry || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
543 + if ( empty( $entry ) || ( FrmEntriesHelper::DRAFT_ENTRY_STATUS === (int) $entry->is_draft && 'draft' !== $event ) ) {
692 544 continue;
693 545 }
694 546
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
547 + $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 548
697 549 if ( $child_entry ) {
698 550 // maybe trigger actions for sub forms
699 551 $trigger_children = apply_filters( 'frm_use_embedded_form_actions', false, compact( 'form', 'entry' ) );
700 -
701 552 if ( ! $trigger_children ) {
702 553 continue;
703 554 }
704 555 }
@@ -704,9 +555,8 @@
704 555 }
705 556
706 557 // Check conditional logic.
707 558 $stop = FrmFormAction::action_conditions_met( $action, $entry );
708 -
709 559 if ( $stop ) {
710 560 continue;
711 561 }
712 562
@@ -716,9 +566,9 @@
716 566
717 567 unset( $action );
718 568 }//end foreach
719 569
720 - if ( $stored_actions ) {
570 + if ( ! empty( $stored_actions ) ) {
721 571 asort( $action_priority );
722 572
723 573 // Make sure hooks are loaded.
724 574 new FrmNotification();
@@ -749,15 +599,8 @@
749 599 }//end foreach
750 600 }//end if
751 601 }
752 602
753 - /**
754 - * @param int|string $form_id
755 - * @param array $values
756 - * @param array $args
757 - *
758 - * @return void
759 - */
760 603 public static function duplicate_form_actions( $form_id, $values, $args = array() ) {
761 604 if ( empty( $args['old_id'] ) ) {
762 605 // Continue if we know which actions to copy.
763 606 return;
@@ -773,13 +616,8 @@
773 616 unset( $action_control );
774 617 }
775 618 }
776 619
777 - /**
778 - * @param string $where
779 - *
780 - * @return string
781 - */
782 620 public static function limit_by_type( $where ) {
783 621 global $frm_vars, $wpdb;
784 622
785 623 if ( ! isset( $frm_vars['action_type'] ) ) {
@@ -785,31 +623,15 @@
785 623 if ( ! isset( $frm_vars['action_type'] ) ) {
786 624 return $where;
787 625 }
788 626
789 - return $where . $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
790 - }
627 + $where .= $wpdb->prepare( ' AND post_excerpt = %s ', $frm_vars['action_type'] );
791 628
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;
629 + return $where;
804 630 }
805 631 }
806 632
807 633 class Frm_Form_Action_Factory {
808 -
809 - /**
810 - * @var array
811 - */
812 634 public $actions = array();
813 635
814 636 public function __construct() {
815 637 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
@@ -814,22 +636,12 @@
814 636 public function __construct() {
815 637 add_action( 'frm_form_actions_init', array( $this, '_register_actions' ), 100 );
816 638 }
817 639
818 - /**
819 - * @param string $action_class
820 - *
821 - * @return void
822 - */
823 640 public function register( $action_class ) {
824 641 $this->actions[ $action_class ] = new $action_class();
825 642 }
826 643
827 - /**
828 - * @param string $action_class
829 - *
830 - * @return void
831 - */
832 644 public function unregister( $action_class ) {
833 645 if ( isset( $this->actions[ $action_class ] ) ) {
834 646 unset( $this->actions[ $action_class ] );
835 647 }