@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | $groups = FrmFormActionsController::form_action_groups(); |
| 228 | 228 | $group = 'misc'; |
| 229 | 229 | |
| 230 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 230 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 231 | 231 | $group = $action_options['group']; |
| 232 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 232 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 233 | 233 | $group = $this->id_base; |
| 234 | 234 | } else { |
| 235 | 235 | foreach ( $groups as $name => $check_group ) { |
@@ -240,8 +240,8 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - $groups[ $group ]['id'] = $group; |
|
| 244 | - return $groups[ $group ]; |
|
| 243 | + $groups[$group]['id'] = $group; |
|
| 244 | + return $groups[$group]; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /** |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | * @return int $post_id |
| 368 | 368 | */ |
| 369 | 369 | public function maybe_create_action( $action, $forms ) { |
| 370 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] === 'updated' ) { |
|
| 370 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] === 'updated' ) { |
|
| 371 | 371 | // Update action only |
| 372 | 372 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 373 | 373 | $post_id = $this->save_settings( $action ); |
@@ -393,18 +393,18 @@ discard block |
||
| 393 | 393 | $switch = $this->get_global_switch_fields(); |
| 394 | 394 | |
| 395 | 395 | foreach ( (array) $action->post_content as $key => $val ) { |
| 396 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 397 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 396 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 397 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 398 | 398 | } elseif ( ! is_array( $val ) ) { |
| 399 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 400 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 399 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 400 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 401 | 401 | // loop through each value if empty |
| 402 | - if ( empty( $switch[ $key ] ) ) { |
|
| 403 | - $switch[ $key ] = array_keys( $val ); |
|
| 402 | + if ( empty( $switch[$key] ) ) { |
|
| 403 | + $switch[$key] = array_keys( $val ); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 407 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 406 | + foreach ( $switch[$key] as $subkey ) { |
|
| 407 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | |
@@ -429,20 +429,20 @@ discard block |
||
| 429 | 429 | foreach ( $subkey as $subkey2 ) { |
| 430 | 430 | foreach ( (array) $val as $ck => $cv ) { |
| 431 | 431 | if ( is_array( $cv ) ) { |
| 432 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 433 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 434 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 432 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 433 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 434 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | } else { |
| 439 | 439 | foreach ( (array) $val as $ck => $cv ) { |
| 440 | 440 | if ( is_array( $cv ) ) { |
| 441 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 442 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 443 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 441 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 442 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 443 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 444 | 444 | } elseif ( $ck == $subkey ) { |
| 445 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 445 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | }//end if |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 473 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 473 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 474 | 474 | // Sanitizing removes scripts and <email> type of values. |
| 475 | 475 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 476 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 476 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 477 | 477 | } else { |
| 478 | 478 | return; |
| 479 | 479 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | foreach ( $settings as $number => $new_instance ) { |
| 484 | 484 | $this->_set( $number ); |
| 485 | 485 | |
| 486 | - $old_instance = $all_instances[ $number ] ?? array(); |
|
| 486 | + $old_instance = $all_instances[$number] ?? array(); |
|
| 487 | 487 | |
| 488 | 488 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 489 | 489 | $new_instance['post_status'] = 'draft'; |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 523 | 523 | |
| 524 | 524 | if ( false !== $instance ) { |
| 525 | - $all_instances[ $number ] = $instance; |
|
| 525 | + $all_instances[$number] = $instance; |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | $action_ids[] = $this->save_settings( $instance ); |
@@ -633,12 +633,12 @@ discard block |
||
| 633 | 633 | // some plugins/themes are formatting the post_excerpt |
| 634 | 634 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 635 | 635 | |
| 636 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 636 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 637 | 637 | continue; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 641 | - $settings[ $action->ID ] = $action; |
|
| 640 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 641 | + $settings[$action->ID] = $action; |
|
| 642 | 642 | |
| 643 | 643 | if ( count( $settings ) >= $limit ) { |
| 644 | 644 | break; |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | * @return int The filtered limit value. |
| 665 | 665 | */ |
| 666 | 666 | public static function get_action_limit( $form_id, $limit = 99 ) { |
| 667 | - $type = 'all'; |
|
| 667 | + $type = 'all'; |
|
| 668 | 668 | return (int) apply_filters( 'frm_form_action_limit', (int) $limit, compact( 'type', 'form_id' ) ); |
| 669 | 669 | } |
| 670 | 670 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | 'limit' => 99, |
| 689 | 689 | 'post_status' => $default_status, |
| 690 | 690 | ); |
| 691 | - $args = wp_parse_args( $args, $defaults ); |
|
| 691 | + $args = wp_parse_args( $args, $defaults ); |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | $action = $this->prepare_action( $action ); |
| 770 | 770 | |
| 771 | - $settings[ $action->ID ] = $action; |
|
| 771 | + $settings[$action->ID] = $action; |
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | if ( 1 === $limit ) { |
@@ -816,10 +816,10 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | foreach ( $default_values as $k => $vals ) { |
| 818 | 818 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 819 | - if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 819 | + if ( 'event' === $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 820 | 820 | continue; |
| 821 | 821 | } |
| 822 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 822 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 823 | 823 | } |
| 824 | 824 | } |
| 825 | 825 | |
@@ -923,9 +923,9 @@ discard block |
||
| 923 | 923 | |
| 924 | 924 | // fill with existing options |
| 925 | 925 | foreach ( $action->post_content as $name => $val ) { |
| 926 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 927 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 928 | - unset( $form->options[ $name ] ); |
|
| 926 | + if ( isset( $form->options[$name] ) ) { |
|
| 927 | + $action->post_content[$name] = $form->options[$name]; |
|
| 928 | + unset( $form->options[$name] ); |
|
| 929 | 929 | } |
| 930 | 930 | } |
| 931 | 931 | |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'include' ); |
| 1036 | 1036 | return array_filter( |
| 1037 | 1037 | $form_fields, |
| 1038 | - function ( $form_field ) { |
|
| 1038 | + function( $form_field ) { |
|
| 1039 | 1039 | return ! FrmField::is_no_save_field( $form_field->type ); |
| 1040 | 1040 | } |
| 1041 | 1041 | ); |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | // Get posted data. |
| 89 | 89 | $plugin_slug = FrmAppHelper::get_post_param( 'plugin', '', 'sanitize_text_field' ); |
| 90 | 90 | |
| 91 | - if ( ! empty( get_plugins()[ $plugin_slug ] ) ) { |
|
| 91 | + if ( ! empty( get_plugins()[$plugin_slug] ) ) { |
|
| 92 | 92 | $activate = activate_plugin( $plugin_slug ); |
| 93 | 93 | } else { |
| 94 | 94 | // Include necessary files for plugin installation. |