@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'payments' => $frm_payment->get_count(), |
| 129 | 129 | 'subscriptions' => $frm_sub->get_count(), |
| 130 | 130 | ); |
| 131 | - $type = FrmAppHelper::get_simple_request( |
|
| 131 | + $type = FrmAppHelper::get_simple_request( |
|
| 132 | 132 | array( |
| 133 | 133 | 'param' => 'trans_type', |
| 134 | 134 | 'type' => 'request', |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | foreach ( $statuses as $status => $name ) { |
| 140 | 140 | $class = $status === $type ? ' class="current"' : ''; |
| 141 | 141 | |
| 142 | - if ( $counts[ $status ] || 'published' === $status ) { |
|
| 143 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable-payments&trans_type=' . $status ) . '" ' . $class . '>' |
|
| 142 | + if ( $counts[$status] || 'published' === $status ) { |
|
| 143 | + $links[$status] = '<a href="' . esc_url( '?page=formidable-payments&trans_type=' . $status ) . '" ' . $class . '>' |
|
| 144 | 144 | // translators: %1$s: Transaction type (Payments or Subscriptions), %2$s: Span start tag, %3$s: Count, %4$s: Span close tag. |
| 145 | - . sprintf( esc_html__( '%1$s %2$s(%3$s)%4$s', 'formidable' ), esc_html( $name ), '<span class="count">', number_format_i18n( $counts[ $status ] ), '</span>' ) |
|
| 145 | + . sprintf( esc_html__( '%1$s %2$s(%3$s)%4$s', 'formidable' ), esc_html( $name ), '<span class="count">', number_format_i18n( $counts[$status] ), '</span>' ) |
|
| 146 | 146 | . '</a>'; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | echo '<tr id="payment-' . esc_attr( $item->id ) . '" '; |
| 223 | 223 | |
| 224 | 224 | $is_alternate = 0 === $alt % 2; |
| 225 | - ++$alt; |
|
| 225 | + ++ $alt; |
|
| 226 | 226 | |
| 227 | 227 | if ( $is_alternate ) { |
| 228 | 228 | echo 'class="alternate"'; |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $form_ids = array(); |
| 318 | 318 | |
| 319 | 319 | foreach ( $forms as $form ) { |
| 320 | - $form_ids[ $form->id ] = $form; |
|
| 320 | + $form_ids[$form->id] = $form; |
|
| 321 | 321 | unset( $form ); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | 'href' => esc_url( $link ), |
| 371 | 371 | 'title' => __( 'View', 'formidable' ), |
| 372 | 372 | ); |
| 373 | - $link = '<a ' . FrmAppHelper::array_to_html_params( $link_params ) . '>' |
|
| 373 | + $link = '<a ' . FrmAppHelper::array_to_html_params( $link_params ) . '>' |
|
| 374 | 374 | . $item->{$field} |
| 375 | 375 | . '</a>'; |
| 376 | 376 | |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | * @return mixed |
| 429 | 429 | */ |
| 430 | 430 | private function get_form_id_column( $item, $atts ) { |
| 431 | - if ( isset( $atts['form_ids'][ $item->item_id ] ) ) { |
|
| 432 | - return FrmFormsHelper::edit_form_link( $atts['form_ids'][ $item->item_id ]->form_id ); |
|
| 431 | + if ( isset( $atts['form_ids'][$item->item_id] ) ) { |
|
| 432 | + return FrmFormsHelper::edit_form_link( $atts['form_ids'][$item->item_id]->form_id ); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | return ''; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | */ |
| 512 | 512 | private function get_processing_tooltip() { |
| 513 | 513 | return FrmAppHelper::clip( |
| 514 | - function () { |
|
| 514 | + function() { |
|
| 515 | 515 | FrmAppHelper::tooltip_icon( __( 'This payment method may take between 4-5 business days to process.', 'formidable' ) ); |
| 516 | 516 | } |
| 517 | 517 | ); |
@@ -134,22 +134,22 @@ discard block |
||
| 134 | 134 | $default_settings = $this->get_defaults(); |
| 135 | 135 | |
| 136 | 136 | foreach ( $default_settings as $setting => $default ) { |
| 137 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 138 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 137 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 138 | + $new_instance['post_content'][$setting] = $default; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | if ( $this->is_color( $setting ) ) { |
| 142 | - $color_val = $new_instance['post_content'][ $setting ]; |
|
| 142 | + $color_val = $new_instance['post_content'][$setting]; |
|
| 143 | 143 | |
| 144 | 144 | if ( $color_val !== '' && false !== strpos( $color_val, 'rgb' ) ) { |
| 145 | 145 | // Maybe sanitize if invalid rgba value is entered. |
| 146 | 146 | $this->maybe_sanitize_rgba_value( $color_val ); |
| 147 | 147 | } |
| 148 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val ); |
|
| 149 | - } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 150 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 148 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $color_val ); |
|
| 149 | + } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 150 | + $new_instance['post_content'][$setting] = 0; |
|
| 151 | 151 | } elseif ( $setting === 'font' ) { |
| 152 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 152 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | $sanitized_settings = array(); |
| 266 | 266 | |
| 267 | 267 | foreach ( $valid_keys as $key ) { |
| 268 | - $sanitized_settings[ $key ] = isset( $settings[ $key ] ) ? sanitize_textarea_field( $settings[ $key ] ) : $defaults[ $key ]; |
|
| 268 | + $sanitized_settings[$key] = isset( $settings[$key] ) ? sanitize_textarea_field( $settings[$key] ) : $defaults[$key]; |
|
| 269 | 269 | |
| 270 | 270 | if ( 'custom_css' !== $key && 'single_style_custom_css' !== $key ) { |
| 271 | - $sanitized_settings[ $key ] = $this->strip_invalid_characters( $sanitized_settings[ $key ] ); |
|
| 271 | + $sanitized_settings[$key] = $this->strip_invalid_characters( $sanitized_settings[$key] ); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | return $sanitized_settings; |
@@ -570,13 +570,13 @@ discard block |
||
| 570 | 570 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 571 | 571 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 572 | 572 | |
| 573 | - $styles[ $style->ID ] = $style; |
|
| 573 | + $styles[$style->ID] = $style; |
|
| 574 | 574 | }//end foreach |
| 575 | 575 | |
| 576 | 576 | if ( ! $default_style ) { |
| 577 | 577 | $default_style = reset( $styles ); |
| 578 | 578 | |
| 579 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 579 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | return $styles; |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | continue; |
| 832 | 832 | } |
| 833 | 833 | |
| 834 | - if ( $value && $char === $value[ strlen( $value ) - 1 ] ) { |
|
| 834 | + if ( $value && $char === $value[strlen( $value ) - 1] ) { |
|
| 835 | 835 | $value = $char . $value; |
| 836 | 836 | } else { |
| 837 | 837 | $value .= $char; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | if ( $new_val !== $value ) { |
| 234 | - $new_values[ $key ] = $new_val; |
|
| 234 | + $new_values[$key] = $new_val; |
|
| 235 | 235 | } |
| 236 | 236 | }//end foreach |
| 237 | 237 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | foreach ( $values as $value_key => $value ) { |
| 270 | 270 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 271 | - $new_values[ $value_key ] = $value; |
|
| 271 | + $new_values[$value_key] = $value; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -358,20 +358,20 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | foreach ( $all_fields as $fid ) { |
| 360 | 360 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 361 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 361 | + $values['item_meta'][$fid->id] = ''; |
|
| 362 | 362 | } |
| 363 | - $field_array[ $fid->id ] = $fid; |
|
| 363 | + $field_array[$fid->id] = $fid; |
|
| 364 | 364 | } |
| 365 | 365 | unset( $all_fields ); |
| 366 | 366 | |
| 367 | 367 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 368 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 368 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 369 | 369 | |
| 370 | 370 | if ( ! $field ) { |
| 371 | 371 | continue; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 374 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 375 | 375 | |
| 376 | 376 | if ( $is_settings_page ) { |
| 377 | 377 | self::get_settings_page_html( $values, $field ); |
@@ -392,22 +392,22 @@ discard block |
||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | foreach ( $update_options as $opt => $default ) { |
| 395 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 396 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 395 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 396 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 400 | 400 | |
| 401 | 401 | $new_field = array( |
| 402 | 402 | 'field_options' => $field->field_options, |
| 403 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 403 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 404 | 404 | ); |
| 405 | 405 | |
| 406 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 407 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 406 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 407 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 408 | 408 | if ( is_array( $option ) ) { |
| 409 | 409 | foreach ( $option as $key => $item ) { |
| 410 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 410 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 440 | 440 | if ( $field->type === 'textarea' && |
| 441 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 442 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 441 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 442 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 443 | 443 | |
| 444 | 444 | $new_field['field_options']['max'] = ''; |
| 445 | 445 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 448 | 448 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 449 | 449 | */ |
| 450 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 450 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | 453 | |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | * @return void |
| 529 | 529 | */ |
| 530 | 530 | private static function get_settings_page_html( $values, &$field ) { |
| 531 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 531 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 532 | 532 | $prev_opts = array(); |
| 533 | 533 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 534 | 534 | |
| 535 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 535 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 536 | 536 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 537 | 537 | $prev_opts = $field->field_options; |
| 538 | 538 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | foreach ( $field_cols as $col => $default ) { |
| 568 | 568 | $default = $default === '' ? $field->{$col} : $default; |
| 569 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 569 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | self::destroy( $form->id ); |
| 776 | 776 | |
| 777 | 777 | if ( empty( $form->parent_form_id ) ) { |
| 778 | - ++$count; |
|
| 778 | + ++ $count; |
|
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | 781 | |
@@ -1004,16 +1004,16 @@ discard block |
||
| 1004 | 1004 | foreach ( $results as $row ) { |
| 1005 | 1005 | if ( 'trash' != $row->status ) { |
| 1006 | 1006 | if ( $row->is_template ) { |
| 1007 | - ++$counts['template']; |
|
| 1007 | + ++ $counts['template']; |
|
| 1008 | 1008 | } else { |
| 1009 | - ++$counts['published']; |
|
| 1009 | + ++ $counts['published']; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | } else { |
| 1012 | - ++$counts['trash']; |
|
| 1012 | + ++ $counts['trash']; |
|
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | if ( 'draft' == $row->status ) { |
| 1016 | - ++$counts['draft']; |
|
| 1016 | + ++ $counts['draft']; |
|
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | unset( $row ); |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | self::maybe_get_form( $form ); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1066 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1065 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1066 | + return $frm_vars['form_params'][$form->id]; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | |
| 1069 | 1069 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1093,15 +1093,15 @@ discard block |
||
| 1093 | 1093 | // If there are two forms on the same page, make sure not to submit both. |
| 1094 | 1094 | foreach ( $default_values as $var => $default ) { |
| 1095 | 1095 | if ( $var === 'action' ) { |
| 1096 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1096 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1097 | 1097 | } else { |
| 1098 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1098 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1099 | 1099 | } |
| 1100 | 1100 | unset( $var, $default ); |
| 1101 | 1101 | } |
| 1102 | 1102 | } else { |
| 1103 | 1103 | foreach ( $default_values as $var => $default ) { |
| 1104 | - $values[ $var ] = $default; |
|
| 1104 | + $values[$var] = $default; |
|
| 1105 | 1105 | unset( $var, $default ); |
| 1106 | 1106 | } |
| 1107 | 1107 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | ); |
| 1132 | 1132 | |
| 1133 | 1133 | foreach ( $defaults as $var => $default ) { |
| 1134 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1134 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | return $values; |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | ); |
| 1167 | 1167 | |
| 1168 | 1168 | foreach ( $defaults as $var => $default ) { |
| 1169 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1169 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1170 | 1170 | } |
| 1171 | 1171 | |
| 1172 | 1172 | return $values; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | $form = $atts['form']; |
| 1312 | 1312 | $default = $atts['default'] ?? ''; |
| 1313 | 1313 | |
| 1314 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1314 | + return $form->options[$atts['option']] ?? $default; |
|
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | 1317 | /** |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | * @return array |
| 179 | 179 | */ |
| 180 | 180 | private function prepare_array_property( $index, $atts ) { |
| 181 | - if ( ! empty( $atts[ $index ] ) ) { |
|
| 182 | - $property = is_array( $atts[ $index ] ) ? $atts[ $index ] : explode( ',', $atts[ $index ] ); |
|
| 181 | + if ( ! empty( $atts[$index] ) ) { |
|
| 182 | + $property = is_array( $atts[$index] ) ? $atts[$index] : explode( ',', $atts[$index] ); |
|
| 183 | 183 | } else { |
| 184 | 184 | $property = array(); |
| 185 | 185 | } |
@@ -258,11 +258,11 @@ discard block |
||
| 258 | 258 | ); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $ip = array( |
|
| 261 | + $ip = array( |
|
| 262 | 262 | 'label' => __( 'IP Address', 'formidable' ), |
| 263 | 263 | 'value' => $this->entry->ip, |
| 264 | 264 | ); |
| 265 | - $browser = array( |
|
| 265 | + $browser = array( |
|
| 266 | 266 | 'label' => __( 'User-Agent (Browser/OS)', 'formidable' ), |
| 267 | 267 | 'value' => isset( $entry_description['browser'] ) ? FrmEntriesHelper::get_browser( $entry_description['browser'] ) : '', |
| 268 | 268 | ); |
@@ -351,6 +351,6 @@ discard block |
||
| 351 | 351 | * @return void |
| 352 | 352 | */ |
| 353 | 353 | protected function add_field_values( $field ) { |
| 354 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 354 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 355 | 355 | } |
| 356 | 356 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * @var bool |
| 10 | 10 | */ |
| 11 | - public static $use_cache = true; |
|
| 11 | + public static $use_cache = true; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @var int |
@@ -352,11 +352,11 @@ discard block |
||
| 352 | 352 | 'ranking' => '2024-03-12', |
| 353 | 353 | ); |
| 354 | 354 | |
| 355 | - if ( ! isset( $release_dates[ $type ] ) ) { |
|
| 355 | + if ( ! isset( $release_dates[$type] ) ) { |
|
| 356 | 356 | return false; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - $release_date = $release_dates[ $type ]; |
|
| 359 | + $release_date = $release_dates[$type]; |
|
| 360 | 360 | |
| 361 | 361 | $three_months_after_release = gmdate( 'Y-m-d', strtotime( $release_date . ' + 90 days' ) ); |
| 362 | 362 | return gmdate( 'Y-m-d' ) < $three_months_after_release; |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 391 | 391 | |
| 392 | 392 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 393 | - if ( isset( $values[ $col ] ) ) { |
|
| 394 | - $new_values[ $col ] = $values[ $col ]; |
|
| 393 | + if ( isset( $values[$col] ) ) { |
|
| 394 | + $new_values[$col] = $values[$col]; |
|
| 395 | 395 | } |
| 396 | 396 | } |
| 397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 404 | 404 | |
| 405 | 405 | if ( isset( $values['id'] ) ) { |
| 406 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 406 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 407 | 407 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 408 | 408 | } |
| 409 | 409 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | foreach ( $new_values as $k => $v ) { |
| 413 | 413 | if ( is_array( $v ) ) { |
| 414 | - $new_values[ $k ] = $k === 'default_value' ? FrmAppHelper::maybe_json_encode( $v ) : serialize( $v ); |
|
| 414 | + $new_values[$k] = $k === 'default_value' ? FrmAppHelper::maybe_json_encode( $v ) : serialize( $v ); |
|
| 415 | 415 | } |
| 416 | 416 | unset( $k, $v ); |
| 417 | 417 | } |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | if ( isset( $values['id'] ) ) { |
| 433 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 433 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | return $new_id; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @return string |
| 486 | 486 | */ |
| 487 | - function ( $match ) { |
|
| 487 | + function( $match ) { |
|
| 488 | 488 | $attr = shortcode_parse_atts( $match[3] ); |
| 489 | 489 | |
| 490 | 490 | if ( ! is_array( $attr ) ) { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | if ( FrmAppHelper::input_key_is_safe( $key, 'update' ) ) { |
| 515 | - $safe_atts[ $key ] = $value; |
|
| 515 | + $safe_atts[$key] = $value; |
|
| 516 | 516 | } |
| 517 | 517 | }//end foreach |
| 518 | 518 | |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 585 | 585 | global $frm_duplicate_ids; |
| 586 | 586 | |
| 587 | - $where = array( |
|
| 587 | + $where = array( |
|
| 588 | 588 | array( |
| 589 | 589 | 'or' => 1, |
| 590 | 590 | 'fi.form_id' => $old_form_id, |
@@ -631,8 +631,8 @@ discard block |
||
| 631 | 631 | |
| 632 | 632 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 633 | 633 | $new_id = self::create( $values ); |
| 634 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 635 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 634 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 635 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 636 | 636 | unset( $field ); |
| 637 | 637 | }//end foreach |
| 638 | 638 | } |
@@ -682,11 +682,11 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | // serialize array values |
| 684 | 684 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 685 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 685 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 686 | 686 | if ( 'field_options' === $opt ) { |
| 687 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 687 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 688 | 688 | } |
| 689 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 689 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
@@ -900,8 +900,8 @@ discard block |
||
| 900 | 900 | continue; |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | - $fields[ $result->id ] = $result; |
|
| 904 | - ++$count; |
|
| 903 | + $fields[$result->id] = $result; |
|
| 904 | + ++ $count; |
|
| 905 | 905 | |
| 906 | 906 | if ( $limit == 1 ) { |
| 907 | 907 | $fields = $result; |
@@ -956,8 +956,8 @@ discard block |
||
| 956 | 956 | $count = 0; |
| 957 | 957 | |
| 958 | 958 | foreach ( $results as $result ) { |
| 959 | - ++$count; |
|
| 960 | - $fields[ $result->id ] = $result; |
|
| 959 | + ++ $count; |
|
| 960 | + $fields[$result->id] = $result; |
|
| 961 | 961 | |
| 962 | 962 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 963 | 963 | break; |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | $query_type = $limit === ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 1091 | 1091 | |
| 1092 | 1092 | if ( is_array( $where ) ) { |
| 1093 | - $args = array( |
|
| 1093 | + $args = array( |
|
| 1094 | 1094 | 'order_by' => $order_by, |
| 1095 | 1095 | 'limit' => $limit, |
| 1096 | 1096 | ); |
@@ -1127,9 +1127,9 @@ discard block |
||
| 1127 | 1127 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 1128 | 1128 | |
| 1129 | 1129 | self::prepare_options( $result ); |
| 1130 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 1131 | - $results[ $r_key ]->options = $result->options; |
|
| 1132 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 1130 | + $results[$r_key]->field_options = $result->field_options; |
|
| 1131 | + $results[$r_key]->options = $result->options; |
|
| 1132 | + $results[$r_key]->default_value = $result->default_value; |
|
| 1133 | 1133 | |
| 1134 | 1134 | unset( $r_key, $result ); |
| 1135 | 1135 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | |
| 1226 | 1226 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 1227 | 1227 | // if this transient is full, check for another |
| 1228 | - ++$next; |
|
| 1228 | + ++ $next; |
|
| 1229 | 1229 | self::get_next_transient( $fields, $base_name, $next ); |
| 1230 | 1230 | } |
| 1231 | 1231 | } |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | return; |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - ++$next; |
|
| 1264 | + ++ $next; |
|
| 1265 | 1265 | } |
| 1266 | 1266 | } |
| 1267 | 1267 | |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | * @return bool |
| 1420 | 1420 | */ |
| 1421 | 1421 | public static function is_option_true_in_array( $field, $option ) { |
| 1422 | - return ! empty( $field[ $option ] ); |
|
| 1422 | + return ! empty( $field[$option] ); |
|
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | /** |
@@ -1429,7 +1429,7 @@ discard block |
||
| 1429 | 1429 | * @return bool |
| 1430 | 1430 | */ |
| 1431 | 1431 | public static function is_option_true_in_object( $field, $option ) { |
| 1432 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1432 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1433 | 1433 | } |
| 1434 | 1434 | |
| 1435 | 1435 | /** |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | * @return bool |
| 1440 | 1440 | */ |
| 1441 | 1441 | public static function is_option_empty_in_array( $field, $option ) { |
| 1442 | - return empty( $field[ $option ] ); |
|
| 1442 | + return empty( $field[$option] ); |
|
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | /** |
@@ -1449,7 +1449,7 @@ discard block |
||
| 1449 | 1449 | * @return bool |
| 1450 | 1450 | */ |
| 1451 | 1451 | public static function is_option_empty_in_object( $field, $option ) { |
| 1452 | - return empty( $field->field_options[ $option ] ); |
|
| 1452 | + return empty( $field->field_options[$option] ); |
|
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | 1455 | /** |
@@ -1459,7 +1459,7 @@ discard block |
||
| 1459 | 1459 | * @return bool |
| 1460 | 1460 | */ |
| 1461 | 1461 | public static function is_option_value_in_object( $field, $option ) { |
| 1462 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1462 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | /** |
@@ -1481,10 +1481,10 @@ discard block |
||
| 1481 | 1481 | * @return mixed |
| 1482 | 1482 | */ |
| 1483 | 1483 | public static function get_option_in_array( $field, $option ) { |
| 1484 | - if ( isset( $field[ $option ] ) ) { |
|
| 1485 | - $this_option = $field[ $option ]; |
|
| 1486 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1487 | - $this_option = $field['field_options'][ $option ]; |
|
| 1484 | + if ( isset( $field[$option] ) ) { |
|
| 1485 | + $this_option = $field[$option]; |
|
| 1486 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1487 | + $this_option = $field['field_options'][$option]; |
|
| 1488 | 1488 | } else { |
| 1489 | 1489 | $this_option = ''; |
| 1490 | 1490 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
| 1499 | 1499 | * @return mixed |
| 1500 | 1500 | */ |
| 1501 | 1501 | public static function get_option_in_object( $field, $option ) { |
| 1502 | - return $field->field_options[ $option ] ?? ''; |
|
| 1502 | + return $field->field_options[$option] ?? ''; |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | /** |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
| 154 | 154 | |
| 155 | 155 | if ( $repeating ) { |
| 156 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 156 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 157 | 157 | $value_is_posted = true; |
| 158 | 158 | } |
| 159 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 159 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 160 | 160 | $value_is_posted = true; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
| 201 | 201 | |
| 202 | 202 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 203 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 203 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 204 | 204 | |
| 205 | 205 | $this_atts = ! empty( $add_atts ) ? array_merge( $atts, $add_atts ) : $atts; |
| 206 | 206 | |
| 207 | 207 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
| 208 | 208 | |
| 209 | 209 | // Add the default message. |
| 210 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
| 210 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return $message; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return string |
| 222 | 222 | */ |
| 223 | 223 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 224 | - $field_value = $entry->metas[ $field->id ] ?? false; |
|
| 224 | + $field_value = $entry->metas[$field->id] ?? false; |
|
| 225 | 225 | |
| 226 | 226 | if ( FrmAppHelper::pro_is_installed() ) { |
| 227 | 227 | $empty = empty( $field_value ); |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
| 252 | 252 | } else { |
| 253 | 253 | // Get all values for this field. |
| 254 | - $child_values = $entry->metas[ $atts['embedded_field_id'] ] ?? false; |
|
| 254 | + $child_values = $entry->metas[$atts['embedded_field_id']] ?? false; |
|
| 255 | 255 | |
| 256 | 256 | if ( $child_values ) { |
| 257 | 257 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | if ( empty( $args['parent_field_id'] ) ) { |
| 386 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 386 | + $_POST['item_meta'][$field->id] = $value; |
|
| 387 | 387 | } else { |
| 388 | 388 | self::set_parent_field_posted_value( $field, $value, $args ); |
| 389 | 389 | } |
@@ -401,17 +401,17 @@ discard block |
||
| 401 | 401 | * @return void |
| 402 | 402 | */ |
| 403 | 403 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 404 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 405 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 406 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 404 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 405 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 406 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 407 | 407 | } |
| 408 | 408 | } else { |
| 409 | 409 | // All of the section was probably removed. |
| 410 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 411 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 410 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 411 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 414 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -458,9 +458,9 @@ discard block |
||
| 458 | 458 | private static function get_posted_meta( $field_id, $args ) { |
| 459 | 459 | if ( empty( $args['parent_field_id'] ) ) { |
| 460 | 460 | // Sanitizing is done next. |
| 461 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 461 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 462 | 462 | } else { |
| 463 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 463 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 464 | 464 | } |
| 465 | 465 | return $value; |
| 466 | 466 | } |
@@ -494,14 +494,14 @@ discard block |
||
| 494 | 494 | self::set_other_repeating_vals( $field, $value, $args ); |
| 495 | 495 | |
| 496 | 496 | // Check if there are any posted "Other" values. |
| 497 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 497 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 498 | 498 | |
| 499 | 499 | // Save original value. |
| 500 | 500 | $args['temp_value'] = $value; |
| 501 | 501 | $args['other'] = true; |
| 502 | 502 | |
| 503 | 503 | // Sanitizing is done next. |
| 504 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 504 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 505 | 505 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 506 | 506 | |
| 507 | 507 | // Set the validation value now |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | // Check if there are any other posted "other" values for this field. |
| 529 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 529 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 530 | 530 | // Save original value |
| 531 | 531 | $args['temp_value'] = $value; |
| 532 | 532 | $args['other'] = true; |
| 533 | 533 | |
| 534 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 534 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 535 | 535 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 536 | 536 | |
| 537 | 537 | // Set the validation value now. |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
| 561 | 561 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
| 562 | 562 | foreach ( $other_vals as $k => $v ) { |
| 563 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
| 563 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
| 564 | 564 | // If the other box is checked, but doesn't have a value. |
| 565 | 565 | $value = ''; |
| 566 | 566 | break; |
@@ -577,26 +577,26 @@ discard block |
||
| 577 | 577 | |
| 578 | 578 | // Multi-select dropdown. |
| 579 | 579 | if ( is_array( $value ) ) { |
| 580 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 580 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 581 | 581 | |
| 582 | 582 | if ( $o_key !== false ) { |
| 583 | 583 | // Modify the original value so other key will be preserved. |
| 584 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 584 | + $value[$other_key] = $value[$o_key]; |
|
| 585 | 585 | |
| 586 | 586 | // By default, the array keys will be numeric for multi-select dropdowns. |
| 587 | 587 | // If going backwards and forwards between pages, the array key will match the other key. |
| 588 | 588 | if ( $o_key !== $other_key ) { |
| 589 | - unset( $value[ $o_key ] ); |
|
| 589 | + unset( $value[$o_key] ); |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | $args['temp_value'] = $value; |
| 593 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 593 | + $value[$other_key] = reset( $other_vals ); |
|
| 594 | 594 | |
| 595 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
| 596 | - unset( $value[ $other_key ] ); |
|
| 595 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
| 596 | + unset( $value[$other_key] ); |
|
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
| 599 | + } elseif ( $field->options[$other_key] == $value ) { |
|
| 600 | 600 | $value = $other_vals; |
| 601 | 601 | }//end if |
| 602 | 602 | }//end if |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | * @return void |
| 856 | 856 | */ |
| 857 | 857 | public static function maybe_render_captcha_score( $entry_id ) { |
| 858 | - $query = array( |
|
| 858 | + $query = array( |
|
| 859 | 859 | 'item_id' => (int) $entry_id, |
| 860 | 860 | 'field_id' => 0, |
| 861 | 861 | ); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | public static function get_entry_status_label( $status ) { |
| 911 | 911 | $statuses = self::get_entry_statuses(); |
| 912 | 912 | |
| 913 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
| 913 | + return $statuses[self::get_entry_status( $status )]; |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | return $errors; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
| 31 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
| 32 | 32 | $frm_settings = FrmAppHelper::get_settings(); |
| 33 | 33 | $errors['form'] = $frm_settings->admin_permission; |
| 34 | 34 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ); |
| 150 | 150 | $args = wp_parse_args( $args, $defaults ); |
| 151 | 151 | |
| 152 | - $value = empty( $args['parent_field_id'] ) ? ( $values['item_meta'][ $args['id'] ] ?? '' ) : $values; |
|
| 152 | + $value = empty( $args['parent_field_id'] ) ? ( $values['item_meta'][$args['id']] ?? '' ) : $values; |
|
| 153 | 153 | |
| 154 | 154 | // Check for values in "Other" fields |
| 155 | 155 | FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 170 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 170 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 171 | 171 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 172 | 172 | self::maybe_add_item_name( $value, $posted_field ); |
| 173 | 173 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $option_is_valid = (bool) apply_filters( 'frm_option_is_valid', $option_is_valid, $value, $posted_field ); |
| 221 | 221 | |
| 222 | 222 | if ( ! $option_is_valid ) { |
| 223 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 223 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'invalid' ); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | FrmFieldsHelper::prepare_new_front_field( $values, $field_object ); |
| 358 | 358 | |
| 359 | 359 | $separate_value = FrmField::get_option( $field_object, 'separate_value' ); |
| 360 | - $map_callback = function ( $option ) use ( $separate_value ) { |
|
| 360 | + $map_callback = function( $option ) use ( $separate_value ) { |
|
| 361 | 361 | if ( is_array( $option ) ) { |
| 362 | 362 | $option_value = $separate_value ? $option['value'] : $option['label']; |
| 363 | 363 | } else { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $pattern = self::phone_format( $field ); |
| 454 | 454 | |
| 455 | 455 | if ( ! preg_match( $pattern, $value ) ) { |
| 456 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 456 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | } |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | */ |
| 586 | 586 | private static function form_is_in_progress( $values ) { |
| 587 | 587 | return FrmAppHelper::pro_is_installed() && |
| 588 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 588 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 589 | 589 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
| 590 | 590 | } |
| 591 | 591 | |
@@ -822,9 +822,9 @@ discard block |
||
| 822 | 822 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'], $values ); |
| 823 | 823 | |
| 824 | 824 | if ( $found ) { |
| 825 | - $datas[ $key ] = $value; |
|
| 825 | + $datas[$key] = $value; |
|
| 826 | 826 | $datas['frm_duplicated'][] = $field_id; |
| 827 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
| 827 | + unset( $datas['missing_keys'][$key_index] ); |
|
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | }//end foreach |
@@ -869,12 +869,12 @@ discard block |
||
| 869 | 869 | continue; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - if ( isset( $fields[ $index + 1 ] ) && 'Last' === $fields[ $index + 1 ]->name ) { |
|
| 873 | - if ( empty( $values[ absint( $fields[ $index + 1 ]->id ) ] ) ) { |
|
| 872 | + if ( isset( $fields[$index + 1] ) && 'Last' === $fields[$index + 1]->name ) { |
|
| 873 | + if ( empty( $values[absint( $fields[$index + 1]->id )] ) ) { |
|
| 874 | 874 | continue; |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - $value .= ' ' . $values[ $fields[ $index + 1 ]->id ]; |
|
| 877 | + $value .= ' ' . $values[$fields[$index + 1]->id]; |
|
| 878 | 878 | return true; |
| 879 | 879 | } |
| 880 | 880 | } |
@@ -895,14 +895,14 @@ discard block |
||
| 895 | 895 | private static function get_name_text_fields( $form_id ) { |
| 896 | 896 | $name_text_fields_is_initialized = is_array( self::$name_text_fields ); |
| 897 | 897 | |
| 898 | - if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[ $form_id ] ) ) { |
|
| 899 | - return self::$name_text_fields[ $form_id ]; |
|
| 898 | + if ( $name_text_fields_is_initialized && isset( self::$name_text_fields[$form_id] ) ) { |
|
| 899 | + return self::$name_text_fields[$form_id]; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | if ( ! $name_text_fields_is_initialized ) { |
| 903 | 903 | self::$name_text_fields = array(); |
| 904 | 904 | } |
| 905 | - self::$name_text_fields[ $form_id ] = FrmDb::get_results( |
|
| 905 | + self::$name_text_fields[$form_id] = FrmDb::get_results( |
|
| 906 | 906 | 'frm_fields', |
| 907 | 907 | array( |
| 908 | 908 | 'form_id' => $form_id, |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | array( 'order_by' => 'field_order ASC' ) |
| 914 | 914 | ); |
| 915 | 915 | |
| 916 | - return self::$name_text_fields[ $form_id ]; |
|
| 916 | + return self::$name_text_fields[$form_id]; |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | /** |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | |
| 928 | 928 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 929 | 929 | if ( $include_value ) { |
| 930 | - $datas[ $key ] = $value; |
|
| 930 | + $datas[$key] = $value; |
|
| 931 | 931 | } |
| 932 | 932 | unset( $key, $value ); |
| 933 | 933 | } |
@@ -946,10 +946,10 @@ discard block |
||
| 946 | 946 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 947 | 947 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 948 | 948 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 949 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 950 | - unset( $values['item_meta'][ $index ] ); |
|
| 949 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 950 | + unset( $values['item_meta'][$index] ); |
|
| 951 | 951 | } else { |
| 952 | - unset( $values[ $index ] ); |
|
| 952 | + unset( $values[$index] ); |
|
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | unset( $datas['frm_duplicated'] ); |
@@ -971,15 +971,15 @@ discard block |
||
| 971 | 971 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
| 972 | 972 | |
| 973 | 973 | foreach ( $skipped_fields as $skipped_field ) { |
| 974 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
| 974 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
| 975 | 975 | continue; |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
| 979 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
| 979 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
| 980 | 980 | |
| 981 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
| 982 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
| 981 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
| 982 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
| 983 | 983 | } |
| 984 | 984 | } |
| 985 | 985 | } |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | // If a choice field has Other option, but Other is not selected. |
| 1020 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
| 1020 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
| 1021 | 1021 | return true; |
| 1022 | 1022 | } |
| 1023 | 1023 | |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | foreach ( $field_data->options as $option ) { |
| 1026 | 1026 | $option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? '' ); |
| 1027 | 1027 | |
| 1028 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
| 1028 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
| 1029 | 1029 | return true; |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | // Convert name array to string. |
| 1104 | 1104 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
| 1105 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
| 1105 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
| 1106 | 1106 | $values['name_field_ids'][] = $field_id; |
| 1107 | 1107 | continue; |
| 1108 | 1108 | } |
@@ -1123,8 +1123,8 @@ discard block |
||
| 1123 | 1123 | continue; |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1127 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 1126 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 1127 | + $values['item_meta'][$subsubindex] = array(); |
|
| 1128 | 1128 | } |
| 1129 | 1129 | |
| 1130 | 1130 | // Convert name array to string. |
@@ -1134,13 +1134,13 @@ discard block |
||
| 1134 | 1134 | $values['name_field_ids'][] = $subsubindex; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - if ( is_array( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 1138 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 1137 | + if ( is_array( $values['item_meta'][$subsubindex] ) ) { |
|
| 1138 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 1139 | 1139 | } |
| 1140 | 1140 | } |
| 1141 | 1141 | }//end foreach |
| 1142 | 1142 | |
| 1143 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 1143 | + unset( $values['item_meta'][$field_id] ); |
|
| 1144 | 1144 | }//end foreach |
| 1145 | 1145 | |
| 1146 | 1146 | return $form_ids; |