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