@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // Validate the number format. |
| 72 | 72 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 73 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 73 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // validate number settings |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
| 83 | 83 | $value = (float) $args['value']; |
| 84 | 84 | if ( $value < $minnum ) { |
| 85 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
| 85 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
| 86 | 86 | } elseif ( $value > $maxnum ) { |
| 87 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
| 87 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return void |
| 106 | 106 | */ |
| 107 | 107 | private function validate_step( &$errors, $args ) { |
| 108 | - if ( isset( $errors[ 'field' . $args['id'] ] ) ) { |
|
| 108 | + if ( isset( $errors['field' . $args['id']] ) ) { |
|
| 109 | 109 | // Don't need to check if value is invalid before. |
| 110 | 110 | return; |
| 111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $errors[ 'field' . $args['id'] ] = sprintf( |
|
| 123 | + $errors['field' . $args['id']] = sprintf( |
|
| 124 | 124 | // Translators: %1$s: the first nearest value; %2$s: the second nearest value. |
| 125 | 125 | __( 'Please enter a valid value. Two nearest valid values are %1$s and %2$s', 'formidable' ), |
| 126 | 126 | floatval( $result[0] ), |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 273 | 273 | |
| 274 | 274 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 275 | - $new_values[ $col ] = $values[ $col ]; |
|
| 275 | + $new_values[$col] = $values[$col]; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 284 | 284 | |
| 285 | 285 | if ( isset( $values['id'] ) ) { |
| 286 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 286 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 287 | 287 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 288 | 288 | } |
| 289 | 289 | |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | foreach ( $new_values as $k => $v ) { |
| 293 | 293 | if ( is_array( $v ) ) { |
| 294 | 294 | if ( $k === 'default_value' ) { |
| 295 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 295 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 296 | 296 | } else { |
| 297 | - $new_values[ $k ] = serialize( $v ); |
|
| 297 | + $new_values[$k] = serialize( $v ); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | unset( $k, $v ); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if ( isset( $values['id'] ) ) { |
| 317 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 317 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | return $new_id; |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 375 | 375 | global $frm_duplicate_ids; |
| 376 | 376 | |
| 377 | - $where = array( |
|
| 377 | + $where = array( |
|
| 378 | 378 | array( |
| 379 | 379 | 'or' => 1, |
| 380 | 380 | 'fi.form_id' => $old_form_id, |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 422 | 422 | $new_id = self::create( $values ); |
| 423 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 424 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 423 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 424 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 425 | 425 | unset( $field ); |
| 426 | 426 | }//end foreach |
| 427 | 427 | } |
@@ -459,11 +459,11 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // serialize array values |
| 461 | 461 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 462 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 462 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 463 | 463 | if ( 'field_options' === $opt ) { |
| 464 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 464 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 465 | 465 | } |
| 466 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 466 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | 'id' => $id, |
| 616 | 616 | 'field_key' => $id, |
| 617 | 617 | ); |
| 618 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 618 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | return $type; |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | continue; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - $fields[ $result->id ] = $result; |
|
| 644 | + $fields[$result->id] = $result; |
|
| 645 | 645 | $count ++; |
| 646 | 646 | if ( $limit == 1 ) { |
| 647 | 647 | $fields = $result; |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $count = 0; |
| 688 | 688 | foreach ( $results as $result ) { |
| 689 | 689 | $count ++; |
| 690 | - $fields[ $result->id ] = $result; |
|
| 690 | + $fields[$result->id] = $result; |
|
| 691 | 691 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 692 | 692 | break; |
| 693 | 693 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | if ( ! empty( $sub_fields ) ) { |
| 759 | - $index = $k + $index_offset; |
|
| 759 | + $index = $k + $index_offset; |
|
| 760 | 760 | $index_offset += count( $sub_fields ); |
| 761 | 761 | array_splice( $results, $index, 0, $sub_fields ); |
| 762 | 762 | } |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 802 | 802 | |
| 803 | 803 | if ( is_array( $where ) ) { |
| 804 | - $args = array( |
|
| 804 | + $args = array( |
|
| 805 | 805 | 'order_by' => $order_by, |
| 806 | 806 | 'limit' => $limit, |
| 807 | 807 | ); |
@@ -832,9 +832,9 @@ discard block |
||
| 832 | 832 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 833 | 833 | |
| 834 | 834 | self::prepare_options( $result ); |
| 835 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 836 | - $results[ $r_key ]->options = $result->options; |
|
| 837 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 835 | + $results[$r_key]->field_options = $result->field_options; |
|
| 836 | + $results[$r_key]->options = $result->options; |
|
| 837 | + $results[$r_key]->default_value = $result->default_value; |
|
| 838 | 838 | |
| 839 | 839 | unset( $r_key, $result ); |
| 840 | 840 | } |
@@ -1037,23 +1037,23 @@ discard block |
||
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | public static function is_option_true_in_array( $field, $option ) { |
| 1040 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 1040 | + return isset( $field[$option] ) && $field[$option]; |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | public static function is_option_true_in_object( $field, $option ) { |
| 1044 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1044 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | public static function is_option_empty_in_array( $field, $option ) { |
| 1048 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 1048 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | public static function is_option_empty_in_object( $field, $option ) { |
| 1052 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 1052 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | public static function is_option_value_in_object( $field, $option ) { |
| 1056 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1056 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
@@ -1071,10 +1071,10 @@ discard block |
||
| 1071 | 1071 | |
| 1072 | 1072 | public static function get_option_in_array( $field, $option ) { |
| 1073 | 1073 | |
| 1074 | - if ( isset( $field[ $option ] ) ) { |
|
| 1075 | - $this_option = $field[ $option ]; |
|
| 1076 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1077 | - $this_option = $field['field_options'][ $option ]; |
|
| 1074 | + if ( isset( $field[$option] ) ) { |
|
| 1075 | + $this_option = $field[$option]; |
|
| 1076 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1077 | + $this_option = $field['field_options'][$option]; |
|
| 1078 | 1078 | } else { |
| 1079 | 1079 | $this_option = ''; |
| 1080 | 1080 | } |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | public static function get_option_in_object( $field, $option ) { |
| 1086 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1086 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | /** |
@@ -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 | }//end foreach |
| 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 | |
@@ -356,22 +356,22 @@ discard block |
||
| 356 | 356 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 357 | 357 | |
| 358 | 358 | foreach ( $update_options as $opt => $default ) { |
| 359 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 360 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 359 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 360 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 364 | 364 | |
| 365 | 365 | $new_field = array( |
| 366 | 366 | 'field_options' => $field->field_options, |
| 367 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 367 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 371 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 370 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 371 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 372 | 372 | if ( is_array( $option ) ) { |
| 373 | 373 | foreach ( $option as $key => $item ) { |
| 374 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 374 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 403 | 403 | if ( $field->type === 'textarea' && |
| 404 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 405 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 404 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 405 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 406 | 406 | |
| 407 | 407 | $new_field['field_options']['max'] = ''; |
| 408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 411 | 411 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 412 | 412 | */ |
| 413 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 413 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -486,11 +486,11 @@ discard block |
||
| 486 | 486 | * Updating the settings page |
| 487 | 487 | */ |
| 488 | 488 | private static function get_settings_page_html( $values, &$field ) { |
| 489 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 489 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 490 | 490 | $prev_opts = array(); |
| 491 | 491 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 492 | 492 | |
| 493 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 493 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 494 | 494 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 495 | 495 | $prev_opts = $field->field_options; |
| 496 | 496 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | foreach ( $field_cols as $col => $default ) { |
| 517 | 517 | $default = ( $default === '' ) ? $field->{$col} : $default; |
| 518 | 518 | |
| 519 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 519 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Don't save the template option. |
@@ -941,8 +941,8 @@ discard block |
||
| 941 | 941 | self::maybe_get_form( $form ); |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 945 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 944 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 945 | + return $frm_vars['form_params'][$form->id]; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -971,15 +971,15 @@ discard block |
||
| 971 | 971 | // If there are two forms on the same page, make sure not to submit both. |
| 972 | 972 | foreach ( $default_values as $var => $default ) { |
| 973 | 973 | if ( $var == 'action' ) { |
| 974 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 974 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 975 | 975 | } else { |
| 976 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 976 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 977 | 977 | } |
| 978 | 978 | unset( $var, $default ); |
| 979 | 979 | } |
| 980 | 980 | } else { |
| 981 | 981 | foreach ( $default_values as $var => $default ) { |
| 982 | - $values[ $var ] = $default; |
|
| 982 | + $values[$var] = $default; |
|
| 983 | 983 | unset( $var, $default ); |
| 984 | 984 | } |
| 985 | 985 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | 'sdir' => '', |
| 1006 | 1006 | ); |
| 1007 | 1007 | foreach ( $defaults as $var => $default ) { |
| 1008 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1008 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | return $values; |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | 'keep_post' => '', |
| 1034 | 1034 | ); |
| 1035 | 1035 | foreach ( $defaults as $var => $default ) { |
| 1036 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1036 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | return $values; |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | $form = $atts['form']; |
| 1137 | 1137 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
| 1138 | 1138 | |
| 1139 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
| 1139 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | /** |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class FrmFormTemplateApi extends FrmFormApi { |
| 7 | 7 | |
| 8 | - protected static $code_option_name = 'frm_free_license_code'; |
|
| 8 | + protected static $code_option_name = 'frm_free_license_code'; |
|
| 9 | 9 | |
| 10 | 10 | private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/'; |
| 11 | 11 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $templates = $this->get_api_info(); |
| 91 | 91 | $contact_form = 20872734; |
| 92 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
| 92 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -164,15 +164,15 @@ discard block |
||
| 164 | 164 | continue; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
| 167 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
| 170 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
| 171 | 171 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
| 172 | 172 | wp_send_json_error( $error ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
| 175 | + $data['url'] = $data['urlByKey'][$key]; |
|
| 176 | 176 | }//end if |
| 177 | 177 | |
| 178 | 178 | wp_send_json_success( $data ); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 163 | 163 | $to = $this->explode_emails( $to ); |
| 164 | 164 | |
| 165 | - $where = array( |
|
| 165 | + $where = array( |
|
| 166 | 166 | 'it.field_id !' => 0, |
| 167 | 167 | 'it.item_id' => $this->entry->id, |
| 168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'entry' => $this->entry, |
| 173 | 173 | 'form' => $this->form, |
| 174 | 174 | ); |
| 175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 176 | 176 | |
| 177 | 177 | $this->to = array_unique( (array) $to ); |
| 178 | 178 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | // Add the user info if it isn't already included |
| 410 | 410 | if ( $this->include_user_info && $prev_mail_body === $mail_body ) { |
| 411 | - $data = $this->entry->description; |
|
| 411 | + $data = $this->entry->description; |
|
| 412 | 412 | $mail_body .= "\r\n\r\n" . __( 'User Information', 'formidable' ) . "\r\n"; |
| 413 | 413 | $this->maybe_add_ip( $mail_body ); |
| 414 | 414 | $mail_body .= __( 'User-Agent (Browser/OS)', 'formidable' ) . ': ' . FrmEntriesHelper::get_browser( $data['browser'] ) . "\r\n"; |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
| 703 | 703 | } else { |
| 704 | 704 | // If user enters a name without an email |
| 705 | - unset( $recipients[ $key ] ); |
|
| 705 | + unset( $recipients[$key] ); |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 710 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 711 | 711 | }//end foreach |
| 712 | 712 | |
| 713 | 713 | return $recipients; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | ); |
| 858 | 858 | |
| 859 | 859 | // Remove phone number from to addresses |
| 860 | - unset( $this->to[ $key ] ); |
|
| 860 | + unset( $this->to[$key] ); |
|
| 861 | 861 | }//end if |
| 862 | 862 | }//end foreach |
| 863 | 863 | } |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | return $this->get_pagenum(); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 239 | - return $this->_pagination_args[ $key ]; |
|
| 238 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 239 | + return $this->_pagination_args[$key]; |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -284,8 +284,8 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | private function hidden_search_inputs( $param_name ) { |
| 287 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 288 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 287 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 288 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 289 | 289 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | echo "<ul class='subsubsub'>\n"; |
| 331 | 331 | foreach ( $views as $class => $view ) { |
| 332 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 332 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 333 | 333 | } |
| 334 | 334 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 335 | 335 | echo '</ul>'; |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | 'next' => __( 'Next page', 'formidable' ), |
| 710 | 710 | ); |
| 711 | 711 | |
| 712 | - return $labels[ $link ]; |
|
| 712 | + return $labels[$link]; |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | private function current_url() { |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | // If the primary column doesn't exist fall back to the |
| 804 | 804 | // first non-checkbox column. |
| 805 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 805 | + if ( ! isset( $columns[$default] ) ) { |
|
| 806 | 806 | $default = self::get_default_primary_column_name(); |
| 807 | 807 | } |
| 808 | 808 | |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | */ |
| 817 | 817 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 818 | 818 | |
| 819 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 819 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 820 | 820 | $column = $default; |
| 821 | 821 | } |
| 822 | 822 | |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | // In 4.3, we added a fourth argument for primary column. |
| 839 | 839 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 840 | 840 | foreach ( $this->_column_headers as $key => $value ) { |
| 841 | - $column_headers[ $key ] = $value; |
|
| 841 | + $column_headers[$key] = $value; |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | return $column_headers; |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | $data[1] = false; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | - $sortable[ $id ] = $data; |
|
| 874 | + $sortable[$id] = $data; |
|
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | $primary = $this->get_primary_column_name(); |
@@ -948,8 +948,8 @@ discard block |
||
| 948 | 948 | $class[] = 'column-primary'; |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 952 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 951 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 952 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 953 | 953 | |
| 954 | 954 | if ( $current_orderby == $orderby ) { |
| 955 | 955 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1034 | 1034 | */ |
| 1035 | 1035 | protected function should_display( $args, $settings ) { |
| 1036 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1036 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $gateway = $payment_action->post_content['gateway']; |
| 48 | 48 | $is_stripe = $gateway === 'stripe' || ( is_array( $gateway ) && in_array( 'stripe', $gateway, true ) ); |
| 49 | 49 | if ( ! $is_stripe || empty( $payment_action->post_content['amount'] ) ) { |
| 50 | - unset( $payment_actions[ $k ] ); |
|
| 50 | + unset( $payment_actions[$k] ); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | return $payment_actions; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | 'run_triggers' => false, |
| 85 | 85 | 'show_errors' => true, |
| 86 | 86 | ); |
| 87 | - $atts = compact( 'action', 'entry', 'form' ); |
|
| 87 | + $atts = compact( 'action', 'entry', 'form' ); |
|
| 88 | 88 | |
| 89 | 89 | $amount = self::prepare_amount( $action->post_content['amount'], $atts ); |
| 90 | 90 | if ( empty( $amount ) || $amount == 000 ) { |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | $disallowed = array( ';', ':', '!important' ); |
| 503 | 503 | foreach ( $settings as $k => $s ) { |
| 504 | 504 | if ( is_string( $s ) ) { |
| 505 | - $settings[ $k ] = str_replace( $disallowed, '', $s ); |
|
| 505 | + $settings[$k] = str_replace( $disallowed, '', $s ); |
|
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
@@ -574,18 +574,18 @@ discard block |
||
| 574 | 574 | * @return array |
| 575 | 575 | */ |
| 576 | 576 | public static function remove_cc_validation( $errors, $field, $values ) { |
| 577 | - $has_processed = isset( $_POST[ 'frmintent' . $field->form_id ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 577 | + $has_processed = isset( $_POST['frmintent' . $field->form_id] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 578 | 578 | if ( ! $has_processed ) { |
| 579 | 579 | return $errors; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $field_id = isset( $field->temp_id ) ? $field->temp_id : $field->id; |
| 583 | 583 | |
| 584 | - if ( isset( $errors[ 'field' . $field_id . '-cc' ] ) ) { |
|
| 585 | - unset( $errors[ 'field' . $field_id . '-cc' ] ); |
|
| 584 | + if ( isset( $errors['field' . $field_id . '-cc'] ) ) { |
|
| 585 | + unset( $errors['field' . $field_id . '-cc'] ); |
|
| 586 | 586 | } |
| 587 | - if ( isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 588 | - unset( $errors[ 'field' . $field_id ] ); |
|
| 587 | + if ( isset( $errors['field' . $field_id] ) ) { |
|
| 588 | + unset( $errors['field' . $field_id] ); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | return $errors; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
| 166 | 166 | foreach ( $conditionally_add as $index ) { |
| 167 | - if ( isset( $atts[ $index ] ) ) { |
|
| 168 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
| 167 | + if ( isset( $atts[$index] ) ) { |
|
| 168 | + $entry_atts[$index] = $atts[$index]; |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | $unset = array( 'id', 'form_id', 'format' ); |
| 353 | 353 | foreach ( $unset as $param ) { |
| 354 | - if ( isset( $atts[ $param ] ) ) { |
|
| 355 | - unset( $atts[ $param ] ); |
|
| 354 | + if ( isset( $atts[$param] ) ) { |
|
| 355 | + unset( $atts[$param] ); |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
@@ -523,11 +523,11 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
| 525 | 525 | |
| 526 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
| 526 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
| 527 | 527 | |
| 528 | 528 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
| 529 | 529 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
| 530 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
| 530 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
| 531 | 531 | } |
| 532 | 532 | } |
| 533 | 533 | } |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | if ( is_array( $value ) ) { |
| 919 | 919 | foreach ( $value as $key => $single_value ) { |
| 920 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
| 920 | + $value[$key] = $this->strip_html( $single_value ); |
|
| 921 | 921 | } |
| 922 | 922 | } elseif ( $this->is_plain_text && ! is_array( $value ) ) { |
| 923 | 923 | if ( strpos( $value, '<img' ) !== false ) { |
@@ -330,11 +330,11 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | // Perform add or remove operation. |
| 332 | 332 | if ( 'add' === $operation ) { |
| 333 | - self::$favorite_templates[ $key ][] = $template_id; |
|
| 333 | + self::$favorite_templates[$key][] = $template_id; |
|
| 334 | 334 | } elseif ( 'remove' === $operation ) { |
| 335 | - $position = array_search( $template_id, self::$favorite_templates[ $key ], true ); |
|
| 335 | + $position = array_search( $template_id, self::$favorite_templates[$key], true ); |
|
| 336 | 336 | if ( $position !== false ) { |
| 337 | - unset( self::$favorite_templates[ $key ][ $position ] ); |
|
| 337 | + unset( self::$favorite_templates[$key][$position] ); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | foreach ( self::$templates as $key => &$template ) { |
| 464 | 464 | // Skip the template if the categories are not set. |
| 465 | 465 | if ( ! isset( $template['categories'] ) ) { |
| 466 | - unset( self::$templates[ $key ] ); |
|
| 466 | + unset( self::$templates[$key] ); |
|
| 467 | 467 | continue; |
| 468 | 468 | } |
| 469 | 469 | |
@@ -477,14 +477,14 @@ discard block |
||
| 477 | 477 | // Add the slug to the new array. |
| 478 | 478 | $template['category_slugs'][] = $category_slug; |
| 479 | 479 | |
| 480 | - if ( ! isset( self::$categories[ $category_slug ] ) ) { |
|
| 481 | - self::$categories[ $category_slug ] = array( |
|
| 480 | + if ( ! isset( self::$categories[$category_slug] ) ) { |
|
| 481 | + self::$categories[$category_slug] = array( |
|
| 482 | 482 | 'name' => $category, |
| 483 | 483 | 'count' => 0, |
| 484 | 484 | ); |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - self::$categories[ $category_slug ]['count']++; |
|
| 487 | + self::$categories[$category_slug]['count'] ++; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Mark the template as favorite if it's in the favorite templates list. |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $redundant_cats = array_merge( array( 'PayPal', 'Stripe', 'Twilio' ), FrmFormsHelper::ignore_template_categories() ); |
| 500 | 500 | foreach ( $redundant_cats as $redundant_cat ) { |
| 501 | 501 | $category_slug = sanitize_title( $redundant_cat ); |
| 502 | - unset( self::$categories[ $category_slug ] ); |
|
| 502 | + unset( self::$categories[$category_slug] ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | // Sort the categories by keys alphabetically. |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | 'count' => 0, |
| 525 | 525 | ); |
| 526 | 526 | } |
| 527 | - $special_categories['all-templates'] = array( |
|
| 527 | + $special_categories['all-templates'] = array( |
|
| 528 | 528 | 'name' => __( 'All Templates', 'formidable' ), |
| 529 | 529 | 'count' => self::get_template_count(), |
| 530 | 530 | ); |
@@ -552,9 +552,9 @@ discard block |
||
| 552 | 552 | */ |
| 553 | 553 | private static function assign_featured_templates() { |
| 554 | 554 | foreach ( self::FEATURED_TEMPLATES_KEYS as $key ) { |
| 555 | - if ( isset( self::$templates[ $key ] ) ) { |
|
| 556 | - self::$templates[ $key ]['is_featured'] = true; |
|
| 557 | - self::$featured_templates[] = self::$templates[ $key ]; |
|
| 555 | + if ( isset( self::$templates[$key] ) ) { |
|
| 556 | + self::$templates[$key]['is_featured'] = true; |
|
| 557 | + self::$featured_templates[] = self::$templates[$key]; |
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | } |