@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | global $wpdb; |
| 58 | 58 | |
| 59 | - $values = array( |
|
| 59 | + $values = array( |
|
| 60 | 60 | 'item_id' => $entry_id, |
| 61 | 61 | 'field_id' => $field_id, |
| 62 | 62 | ); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $values_indexed_by_field_id[ $field_id ] = $meta_value; |
|
| 151 | + $values_indexed_by_field_id[$field_id] = $meta_value; |
|
| 152 | 152 | |
| 153 | 153 | self::get_value_to_save( compact( 'field', 'field_id', 'entry_id' ), $meta_value ); |
| 154 | 154 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ( $previous_field_ids && in_array( $field_id, $previous_field_ids ) ) { |
| 157 | 157 | if ( $meta_value === array() || ( ! is_array( $meta_value ) && trim( $meta_value ) === '' ) ) { |
| 158 | 158 | // Remove blank fields. |
| 159 | - unset( $values_indexed_by_field_id[ $field_id ] ); |
|
| 159 | + unset( $values_indexed_by_field_id[$field_id] ); |
|
| 160 | 160 | } else { |
| 161 | 161 | // if value exists, then update it |
| 162 | 162 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public static function get_meta_value( $entry, $field_id ) { |
| 252 | 252 | if ( isset( $entry->metas ) ) { |
| 253 | - return $entry->metas[ $field_id ] ?? false; |
|
| 253 | + return $entry->metas[$field_id] ?? false; |
|
| 254 | 254 | } |
| 255 | 255 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
| 256 | 256 | } |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | $cached = FrmDb::check_cache( $entry_id, 'frm_entry' ); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
| 277 | - $result = $cached->metas[ $field_id ]; |
|
| 276 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
| 277 | + $result = $cached->metas[$field_id]; |
|
| 278 | 278 | return wp_unslash( $result ); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | foreach ( $values as $k => $v ) { |
| 327 | 327 | FrmAppHelper::unserialize_or_decode( $v ); |
| 328 | - $values[ $k ] = $v; |
|
| 328 | + $values[$k] = $v; |
|
| 329 | 329 | unset( $k, $v ); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | foreach ( $results as $k => $result ) { |
| 403 | 403 | FrmAppHelper::unserialize_or_decode( $result->meta_value ); |
| 404 | - $results[ $k ]->meta_value = wp_unslash( $result->meta_value ); |
|
| 404 | + $results[$k]->meta_value = wp_unslash( $result->meta_value ); |
|
| 405 | 405 | unset( $k, $result ); |
| 406 | 406 | } |
| 407 | 407 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | } elseif ( str_contains( $args['is_draft'], ',' ) ) { |
| 535 | 535 | $is_draft = array_reduce( |
| 536 | 536 | explode( ',', $args['is_draft'] ), |
| 537 | - function ( $total, $current ) { |
|
| 537 | + function( $total, $current ) { |
|
| 538 | 538 | if ( is_numeric( $current ) ) { |
| 539 | 539 | $total[] = absint( $current ); |
| 540 | 540 | } |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
| 177 | 177 | |
| 178 | 178 | foreach ( $conditionally_add as $index ) { |
| 179 | - if ( isset( $atts[ $index ] ) ) { |
|
| 180 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
| 179 | + if ( isset( $atts[$index] ) ) { |
|
| 180 | + $entry_atts[$index] = $atts[$index]; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | $unset = array( 'id', 'form_id', 'format' ); |
| 382 | 382 | |
| 383 | 383 | foreach ( $unset as $param ) { |
| 384 | - if ( isset( $atts[ $param ] ) ) { |
|
| 385 | - unset( $atts[ $param ] ); |
|
| 384 | + if ( isset( $atts[$param] ) ) { |
|
| 385 | + unset( $atts[$param] ); |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | protected function push_single_field_to_array( $field_value, &$output ) { |
| 557 | 557 | if ( $this->include_field_in_content( $field_value ) ) { |
| 558 | 558 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
| 559 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
| 559 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
| 560 | 560 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
| 561 | 561 | |
| 562 | 562 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
| 563 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
| 563 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | } |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | if ( $this->is_plain_text ) { |
| 977 | 977 | if ( is_array( $value ) ) { |
| 978 | 978 | foreach ( $value as $key => $single_value ) { |
| 979 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
| 979 | + $value[$key] = $this->strip_html( $single_value ); |
|
| 980 | 980 | } |
| 981 | 981 | } elseif ( $this->is_plain_text && ! is_array( $value ) ) { |
| 982 | 982 | if ( str_contains( $value, '<img' ) ) { |
@@ -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,21 +359,21 @@ 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 | 364 | |
| 365 | - $field_array[ $fid->id ] = $fid; |
|
| 365 | + $field_array[$fid->id] = $fid; |
|
| 366 | 366 | } |
| 367 | 367 | unset( $all_fields ); |
| 368 | 368 | |
| 369 | 369 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 370 | - $field = $field_array[ $field_id ] ?? FrmField::getOne( $field_id ); |
|
| 370 | + $field = $field_array[$field_id] ?? FrmField::getOne( $field_id ); |
|
| 371 | 371 | |
| 372 | 372 | if ( ! $field ) { |
| 373 | 373 | continue; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $is_settings_page = isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ); |
|
| 376 | + $is_settings_page = isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ); |
|
| 377 | 377 | |
| 378 | 378 | if ( $is_settings_page ) { |
| 379 | 379 | self::get_settings_page_html( $values, $field ); |
@@ -394,22 +394,22 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | foreach ( $update_options as $opt => $default ) { |
| 397 | - $field->field_options[ $opt ] = $values['field_options'][ $opt . '_' . $field_id ] ?? $default; |
|
| 398 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 397 | + $field->field_options[$opt] = $values['field_options'][$opt . '_' . $field_id] ?? $default; |
|
| 398 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 402 | 402 | |
| 403 | 403 | $new_field = array( |
| 404 | 404 | 'field_options' => $field->field_options, |
| 405 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 405 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 406 | 406 | ); |
| 407 | 407 | |
| 408 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 409 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 408 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 409 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 410 | 410 | if ( is_array( $option ) ) { |
| 411 | 411 | foreach ( $option as $key => $item ) { |
| 412 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 412 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 413 | 413 | } |
| 414 | 414 | } |
| 415 | 415 | } |
@@ -440,15 +440,15 @@ discard block |
||
| 440 | 440 | */ |
| 441 | 441 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 442 | 442 | if ( $field->type === 'textarea' && |
| 443 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 444 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 443 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 444 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 445 | 445 | $new_field['field_options']['max'] = ''; |
| 446 | 446 | |
| 447 | 447 | /** |
| 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 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $content_before_channel_tag, |
| 108 | 108 | 1 |
| 109 | 109 | ); |
| 110 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 110 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | 201 | if ( $term && is_array( $term ) ) { |
| 202 | - ++$imported['imported']['terms']; |
|
| 203 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 202 | + ++ $imported['imported']['terms']; |
|
| 203 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | unset( $term, $t ); |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | if ( $form_id ) { |
| 261 | 261 | if ( empty( $form['parent_form_id'] ) ) { |
| 262 | 262 | // Don't include the repeater form in the imported count. |
| 263 | - ++$imported['imported']['forms']; |
|
| 263 | + ++ $imported['imported']['forms']; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Keep track of whether this specific form was updated or not. |
| 267 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 267 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // Update field ids/keys to new ones. |
| 280 | 280 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 281 | 281 | |
| 282 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 282 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 283 | 283 | |
| 284 | 284 | // Send pre 2.0 form options through function that creates actions. |
| 285 | 285 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | if ( empty( $form['parent_form_id'] ) ) { |
| 370 | 370 | // Don't include the repeater form in the updated count. |
| 371 | - ++$imported['updated']['forms']; |
|
| 371 | + ++ $imported['updated']['forms']; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // Keep track of whether this specific form was updated or not |
| 375 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 375 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
@@ -385,8 +385,8 @@ discard block |
||
| 385 | 385 | $old_fields = array(); |
| 386 | 386 | |
| 387 | 387 | foreach ( $form_fields as $f ) { |
| 388 | - $old_fields[ $f->id ] = $f; |
|
| 389 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 388 | + $old_fields[$f->id] = $f; |
|
| 389 | + $old_fields[$f->field_key] = $f->id; |
|
| 390 | 390 | unset( $f ); |
| 391 | 391 | } |
| 392 | 392 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 448 | 448 | if ( $parent_form_id ) { |
| 449 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 449 | + $child_forms[$form_id] = $parent_form_id; |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | |
@@ -461,9 +461,9 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 463 | 463 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 464 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 464 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 465 | 465 | // Update all children with this old parent_form_id |
| 466 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 466 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 467 | 467 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 468 | 468 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 469 | 469 | } |
@@ -499,33 +499,33 @@ discard block |
||
| 499 | 499 | |
| 500 | 500 | if ( $this_form ) { |
| 501 | 501 | // check for field to edit by field id |
| 502 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 502 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 503 | 503 | FrmField::update( $f['id'], $f ); |
| 504 | - ++$imported['updated']['fields']; |
|
| 504 | + ++ $imported['updated']['fields']; |
|
| 505 | 505 | |
| 506 | - unset( $form_fields[ $f['id'] ] ); |
|
| 506 | + unset( $form_fields[$f['id']] ); |
|
| 507 | 507 | |
| 508 | 508 | // Unset old field key. |
| 509 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 510 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 509 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 510 | + unset( $form_fields[$f['field_key']] ); |
|
| 511 | 511 | } |
| 512 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 513 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 512 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 513 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 514 | 514 | $old_field_id = $f['id']; |
| 515 | 515 | |
| 516 | 516 | // check for field to edit by field key |
| 517 | 517 | unset( $f['id'] ); |
| 518 | 518 | |
| 519 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 520 | - ++$imported['updated']['fields']; |
|
| 519 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 520 | + ++ $imported['updated']['fields']; |
|
| 521 | 521 | |
| 522 | 522 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
| 523 | 523 | |
| 524 | 524 | // Unset old field id. |
| 525 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
| 525 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
| 526 | 526 | |
| 527 | 527 | // Unset old field key. |
| 528 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 528 | + unset( $form_fields[$f['field_key']] ); |
|
| 529 | 529 | } else { |
| 530 | 530 | // If no matching field id or key in this form, create the field. |
| 531 | 531 | self::create_imported_field( $f, $imported ); |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | */ |
| 566 | 566 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
| 567 | 567 | // Assign field array the update field's ID. |
| 568 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
| 568 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
| 569 | 569 | |
| 570 | 570 | /** |
| 571 | 571 | * Fires when an existing field is imported. |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | * @param int $field_id |
| 577 | 577 | * @param int $old_field_id |
| 578 | 578 | */ |
| 579 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
| 579 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -690,8 +690,8 @@ discard block |
||
| 690 | 690 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 691 | 691 | $form_select = (int) $f['field_options']['form_select']; |
| 692 | 692 | |
| 693 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 694 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 693 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 694 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 695 | 695 | } |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -715,8 +715,8 @@ discard block |
||
| 715 | 715 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 716 | 716 | $old_form = $f['field_options']['get_values_form']; |
| 717 | 717 | |
| 718 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 719 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 718 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 719 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | } |
@@ -732,13 +732,13 @@ discard block |
||
| 732 | 732 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 733 | 733 | |
| 734 | 734 | foreach ( $update_values as $k => $v ) { |
| 735 | - $f[ $k ] = $v; |
|
| 735 | + $f[$k] = $v; |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 739 | 739 | |
| 740 | 740 | foreach ( $update_values as $k => $v ) { |
| 741 | - $f[ $k ] = $v; |
|
| 741 | + $f[$k] = $v; |
|
| 742 | 742 | } |
| 743 | 743 | } |
| 744 | 744 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | $field = (array) $field; |
| 758 | 758 | $field_options = $field['field_options']; |
| 759 | 759 | |
| 760 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 760 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 761 | 761 | return array(); |
| 762 | 762 | } |
| 763 | 763 | |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 788 | 788 | if ( $opt == $default_value ) { |
| 789 | - unset( $options[ $opt_key ] ); |
|
| 789 | + unset( $options[$opt_key] ); |
|
| 790 | 790 | break; |
| 791 | 791 | } |
| 792 | 792 | } |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | |
| 819 | 819 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 820 | 820 | if ( $new_id != false ) { |
| 821 | - ++$imported['imported']['fields']; |
|
| 821 | + ++ $imported['imported']['fields']; |
|
| 822 | 822 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
| 823 | 823 | } |
| 824 | 824 | } |
@@ -848,10 +848,10 @@ discard block |
||
| 848 | 848 | |
| 849 | 849 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 850 | 850 | // Remove the src from options as it isn't required after import. |
| 851 | - unset( $field['options'][ $key ]['src'] ); |
|
| 851 | + unset( $field['options'][$key]['src'] ); |
|
| 852 | 852 | |
| 853 | 853 | if ( is_numeric( $image_id ) ) { |
| 854 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 854 | + $field['options'][$key]['image'] = $image_id; |
|
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | 857 | |
@@ -1046,8 +1046,8 @@ discard block |
||
| 1046 | 1046 | } else { |
| 1047 | 1047 | if ( $post['post_type'] === 'frm_display' ) { |
| 1048 | 1048 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 1049 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 1050 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 1049 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 1050 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 1051 | 1051 | } |
| 1052 | 1052 | // Create/update post now |
| 1053 | 1053 | $post_id = wp_insert_post( $post ); |
@@ -1058,7 +1058,7 @@ discard block |
||
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | 1060 | if ( str_contains( $post['post_content'], '[display-frm-data' ) || str_contains( $post['post_content'], '[formidable' ) ) { |
| 1061 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 1061 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 1062 | 1062 | } |
| 1063 | 1063 | |
| 1064 | 1064 | self::update_postmeta( $post, $post_id ); |
@@ -1066,20 +1066,20 @@ discard block |
||
| 1066 | 1066 | |
| 1067 | 1067 | $this_type = 'posts'; |
| 1068 | 1068 | |
| 1069 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 1070 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 1069 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 1070 | + $this_type = $post_types[$post['post_type']]; |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | if ( isset( $post['ID'] ) && (int) $post_id === (int) $post['ID'] ) { |
| 1074 | - ++$imported['updated'][ $this_type ]; |
|
| 1074 | + ++ $imported['updated'][$this_type]; |
|
| 1075 | 1075 | } else { |
| 1076 | - ++$imported['imported'][ $this_type ]; |
|
| 1076 | + ++ $imported['imported'][$this_type]; |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | - $imported['posts'][ $old_id ] = $post_id; |
|
| 1079 | + $imported['posts'][$old_id] = $post_id; |
|
| 1080 | 1080 | |
| 1081 | 1081 | if ( $post['post_type'] === 'frm_display' ) { |
| 1082 | - $view_ids[ $old_id ] = $post_id; |
|
| 1082 | + $view_ids[$old_id] = $post_id; |
|
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1257,9 +1257,9 @@ discard block |
||
| 1257 | 1257 | $post['attachment_url'] = (string) $item->attachment_url; |
| 1258 | 1258 | } |
| 1259 | 1259 | |
| 1260 | - if ( $post['post_type'] === FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 1260 | + if ( $post['post_type'] === FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1261 | 1261 | // update to new form id |
| 1262 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1262 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | // Don't allow default styles to take over a site's default style |
@@ -1296,8 +1296,8 @@ discard block |
||
| 1296 | 1296 | ); |
| 1297 | 1297 | |
| 1298 | 1298 | // Switch old form and field ids to new ones. |
| 1299 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1300 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1299 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1300 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1301 | 1301 | } else { |
| 1302 | 1302 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1303 | 1303 | |
@@ -1307,23 +1307,23 @@ discard block |
||
| 1307 | 1307 | $m['value'] = FrmFieldsHelper::switch_field_ids( $m['value'] ); |
| 1308 | 1308 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1309 | 1309 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1310 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1311 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1310 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1311 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | if ( ! empty( $m['value']['map_address_fields'] ) ) { |
| 1316 | 1316 | foreach ( $m['value']['map_address_fields'] as $address_field_key => $address_field_id ) { |
| 1317 | - if ( isset( $frm_duplicate_ids[ $address_field_id ] ) ) { |
|
| 1318 | - $m['value']['map_address_fields'][ $address_field_key ] = $frm_duplicate_ids[ $address_field_id ]; |
|
| 1317 | + if ( isset( $frm_duplicate_ids[$address_field_id] ) ) { |
|
| 1318 | + $m['value']['map_address_fields'][$address_field_key] = $frm_duplicate_ids[$address_field_id]; |
|
| 1319 | 1319 | } |
| 1320 | 1320 | } |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | 1323 | if ( ! empty( $m['value']['calendar_options'] ) ) { |
| 1324 | 1324 | foreach ( $m['value']['calendar_options'] as $calendar_option_group_key => $calendar_option ) { |
| 1325 | - if ( isset( $frm_duplicate_ids[ $calendar_option['value'] ] ) ) { |
|
| 1326 | - $m['value']['calendar_options'][ $calendar_option_group_key ]['value'] = $frm_duplicate_ids[ $calendar_option['value'] ]; |
|
| 1325 | + if ( isset( $frm_duplicate_ids[$calendar_option['value']] ) ) { |
|
| 1326 | + $m['value']['calendar_options'][$calendar_option_group_key]['value'] = $frm_duplicate_ids[$calendar_option['value']]; |
|
| 1327 | 1327 | } |
| 1328 | 1328 | } |
| 1329 | 1329 | } |
@@ -1331,8 +1331,8 @@ discard block |
||
| 1331 | 1331 | if ( ! empty( $m['value']['timeline_options'] ) ) { |
| 1332 | 1332 | foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) { |
| 1333 | 1333 | foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) { |
| 1334 | - if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) { |
|
| 1335 | - $m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ]; |
|
| 1334 | + if ( isset( $frm_duplicate_ids[$timeline_option] ) ) { |
|
| 1335 | + $m['value']['timeline_options'][$timeline_option_group_key][$timeline_option_key] = $frm_duplicate_ids[$timeline_option]; |
|
| 1336 | 1336 | } |
| 1337 | 1337 | } |
| 1338 | 1338 | } |
@@ -1341,8 +1341,8 @@ discard block |
||
| 1341 | 1341 | $check_dup_array = array(); |
| 1342 | 1342 | |
| 1343 | 1343 | if ( ! empty( $m['value']['order_by'] ) ) { |
| 1344 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1345 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1344 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1345 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1346 | 1346 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1347 | 1347 | $check_dup_array[] = 'order_by'; |
| 1348 | 1348 | } |
@@ -1353,9 +1353,9 @@ discard block |
||
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | foreach ( $check_dup_array as $check_k ) { |
| 1356 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1357 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1358 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1356 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1357 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1358 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1359 | 1359 | } |
| 1360 | 1360 | unset( $mk, $mv ); |
| 1361 | 1361 | } |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1369 | 1369 | } |
| 1370 | 1370 | |
| 1371 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1371 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | /** |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | * @return void |
| 1379 | 1379 | */ |
| 1380 | 1380 | private static function populate_layout( &$post, $layout ) { |
| 1381 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1381 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | /** |
@@ -1409,11 +1409,11 @@ discard block |
||
| 1409 | 1409 | $name = (string) $c; |
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1413 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1412 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1413 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1414 | 1414 | } |
| 1415 | 1415 | |
| 1416 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1416 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1417 | 1417 | unset( $name ); |
| 1418 | 1418 | }//end foreach |
| 1419 | 1419 | } |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | $message = '<ul>'; |
| 1571 | 1571 | |
| 1572 | 1572 | foreach ( $result as $type => $results ) { |
| 1573 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1573 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1574 | 1574 | // only print imported and updated |
| 1575 | 1575 | continue; |
| 1576 | 1576 | } |
@@ -1583,7 +1583,7 @@ discard block |
||
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | if ( $s_message ) { |
| 1586 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1586 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1587 | 1587 | $message .= implode( ', ', $s_message ); |
| 1588 | 1588 | $message .= '</li>'; |
| 1589 | 1589 | } |
@@ -1635,8 +1635,8 @@ discard block |
||
| 1635 | 1635 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1636 | 1636 | ); |
| 1637 | 1637 | |
| 1638 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1639 | - $s_message[] = $strings[ $type ]; |
|
| 1638 | + if ( isset( $strings[$type] ) ) { |
|
| 1639 | + $s_message[] = $strings[$type]; |
|
| 1640 | 1640 | } else { |
| 1641 | 1641 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1642 | 1642 | |
@@ -1796,7 +1796,7 @@ discard block |
||
| 1796 | 1796 | |
| 1797 | 1797 | foreach ( $options as $key => $option ) { |
| 1798 | 1798 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1799 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1799 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1800 | 1800 | $updated = true; |
| 1801 | 1801 | } |
| 1802 | 1802 | } |
@@ -1836,8 +1836,8 @@ discard block |
||
| 1836 | 1836 | */ |
| 1837 | 1837 | private static function remove_defaults( $defaults, &$saved ) { |
| 1838 | 1838 | foreach ( $saved as $key => $value ) { |
| 1839 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1840 | - unset( $saved[ $key ] ); |
|
| 1839 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1840 | + unset( $saved[$key] ); |
|
| 1841 | 1841 | } |
| 1842 | 1842 | } |
| 1843 | 1843 | } |
@@ -1854,16 +1854,16 @@ discard block |
||
| 1854 | 1854 | * @return void |
| 1855 | 1855 | */ |
| 1856 | 1856 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1857 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1857 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1858 | 1858 | return; |
| 1859 | 1859 | } |
| 1860 | 1860 | |
| 1861 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1862 | - $default_html = $defaults[ $html_name ]; |
|
| 1861 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1862 | + $default_html = $defaults[$html_name]; |
|
| 1863 | 1863 | |
| 1864 | 1864 | // phpcs:ignore Universal.Operators.StrictComparisons |
| 1865 | 1865 | if ( $old_html == $default_html ) { |
| 1866 | - unset( $options[ $html_name ] ); |
|
| 1866 | + unset( $options[$html_name] ); |
|
| 1867 | 1867 | return; |
| 1868 | 1868 | } |
| 1869 | 1869 | |
@@ -1871,7 +1871,7 @@ discard block |
||
| 1871 | 1871 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1872 | 1872 | |
| 1873 | 1873 | if ( $old_html === $default_html ) { |
| 1874 | - unset( $options[ $html_name ] ); |
|
| 1874 | + unset( $options[$html_name] ); |
|
| 1875 | 1875 | } |
| 1876 | 1876 | } |
| 1877 | 1877 | |
@@ -1978,8 +1978,8 @@ discard block |
||
| 1978 | 1978 | ); |
| 1979 | 1979 | |
| 1980 | 1980 | foreach ( $post_settings as $post_setting ) { |
| 1981 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1982 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1981 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1982 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1983 | 1983 | } |
| 1984 | 1984 | unset( $post_setting ); |
| 1985 | 1985 | } |
@@ -2018,7 +2018,7 @@ discard block |
||
| 2018 | 2018 | if ( ! $exists ) { |
| 2019 | 2019 | // this isn't an email, but we need to use a class that will always be included |
| 2020 | 2020 | FrmDb::save_json_post( $new_action ); |
| 2021 | - ++$imported['imported']['actions']; |
|
| 2021 | + ++ $imported['imported']['actions']; |
|
| 2022 | 2022 | } |
| 2023 | 2023 | } |
| 2024 | 2024 | |
@@ -2052,12 +2052,12 @@ discard block |
||
| 2052 | 2052 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 2053 | 2053 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 2054 | 2054 | // Replace old IDs with new IDs |
| 2055 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 2055 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 2056 | 2056 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 2057 | 2057 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 2058 | 2058 | foreach ( $setting as $k => $val ) { |
| 2059 | 2059 | // Replace old IDs with new IDs |
| 2060 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 2060 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 2061 | 2061 | } |
| 2062 | 2062 | } |
| 2063 | 2063 | unset( $key, $setting ); |
@@ -2125,7 +2125,7 @@ discard block |
||
| 2125 | 2125 | |
| 2126 | 2126 | if ( ! $exists ) { |
| 2127 | 2127 | FrmDb::save_json_post( $new_notification ); |
| 2128 | - ++$imported['imported']['actions']; |
|
| 2128 | + ++ $imported['imported']['actions']; |
|
| 2129 | 2129 | } |
| 2130 | 2130 | unset( $new_notification ); |
| 2131 | 2131 | }//end foreach |
@@ -2147,8 +2147,8 @@ discard block |
||
| 2147 | 2147 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 2148 | 2148 | |
| 2149 | 2149 | foreach ( $delete_settings as $index ) { |
| 2150 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 2151 | - unset( $form_options[ $index ] ); |
|
| 2150 | + if ( isset( $form_options[$index] ) ) { |
|
| 2151 | + unset( $form_options[$index] ); |
|
| 2152 | 2152 | } |
| 2153 | 2153 | } |
| 2154 | 2154 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -2218,13 +2218,13 @@ discard block |
||
| 2218 | 2218 | ); |
| 2219 | 2219 | |
| 2220 | 2220 | foreach ( $reply_fields as $f => $val ) { |
| 2221 | - if ( isset( $notification[ $f ] ) ) { |
|
| 2222 | - $atts[ $f ] = $notification[ $f ]; |
|
| 2221 | + if ( isset( $notification[$f] ) ) { |
|
| 2222 | + $atts[$f] = $notification[$f]; |
|
| 2223 | 2223 | |
| 2224 | - if ( 'custom' === $notification[ $f ] ) { |
|
| 2225 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 2226 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 2227 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 2224 | + if ( 'custom' === $notification[$f] ) { |
|
| 2225 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 2226 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 2227 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 2228 | 2228 | } |
| 2229 | 2229 | } |
| 2230 | 2230 | unset( $f, $val ); |
@@ -2260,14 +2260,14 @@ discard block |
||
| 2260 | 2260 | |
| 2261 | 2261 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 2262 | 2262 | if ( is_numeric( $email_field ) ) { |
| 2263 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 2263 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 2264 | 2264 | } |
| 2265 | 2265 | |
| 2266 | 2266 | if ( str_contains( $email_field, '|' ) ) { |
| 2267 | 2267 | $email_opt = explode( '|', $email_field ); |
| 2268 | 2268 | |
| 2269 | 2269 | if ( isset( $email_opt[0] ) ) { |
| 2270 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2270 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 2271 | 2271 | } |
| 2272 | 2272 | unset( $email_opt ); |
| 2273 | 2273 | } |
@@ -2299,12 +2299,12 @@ discard block |
||
| 2299 | 2299 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 2300 | 2300 | |
| 2301 | 2301 | foreach ( $add_fields as $add_field ) { |
| 2302 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 2303 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 2302 | + if ( isset( $notification[$add_field] ) ) { |
|
| 2303 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 2304 | 2304 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ), true ) ) { |
| 2305 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 2305 | + $new_notification['post_content'][$add_field] = 0; |
|
| 2306 | 2306 | } else { |
| 2307 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 2307 | + $new_notification['post_content'][$add_field] = ''; |
|
| 2308 | 2308 | } |
| 2309 | 2309 | unset( $add_field ); |
| 2310 | 2310 | } |
@@ -2330,7 +2330,7 @@ discard block |
||
| 2330 | 2330 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 2331 | 2331 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 2332 | 2332 | if ( is_numeric( $email_key ) ) { |
| 2333 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2333 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 2334 | 2334 | } |
| 2335 | 2335 | unset( $email_key, $val ); |
| 2336 | 2336 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | $tokens = $phpcsFile->getTokens(); |
| 50 | 50 | |
| 51 | 51 | // Make sure this block has a scope (curly braces). |
| 52 | - if ( ! isset( $tokens[ $stackPtr ]['scope_opener'] ) ) { |
|
| 52 | + if ( ! isset( $tokens[$stackPtr]['scope_opener'] ) ) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - $scopeOpener = $tokens[ $stackPtr ]['scope_opener']; |
|
| 57 | - $scopeCloser = $tokens[ $stackPtr ]['scope_closer']; |
|
| 56 | + $scopeOpener = $tokens[$stackPtr]['scope_opener']; |
|
| 57 | + $scopeCloser = $tokens[$stackPtr]['scope_closer']; |
|
| 58 | 58 | |
| 59 | 59 | // Find the first non-whitespace token after the opening brace. |
| 60 | 60 | $firstContent = $phpcsFile->findNext( T_WHITESPACE, $scopeOpener + 1, $scopeCloser, true ); |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $openerLine = $tokens[ $scopeOpener ]['line']; |
|
| 68 | - $contentLine = $tokens[ $firstContent ]['line']; |
|
| 67 | + $openerLine = $tokens[$scopeOpener]['line']; |
|
| 68 | + $contentLine = $tokens[$firstContent]['line']; |
|
| 69 | 69 | |
| 70 | 70 | // Check if there's a blank line between the opener and first content. |
| 71 | 71 | // A blank line means the content is more than 1 line after the opener. |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | // Find the whitespace token right after the opener that contains the blank line. |
| 87 | 87 | $nextToken = $scopeOpener + 1; |
| 88 | 88 | |
| 89 | - if ( $tokens[ $nextToken ]['code'] === T_WHITESPACE ) { |
|
| 90 | - $content = $tokens[ $nextToken ]['content']; |
|
| 89 | + if ( $tokens[$nextToken]['code'] === T_WHITESPACE ) { |
|
| 90 | + $content = $tokens[$nextToken]['content']; |
|
| 91 | 91 | $newlineCount = substr_count( $content, "\n" ); |
| 92 | 92 | |
| 93 | 93 | if ( $newlineCount >= 2 ) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // Check if the next token is also whitespace with a newline. |
| 101 | 101 | $afterNext = $nextToken + 1; |
| 102 | 102 | |
| 103 | - if ( $afterNext < $firstContent && $tokens[ $afterNext ]['code'] === T_WHITESPACE ) { |
|
| 103 | + if ( $afterNext < $firstContent && $tokens[$afterNext]['code'] === T_WHITESPACE ) { |
|
| 104 | 104 | // Remove this extra whitespace token. |
| 105 | 105 | $phpcsFile->fixer->replaceToken( $afterNext, '' ); |
| 106 | 106 | } |