PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.25.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.25.1
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
formidable / classes / controllers / FrmFormActionsController.php

FrmFormActionsController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.25.1, at classes/controllers/FrmFormActionsController.php

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