@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | unset( $filename ); |
| 156 | 156 | |
| 157 | - $comment_count = FrmDb::get_count( |
|
| 157 | + $comment_count = FrmDb::get_count( |
|
| 158 | 158 | 'frm_item_metas', |
| 159 | 159 | array( |
| 160 | 160 | 'item_id' => $atts['entry_ids'], |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | private static function prepare_csv_headings() { |
| 317 | 317 | $headings = array(); |
| 318 | 318 | self::csv_headings( $headings ); |
| 319 | - $headings = apply_filters( |
|
| 319 | + $headings = apply_filters( |
|
| 320 | 320 | 'frm_csv_columns', |
| 321 | 321 | $headings, |
| 322 | 322 | self::$form_id, |
@@ -345,15 +345,15 @@ discard block |
||
| 345 | 345 | $field_headings = array(); |
| 346 | 346 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 347 | 347 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 348 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 348 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - if ( ! empty( $field_headings[ $col->id . '_label' ] ) ) { |
|
| 352 | - $field_headings[ $col->id ] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 351 | + if ( ! empty( $field_headings[$col->id . '_label'] ) ) { |
|
| 352 | + $field_headings[$col->id] = strip_tags( $col->name . ' ' . __( '(value)', 'formidable' ) ); |
|
| 353 | 353 | } else { |
| 354 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 354 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 355 | 355 | } |
| 356 | - $field_headings = apply_filters( |
|
| 356 | + $field_headings = apply_filters( |
|
| 357 | 357 | 'frm_csv_field_columns', |
| 358 | 358 | $field_headings, |
| 359 | 359 | array_merge( |
@@ -378,14 +378,14 @@ discard block |
||
| 378 | 378 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 379 | 379 | $repeater_id = $col->field_options['in_section']; |
| 380 | 380 | // Set a placeholder to maintain order for repeater fields. |
| 381 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 381 | + $headings['repeater' . $repeater_id] = array(); |
|
| 382 | 382 | |
| 383 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 384 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 383 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 384 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 385 | 385 | $repeater_ids[] = $repeater_id; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 388 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 389 | 389 | |
| 390 | 390 | continue; |
| 391 | 391 | } |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | $end = strpos( $row->meta_value, ':{' ); |
| 405 | 405 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 406 | 406 | |
| 407 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 408 | - $max[ $row->field_id ] = $length; |
|
| 407 | + if ( $length > $max[$row->field_id] ) { |
|
| 408 | + $max[$row->field_id] = $length; |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -416,17 +416,17 @@ discard block |
||
| 416 | 416 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 417 | 417 | |
| 418 | 418 | $repeater_headings = array(); |
| 419 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 419 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 420 | 420 | $repeater_headings += self::field_headings( $col ); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 423 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 424 | 424 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 425 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 425 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } else { |
| 429 | - $flat[ $key ] = $heading; |
|
| 429 | + $flat[$key] = $heading; |
|
| 430 | 430 | } |
| 431 | 431 | } |
| 432 | 432 | |
@@ -439,10 +439,10 @@ discard block |
||
| 439 | 439 | }//end if |
| 440 | 440 | |
| 441 | 441 | if ( self::$comment_count ) { |
| 442 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 443 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 444 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 445 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 442 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 443 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 444 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 445 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 446 | 446 | } |
| 447 | 447 | unset( $i ); |
| 448 | 448 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | private static function prepare_next_csv_rows( $next_set ) { |
| 497 | 497 | if ( FrmAppHelper::pro_is_installed() ) { |
| 498 | - $where = array( |
|
| 498 | + $where = array( |
|
| 499 | 499 | 'or' => 1, |
| 500 | 500 | 'id' => $next_set, |
| 501 | 501 | 'parent_item_id' => $next_set, |
@@ -560,32 +560,32 @@ discard block |
||
| 560 | 560 | continue; |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 564 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 565 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 563 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 564 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 565 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 569 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 570 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 568 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 569 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 570 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 571 | 571 | // if the data is here, it should be an array but if this field has collected data |
| 572 | 572 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 573 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 573 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | // Add the repeated values. |
| 577 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 577 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 578 | 578 | }//end foreach |
| 579 | 579 | |
| 580 | 580 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 581 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 581 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 582 | 582 | }//end if |
| 583 | 583 | |
| 584 | 584 | // add the embedded form id |
| 585 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 586 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 585 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 586 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 587 | 587 | } |
| 588 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 588 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
@@ -606,19 +606,19 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | $repeater_id = $field->field_options['in_section']; |
| 609 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 609 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 610 | 610 | return $metas; |
| 611 | 611 | } |
| 612 | 612 | |
| 613 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 614 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 615 | - $metas[ $repeater_child->id ] = ''; |
|
| 613 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 614 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 615 | + $metas[$repeater_child->id] = ''; |
|
| 616 | 616 | |
| 617 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 618 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 617 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 618 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 621 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | */ |
| 648 | 648 | private static function add_field_values_to_csv( &$row ) { |
| 649 | 649 | foreach ( self::$fields as $col ) { |
| 650 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
| 650 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
| 651 | 651 | |
| 652 | 652 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 653 | 653 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -666,20 +666,20 @@ discard block |
||
| 666 | 666 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
| 667 | 667 | $label_key = $col->id . '_label'; |
| 668 | 668 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 669 | - $row[ $label_key ] = array(); |
|
| 669 | + $row[$label_key] = array(); |
|
| 670 | 670 | |
| 671 | 671 | if ( is_array( $field_value ) ) { |
| 672 | 672 | foreach ( $field_value as $value ) { |
| 673 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 673 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | } else { |
| 677 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 677 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 678 | 678 | } |
| 679 | 679 | unset( $label_key ); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - $row[ $col->id ] = $field_value; |
|
| 682 | + $row[$col->id] = $field_value; |
|
| 683 | 683 | |
| 684 | 684 | unset( $col, $field_value ); |
| 685 | 685 | }//end foreach |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | 'show_icon' => false, |
| 703 | 703 | 'entry_id' => self::$entry->id, |
| 704 | 704 | 'sep' => self::$separator, |
| 705 | - 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
| 705 | + 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
| 706 | 706 | ) |
| 707 | 707 | ); |
| 708 | 708 | } |
@@ -721,8 +721,8 @@ discard block |
||
| 721 | 721 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 722 | 722 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 723 | 723 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 724 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 725 | - $row[ $column_key ] = $sub_sub_value; |
|
| 724 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 725 | + $row[$column_key] = $sub_sub_value; |
|
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | |
@@ -730,8 +730,8 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | $column_key = $atts['col']->id . '_' . $key; |
| 733 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 734 | - $row[ $column_key ] = $sub_value; |
|
| 733 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 734 | + $row[$column_key] = $sub_value; |
|
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | } |
@@ -766,18 +766,18 @@ discard block |
||
| 766 | 766 | $echo = 'echo' === self::$mode; |
| 767 | 767 | |
| 768 | 768 | foreach ( self::$headings as $k => $heading ) { |
| 769 | - if ( isset( $rows[ $k ] ) ) { |
|
| 770 | - $row = $rows[ $k ]; |
|
| 769 | + if ( isset( $rows[$k] ) ) { |
|
| 770 | + $row = $rows[$k]; |
|
| 771 | 771 | } else { |
| 772 | 772 | $row = ''; |
| 773 | 773 | // array indexed data is not at $rows[ $k ] |
| 774 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 774 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 775 | 775 | $start = strrpos( $k, '[' ); |
| 776 | - $key = substr( $k, 0, $start++ ); |
|
| 776 | + $key = substr( $k, 0, $start ++ ); |
|
| 777 | 777 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 778 | 778 | |
| 779 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 780 | - $row = $rows[ $key ][ $index ]; |
|
| 779 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 780 | + $row = $rows[$key][$index]; |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | unset( $start, $key, $index ); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | 58 | private static function flag_new_unique_key( $unique_id ) { |
| 59 | - if ( ! isset( self::$unique_id_match_checks[ $unique_id ] ) ) { |
|
| 60 | - self::$unique_id_match_checks[ $unique_id ] = false; |
|
| 59 | + if ( ! isset( self::$unique_id_match_checks[$unique_id] ) ) { |
|
| 60 | + self::$unique_id_match_checks[$unique_id] = false; |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ( 0 === (int) $meta->field_id ) { |
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 115 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if ( isset( self::$unique_id_match_checks[ $unique_id ] ) ) { |
|
| 181 | - return self::$unique_id_match_checks[ $unique_id ]; |
|
| 180 | + if ( isset( self::$unique_id_match_checks[$unique_id] ) ) { |
|
| 181 | + return self::$unique_id_match_checks[$unique_id]; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $timestamp = strtotime( $created_at ); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $timestamp = time(); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - self::$unique_id_match_checks[ $unique_id ] = (bool) FrmDb::get_var( |
|
| 189 | + self::$unique_id_match_checks[$unique_id] = (bool) FrmDb::get_var( |
|
| 190 | 190 | 'frm_item_metas', |
| 191 | 191 | array( |
| 192 | 192 | 'field_id' => 0, |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | 'id' |
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | - return self::$unique_id_match_checks[ $unique_id ]; |
|
| 199 | + return self::$unique_id_match_checks[$unique_id]; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | $reduced = array(); |
| 227 | 227 | foreach ( $filter_vals as $field_id => $value ) { |
| 228 | 228 | $field = FrmFieldFactory::get_field_object( $field_id ); |
| 229 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 230 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
| 231 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
| 232 | - unset( $reduced[ $field_id ] ); |
|
| 229 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 230 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
| 231 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
| 232 | + unset( $reduced[$field_id] ); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | return $reduced; |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | private static function prepare_entries( &$entries ) { |
| 516 | 516 | foreach ( $entries as $k => $entry ) { |
| 517 | 517 | self::prepare_entry( $entry ); |
| 518 | - $entries[ $k ] = $entry; |
|
| 518 | + $entries[$k] = $entry; |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
@@ -546,19 +546,19 @@ discard block |
||
| 546 | 546 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 547 | 547 | |
| 548 | 548 | if ( $meta_val->item_id == $entry->id ) { |
| 549 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 549 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 550 | 550 | if ( $include_key ) { |
| 551 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 551 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 552 | 552 | } |
| 553 | 553 | continue; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | // include sub entries in an array |
| 557 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
| 558 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 557 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
| 558 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 561 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 562 | 562 | |
| 563 | 563 | unset( $meta_val ); |
| 564 | 564 | } |
@@ -662,16 +662,16 @@ discard block |
||
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | foreach ( $metas as $m_key => $meta_val ) { |
| 665 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 665 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 666 | 666 | continue; |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 670 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 669 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 670 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 671 | 671 | } |
| 672 | 672 | |
| 673 | 673 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 674 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 674 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 675 | 675 | unset( $m_key, $meta_val ); |
| 676 | 676 | } |
| 677 | 677 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | * @return mixed |
| 864 | 864 | */ |
| 865 | 865 | private static function get_entry_value( $values, $name, $default ) { |
| 866 | - return $values[ $name ] ?? $default; |
|
| 866 | + return $values[$name] ?? $default; |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | /** |
@@ -1070,7 +1070,7 @@ discard block |
||
| 1070 | 1070 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
| 1071 | 1071 | global $frm_vars; |
| 1072 | 1072 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
| 1073 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
| 1073 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
| 1074 | 1074 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
| 1075 | 1075 | } |
| 1076 | 1076 | } |
@@ -133,19 +133,19 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | foreach ( $action_controls as $action ) { |
| 136 | - if ( isset( $groups[ $action->id_base ] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 136 | + if ( isset( $groups[$action->id_base] ) || in_array( $action->id_base, $grouped ) ) { |
|
| 137 | 137 | continue; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $this_group = $action->action_options['group']; |
| 141 | - if ( ! isset( $groups[ $this_group ] ) ) { |
|
| 141 | + if ( ! isset( $groups[$this_group] ) ) { |
|
| 142 | 142 | $this_group = 'misc'; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if ( ! isset( $groups[ $this_group ]['actions'] ) ) { |
|
| 146 | - $groups[ $this_group ]['actions'] = array(); |
|
| 145 | + if ( ! isset( $groups[$this_group]['actions'] ) ) { |
|
| 146 | + $groups[$this_group]['actions'] = array(); |
|
| 147 | 147 | } |
| 148 | - $groups[ $this_group ]['actions'][] = $action->id_base; |
|
| 148 | + $groups[$this_group]['actions'][] = $action->id_base; |
|
| 149 | 149 | |
| 150 | 150 | unset( $action ); |
| 151 | 151 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | return $a; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - $actions[ $a->id_base ] = $a; |
|
| 322 | + $actions[$a->id_base] = $a; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | return $actions; |
@@ -358,18 +358,18 @@ discard block |
||
| 358 | 358 | $action_map = array(); |
| 359 | 359 | |
| 360 | 360 | foreach ( $action_controls as $key => $control ) { |
| 361 | - $action_map[ $control->id_base ] = $key; |
|
| 361 | + $action_map[$control->id_base] = $key; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | self::maybe_show_limit_warning( $form->id, $form_actions ); |
| 365 | 365 | |
| 366 | 366 | foreach ( $form_actions as $action ) { |
| 367 | - if ( ! isset( $action_map[ $action->post_excerpt ] ) ) { |
|
| 367 | + if ( ! isset( $action_map[$action->post_excerpt] ) ) { |
|
| 368 | 368 | // don't try and show settings if action no longer exists |
| 369 | 369 | continue; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - self::action_control( $action, $form, $action->ID, $action_controls[ $action_map[ $action->post_excerpt ] ], $values ); |
|
| 372 | + self::action_control( $action, $form, $action->ID, $action_controls[$action_map[$action->post_excerpt]], $values ); |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | |
@@ -681,8 +681,8 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | // Store actions so they can be triggered with the correct priority. |
| 684 | - $stored_actions[ $action->ID ] = $action; |
|
| 685 | - $action_priority[ $action->ID ] = $link_settings[ $action->post_excerpt ]->action_options['priority']; |
|
| 684 | + $stored_actions[$action->ID] = $action; |
|
| 685 | + $action_priority[$action->ID] = $link_settings[$action->post_excerpt]->action_options['priority']; |
|
| 686 | 686 | |
| 687 | 687 | unset( $action ); |
| 688 | 688 | }//end foreach |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | new FrmNotification(); |
| 695 | 695 | |
| 696 | 696 | foreach ( $action_priority as $action_id => $priority ) { |
| 697 | - $action = $stored_actions[ $action_id ]; |
|
| 697 | + $action = $stored_actions[$action_id]; |
|
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | 700 | * Allows custom form action trigger. |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * @return void |
| 792 | 792 | */ |
| 793 | 793 | public function register( $action_class ) { |
| 794 | - $this->actions[ $action_class ] = new $action_class(); |
|
| 794 | + $this->actions[$action_class] = new $action_class(); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | * @return void |
| 801 | 801 | */ |
| 802 | 802 | public function unregister( $action_class ) { |
| 803 | - if ( isset( $this->actions[ $action_class ] ) ) { |
|
| 804 | - unset( $this->actions[ $action_class ] ); |
|
| 803 | + if ( isset( $this->actions[$action_class] ) ) { |
|
| 804 | + unset( $this->actions[$action_class] ); |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
@@ -810,8 +810,8 @@ discard block |
||
| 810 | 810 | |
| 811 | 811 | foreach ( $keys as $key ) { |
| 812 | 812 | // don't register new action if old action with the same id is already registered |
| 813 | - if ( ! isset( $this->actions[ $key ] ) ) { |
|
| 814 | - $this->actions[ $key ]->_register(); |
|
| 813 | + if ( ! isset( $this->actions[$key] ) ) { |
|
| 814 | + $this->actions[$key]->_register(); |
|
| 815 | 815 | } |
| 816 | 816 | } |
| 817 | 817 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @return array |
| 76 | 76 | */ |
| 77 | 77 | public function insert_installed_addon( $plugins ) { |
| 78 | - $plugins[ $this->plugin_slug ] = $this; |
|
| 78 | + $plugins[$this->plugin_slug] = $this; |
|
| 79 | 79 | |
| 80 | 80 | return $plugins; |
| 81 | 81 | } |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | public static function get_addon( $plugin_slug ) { |
| 89 | 89 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
| 90 | 90 | $plugin = false; |
| 91 | - if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
| 92 | - $plugin = $plugins[ $plugin_slug ]; |
|
| 91 | + if ( isset( $plugins[$plugin_slug] ) ) { |
|
| 92 | + $plugin = $plugins[$plugin_slug]; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return $plugin; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } else { |
| 150 | 150 | $api = new FrmFormApi( $this->license ); |
| 151 | 151 | $plugins = $api->get_api_info(); |
| 152 | - $_data = $plugins[ $item_id ]; |
|
| 152 | + $_data = $plugins[$item_id]; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $_data['sections'] = array( |
@@ -417,19 +417,19 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | if ( $this->is_current_version( $transient ) ) { |
| 419 | 419 | // Make sure it doesn't show there is an update if plugin is up-to-date. |
| 420 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 421 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 420 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 421 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 422 | 422 | } |
| 423 | - } elseif ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 424 | - $this->prepare_update_details( $transient->response[ $this->plugin_folder ] ); |
|
| 423 | + } elseif ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 424 | + $this->prepare_update_details( $transient->response[$this->plugin_folder] ); |
|
| 425 | 425 | |
| 426 | 426 | // if the transient has expired, clear the update and trigger it again |
| 427 | - if ( $transient->response[ $this->plugin_folder ] === false ) { |
|
| 427 | + if ( $transient->response[$this->plugin_folder] === false ) { |
|
| 428 | 428 | if ( ! $this->has_been_cleared() ) { |
| 429 | 429 | $this->cleared_plugins(); |
| 430 | 430 | $this->manually_queue_update(); |
| 431 | 431 | } |
| 432 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 432 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | * @return bool |
| 534 | 534 | */ |
| 535 | 535 | private function is_current_version( $transient ) { |
| 536 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
| 536 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
| 537 | 537 | return false; |
| 538 | 538 | } |
| 539 | 539 | |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | return true; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] === $transient->response[ $this->plugin_folder ]->new_version; |
|
| 545 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] === $transient->response[$this->plugin_folder]->new_version; |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | /** |
@@ -694,8 +694,8 @@ discard block |
||
| 694 | 694 | $response['message'] = $response['status']; |
| 695 | 695 | } else { |
| 696 | 696 | $messages = $this->get_messages(); |
| 697 | - if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
| 698 | - $response['message'] = $messages[ $response['status'] ]; |
|
| 697 | + if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
| 698 | + $response['message'] = $messages[$response['status']]; |
|
| 699 | 699 | } else { |
| 700 | 700 | $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
| 701 | 701 | } |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | 'user-agent' => $this->plugin_slug . '/' . $this->version . '; ' . get_bloginfo( 'url' ), |
| 860 | 860 | ); |
| 861 | 861 | |
| 862 | - $resp = wp_remote_post( |
|
| 862 | + $resp = wp_remote_post( |
|
| 863 | 863 | $this->store_url . '?l=' . urlencode( base64_encode( $this->license ) ), |
| 864 | 864 | $arg_array |
| 865 | 865 | ); |
@@ -593,7 +593,8 @@ |
||
| 593 | 593 | * @return void |
| 594 | 594 | */ |
| 595 | 595 | private function is_license_revoked() { |
| 596 | - if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 596 | + if ( empty( $this->license ) || empty( $this->plugin_slug ) || isset( $_POST['license'] ) ) { |
|
| 597 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 597 | 598 | return; |
| 598 | 599 | } |
| 599 | 600 | |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | return $this->get_pagenum(); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 234 | - return $this->_pagination_args[ $key ]; |
|
| 233 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 234 | + return $this->_pagination_args[$key]; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | * @return void |
| 282 | 282 | */ |
| 283 | 283 | private function hidden_search_inputs( $param_name ) { |
| 284 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 285 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 284 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 285 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 286 | 286 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 287 | 287 | } |
| 288 | 288 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | echo "<ul class='subsubsub'>\n"; |
| 326 | 326 | foreach ( $views as $class => $view ) { |
| 327 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 327 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 328 | 328 | } |
| 329 | 329 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 330 | 330 | echo '</ul>'; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 492 | 492 | foreach ( $actions as $action => $link ) { |
| 493 | - ++$i; |
|
| 493 | + ++ $i; |
|
| 494 | 494 | $sep = $i === $action_count ? '' : ' | '; |
| 495 | 495 | $out .= "<span class='$action'>$link$sep</span>"; |
| 496 | 496 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | 'next' => __( 'Next page', 'formidable' ), |
| 724 | 724 | ); |
| 725 | 725 | |
| 726 | - return $labels[ $link ]; |
|
| 726 | + return $labels[$link]; |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | private function current_url() { |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | // If the primary column doesn't exist fall back to the |
| 830 | 830 | // first non-checkbox column. |
| 831 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 831 | + if ( ! isset( $columns[$default] ) ) { |
|
| 832 | 832 | $default = self::get_default_primary_column_name(); |
| 833 | 833 | } |
| 834 | 834 | |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | */ |
| 843 | 843 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 844 | 844 | |
| 845 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 845 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 846 | 846 | $column = $default; |
| 847 | 847 | } |
| 848 | 848 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | // In 4.3, we added a fourth argument for primary column. |
| 864 | 864 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 865 | 865 | foreach ( $this->_column_headers as $key => $value ) { |
| 866 | - $column_headers[ $key ] = $value; |
|
| 866 | + $column_headers[$key] = $value; |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | return $column_headers; |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | $data[1] = false; |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - $sortable[ $id ] = $data; |
|
| 899 | + $sortable[$id] = $data; |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | $primary = $this->get_primary_column_name(); |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | static $cb_counter = 1; |
| 955 | 955 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 956 | 956 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 957 | - ++$cb_counter; |
|
| 957 | + ++ $cb_counter; |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -976,8 +976,8 @@ discard block |
||
| 976 | 976 | $class[] = 'column-primary'; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 980 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 979 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 980 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 981 | 981 | |
| 982 | 982 | if ( $current_orderby == $orderby ) { |
| 983 | 983 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1095 | 1095 | */ |
| 1096 | 1096 | protected function should_display( $args, $settings ) { |
| 1097 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1097 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | /** |
@@ -231,7 +231,8 @@ discard block |
||
| 231 | 231 | return false; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if ( ! $_POST || ! isset( $_POST['field_options'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 234 | + if ( ! $_POST || ! isset( $_POST['field_options'] ) ) { |
|
| 235 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 235 | 236 | return false; |
| 236 | 237 | } |
| 237 | 238 | |
@@ -338,7 +339,8 @@ discard block |
||
| 338 | 339 | * @return void |
| 339 | 340 | */ |
| 340 | 341 | private static function get_posted_field_setting( $setting, &$value ) { |
| 341 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 342 | + if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 343 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 342 | 344 | return; |
| 343 | 345 | } |
| 344 | 346 | |
@@ -1531,7 +1533,8 @@ discard block |
||
| 1531 | 1533 | |
| 1532 | 1534 | // Check posted vals before checking saved values |
| 1533 | 1535 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1534 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1536 | + if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 1537 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1535 | 1538 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1536 | 1539 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1537 | 1540 | $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
@@ -1542,7 +1545,8 @@ discard block |
||
| 1542 | 1545 | return $other_val; |
| 1543 | 1546 | } |
| 1544 | 1547 | |
| 1545 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1548 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 1549 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1546 | 1550 | // For normal fields |
| 1547 | 1551 | |
| 1548 | 1552 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
| 45 | 45 | $values['field_options']['data_type'] = $setting; |
| 46 | 46 | } else { |
| 47 | - $values['field_options'][ $setting ] = 1; |
|
| 47 | + $values['field_options'][$setting] = 1; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | foreach ( $defaults as $opt => $default ) { |
| 212 | - $values[ $opt ] = $field->field_options[ $opt ] ?? $default; |
|
| 212 | + $values[$opt] = $field->field_options[$opt] ?? $default; |
|
| 213 | 213 | |
| 214 | 214 | if ( $check_post ) { |
| 215 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 215 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | return self::$context_is_safe_to_load_field_options_from_request_data; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - $function = function () { |
|
| 232 | + $function = function() { |
|
| 233 | 233 | if ( ! FrmAppHelper::is_admin_page() ) { |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | * @return void |
| 342 | 342 | */ |
| 343 | 343 | private static function get_posted_field_setting( $setting, &$value ) { |
| 344 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 344 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 345 | 345 | return; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if ( strpos( $setting, 'html' ) !== false ) { |
| 349 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 349 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 350 | 350 | |
| 351 | 351 | // Conditionally strip script tags if the user sending $_POST data is not allowed to use unfiltered HTML. |
| 352 | 352 | if ( ! FrmAppHelper::allow_unfiltered_html() ) { |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 356 | 356 | // TODO: Remove stripslashes on output, and use on input only. |
| 357 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 357 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 358 | 358 | } else { |
| 359 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 359 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 360 | 360 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 361 | 361 | } |
| 362 | 362 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 440 | 440 | |
| 441 | 441 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 442 | - $values[ $col ] = $field->{$col}; |
|
| 442 | + $values[$col] = $field->{$col}; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | ); |
| 478 | 478 | |
| 479 | 479 | $msg = FrmField::get_option( $field, $error ); |
| 480 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 480 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 481 | 481 | $msg = do_shortcode( $msg ); |
| 482 | 482 | |
| 483 | 483 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | 'inside_class' => 'inside', |
| 809 | 809 | 'dismiss-icon' => true, |
| 810 | 810 | ); |
| 811 | - $args = array_merge( $defaults, $args ); |
|
| 811 | + $args = array_merge( $defaults, $args ); |
|
| 812 | 812 | |
| 813 | 813 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
| 814 | 814 | } |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | continue; |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 1096 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 1097 | 1097 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 1098 | 1098 | |
| 1099 | 1099 | $atts['entry'] = $entry; |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | if ( $replace_with !== null ) { |
| 1104 | 1104 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
| 1105 | 1105 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 1106 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 1106 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | unset( $atts, $replace_with ); |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
| 1123 | 1123 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 1124 | 1124 | foreach ( $included_atts as $included_att ) { |
| 1125 | - if ( '0' === $atts[ $included_att ] ) { |
|
| 1125 | + if ( '0' === $atts[$included_att] ) { |
|
| 1126 | 1126 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
| 1127 | 1127 | continue; |
| 1128 | 1128 | } |
@@ -1204,8 +1204,8 @@ discard block |
||
| 1204 | 1204 | |
| 1205 | 1205 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get', 'default-email', 'default-from-email' ); |
| 1206 | 1206 | |
| 1207 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 1208 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 1207 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 1208 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 1209 | 1209 | } elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) { |
| 1210 | 1210 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 1211 | 1211 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1452,8 +1452,8 @@ discard block |
||
| 1452 | 1452 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 1453 | 1453 | } elseif ( in_array( $type, $multiple_input, true ) ) { |
| 1454 | 1454 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 1455 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 1456 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 1455 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 1456 | + $field_types[$type] = $field_selection[$type]; |
|
| 1457 | 1457 | } |
| 1458 | 1458 | |
| 1459 | 1459 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | foreach ( $inputs as $input ) { |
| 1499 | 1499 | // This may not be set if a field type was removed using the frm_available_fields or frm_pro_available_fields filters. |
| 1500 | 1500 | if ( array_key_exists( $input, $fields ) ) { |
| 1501 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1501 | + $field_types[$input] = $fields[$input]; |
|
| 1502 | 1502 | } |
| 1503 | 1503 | unset( $input ); |
| 1504 | 1504 | } |
@@ -1533,7 +1533,7 @@ discard block |
||
| 1533 | 1533 | 'parent' => false, |
| 1534 | 1534 | 'pointer' => false, |
| 1535 | 1535 | ); |
| 1536 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1536 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1537 | 1537 | |
| 1538 | 1538 | $opt_key = $args['opt_key']; |
| 1539 | 1539 | $field = $args['field']; |
@@ -1549,25 +1549,25 @@ discard block |
||
| 1549 | 1549 | |
| 1550 | 1550 | // Check posted vals before checking saved values |
| 1551 | 1551 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1552 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1552 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1553 | 1553 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1554 | 1554 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1555 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1555 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1556 | 1556 | } else { |
| 1557 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1557 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | return $other_val; |
| 1561 | 1561 | } |
| 1562 | 1562 | |
| 1563 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1563 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1564 | 1564 | // For normal fields |
| 1565 | 1565 | |
| 1566 | 1566 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1567 | 1567 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1568 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1568 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1569 | 1569 | } else { |
| 1570 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1570 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1571 | 1571 | } |
| 1572 | 1572 | |
| 1573 | 1573 | return $other_val; |
@@ -1577,8 +1577,8 @@ discard block |
||
| 1577 | 1577 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
| 1578 | 1578 | // Check if there is an "other" val in saved value and make sure the |
| 1579 | 1579 | // "other" val is not equal to the Other checkbox option |
| 1580 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1581 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1580 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1581 | + $other_val = $field['value'][$opt_key]; |
|
| 1582 | 1582 | } |
| 1583 | 1583 | } else { |
| 1584 | 1584 | /** |
@@ -1590,8 +1590,8 @@ discard block |
||
| 1590 | 1590 | // Multi-select dropdowns - key is not preserved |
| 1591 | 1591 | if ( is_array( $field['value'] ) ) { |
| 1592 | 1592 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1593 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1594 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1593 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1594 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1595 | 1595 | } |
| 1596 | 1596 | } elseif ( $temp_val == $field['value'] ) { |
| 1597 | 1597 | // For radio and regular dropdowns |
@@ -1816,11 +1816,11 @@ discard block |
||
| 1816 | 1816 | foreach ( $val as $k => $v ) { |
| 1817 | 1817 | if ( is_string( $v ) ) { |
| 1818 | 1818 | if ( 'custom_html' === $k ) { |
| 1819 | - $val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1819 | + $val[$k] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1820 | 1820 | unset( $k, $v ); |
| 1821 | 1821 | continue; |
| 1822 | 1822 | } |
| 1823 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1823 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1824 | 1824 | unset( $k, $v ); |
| 1825 | 1825 | } |
| 1826 | 1826 | } |
@@ -1849,8 +1849,8 @@ discard block |
||
| 1849 | 1849 | if ( false === $index ) { |
| 1850 | 1850 | continue; |
| 1851 | 1851 | } |
| 1852 | - unset( $replace[ $index ] ); |
|
| 1853 | - unset( $replace_with[ $index ] ); |
|
| 1852 | + unset( $replace[$index] ); |
|
| 1853 | + unset( $replace_with[$index] ); |
|
| 1854 | 1854 | } |
| 1855 | 1855 | |
| 1856 | 1856 | $value = str_replace( $replace, $replace_with, $value ); |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | $countries['class'] = 'frm-countries-opts'; |
| 2210 | 2210 | } |
| 2211 | 2211 | |
| 2212 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 2212 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 2213 | 2213 | |
| 2214 | 2214 | // State abv. |
| 2215 | 2215 | $states = self::get_us_states(); |
@@ -2219,7 +2219,7 @@ discard block |
||
| 2219 | 2219 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 2220 | 2220 | } |
| 2221 | 2221 | |
| 2222 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 2222 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 2223 | 2223 | |
| 2224 | 2224 | // States. |
| 2225 | 2225 | $states = array_values( $states ); |
@@ -2228,7 +2228,7 @@ discard block |
||
| 2228 | 2228 | $states['class'] = 'frm-states-opts'; |
| 2229 | 2229 | } |
| 2230 | 2230 | |
| 2231 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 2231 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 2232 | 2232 | unset( $state_abv, $states ); |
| 2233 | 2233 | |
| 2234 | 2234 | // Age. |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | $ages['class'] = 'frm-age-opts'; |
| 2247 | 2247 | } |
| 2248 | 2248 | |
| 2249 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 2249 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 2250 | 2250 | |
| 2251 | 2251 | // Satisfaction. |
| 2252 | 2252 | $satisfaction = array( |
@@ -2261,7 +2261,7 @@ discard block |
||
| 2261 | 2261 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 2262 | 2262 | } |
| 2263 | 2263 | |
| 2264 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 2264 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 2265 | 2265 | |
| 2266 | 2266 | // Importance. |
| 2267 | 2267 | $importance = array( |
@@ -2276,7 +2276,7 @@ discard block |
||
| 2276 | 2276 | $importance['class'] = 'frm-importance-opts'; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 2279 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 2280 | 2280 | |
| 2281 | 2281 | // Agreement. |
| 2282 | 2282 | $agreement = array( |
@@ -2291,7 +2291,7 @@ discard block |
||
| 2291 | 2291 | $agreement['class'] = 'frm-agreement-opts'; |
| 2292 | 2292 | } |
| 2293 | 2293 | |
| 2294 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 2294 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 2295 | 2295 | |
| 2296 | 2296 | // Likely. |
| 2297 | 2297 | $likely = array( |
@@ -2306,7 +2306,7 @@ discard block |
||
| 2306 | 2306 | $likely['class'] = 'frm-likely-opts'; |
| 2307 | 2307 | } |
| 2308 | 2308 | |
| 2309 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 2309 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 2310 | 2310 | |
| 2311 | 2311 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 2312 | 2312 | } |
@@ -2553,16 +2553,16 @@ discard block |
||
| 2553 | 2553 | */ |
| 2554 | 2554 | private static function fill_image_setting_options( $options, &$args ) { |
| 2555 | 2555 | foreach ( $options as $key => $option ) { |
| 2556 | - $args['options'][ $key ] = $option; |
|
| 2556 | + $args['options'][$key] = $option; |
|
| 2557 | 2557 | |
| 2558 | 2558 | if ( ! empty( $option['addon'] ) ) { |
| 2559 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2559 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2560 | 2560 | } |
| 2561 | 2561 | |
| 2562 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 2562 | + unset( $args['options'][$key]['addon'] ); |
|
| 2563 | 2563 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2564 | 2564 | foreach ( $fill as $f ) { |
| 2565 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 2565 | + unset( $args['options'][$key][$f], $f ); |
|
| 2566 | 2566 | } |
| 2567 | 2567 | } |
| 2568 | 2568 | } |
@@ -2585,8 +2585,8 @@ discard block |
||
| 2585 | 2585 | |
| 2586 | 2586 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2587 | 2587 | foreach ( $fill as $f ) { |
| 2588 | - if ( isset( $option[ $f ] ) ) { |
|
| 2589 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 2588 | + if ( isset( $option[$f] ) ) { |
|
| 2589 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 2590 | 2590 | } |
| 2591 | 2591 | } |
| 2592 | 2592 | |
@@ -2654,7 +2654,7 @@ discard block |
||
| 2654 | 2654 | |
| 2655 | 2655 | return array_filter( |
| 2656 | 2656 | $rows, |
| 2657 | - function ( $row ) { |
|
| 2657 | + function( $row ) { |
|
| 2658 | 2658 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
| 2659 | 2659 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
| 2660 | 2660 | } |
@@ -2720,7 +2720,7 @@ discard block |
||
| 2720 | 2720 | if ( empty( $attributes['data-fid'] ) ) { |
| 2721 | 2721 | unset( $data['plugin-status'] ); |
| 2722 | 2722 | foreach ( $data as $key => $value ) { |
| 2723 | - $attributes[ 'data-' . $key ] = $value; |
|
| 2723 | + $attributes['data-' . $key] = $value; |
|
| 2724 | 2724 | } |
| 2725 | 2725 | } |
| 2726 | 2726 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | 48 | private function _set( $param, $atts ) { |
| 49 | - if ( isset( $atts[ $param ] ) ) { |
|
| 50 | - $this->{$param} = $atts[ $param ]; |
|
| 49 | + if ( isset( $atts[$param] ) ) { |
|
| 50 | + $this->{$param} = $atts[$param]; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $exclude = array( 'field_obj', 'html' ); |
| 99 | 99 | foreach ( $exclude as $ex ) { |
| 100 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 101 | - unset( $this->pass_args[ $ex ] ); |
|
| 100 | + if ( isset( $atts[$ex] ) ) { |
|
| 101 | + unset( $this->pass_args[$ex] ); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @return void |
| 113 | 113 | */ |
| 114 | 114 | private function set_from_field( $atts, $set ) { |
| 115 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 116 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 115 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 116 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 117 | 117 | } else { |
| 118 | 118 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 119 | 119 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | private function replace_error_shortcode() { |
| 266 | 266 | $this->maybe_add_error_id(); |
| 267 | - $error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false; |
|
| 267 | + $error = $this->pass_args['errors']['field' . $this->field_id] ?? false; |
|
| 268 | 268 | |
| 269 | 269 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
| 270 | 270 | $error_body = self::get_error_body( $this->html ); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @return void |
| 308 | 308 | */ |
| 309 | 309 | private function maybe_add_error_id() { |
| 310 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 310 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 311 | 311 | return; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
| 400 | 400 | |
| 401 | 401 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 402 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 402 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 403 | 403 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 404 | 404 | |
| 405 | 405 | $replace_with = ''; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 413 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | private function prepare_input_shortcode_atts( $shortcode_atts ) { |
| 434 | 434 | if ( isset( $shortcode_atts['opt'] ) ) { |
| 435 | - --$shortcode_atts['opt']; |
|
| 435 | + -- $shortcode_atts['opt']; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | $field_class = $shortcode_atts['class'] ?? ''; |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | private function get_field_div_classes() { |
| 504 | 504 | // Add error class |
| 505 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 505 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 506 | 506 | |
| 507 | 507 | // Add label position class |
| 508 | 508 | $settings = $this->field_obj->display_field_settings(); |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | // Add 'aria-invalid' attribute to the group if there are errors. |
| 586 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 586 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 587 | 587 | $attributes['aria-invalid'] = 'true'; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | $field_val = ''; |
| 161 | 161 | if ( is_object( $this->field ) ) { |
| 162 | 162 | $field_val = $this->field->{$column}; |
| 163 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 164 | - $field_val = $this->field[ $column ]; |
|
| 163 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 164 | + $field_val = $this->field[$column]; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $field_val; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if ( is_object( $this->field ) ) { |
| 178 | 178 | $this->field->{$column} = $value; |
| 179 | 179 | } elseif ( is_array( $this->field ) ) { |
| 180 | - $this->field[ $column ] = $value; |
|
| 180 | + $this->field[$column] = $value; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | printf( |
| 724 | 724 | /* translators: %s: Field type */ |
| 725 | 725 | esc_html__( '%s Options', 'formidable' ), |
| 726 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 726 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 727 | 727 | ); |
| 728 | 728 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown8_icon', array( 'aria-hidden' => 'true' ) ); |
| 729 | 729 | ?> |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | * @return array |
| 833 | 833 | */ |
| 834 | 834 | public function get_new_field_defaults() { |
| 835 | - $field = array( |
|
| 835 | + $field = array( |
|
| 836 | 836 | 'name' => $this->get_new_field_name(), |
| 837 | 837 | 'description' => '', |
| 838 | 838 | 'type' => $this->type, |
@@ -863,8 +863,8 @@ discard block |
||
| 863 | 863 | |
| 864 | 864 | $fields = array_merge( $fields, $pro_fields ); |
| 865 | 865 | |
| 866 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 867 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 866 | + if ( isset( $fields[$this->type] ) ) { |
|
| 867 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | return $name; |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | * @return array |
| 882 | 882 | */ |
| 883 | 883 | public function get_default_field_options() { |
| 884 | - $opts = array( |
|
| 884 | + $opts = array( |
|
| 885 | 885 | 'size' => '', |
| 886 | 886 | 'max' => '', |
| 887 | 887 | 'label' => '', |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | * @return void |
| 1136 | 1136 | */ |
| 1137 | 1137 | public function set_aria_invalid_error( &$shortcode_atts, $args ) { |
| 1138 | - $shortcode_atts['aria-invalid'] = isset( $args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 1138 | + $shortcode_atts['aria-invalid'] = isset( $args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | /** |
@@ -1316,11 +1316,11 @@ discard block |
||
| 1316 | 1316 | } |
| 1317 | 1317 | |
| 1318 | 1318 | $options = array_values( $this->field['options'] ); |
| 1319 | - if ( ! isset( $options[ $opt ] ) ) { |
|
| 1319 | + if ( ! isset( $options[$opt] ) ) { |
|
| 1320 | 1320 | return $hidden; |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | - $option = $options[ $opt ]; |
|
| 1323 | + $option = $options[$opt]; |
|
| 1324 | 1324 | if ( is_array( $option ) ) { |
| 1325 | 1325 | $option = $option['value']; |
| 1326 | 1326 | } |
@@ -1403,8 +1403,8 @@ discard block |
||
| 1403 | 1403 | $selected = $values['field_value']; |
| 1404 | 1404 | |
| 1405 | 1405 | if ( isset( $values['combo_name'] ) ) { |
| 1406 | - $options = $options[ $values['combo_name'] ]; |
|
| 1407 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1406 | + $options = $options[$values['combo_name']]; |
|
| 1407 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | $input = $this->select_tag( $values ); |
@@ -1474,7 +1474,7 @@ discard block |
||
| 1474 | 1474 | * @return array |
| 1475 | 1475 | */ |
| 1476 | 1476 | protected function fill_display_field_values( $args = array() ) { |
| 1477 | - $defaults = array( |
|
| 1477 | + $defaults = array( |
|
| 1478 | 1478 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1479 | 1479 | 'field_id' => $this->get_field_column( 'id' ), |
| 1480 | 1480 | 'field_plus_id' => '', |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | } |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1539 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1540 | 1540 | if ( $error_comes_first ) { |
| 1541 | 1541 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1542 | 1542 | } else { |
@@ -1618,11 +1618,11 @@ discard block |
||
| 1618 | 1618 | |
| 1619 | 1619 | $field_id = $this->get_field_column( 'id' ); |
| 1620 | 1620 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1621 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1621 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1622 | 1622 | return false; |
| 1623 | 1623 | } |
| 1624 | 1624 | |
| 1625 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1625 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1626 | 1626 | return $already_validated_this_value; |
| 1627 | 1627 | } |
| 1628 | 1628 | |
@@ -1649,7 +1649,7 @@ discard block |
||
| 1649 | 1649 | private function value_validated_as_unique( $value ) { |
| 1650 | 1650 | global $frm_validated_unique_values; |
| 1651 | 1651 | $field_id = $this->get_field_column( 'id' ); |
| 1652 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1652 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | /** |
@@ -1694,8 +1694,8 @@ discard block |
||
| 1694 | 1694 | $value = $this->prepare_display_value( $value, $atts ); |
| 1695 | 1695 | |
| 1696 | 1696 | if ( is_array( $value ) ) { |
| 1697 | - if ( ! empty( $atts['show'] ) && isset( $value[ $atts['show'] ] ) ) { |
|
| 1698 | - $value = $value[ $atts['show'] ]; |
|
| 1697 | + if ( ! empty( $atts['show'] ) && isset( $value[$atts['show']] ) ) { |
|
| 1698 | + $value = $value[$atts['show']]; |
|
| 1699 | 1699 | } elseif ( empty( $atts['return_array'] ) ) { |
| 1700 | 1700 | $sep = $atts['sep'] ?? ', '; |
| 1701 | 1701 | $value = FrmAppHelper::safe_implode( $sep, $value ); |
@@ -1825,8 +1825,8 @@ discard block |
||
| 1825 | 1825 | $saved_entries = $atts['ids']; |
| 1826 | 1826 | $new_value = array(); |
| 1827 | 1827 | foreach ( (array) $value as $old_child_id ) { |
| 1828 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1829 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1828 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1829 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields', 'entry' ); |
| 171 | 171 | foreach ( $conditionally_add as $index ) { |
| 172 | - if ( isset( $atts[ $index ] ) ) { |
|
| 173 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
| 172 | + if ( isset( $atts[$index] ) ) { |
|
| 173 | + $entry_atts[$index] = $atts[$index]; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $unset = array( 'id', 'form_id', 'format' ); |
| 378 | 378 | foreach ( $unset as $param ) { |
| 379 | - if ( isset( $atts[ $param ] ) ) { |
|
| 380 | - unset( $atts[ $param ] ); |
|
| 379 | + if ( isset( $atts[$param] ) ) { |
|
| 380 | + unset( $atts[$param] ); |
|
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | |
@@ -553,11 +553,11 @@ discard block |
||
| 553 | 553 | |
| 554 | 554 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
| 555 | 555 | |
| 556 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
| 556 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
| 557 | 557 | |
| 558 | 558 | $has_separate_value = (bool) $field_value->get_field_option( 'separate_value' ); |
| 559 | 559 | if ( $has_separate_value || $displayed_value !== $field_value->get_saved_value() ) { |
| 560 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
| 560 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | } |
@@ -975,7 +975,7 @@ discard block |
||
| 975 | 975 | if ( $this->is_plain_text ) { |
| 976 | 976 | if ( is_array( $value ) ) { |
| 977 | 977 | foreach ( $value as $key => $single_value ) { |
| 978 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
| 978 | + $value[$key] = $this->strip_html( $single_value ); |
|
| 979 | 979 | } |
| 980 | 980 | } elseif ( $this->is_plain_text && ! is_array( $value ) ) { |
| 981 | 981 | if ( strpos( $value, '<img' ) !== false ) { |