@@ -65,7 +65,7 @@ |
||
| 65 | 65 | protected function get_field_value( $args ) { |
| 66 | 66 | $user_ID = get_current_user_id(); |
| 67 | 67 | $user_ID = $user_ID ? $user_ID : ''; |
| 68 | - $posted_value = FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 68 | + $posted_value = FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 69 | 69 | $action = $args['action'] ?? $args['form_action'] ?? ''; |
| 70 | 70 | $updating = $action === 'update'; |
| 71 | 71 | return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID; |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | if ( is_wp_error( $resp ) ) { |
| 298 | 298 | $error_string = $resp->get_error_message(); |
| 299 | - $errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your captcha', 'formidable' ); |
|
| 300 | - $errors[ 'field' . $args['id'] ] .= ' ' . $error_string; |
|
| 299 | + $errors['field' . $args['id']] = __( 'There was a problem verifying your captcha', 'formidable' ); |
|
| 300 | + $errors['field' . $args['id']] .= ' ' . $error_string; |
|
| 301 | 301 | return $errors; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | if ( $invalid_message === __( 'The reCAPTCHA was not entered correctly', 'formidable' ) ) { |
| 326 | 326 | $invalid_message = ''; |
| 327 | 327 | } |
| 328 | - $errors[ 'field' . $args['id'] ] = $invalid_message === '' ? $frm_settings->re_msg : $invalid_message; |
|
| 328 | + $errors['field' . $args['id']] = $invalid_message === '' ? $frm_settings->re_msg : $invalid_message; |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | return $errors; |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | $form_id = is_object( $this->field ) ? $this->field->form_id : $this->field['form_id']; |
| 347 | 347 | |
| 348 | - if ( ! isset( $frm_vars['captcha_scores'][ $form_id ] ) ) { |
|
| 349 | - $frm_vars['captcha_scores'][ $form_id ] = $score; |
|
| 348 | + if ( ! isset( $frm_vars['captcha_scores'][$form_id] ) ) { |
|
| 349 | + $frm_vars['captcha_scores'][$form_id] = $score; |
|
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | protected static function post_data_includes_token() { |
| 378 | 378 | $settings = FrmCaptchaFactory::get_settings_object(); |
| 379 | 379 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 380 | - return ! empty( $_POST[ $settings->token_field ] ); |
|
| 380 | + return ! empty( $_POST[$settings->token_field] ); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | if ( $new_val !== $value ) { |
| 235 | - $new_values[ $key ] = $new_val; |
|
| 235 | + $new_values[$key] = $new_val; |
|
| 236 | 236 | } |
| 237 | 237 | }//end foreach |
| 238 | 238 | |
@@ -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, true ) ) { |
| 271 | - $new_values[ $value_key ] = $value; |
|
| 271 | + $new_values[$value_key] = $value; |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
@@ -359,20 +359,20 @@ discard block |
||
| 359 | 359 | foreach ( $all_fields as $fid ) { |
| 360 | 360 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 361 | 361 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 362 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 362 | + $values['item_meta'][$fid->id] = ''; |
|
| 363 | 363 | } |
| 364 | - $field_array[ $fid->id ] = $fid; |
|
| 364 | + $field_array[$fid->id] = $fid; |
|
| 365 | 365 | } |
| 366 | 366 | unset( $all_fields ); |
| 367 | 367 | |
| 368 | 368 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 369 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 369 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 370 | 370 | |
| 371 | 371 | if ( ! $field ) { |
| 372 | 372 | continue; |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - $is_settings_page = isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ); |
|
| 375 | + $is_settings_page = isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ); |
|
| 376 | 376 | |
| 377 | 377 | if ( $is_settings_page ) { |
| 378 | 378 | self::get_settings_page_html( $values, $field ); |
@@ -393,22 +393,22 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | foreach ( $update_options as $opt => $default ) { |
| 396 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 397 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 396 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 397 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 401 | 401 | |
| 402 | 402 | $new_field = array( |
| 403 | 403 | 'field_options' => $field->field_options, |
| 404 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 404 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 405 | 405 | ); |
| 406 | 406 | |
| 407 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 408 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 407 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 408 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 409 | 409 | if ( is_array( $option ) ) { |
| 410 | 410 | foreach ( $option as $key => $item ) { |
| 411 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 411 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 441 | 441 | if ( $field->type === 'textarea' && |
| 442 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 443 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 442 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 443 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 444 | 444 | |
| 445 | 445 | $new_field['field_options']['max'] = ''; |
| 446 | 446 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 449 | 449 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 450 | 450 | */ |
| 451 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 451 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
@@ -526,11 +526,11 @@ discard block |
||
| 526 | 526 | * @return void |
| 527 | 527 | */ |
| 528 | 528 | private static function get_settings_page_html( $values, &$field ) { |
| 529 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 529 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 530 | 530 | $prev_opts = array(); |
| 531 | 531 | $fallback_html = $field->field_options['custom_html'] ?? FrmFieldsHelper::get_default_html( $field->type ); |
| 532 | 532 | |
| 533 | - $field->field_options['custom_html'] = $values['field_options'][ 'custom_html_' . $field->id ] ?? $fallback_html; |
|
| 533 | + $field->field_options['custom_html'] = $values['field_options']['custom_html_' . $field->id] ?? $fallback_html; |
|
| 534 | 534 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
| 535 | 535 | $prev_opts = $field->field_options; |
| 536 | 536 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | foreach ( $field_cols as $col => $default ) { |
| 567 | 567 | $default = $default === '' ? $field->{$col} : $default; |
| 568 | - $new_field[ $col ] = $values['field_options'][ $col . '_' . $field->id ] ?? $default; |
|
| 568 | + $new_field[$col] = $values['field_options'][$col . '_' . $field->id] ?? $default; |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) { |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | self::destroy( $form->id ); |
| 775 | 775 | |
| 776 | 776 | if ( empty( $form->parent_form_id ) ) { |
| 777 | - ++$count; |
|
| 777 | + ++ $count; |
|
| 778 | 778 | } |
| 779 | 779 | } |
| 780 | 780 | |
@@ -998,16 +998,16 @@ discard block |
||
| 998 | 998 | foreach ( $results as $row ) { |
| 999 | 999 | if ( 'trash' !== $row->status ) { |
| 1000 | 1000 | if ( $row->is_template ) { |
| 1001 | - ++$counts['template']; |
|
| 1001 | + ++ $counts['template']; |
|
| 1002 | 1002 | } else { |
| 1003 | - ++$counts['published']; |
|
| 1003 | + ++ $counts['published']; |
|
| 1004 | 1004 | } |
| 1005 | 1005 | } else { |
| 1006 | - ++$counts['trash']; |
|
| 1006 | + ++ $counts['trash']; |
|
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | if ( 'draft' === $row->status ) { |
| 1010 | - ++$counts['draft']; |
|
| 1010 | + ++ $counts['draft']; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | unset( $row ); |
@@ -1056,8 +1056,8 @@ discard block |
||
| 1056 | 1056 | self::maybe_get_form( $form ); |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 1060 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 1059 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 1060 | + return $frm_vars['form_params'][$form->id]; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1088,15 +1088,15 @@ discard block |
||
| 1088 | 1088 | // If there are two forms on the same page, make sure not to submit both. |
| 1089 | 1089 | foreach ( $default_values as $var => $default ) { |
| 1090 | 1090 | if ( $var === 'action' ) { |
| 1091 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1091 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1092 | 1092 | } else { |
| 1093 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1093 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1094 | 1094 | } |
| 1095 | 1095 | unset( $var, $default ); |
| 1096 | 1096 | } |
| 1097 | 1097 | } else { |
| 1098 | 1098 | foreach ( $default_values as $var => $default ) { |
| 1099 | - $values[ $var ] = $default; |
|
| 1099 | + $values[$var] = $default; |
|
| 1100 | 1100 | unset( $var, $default ); |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | ); |
| 1127 | 1127 | |
| 1128 | 1128 | foreach ( $defaults as $var => $default ) { |
| 1129 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1129 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | return $values; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | ); |
| 1162 | 1162 | |
| 1163 | 1163 | foreach ( $defaults as $var => $default ) { |
| 1164 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1164 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | return $values; |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | $form = $atts['form']; |
| 1305 | 1305 | $default = $atts['default'] ?? ''; |
| 1306 | 1306 | |
| 1307 | - return $form->options[ $atts['option'] ] ?? $default; |
|
| 1307 | + return $form->options[$atts['option']] ?? $default; |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | $tokens = $phpcsFile->getTokens(); |
| 46 | 46 | |
| 47 | 47 | // Must have a closing parenthesis. |
| 48 | - if ( ! isset( $tokens[ $stackPtr ]['parenthesis_closer'] ) ) { |
|
| 48 | + if ( ! isset( $tokens[$stackPtr]['parenthesis_closer'] ) ) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - $closeParen = $tokens[ $stackPtr ]['parenthesis_closer']; |
|
| 52 | + $closeParen = $tokens[$stackPtr]['parenthesis_closer']; |
|
| 53 | 53 | |
| 54 | 54 | // Check what's before the opening parenthesis. |
| 55 | 55 | $prevToken = $phpcsFile->findPrevious( T_WHITESPACE, $stackPtr - 1, null, true ); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | T_RETURN, |
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | - if ( ! in_array( $tokens[ $prevToken ]['code'], $validPrecedingTokens, true ) ) { |
|
| 72 | + if ( ! in_array( $tokens[$prevToken]['code'], $validPrecedingTokens, true ) ) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // The expression should end with a semicolon or comma (for array elements). |
| 84 | - if ( $tokens[ $afterClose ]['code'] !== T_SEMICOLON && $tokens[ $afterClose ]['code'] !== T_COMMA && $tokens[ $afterClose ]['code'] !== T_CLOSE_PARENTHESIS ) { |
|
| 84 | + if ( $tokens[$afterClose]['code'] !== T_SEMICOLON && $tokens[$afterClose]['code'] !== T_COMMA && $tokens[$afterClose]['code'] !== T_CLOSE_PARENTHESIS ) { |
|
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | // Remove whitespace after opening parenthesis. |
| 106 | 106 | $next = $stackPtr + 1; |
| 107 | 107 | |
| 108 | - while ( $next < $closeParen && $tokens[ $next ]['code'] === T_WHITESPACE ) { |
|
| 108 | + while ( $next < $closeParen && $tokens[$next]['code'] === T_WHITESPACE ) { |
|
| 109 | 109 | $phpcsFile->fixer->replaceToken( $next, '' ); |
| 110 | - ++$next; |
|
| 110 | + ++ $next; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | // Remove whitespace before closing parenthesis. |
| 114 | 114 | $prev = $closeParen - 1; |
| 115 | 115 | |
| 116 | - while ( $prev > $stackPtr && $tokens[ $prev ]['code'] === T_WHITESPACE ) { |
|
| 116 | + while ( $prev > $stackPtr && $tokens[$prev]['code'] === T_WHITESPACE ) { |
|
| 117 | 117 | $phpcsFile->fixer->replaceToken( $prev, '' ); |
| 118 | - --$prev; |
|
| 118 | + -- $prev; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Remove closing parenthesis. |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | $hasArithmeticOp = false; |
| 151 | 151 | $nestedParenDepth = 0; |
| 152 | 152 | |
| 153 | - for ( $i = $openParen + 1; $i < $closeParen; $i++ ) { |
|
| 154 | - $code = $tokens[ $i ]['code']; |
|
| 153 | + for ( $i = $openParen + 1; $i < $closeParen; $i ++ ) { |
|
| 154 | + $code = $tokens[$i]['code']; |
|
| 155 | 155 | |
| 156 | 156 | // Track nested parentheses - we only care about the top level. |
| 157 | 157 | if ( $code === T_OPEN_PARENTHESIS ) { |
| 158 | - ++$nestedParenDepth; |
|
| 158 | + ++ $nestedParenDepth; |
|
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if ( $code === T_CLOSE_PARENTHESIS ) { |
| 163 | - --$nestedParenDepth; |
|
| 163 | + -- $nestedParenDepth; |
|
| 164 | 164 | continue; |
| 165 | 165 | } |
| 166 | 166 | |