@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( $new_val !== $value ) { |
212 | - $new_values[ $key ] = $new_val; |
|
212 | + $new_values[$key] = $new_val; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | foreach ( $values as $value_key => $value ) { |
242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
243 | - $new_values[ $value_key ] = $value; |
|
243 | + $new_values[$value_key] = $value; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
324 | 324 | foreach ( $all_fields as $fid ) { |
325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
326 | - $values['item_meta'][ $fid->id ] = ''; |
|
326 | + $values['item_meta'][$fid->id] = ''; |
|
327 | 327 | } |
328 | - $field_array[ $fid->id ] = $fid; |
|
328 | + $field_array[$fid->id] = $fid; |
|
329 | 329 | } |
330 | 330 | unset( $all_fields ); |
331 | 331 | |
332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
334 | - $field = $field_array[ $field_id ]; |
|
333 | + if ( isset( $field_array[$field_id] ) ) { |
|
334 | + $field = $field_array[$field_id]; |
|
335 | 335 | } else { |
336 | 336 | $field = FrmField::getOne( $field_id ); |
337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
344 | 344 | if ( $is_settings_page ) { |
345 | 345 | self::get_settings_page_html( $values, $field ); |
346 | 346 | |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
356 | 356 | |
357 | 357 | foreach ( $update_options as $opt => $default ) { |
358 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
359 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
358 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
359 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
363 | 363 | |
364 | 364 | $new_field = array( |
365 | 365 | 'field_options' => $field->field_options, |
366 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
366 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
367 | 367 | ); |
368 | 368 | |
369 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
370 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
369 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
370 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
371 | 371 | if ( is_array( $option ) ) { |
372 | 372 | foreach ( $option as $key => $item ) { |
373 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
373 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | } |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | */ |
401 | 401 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
402 | 402 | if ( $field->type === 'textarea' && |
403 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
404 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
403 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
404 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
405 | 405 | |
406 | 406 | $new_field['field_options']['max'] = ''; |
407 | 407 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
410 | 410 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
411 | 411 | */ |
412 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
412 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | * Updating the settings page |
485 | 485 | */ |
486 | 486 | private static function get_settings_page_html( $values, &$field ) { |
487 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
487 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
488 | 488 | $prev_opts = array(); |
489 | 489 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
490 | 490 | |
491 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
491 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
492 | 492 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
493 | 493 | $prev_opts = $field->field_options; |
494 | 494 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | foreach ( $field_cols as $col => $default ) { |
515 | 515 | $default = ( $default === '' ) ? $field->{$col} : $default; |
516 | 516 | |
517 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
517 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | // Don't save the template option. |
@@ -938,8 +938,8 @@ discard block |
||
938 | 938 | self::maybe_get_form( $form ); |
939 | 939 | } |
940 | 940 | |
941 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
942 | - return $frm_vars['form_params'][ $form->id ]; |
|
941 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
942 | + return $frm_vars['form_params'][$form->id]; |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -968,15 +968,15 @@ discard block |
||
968 | 968 | //if there are two forms on the same page, make sure not to submit both |
969 | 969 | foreach ( $default_values as $var => $default ) { |
970 | 970 | if ( $var == 'action' ) { |
971 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
971 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
972 | 972 | } else { |
973 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
973 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
974 | 974 | } |
975 | 975 | unset( $var, $default ); |
976 | 976 | } |
977 | 977 | } else { |
978 | 978 | foreach ( $default_values as $var => $default ) { |
979 | - $values[ $var ] = $default; |
|
979 | + $values[$var] = $default; |
|
980 | 980 | unset( $var, $default ); |
981 | 981 | } |
982 | 982 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | 'sdir' => '', |
1003 | 1003 | ); |
1004 | 1004 | foreach ( $defaults as $var => $default ) { |
1005 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1005 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | return $values; |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | 'keep_post' => '', |
1031 | 1031 | ); |
1032 | 1032 | foreach ( $defaults as $var => $default ) { |
1033 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1033 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | return $values; |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | $form = $atts['form']; |
1134 | 1134 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1135 | 1135 | |
1136 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1136 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | /** |
@@ -126,11 +126,11 @@ |
||
126 | 126 | foreach ( $payments as $payment ) { |
127 | 127 | list( $amount, $currency ) = FrmTransLiteAppHelper::get_amount_and_currency_from_payment( $payment ); |
128 | 128 | |
129 | - if ( ! isset( $data[ $currency ] ) ) { |
|
130 | - $data[ $currency ] = 0; |
|
129 | + if ( ! isset( $data[$currency] ) ) { |
|
130 | + $data[$currency] = 0; |
|
131 | 131 | } |
132 | 132 | |
133 | - $data[ $currency ] += floatval( $amount ); |
|
133 | + $data[$currency] += floatval( $amount ); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $data; |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public static function get_last_sent_date( $type ) { |
238 | 238 | $options = self::get_options(); |
239 | - if ( empty( $options[ 'last_' . $type ] ) ) { |
|
239 | + if ( empty( $options['last_' . $type] ) ) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
243 | - return $options[ 'last_' . $type ]; |
|
243 | + return $options['last_' . $type]; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | public static function set_last_sent_date( $type, $value = null ) { |
253 | 253 | $options = self::get_options(); |
254 | 254 | |
255 | - $options[ 'last_' . $type ] = null === $value ? self::get_date_from_today() : ''; |
|
255 | + $options['last_' . $type] = null === $value ? self::get_date_from_today() : ''; |
|
256 | 256 | self::save_options( $options ); |
257 | 257 | } |
258 | 258 |