@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'page' => '', |
| 46 | 46 | 'class' => 'frm-mt-0', |
| 47 | 47 | ); |
| 48 | - $tip = array_merge( $defaults, $tip ); |
|
| 48 | + $tip = array_merge( $defaults, $tip ); |
|
| 49 | 49 | |
| 50 | 50 | if ( isset( $tip['link'] ) && ! isset( $tip['link']['medium'] ) ) { |
| 51 | 51 | $tip['link']['medium'] = 'tip'; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | public static function get_random_tip( $tips ) { |
| 394 | 394 | $random = random_int( 0, count( $tips ) - 1 ); |
| 395 | 395 | |
| 396 | - return $tips[ $random ]; |
|
| 396 | + return $tips[$random]; |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -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'], |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | private static function prepare_csv_headings() { |
| 301 | 301 | $headings = array(); |
| 302 | 302 | self::csv_headings( $headings ); |
| 303 | - $headings = apply_filters( |
|
| 303 | + $headings = apply_filters( |
|
| 304 | 304 | 'frm_csv_columns', |
| 305 | 305 | $headings, |
| 306 | 306 | self::$form_id, |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | $field_headings = array(); |
| 325 | 325 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 326 | 326 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 327 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 327 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 330 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 331 | 331 | $field_headings = apply_filters( |
| 332 | 332 | 'frm_csv_field_columns', |
| 333 | 333 | $field_headings, |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 349 | 349 | $repeater_id = $col->field_options['in_section']; |
| 350 | 350 | // Set a placeholder to maintain order for repeater fields. |
| 351 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 351 | + $headings['repeater' . $repeater_id] = array(); |
|
| 352 | 352 | |
| 353 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 354 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 353 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 354 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 355 | 355 | $repeater_ids[] = $repeater_id; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 358 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 359 | 359 | |
| 360 | 360 | continue; |
| 361 | 361 | } |
@@ -374,8 +374,8 @@ discard block |
||
| 374 | 374 | $end = strpos( $row->meta_value, ':{' ); |
| 375 | 375 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 376 | 376 | |
| 377 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 378 | - $max[ $row->field_id ] = $length; |
|
| 377 | + if ( $length > $max[$row->field_id] ) { |
|
| 378 | + $max[$row->field_id] = $length; |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -386,17 +386,17 @@ discard block |
||
| 386 | 386 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 387 | 387 | |
| 388 | 388 | $repeater_headings = array(); |
| 389 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 389 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 390 | 390 | $repeater_headings += self::field_headings( $col ); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 393 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 394 | 394 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 395 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 395 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } else { |
| 399 | - $flat[ $key ] = $heading; |
|
| 399 | + $flat[$key] = $heading; |
|
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | }//end if |
| 410 | 410 | |
| 411 | 411 | if ( self::$comment_count ) { |
| 412 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 413 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 414 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 415 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 412 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 413 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 414 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 415 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 416 | 416 | } |
| 417 | 417 | unset( $i ); |
| 418 | 418 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | private static function prepare_next_csv_rows( $next_set ) { |
| 459 | 459 | if ( FrmAppHelper::pro_is_installed() ) { |
| 460 | - $where = array( |
|
| 460 | + $where = array( |
|
| 461 | 461 | 'or' => 1, |
| 462 | 462 | 'id' => $next_set, |
| 463 | 463 | 'parent_item_id' => $next_set, |
@@ -514,32 +514,32 @@ discard block |
||
| 514 | 514 | continue; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 518 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 519 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 517 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 518 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 519 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 523 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 524 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 522 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 523 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 524 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 525 | 525 | // if the data is here, it should be an array but if this field has collected data |
| 526 | 526 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 527 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 527 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | // Add the repeated values. |
| 531 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 531 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 532 | 532 | }//end foreach |
| 533 | 533 | |
| 534 | 534 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 535 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 535 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 536 | 536 | }//end if |
| 537 | 537 | |
| 538 | 538 | // add the embedded form id |
| 539 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 540 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 539 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 540 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 541 | 541 | } |
| 542 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 542 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -560,19 +560,19 @@ discard block |
||
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | $repeater_id = $field->field_options['in_section']; |
| 563 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 563 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 564 | 564 | return $metas; |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 568 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 569 | - $metas[ $repeater_child->id ] = ''; |
|
| 567 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 568 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 569 | + $metas[$repeater_child->id] = ''; |
|
| 570 | 570 | |
| 571 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 572 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 571 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 572 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 575 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | private static function add_field_values_to_csv( &$row ) { |
| 593 | 593 | foreach ( self::$fields as $col ) { |
| 594 | - $field_value = self::$entry->metas[ $col->id ] ?? false; |
|
| 594 | + $field_value = self::$entry->metas[$col->id] ?? false; |
|
| 595 | 595 | |
| 596 | 596 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 597 | 597 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -610,20 +610,20 @@ discard block |
||
| 610 | 610 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
| 611 | 611 | $label_key = $col->id . '_label'; |
| 612 | 612 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 613 | - $row[ $label_key ] = array(); |
|
| 613 | + $row[$label_key] = array(); |
|
| 614 | 614 | |
| 615 | 615 | if ( is_array( $field_value ) ) { |
| 616 | 616 | foreach ( $field_value as $value ) { |
| 617 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 617 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | } else { |
| 621 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 621 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 622 | 622 | } |
| 623 | 623 | unset( $label_key ); |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - $row[ $col->id ] = $field_value; |
|
| 626 | + $row[$col->id] = $field_value; |
|
| 627 | 627 | |
| 628 | 628 | unset( $col, $field_value ); |
| 629 | 629 | }//end foreach |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | 'show_icon' => false, |
| 647 | 647 | 'entry_id' => self::$entry->id, |
| 648 | 648 | 'sep' => self::$separator, |
| 649 | - '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, |
|
| 649 | + '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, |
|
| 650 | 650 | ) |
| 651 | 651 | ); |
| 652 | 652 | } |
@@ -661,8 +661,8 @@ discard block |
||
| 661 | 661 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 662 | 662 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 663 | 663 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 664 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 665 | - $row[ $column_key ] = $sub_sub_value; |
|
| 664 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 665 | + $row[$column_key] = $sub_sub_value; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -670,8 +670,8 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | $column_key = $atts['col']->id . '_' . $key; |
| 673 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 674 | - $row[ $column_key ] = $sub_value; |
|
| 673 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 674 | + $row[$column_key] = $sub_value; |
|
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | } |
@@ -696,18 +696,18 @@ discard block |
||
| 696 | 696 | $echo = 'echo' === self::$mode; |
| 697 | 697 | |
| 698 | 698 | foreach ( self::$headings as $k => $heading ) { |
| 699 | - if ( isset( $rows[ $k ] ) ) { |
|
| 700 | - $row = $rows[ $k ]; |
|
| 699 | + if ( isset( $rows[$k] ) ) { |
|
| 700 | + $row = $rows[$k]; |
|
| 701 | 701 | } else { |
| 702 | 702 | $row = ''; |
| 703 | 703 | // array indexed data is not at $rows[ $k ] |
| 704 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 704 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 705 | 705 | $start = strrpos( $k, '[' ); |
| 706 | - $key = substr( $k, 0, $start++ ); |
|
| 706 | + $key = substr( $k, 0, $start ++ ); |
|
| 707 | 707 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 708 | 708 | |
| 709 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 710 | - $row = $rows[ $key ][ $index ]; |
|
| 709 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 710 | + $row = $rows[$key][$index]; |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | unset( $start, $key, $index ); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | wp_enqueue_script( 'formidable_settings' ); |
| 29 | 29 | return FrmAppHelper::clip( |
| 30 | 30 | // @phpstan-ignore-next-line |
| 31 | - function () use ( $id, $name, $args ) { |
|
| 31 | + function() use ( $id, $name, $args ) { |
|
| 32 | 32 | require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
| 33 | 33 | }, |
| 34 | 34 | $args['echo'] ?? false |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $input_number_attrs = array_merge( |
|
| 100 | + $input_number_attrs = array_merge( |
|
| 101 | 101 | $args['input_number_attrs'], |
| 102 | 102 | array( |
| 103 | 103 | 'type' => ! empty( $selected_unit ) ? 'number' : 'text', |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | public static function populate_on_submit_data( &$form_options, $action = null, $event = 'create' ) { |
| 220 | 220 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 221 | 221 | if ( ! $action || ! is_object( $action ) ) { |
| 222 | - $form_options[ $opt . 'action' ] = self::get_default_action_type(); |
|
| 223 | - $form_options[ $opt . 'msg' ] = self::get_default_msg(); |
|
| 222 | + $form_options[$opt . 'action'] = self::get_default_action_type(); |
|
| 223 | + $form_options[$opt . 'msg'] = self::get_default_msg(); |
|
| 224 | 224 | |
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? 'message'; |
|
| 228 | + $form_options[$opt . 'action'] = $action->post_content['success_action'] ?? 'message'; |
|
| 229 | 229 | |
| 230 | - switch ( $form_options[ $opt . 'action' ] ) { |
|
| 230 | + switch ( $form_options[$opt . 'action'] ) { |
|
| 231 | 231 | case 'redirect': |
| 232 | - $form_options[ $opt . 'url' ] = $action->post_content['success_url'] ?? ''; |
|
| 232 | + $form_options[$opt . 'url'] = $action->post_content['success_url'] ?? ''; |
|
| 233 | 233 | $form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] ); |
| 234 | 234 | $form_options['redirect_delay'] = ! empty( $action->post_content['redirect_delay'] ); |
| 235 | 235 | $form_options['redirect_delay_time'] = $action->post_content['redirect_delay_time']; |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | break; |
| 238 | 238 | |
| 239 | 239 | case 'page': |
| 240 | - $form_options[ $opt . 'page_id' ] = $action->post_content['success_page_id'] ?? ''; |
|
| 240 | + $form_options[$opt . 'page_id'] = $action->post_content['success_page_id'] ?? ''; |
|
| 241 | 241 | break; |
| 242 | 242 | |
| 243 | 243 | default: |
| 244 | - $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
| 244 | + $form_options[$opt . 'msg'] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
|
| 245 | 245 | $form_options['show_form'] = ! empty( $action->post_content['show_form'] ); |
| 246 | 246 | } |
| 247 | 247 | } |
@@ -330,20 +330,20 @@ discard block |
||
| 330 | 330 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
| 331 | 331 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 332 | 332 | $data = array( |
| 333 | - 'success_action' => $form_options[ $opt . 'action' ] ?? self::get_default_action_type(), |
|
| 333 | + 'success_action' => $form_options[$opt . 'action'] ?? self::get_default_action_type(), |
|
| 334 | 334 | ); |
| 335 | 335 | |
| 336 | 336 | switch ( $data['success_action'] ) { |
| 337 | 337 | case 'redirect': |
| 338 | - $data['success_url'] = $form_options[ $opt . 'url' ] ?? ''; |
|
| 338 | + $data['success_url'] = $form_options[$opt . 'url'] ?? ''; |
|
| 339 | 339 | break; |
| 340 | 340 | |
| 341 | 341 | case 'page': |
| 342 | - $data['success_page_id'] = $form_options[ $opt . 'page_id' ] ?? ''; |
|
| 342 | + $data['success_page_id'] = $form_options[$opt . 'page_id'] ?? ''; |
|
| 343 | 343 | break; |
| 344 | 344 | |
| 345 | 345 | default: |
| 346 | - $data['success_msg'] = $form_options[ $opt . 'msg' ] ?? self::get_default_msg(); |
|
| 346 | + $data['success_msg'] = $form_options[$opt . 'msg'] ?? self::get_default_msg(); |
|
| 347 | 347 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'class' => '', |
| 38 | 38 | 'inc_children' => 'exclude', |
| 39 | 39 | ); |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args( $args, $defaults ); |
|
| 41 | 41 | |
| 42 | 42 | if ( ! $args['field_id'] ) { |
| 43 | 43 | $args['field_id'] = $field_name; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 80 | 80 | if ( ! empty( $class ) ) { |
| 81 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 81 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | 'description' => '', |
| 323 | 323 | ); |
| 324 | 324 | foreach ( $defaults as $var => $default ) { |
| 325 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 326 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 325 | + if ( ! isset( $values[$var] ) ) { |
|
| 326 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | 'parent_form_id' => 0, |
| 339 | 339 | ); |
| 340 | 340 | foreach ( $defaults as $var => $default ) { |
| 341 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 342 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 341 | + if ( ! isset( $values[$var] ) ) { |
|
| 342 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | unset( $defaults ); |
@@ -376,16 +376,16 @@ discard block |
||
| 376 | 376 | $defaults = self::get_default_opts(); |
| 377 | 377 | foreach ( $defaults as $var => $default ) { |
| 378 | 378 | if ( is_array( $default ) ) { |
| 379 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 380 | - $values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array(); |
|
| 379 | + if ( ! isset( $values[$var] ) ) { |
|
| 380 | + $values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array(); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | foreach ( $default as $k => $v ) { |
| 384 | - $values[ $var ][ $k ] = $post_values && isset( $post_values[ $var ][ $k ] ) ? $post_values[ $var ][ $k ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ? $record->options[ $var ][ $k ] : $v ); |
|
| 384 | + $values[$var][$k] = $post_values && isset( $post_values[$var][$k] ) ? $post_values[$var][$k] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ? $record->options[$var][$k] : $v ); |
|
| 385 | 385 | |
| 386 | 386 | if ( is_array( $v ) ) { |
| 387 | 387 | foreach ( $v as $k1 => $v1 ) { |
| 388 | - $values[ $var ][ $k ][ $k1 ] = $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ? $post_values[ $var ][ $k ][ $k1 ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 388 | + $values[$var][$k][$k1] = $post_values && isset( $post_values[$var][$k][$k1] ) ? $post_values[$var][$k][$k1] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 389 | 389 | unset( $k1, $v1 ); |
| 390 | 390 | } |
| 391 | 391 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | unset( $k, $v ); |
| 394 | 394 | } |
| 395 | 395 | } else { |
| 396 | - $values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default ); |
|
| 396 | + $values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default ); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | unset( $var, $default ); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | public static function fill_form_options( &$options, $values ) { |
| 439 | 439 | $defaults = self::get_default_opts(); |
| 440 | 440 | foreach ( $defaults as $var => $default ) { |
| 441 | - $options[ $var ] = $values['options'][ $var ] ?? $default; |
|
| 441 | + $options[$var] = $values['options'][$var] ?? $default; |
|
| 442 | 442 | unset( $var, $default ); |
| 443 | 443 | } |
| 444 | 444 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | public static function insert_opt_html( $args ) { |
| 616 | 616 | $class = $args['class'] ?? ''; |
| 617 | 617 | $fields = self::get_field_type_data_for_insert_opt_html(); |
| 618 | - $field = $fields[ $args['type'] ] ?? array(); |
|
| 618 | + $field = $fields[$args['type']] ?? array(); |
|
| 619 | 619 | |
| 620 | 620 | self::prepare_field_type( $field ); |
| 621 | 621 | |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $last_field = false; |
| 748 | 748 | foreach ( $fields as $field ) { |
| 749 | 749 | if ( $prev_order === $field->field_order ) { |
| 750 | - ++$add_order; |
|
| 750 | + ++ $add_order; |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ( $add_order ) { |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $label = ( $link_details[ $length ] ?? $link_details['label'] ); |
|
| 1225 | - if ( $length === 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1224 | + $label = ( $link_details[$length] ?? $link_details['label'] ); |
|
| 1225 | + if ( $length === 'icon' && isset( $link_details[$length] ) ) { |
|
| 1226 | 1226 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1227 | 1227 | $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
| 1228 | 1228 | } |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | $status = 'publish'; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | - $name = $nice_names[ $status ]; |
|
| 1372 | + $name = $nice_names[$status]; |
|
| 1373 | 1373 | |
| 1374 | 1374 | return $name; |
| 1375 | 1375 | } |
@@ -1433,7 +1433,7 @@ discard block |
||
| 1433 | 1433 | $icon = $icons['']; |
| 1434 | 1434 | if ( count( $categories ) === 1 ) { |
| 1435 | 1435 | $category = reset( $categories ); |
| 1436 | - $icon = $icons[ $category ] ?? $icon; |
|
| 1436 | + $icon = $icons[$category] ?? $icon; |
|
| 1437 | 1437 | } elseif ( ! empty( $categories ) ) { |
| 1438 | 1438 | $icons = array_intersect_key( $icons, array_flip( $categories ) ); |
| 1439 | 1439 | $icon = reset( $icons ); |
@@ -1555,7 +1555,7 @@ discard block |
||
| 1555 | 1555 | |
| 1556 | 1556 | foreach ( $item['categories'] as $k => $category ) { |
| 1557 | 1557 | if ( in_array( $category, $plans, true ) ) { |
| 1558 | - unset( $item['categories'][ $k ] ); |
|
| 1558 | + unset( $item['categories'][$k] ); |
|
| 1559 | 1559 | |
| 1560 | 1560 | $category = self::convert_legacy_package_names( $category ); |
| 1561 | 1561 | |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | 'include_all' => true, |
| 1595 | 1595 | 'case_lower' => false, |
| 1596 | 1596 | ); |
| 1597 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1597 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1598 | 1598 | |
| 1599 | 1599 | $license_types = array( 'Basic', 'Plus', 'Business', 'Elite' ); |
| 1600 | 1600 | |
@@ -1797,9 +1797,9 @@ discard block |
||
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | foreach ( $shortcodes[0] as $key => $shortcode ) { |
| 1800 | - $options = trim( $shortcodes[3][ $key ] ); |
|
| 1800 | + $options = trim( $shortcodes[3][$key] ); |
|
| 1801 | 1801 | |
| 1802 | - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) { |
|
| 1802 | + if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) { |
|
| 1803 | 1803 | // Skip if shortcodes. |
| 1804 | 1804 | continue; |
| 1805 | 1805 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | continue; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - $new_shortcode = '[' . $shortcodes[2][ $key ]; |
|
| 1812 | + $new_shortcode = '[' . $shortcodes[2][$key]; |
|
| 1813 | 1813 | if ( $options ) { |
| 1814 | 1814 | $new_shortcode .= ' ' . $options; |
| 1815 | 1815 | } |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | if ( $_POST ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 138 | 138 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
| 139 | 139 | if ( $repeating ) { |
| 140 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 140 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 141 | 141 | $value_is_posted = true; |
| 142 | 142 | } |
| 143 | - } elseif ( isset( $_POST['item_meta'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 143 | + } elseif ( isset( $_POST['item_meta'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 144 | 144 | $value_is_posted = true; |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
| 173 | 173 | |
| 174 | 174 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 175 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 175 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 176 | 176 | if ( ! empty( $add_atts ) ) { |
| 177 | 177 | $this_atts = array_merge( $atts, $add_atts ); |
| 178 | 178 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
| 183 | 183 | |
| 184 | 184 | // Add the default message. |
| 185 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
| 185 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | return $message; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return string |
| 196 | 196 | */ |
| 197 | 197 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 198 | - $field_value = $entry->metas[ $field->id ] ?? false; |
|
| 198 | + $field_value = $entry->metas[$field->id] ?? false; |
|
| 199 | 199 | |
| 200 | 200 | if ( FrmAppHelper::pro_is_installed() ) { |
| 201 | 201 | $empty = empty( $field_value ); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ), '', '', true ); |
| 224 | 224 | } else { |
| 225 | 225 | // Get all values for this field. |
| 226 | - $child_values = $entry->metas[ $atts['embedded_field_id'] ] ?? false; |
|
| 226 | + $child_values = $entry->metas[$atts['embedded_field_id']] ?? false; |
|
| 227 | 227 | |
| 228 | 228 | if ( $child_values ) { |
| 229 | 229 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $value = $args['temp_value']; |
| 346 | 346 | } |
| 347 | 347 | if ( empty( $args['parent_field_id'] ) ) { |
| 348 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 348 | + $_POST['item_meta'][$field->id] = $value; |
|
| 349 | 349 | } else { |
| 350 | 350 | self::set_parent_field_posted_value( $field, $value, $args ); |
| 351 | 351 | } |
@@ -357,17 +357,17 @@ discard block |
||
| 357 | 357 | * @since 4.01 |
| 358 | 358 | */ |
| 359 | 359 | private static function set_parent_field_posted_value( $field, $value, $args ) { |
| 360 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ] ) && is_array( $_POST['item_meta'][ $args['parent_field_id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 361 | - if ( ! isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) || ! is_array( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 362 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 360 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']] ) && is_array( $_POST['item_meta'][$args['parent_field_id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 361 | + if ( ! isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) || ! is_array( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 362 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 363 | 363 | } |
| 364 | 364 | } else { |
| 365 | 365 | // All of the section was probably removed. |
| 366 | - $_POST['item_meta'][ $args['parent_field_id'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 367 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 366 | + $_POST['item_meta'][$args['parent_field_id']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 367 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']] = array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 370 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | public static function get_posted_value( $field, &$value, $args ) { |
@@ -397,9 +397,9 @@ discard block |
||
| 397 | 397 | private static function get_posted_meta( $field_id, $args ) { |
| 398 | 398 | if ( empty( $args['parent_field_id'] ) ) { |
| 399 | 399 | // Sanitizing is done next. |
| 400 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 400 | + $value = isset( $_POST['item_meta'][$field_id] ) ? wp_unslash( $_POST['item_meta'][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 401 | 401 | } else { |
| 402 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 402 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 403 | 403 | } |
| 404 | 404 | return $value; |
| 405 | 405 | } |
@@ -430,14 +430,14 @@ discard block |
||
| 430 | 430 | self::set_other_repeating_vals( $field, $value, $args ); |
| 431 | 431 | |
| 432 | 432 | // Check if there are any posted "Other" values. |
| 433 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 433 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 434 | 434 | |
| 435 | 435 | // Save original value. |
| 436 | 436 | $args['temp_value'] = $value; |
| 437 | 437 | $args['other'] = true; |
| 438 | 438 | |
| 439 | 439 | // Sanitizing is done next. |
| 440 | - $other_vals = wp_unslash( $_POST['item_meta']['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 440 | + $other_vals = wp_unslash( $_POST['item_meta']['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 441 | 441 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 442 | 442 | |
| 443 | 443 | // Set the validation value now |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | // Check if there are any other posted "other" values for this field. |
| 463 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 463 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 464 | 464 | // Save original value |
| 465 | 465 | $args['temp_value'] = $value; |
| 466 | 466 | $args['other'] = true; |
| 467 | 467 | |
| 468 | - $other_vals = wp_unslash( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 468 | + $other_vals = wp_unslash( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 469 | 469 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $other_vals ); |
| 470 | 470 | |
| 471 | 471 | // Set the validation value now. |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | if ( is_array( $value ) && $field->type === 'checkbox' ) { |
| 493 | 493 | // Combine "Other" values with checked values. "Other" values will override checked box values. |
| 494 | 494 | foreach ( $other_vals as $k => $v ) { |
| 495 | - if ( isset( $value[ $k ] ) && trim( $v ) === '' ) { |
|
| 495 | + if ( isset( $value[$k] ) && trim( $v ) === '' ) { |
|
| 496 | 496 | // If the other box is checked, but doesn't have a value. |
| 497 | 497 | $value = ''; |
| 498 | 498 | break; |
@@ -509,25 +509,25 @@ discard block |
||
| 509 | 509 | |
| 510 | 510 | // Multi-select dropdown. |
| 511 | 511 | if ( is_array( $value ) ) { |
| 512 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 512 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 513 | 513 | |
| 514 | 514 | if ( $o_key !== false ) { |
| 515 | 515 | // Modify the original value so other key will be preserved. |
| 516 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 516 | + $value[$other_key] = $value[$o_key]; |
|
| 517 | 517 | |
| 518 | 518 | // By default, the array keys will be numeric for multi-select dropdowns. |
| 519 | 519 | // If going backwards and forwards between pages, the array key will match the other key. |
| 520 | 520 | if ( $o_key !== $other_key ) { |
| 521 | - unset( $value[ $o_key ] ); |
|
| 521 | + unset( $value[$o_key] ); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | $args['temp_value'] = $value; |
| 525 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 526 | - if ( FrmAppHelper::is_empty_value( $value[ $other_key ] ) ) { |
|
| 527 | - unset( $value[ $other_key ] ); |
|
| 525 | + $value[$other_key] = reset( $other_vals ); |
|
| 526 | + if ( FrmAppHelper::is_empty_value( $value[$other_key] ) ) { |
|
| 527 | + unset( $value[$other_key] ); |
|
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | - } elseif ( $field->options[ $other_key ] == $value ) { |
|
| 530 | + } elseif ( $field->options[$other_key] == $value ) { |
|
| 531 | 531 | $value = $other_vals; |
| 532 | 532 | }//end if |
| 533 | 533 | }//end if |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | * @return void |
| 775 | 775 | */ |
| 776 | 776 | public static function maybe_render_captcha_score( $entry_id ) { |
| 777 | - $query = array( |
|
| 777 | + $query = array( |
|
| 778 | 778 | 'item_id' => (int) $entry_id, |
| 779 | 779 | 'field_id' => 0, |
| 780 | 780 | ); |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | public static function get_entry_status_label( $status ) { |
| 829 | 829 | $statuses = self::get_entry_statuses(); |
| 830 | 830 | |
| 831 | - return $statuses[ self::get_entry_status( $status ) ]; |
|
| 831 | + return $statuses[self::get_entry_status( $status )]; |
|
| 832 | 832 | } |
| 833 | 833 | |
| 834 | 834 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'fill' => '#4d4d4d', |
| 249 | 249 | 'orange' => '#f05a24', |
| 250 | 250 | ); |
| 251 | - $atts = array_merge( $defaults, $atts ); |
|
| 251 | + $atts = array_merge( $defaults, $atts ); |
|
| 252 | 252 | |
| 253 | 253 | return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 599.68 601.37" width="' . esc_attr( $atts['width'] ) . '" height="' . esc_attr( $atts['height'] ) . '"> |
| 254 | 254 | <path fill="' . esc_attr( $atts['orange'] ) . '" d="M289.6 384h140v76h-140z"/> |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | * @return string |
| 537 | 537 | */ |
| 538 | 538 | public static function get_server_value( $value ) { |
| 539 | - return isset( $_SERVER[ $value ] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[ $value ] ) ) : ''; |
|
| 539 | + return isset( $_SERVER[$value] ) ? wp_strip_all_tags( wp_unslash( $_SERVER[$value] ) ) : ''; |
|
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | /** |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | $ip = ''; |
| 571 | 571 | |
| 572 | 572 | foreach ( $ip_options as $key ) { |
| 573 | - if ( ! isset( $_SERVER[ $key ] ) ) { |
|
| 573 | + if ( ! isset( $_SERVER[$key] ) ) { |
|
| 574 | 574 | continue; |
| 575 | 575 | } |
| 576 | 576 | |
@@ -639,10 +639,10 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | if ( $src === 'get' ) { |
| 642 | - $value = isset( $_POST[ $param ] ) ? wp_unslash( $_POST[ $param ] ) : ( isset( $_GET[ $param ] ) ? wp_unslash( $_GET[ $param ] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
| 643 | - if ( ! isset( $_POST[ $param ] ) && isset( $_GET[ $param ] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 642 | + $value = isset( $_POST[$param] ) ? wp_unslash( $_POST[$param] ) : ( isset( $_GET[$param] ) ? wp_unslash( $_GET[$param] ) : $default ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
|
| 643 | + if ( ! isset( $_POST[$param] ) && isset( $_GET[$param] ) && ! is_array( $value ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 644 | 644 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 645 | - $value = htmlspecialchars_decode( wp_unslash( $_GET[ $param ] ) ); |
|
| 645 | + $value = htmlspecialchars_decode( wp_unslash( $_GET[$param] ) ); |
|
| 646 | 646 | } |
| 647 | 647 | self::sanitize_value( $sanitize, $value ); |
| 648 | 648 | } else { |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | $p = trim( $p, ']' ); |
| 666 | - $value = $value[ $p ] ?? $default; |
|
| 666 | + $value = $value[$p] ?? $default; |
|
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
@@ -728,26 +728,26 @@ discard block |
||
| 728 | 728 | 'sanitize' => 'sanitize_text_field', |
| 729 | 729 | 'serialized' => false, |
| 730 | 730 | ); |
| 731 | - $args = wp_parse_args( $args, $defaults ); |
|
| 731 | + $args = wp_parse_args( $args, $defaults ); |
|
| 732 | 732 | |
| 733 | 733 | $value = $args['default']; |
| 734 | 734 | if ( $args['type'] === 'get' ) { |
| 735 | - if ( $_GET && isset( $_GET[ $args['param'] ] ) ) { |
|
| 735 | + if ( $_GET && isset( $_GET[$args['param']] ) ) { |
|
| 736 | 736 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 737 | - $value = wp_unslash( $_GET[ $args['param'] ] ); |
|
| 737 | + $value = wp_unslash( $_GET[$args['param']] ); |
|
| 738 | 738 | } |
| 739 | 739 | } elseif ( $args['type'] === 'post' ) { |
| 740 | - if ( isset( $_POST[ $args['param'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 740 | + if ( isset( $_POST[$args['param']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 741 | 741 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 742 | - $value = wp_unslash( $_POST[ $args['param'] ] ); |
|
| 742 | + $value = wp_unslash( $_POST[$args['param']] ); |
|
| 743 | 743 | if ( $args['serialized'] === true && is_serialized_string( $value ) && is_serialized( $value ) ) { |
| 744 | 744 | self::unserialize_or_decode( $value ); |
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | - } elseif ( isset( $_REQUEST[ $args['param'] ] ) ) { |
|
| 747 | + } elseif ( isset( $_REQUEST[$args['param']] ) ) { |
|
| 748 | 748 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 749 | 749 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 750 | - $value = wp_unslash( $_REQUEST[ $args['param'] ] ); |
|
| 750 | + $value = wp_unslash( $_REQUEST[$args['param']] ); |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | self::sanitize_value( $args['sanitize'], $value ); |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | if ( is_array( $value ) ) { |
| 795 | 795 | $temp_values = $value; |
| 796 | 796 | foreach ( $temp_values as $k => $v ) { |
| 797 | - self::sanitize_value( $sanitize, $value[ $k ] ); |
|
| 797 | + self::sanitize_value( $sanitize, $value[$k] ); |
|
| 798 | 798 | } |
| 799 | 799 | return; |
| 800 | 800 | } |
@@ -805,8 +805,8 @@ discard block |
||
| 805 | 805 | public static function sanitize_request( $sanitize_method, &$values ) { |
| 806 | 806 | $temp_values = $values; |
| 807 | 807 | foreach ( $temp_values as $k => $val ) { |
| 808 | - if ( isset( $sanitize_method[ $k ] ) ) { |
|
| 809 | - $values[ $k ] = call_user_func( $sanitize_method[ $k ], $val ); |
|
| 808 | + if ( isset( $sanitize_method[$k] ) ) { |
|
| 809 | + $values[$k] = call_user_func( $sanitize_method[$k], $val ); |
|
| 810 | 810 | } |
| 811 | 811 | } |
| 812 | 812 | } |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | if ( is_array( $value ) ) { |
| 867 | 867 | $temp_values = $value; |
| 868 | 868 | foreach ( $temp_values as $k => $v ) { |
| 869 | - self::decode_specialchars( $value[ $k ] ); |
|
| 869 | + self::decode_specialchars( $value[$k] ); |
|
| 870 | 870 | } |
| 871 | 871 | } else { |
| 872 | 872 | self::decode_amp( $value ); |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | * @return array |
| 1002 | 1002 | */ |
| 1003 | 1003 | public static function add_allowed_submit_button_tags( $allowed_html ) { |
| 1004 | - $allowed_html['input'] = array( |
|
| 1004 | + $allowed_html['input'] = array( |
|
| 1005 | 1005 | 'type' => true, |
| 1006 | 1006 | 'value' => true, |
| 1007 | 1007 | 'formnovalidate' => true, |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | $allowed_html = $html; |
| 1025 | 1025 | } elseif ( ! empty( $allowed ) ) { |
| 1026 | 1026 | foreach ( (array) $allowed as $a ) { |
| 1027 | - $allowed_html[ $a ] = $html[ $a ] ?? array(); |
|
| 1027 | + $allowed_html[$a] = $html[$a] ?? array(); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | |
@@ -1208,8 +1208,8 @@ discard block |
||
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | global $wp_query; |
| 1211 | - if ( isset( $wp_query->query_vars[ $param ] ) ) { |
|
| 1212 | - $value = $wp_query->query_vars[ $param ]; |
|
| 1211 | + if ( isset( $wp_query->query_vars[$param] ) ) { |
|
| 1212 | + $value = $wp_query->query_vars[$param]; |
|
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | return $value; |
@@ -1240,9 +1240,9 @@ discard block |
||
| 1240 | 1240 | 'frm_keyalt_icon' => 'frm_key_icon', |
| 1241 | 1241 | 'frm_keyalt_solid_icon' => 'frm_key_solid_icon', |
| 1242 | 1242 | ); |
| 1243 | - if ( isset( $deprecated[ $icon ] ) ) { |
|
| 1244 | - $icon = $deprecated[ $icon ]; |
|
| 1245 | - $class = str_replace( $icon, $deprecated[ $icon ], $class ); |
|
| 1243 | + if ( isset( $deprecated[$icon] ) ) { |
|
| 1244 | + $icon = $deprecated[$icon]; |
|
| 1245 | + $class = str_replace( $icon, $deprecated[$icon], $class ); |
|
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | if ( $icon === $class ) { |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | * @return string|void |
| 1366 | 1366 | */ |
| 1367 | 1367 | public static function array_to_html_params( $atts, $echo = false ) { |
| 1368 | - $callback = function () use ( $atts ) { |
|
| 1368 | + $callback = function() use ( $atts ) { |
|
| 1369 | 1369 | if ( $atts ) { |
| 1370 | 1370 | foreach ( $atts as $key => $value ) { |
| 1371 | 1371 | echo ' ' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
@@ -1543,7 +1543,7 @@ discard block |
||
| 1543 | 1543 | 'value' => false, |
| 1544 | 1544 | 'class' => '', |
| 1545 | 1545 | ); |
| 1546 | - $atts = array_merge( $defaults, $atts ); |
|
| 1546 | + $atts = array_merge( $defaults, $atts ); |
|
| 1547 | 1547 | |
| 1548 | 1548 | if ( $atts['input_id'] === 'template' && empty( $atts['tosearch'] ) ) { |
| 1549 | 1549 | $atts['tosearch'] = 'frm-card'; |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | 'new_file_path' => self::plugin_path() . '/js', |
| 1620 | 1620 | ) |
| 1621 | 1621 | ); |
| 1622 | - $new_file = new FrmCreateFile( $file_atts ); |
|
| 1622 | + $new_file = new FrmCreateFile( $file_atts ); |
|
| 1623 | 1623 | |
| 1624 | 1624 | $files = array( |
| 1625 | 1625 | self::plugin_path() . '/js/formidable.min.js', |
@@ -1833,8 +1833,8 @@ discard block |
||
| 1833 | 1833 | */ |
| 1834 | 1834 | private static function get_dropdown_value_and_label_from_option( $option, $key, $args ) { |
| 1835 | 1835 | if ( is_array( $option ) ) { |
| 1836 | - $value = $option[ $args['value_key'] ] ?? ''; |
|
| 1837 | - $label = $option[ $args['label_key'] ] ?? ''; |
|
| 1836 | + $value = $option[$args['value_key']] ?? ''; |
|
| 1837 | + $label = $option[$args['label_key']] ?? ''; |
|
| 1838 | 1838 | } else { |
| 1839 | 1839 | $value = $key; |
| 1840 | 1840 | $label = $option; |
@@ -2217,8 +2217,8 @@ discard block |
||
| 2217 | 2217 | return $error; |
| 2218 | 2218 | } |
| 2219 | 2219 | |
| 2220 | - $nonce_value = $_REQUEST && isset( $_REQUEST[ $nonce_name ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_name ] ) ) : ''; |
|
| 2221 | - if ( $_REQUEST && ( ! isset( $_REQUEST[ $nonce_name ] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 2220 | + $nonce_value = $_REQUEST && isset( $_REQUEST[$nonce_name] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$nonce_name] ) ) : ''; |
|
| 2221 | + if ( $_REQUEST && ( ! isset( $_REQUEST[$nonce_name] ) || ! wp_verify_nonce( $nonce_value, $nonce ) ) ) { |
|
| 2222 | 2222 | $frm_settings = self::get_settings(); |
| 2223 | 2223 | $error = $frm_settings->admin_permission; |
| 2224 | 2224 | } |
@@ -2254,7 +2254,7 @@ discard block |
||
| 2254 | 2254 | } else { |
| 2255 | 2255 | foreach ( $value as $k => $v ) { |
| 2256 | 2256 | if ( ! is_array( $v ) ) { |
| 2257 | - $value[ $k ] = call_user_func( $original_function, $v ); |
|
| 2257 | + $value[$k] = call_user_func( $original_function, $v ); |
|
| 2258 | 2258 | } |
| 2259 | 2259 | } |
| 2260 | 2260 | } |
@@ -2295,7 +2295,7 @@ discard block |
||
| 2295 | 2295 | if ( is_array( $value ) ) { |
| 2296 | 2296 | $return = array_merge( $return, self::array_flatten( $value, $keys ) ); |
| 2297 | 2297 | } elseif ( $keys === 'keep' ) { |
| 2298 | - $return[ $key ] = $value; |
|
| 2298 | + $return[$key] = $value; |
|
| 2299 | 2299 | } else { |
| 2300 | 2300 | $return[] = $value; |
| 2301 | 2301 | } |
@@ -2370,11 +2370,11 @@ discard block |
||
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | $ver = $default; |
| 2373 | - if ( ! isset( $wp_scripts->registered[ $handle ] ) ) { |
|
| 2373 | + if ( ! isset( $wp_scripts->registered[$handle] ) ) { |
|
| 2374 | 2374 | return $ver; |
| 2375 | 2375 | } |
| 2376 | 2376 | |
| 2377 | - $query = $wp_scripts->registered[ $handle ]; |
|
| 2377 | + $query = $wp_scripts->registered[$handle]; |
|
| 2378 | 2378 | if ( is_object( $query ) && ! empty( $query->ver ) ) { |
| 2379 | 2379 | $ver = $query->ver; |
| 2380 | 2380 | } |
@@ -2390,7 +2390,7 @@ discard block |
||
| 2390 | 2390 | * @return string|null |
| 2391 | 2391 | */ |
| 2392 | 2392 | public static function js_redirect( $url, $echo = false ) { |
| 2393 | - $callback = function () use ( $url ) { |
|
| 2393 | + $callback = function() use ( $url ) { |
|
| 2394 | 2394 | echo '<script type="text/javascript">window.location="' . esc_url_raw( $url ) . '"</script>'; |
| 2395 | 2395 | }; |
| 2396 | 2396 | return self::clip( $callback, $echo ); |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | $suffix = 2; |
| 2486 | 2486 | do { |
| 2487 | 2487 | $key_check = $key . $separator . $suffix; |
| 2488 | - ++$suffix; |
|
| 2488 | + ++ $suffix; |
|
| 2489 | 2489 | } while ( in_array( $key_check, $similar_keys, true ) ); |
| 2490 | 2490 | |
| 2491 | 2491 | $key = $key_check; |
@@ -2595,7 +2595,7 @@ discard block |
||
| 2595 | 2595 | |
| 2596 | 2596 | foreach ( array( 'name', 'description' ) as $var ) { |
| 2597 | 2597 | $default_val = $record->{$var} ?? ''; |
| 2598 | - $values[ $var ] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 2598 | + $values[$var] = self::get_param( $var, $default_val, 'get', 'wp_kses_post' ); |
|
| 2599 | 2599 | unset( $var, $default_val ); |
| 2600 | 2600 | } |
| 2601 | 2601 | |
@@ -2651,9 +2651,9 @@ discard block |
||
| 2651 | 2651 | $meta_value = FrmEntryMeta::get_meta_value( $record, $field->id ); |
| 2652 | 2652 | }//end if |
| 2653 | 2653 | |
| 2654 | - $field_type = $post_values['field_options'][ 'type_' . $field->id ] ?? $field->type; |
|
| 2655 | - if ( isset( $post_values['item_meta'][ $field->id ] ) ) { |
|
| 2656 | - $new_value = $post_values['item_meta'][ $field->id ]; |
|
| 2654 | + $field_type = $post_values['field_options']['type_' . $field->id] ?? $field->type; |
|
| 2655 | + if ( isset( $post_values['item_meta'][$field->id] ) ) { |
|
| 2656 | + $new_value = $post_values['item_meta'][$field->id]; |
|
| 2657 | 2657 | self::unserialize_or_decode( $new_value ); |
| 2658 | 2658 | } else { |
| 2659 | 2659 | $new_value = $meta_value; |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | |
| 2675 | 2675 | $field_array = array_merge( (array) $field->field_options, $field_array ); |
| 2676 | 2676 | |
| 2677 | - $values['fields'][ $field->id ] = $field_array; |
|
| 2677 | + $values['fields'][$field->id] = $field_array; |
|
| 2678 | 2678 | } |
| 2679 | 2679 | |
| 2680 | 2680 | /** |
@@ -2724,11 +2724,11 @@ discard block |
||
| 2724 | 2724 | } |
| 2725 | 2725 | |
| 2726 | 2726 | foreach ( $form->options as $opt => $value ) { |
| 2727 | - if ( isset( $post_values[ $opt ] ) ) { |
|
| 2728 | - $values[ $opt ] = $post_values[ $opt ]; |
|
| 2729 | - self::unserialize_or_decode( $values[ $opt ] ); |
|
| 2727 | + if ( isset( $post_values[$opt] ) ) { |
|
| 2728 | + $values[$opt] = $post_values[$opt]; |
|
| 2729 | + self::unserialize_or_decode( $values[$opt] ); |
|
| 2730 | 2730 | } else { |
| 2731 | - $values[ $opt ] = $value; |
|
| 2731 | + $values[$opt] = $value; |
|
| 2732 | 2732 | } |
| 2733 | 2733 | } |
| 2734 | 2734 | |
@@ -2742,8 +2742,8 @@ discard block |
||
| 2742 | 2742 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 2743 | 2743 | |
| 2744 | 2744 | foreach ( $form_defaults as $opt => $default ) { |
| 2745 | - if ( ! isset( $values[ $opt ] ) || $values[ $opt ] == '' ) { |
|
| 2746 | - $values[ $opt ] = $post_values && isset( $post_values['options'][ $opt ] ) ? $post_values['options'][ $opt ] : $default; |
|
| 2745 | + if ( ! isset( $values[$opt] ) || $values[$opt] == '' ) { |
|
| 2746 | + $values[$opt] = $post_values && isset( $post_values['options'][$opt] ) ? $post_values['options'][$opt] : $default; |
|
| 2747 | 2747 | } |
| 2748 | 2748 | |
| 2749 | 2749 | unset( $opt, $default ); |
@@ -2754,8 +2754,8 @@ discard block |
||
| 2754 | 2754 | } |
| 2755 | 2755 | |
| 2756 | 2756 | foreach ( array( 'before', 'after', 'submit' ) as $h ) { |
| 2757 | - if ( ! isset( $values[ $h . '_html' ] ) ) { |
|
| 2758 | - $values[ $h . '_html' ] = ( $post_values['options'][ $h . '_html' ] ?? FrmFormsHelper::get_default_html( $h ) ); |
|
| 2757 | + if ( ! isset( $values[$h . '_html'] ) ) { |
|
| 2758 | + $values[$h . '_html'] = ( $post_values['options'][$h . '_html'] ?? FrmFormsHelper::get_default_html( $h ) ); |
|
| 2759 | 2759 | } |
| 2760 | 2760 | unset( $h ); |
| 2761 | 2761 | } |
@@ -2950,25 +2950,25 @@ discard block |
||
| 2950 | 2950 | if ( ! is_numeric( $levels ) ) { |
| 2951 | 2951 | // Show time in specified unit. |
| 2952 | 2952 | $levels = self::get_unit( $levels ); |
| 2953 | - if ( isset( $time_strings[ $levels ] ) ) { |
|
| 2953 | + if ( isset( $time_strings[$levels] ) ) { |
|
| 2954 | 2954 | $diff = array( |
| 2955 | 2955 | $levels => self::time_format( $levels, $diff ), |
| 2956 | 2956 | ); |
| 2957 | 2957 | $time_strings = array( |
| 2958 | - $levels => $time_strings[ $levels ], |
|
| 2958 | + $levels => $time_strings[$levels], |
|
| 2959 | 2959 | ); |
| 2960 | 2960 | } |
| 2961 | 2961 | $levels = 1; |
| 2962 | 2962 | } |
| 2963 | 2963 | |
| 2964 | 2964 | foreach ( $time_strings as $k => $v ) { |
| 2965 | - if ( isset( $diff[ $k ] ) && $diff[ $k ] ) { |
|
| 2966 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . ( $diff[ $k ] > 1 ? $v[1] : $v[0] ); |
|
| 2967 | - } elseif ( isset( $diff[ $k ] ) && count( $time_strings ) === 1 ) { |
|
| 2965 | + if ( isset( $diff[$k] ) && $diff[$k] ) { |
|
| 2966 | + $time_strings[$k] = $diff[$k] . ' ' . ( $diff[$k] > 1 ? $v[1] : $v[0] ); |
|
| 2967 | + } elseif ( isset( $diff[$k] ) && count( $time_strings ) === 1 ) { |
|
| 2968 | 2968 | // Account for 0. |
| 2969 | - $time_strings[ $k ] = $diff[ $k ] . ' ' . $v[1]; |
|
| 2969 | + $time_strings[$k] = $diff[$k] . ' ' . $v[1]; |
|
| 2970 | 2970 | } else { |
| 2971 | - unset( $time_strings[ $k ] ); |
|
| 2971 | + unset( $time_strings[$k] ); |
|
| 2972 | 2972 | } |
| 2973 | 2973 | } |
| 2974 | 2974 | |
@@ -2987,8 +2987,8 @@ discard block |
||
| 2987 | 2987 | 'y' => 'y', |
| 2988 | 2988 | 'd' => 'days', |
| 2989 | 2989 | ); |
| 2990 | - if ( isset( $return[ $unit ] ) ) { |
|
| 2991 | - return $diff[ $return[ $unit ] ]; |
|
| 2990 | + if ( isset( $return[$unit] ) ) { |
|
| 2991 | + return $diff[$return[$unit]]; |
|
| 2992 | 2992 | } |
| 2993 | 2993 | |
| 2994 | 2994 | $total = $diff['days'] * self::convert_time( 'd', $unit ); |
@@ -2996,11 +2996,11 @@ discard block |
||
| 2996 | 2996 | $times = array( 'h', 'i', 's' ); |
| 2997 | 2997 | |
| 2998 | 2998 | foreach ( $times as $time ) { |
| 2999 | - if ( ! isset( $diff[ $time ] ) ) { |
|
| 2999 | + if ( ! isset( $diff[$time] ) ) { |
|
| 3000 | 3000 | continue; |
| 3001 | 3001 | } |
| 3002 | 3002 | |
| 3003 | - $total += $diff[ $time ] * self::convert_time( $time, $unit ); |
|
| 3003 | + $total += $diff[$time] * self::convert_time( $time, $unit ); |
|
| 3004 | 3004 | } |
| 3005 | 3005 | |
| 3006 | 3006 | return floor( $total ); |
@@ -3020,7 +3020,7 @@ discard block |
||
| 3020 | 3020 | 'y' => DAY_IN_SECONDS * 365.25, |
| 3021 | 3021 | ); |
| 3022 | 3022 | |
| 3023 | - return $convert[ $from ] / $convert[ $to ]; |
|
| 3023 | + return $convert[$from] / $convert[$to]; |
|
| 3024 | 3024 | } |
| 3025 | 3025 | |
| 3026 | 3026 | /** |
@@ -3028,7 +3028,7 @@ discard block |
||
| 3028 | 3028 | */ |
| 3029 | 3029 | private static function get_unit( $unit ) { |
| 3030 | 3030 | $units = self::get_time_strings(); |
| 3031 | - if ( isset( $units[ $unit ] ) || is_numeric( $unit ) ) { |
|
| 3031 | + if ( isset( $units[$unit] ) || is_numeric( $unit ) ) { |
|
| 3032 | 3032 | return $unit; |
| 3033 | 3033 | } |
| 3034 | 3034 | |
@@ -3144,17 +3144,17 @@ discard block |
||
| 3144 | 3144 | |
| 3145 | 3145 | case 1: |
| 3146 | 3146 | $l2 = $name; |
| 3147 | - self::add_value_to_array( $name, $l2, $this_val, $vars[ $l1 ] ); |
|
| 3147 | + self::add_value_to_array( $name, $l2, $this_val, $vars[$l1] ); |
|
| 3148 | 3148 | break; |
| 3149 | 3149 | |
| 3150 | 3150 | case 2: |
| 3151 | 3151 | $l3 = $name; |
| 3152 | - self::add_value_to_array( $name, $l3, $this_val, $vars[ $l1 ][ $l2 ] ); |
|
| 3152 | + self::add_value_to_array( $name, $l3, $this_val, $vars[$l1][$l2] ); |
|
| 3153 | 3153 | break; |
| 3154 | 3154 | |
| 3155 | 3155 | case 3: |
| 3156 | 3156 | $l4 = $name; |
| 3157 | - self::add_value_to_array( $name, $l4, $this_val, $vars[ $l1 ][ $l2 ][ $l3 ] ); |
|
| 3157 | + self::add_value_to_array( $name, $l4, $this_val, $vars[$l1][$l2][$l3] ); |
|
| 3158 | 3158 | } |
| 3159 | 3159 | |
| 3160 | 3160 | unset( $this_val, $n ); |
@@ -3173,8 +3173,8 @@ discard block |
||
| 3173 | 3173 | public static function add_value_to_array( $name, $l1, $val, &$vars ) { |
| 3174 | 3174 | if ( $name == '' ) { |
| 3175 | 3175 | $vars[] = $val; |
| 3176 | - } elseif ( ! isset( $vars[ $l1 ] ) ) { |
|
| 3177 | - $vars[ $l1 ] = $val; |
|
| 3176 | + } elseif ( ! isset( $vars[$l1] ) ) { |
|
| 3177 | + $vars[$l1] = $val; |
|
| 3178 | 3178 | } |
| 3179 | 3179 | } |
| 3180 | 3180 | |
@@ -3191,7 +3191,7 @@ discard block |
||
| 3191 | 3191 | 'new_tab' => __( 'This option will open the link in a new browser tab. Please note that some popup blockers may prevent this from happening, in which case the link will be displayed.', 'formidable' ), |
| 3192 | 3192 | ); |
| 3193 | 3193 | |
| 3194 | - if ( ! isset( $tooltips[ $name ] ) ) { |
|
| 3194 | + if ( ! isset( $tooltips[$name] ) ) { |
|
| 3195 | 3195 | return; |
| 3196 | 3196 | } |
| 3197 | 3197 | |
@@ -3201,7 +3201,7 @@ discard block |
||
| 3201 | 3201 | echo ' class="frm_help"'; |
| 3202 | 3202 | } |
| 3203 | 3203 | |
| 3204 | - echo ' title="' . esc_attr( $tooltips[ $name ] ); |
|
| 3204 | + echo ' title="' . esc_attr( $tooltips[$name] ); |
|
| 3205 | 3205 | |
| 3206 | 3206 | if ( 'open' != $class ) { |
| 3207 | 3207 | echo '"'; |
@@ -3260,13 +3260,13 @@ discard block |
||
| 3260 | 3260 | } |
| 3261 | 3261 | |
| 3262 | 3262 | private static function prepare_action_slashes( $val, $key, &$post_content ) { |
| 3263 | - if ( ! isset( $post_content[ $key ] ) || is_numeric( $val ) ) { |
|
| 3263 | + if ( ! isset( $post_content[$key] ) || is_numeric( $val ) ) { |
|
| 3264 | 3264 | return; |
| 3265 | 3265 | } |
| 3266 | 3266 | |
| 3267 | 3267 | if ( is_array( $val ) ) { |
| 3268 | 3268 | foreach ( $val as $k1 => $v1 ) { |
| 3269 | - self::prepare_action_slashes( $v1, $k1, $post_content[ $key ] ); |
|
| 3269 | + self::prepare_action_slashes( $v1, $k1, $post_content[$key] ); |
|
| 3270 | 3270 | unset( $k1, $v1 ); |
| 3271 | 3271 | } |
| 3272 | 3272 | } else { |
@@ -3274,7 +3274,7 @@ discard block |
||
| 3274 | 3274 | $val = stripslashes( $val ); |
| 3275 | 3275 | |
| 3276 | 3276 | // Add backslashes before double quotes and forward slashes only |
| 3277 | - $post_content[ $key ] = addcslashes( $val, '"\\/' ); |
|
| 3277 | + $post_content[$key] = addcslashes( $val, '"\\/' ); |
|
| 3278 | 3278 | } |
| 3279 | 3279 | } |
| 3280 | 3280 | |
@@ -3395,14 +3395,14 @@ discard block |
||
| 3395 | 3395 | continue; |
| 3396 | 3396 | } |
| 3397 | 3397 | $key = $input['name']; |
| 3398 | - if ( isset( $formatted[ $key ] ) ) { |
|
| 3399 | - if ( is_array( $formatted[ $key ] ) ) { |
|
| 3400 | - $formatted[ $key ][] = $input['value']; |
|
| 3398 | + if ( isset( $formatted[$key] ) ) { |
|
| 3399 | + if ( is_array( $formatted[$key] ) ) { |
|
| 3400 | + $formatted[$key][] = $input['value']; |
|
| 3401 | 3401 | } else { |
| 3402 | - $formatted[ $key ] = array( $formatted[ $key ], $input['value'] ); |
|
| 3402 | + $formatted[$key] = array( $formatted[$key], $input['value'] ); |
|
| 3403 | 3403 | } |
| 3404 | 3404 | } else { |
| 3405 | - $formatted[ $key ] = $input['value']; |
|
| 3405 | + $formatted[$key] = $input['value']; |
|
| 3406 | 3406 | } |
| 3407 | 3407 | } |
| 3408 | 3408 | |
@@ -4104,8 +4104,8 @@ discard block |
||
| 4104 | 4104 | } |
| 4105 | 4105 | |
| 4106 | 4106 | foreach ( $keys as $key ) { |
| 4107 | - if ( isset( $values[ $key ] ) ) { |
|
| 4108 | - $values[ $key ] = self::kses( $values[ $key ], 'all' ); |
|
| 4107 | + if ( isset( $values[$key] ) ) { |
|
| 4108 | + $values[$key] = self::kses( $values[$key], 'all' ); |
|
| 4109 | 4109 | } |
| 4110 | 4110 | } |
| 4111 | 4111 | |
@@ -4170,7 +4170,7 @@ discard block |
||
| 4170 | 4170 | 'role', |
| 4171 | 4171 | 'style', |
| 4172 | 4172 | ); |
| 4173 | - $safe = in_array( $key, $safe_keys, true ); |
|
| 4173 | + $safe = in_array( $key, $safe_keys, true ); |
|
| 4174 | 4174 | }//end if |
| 4175 | 4175 | |
| 4176 | 4176 | /** |
@@ -4316,7 +4316,7 @@ discard block |
||
| 4316 | 4316 | return 0; |
| 4317 | 4317 | } |
| 4318 | 4318 | |
| 4319 | - return strlen( $parts[ count( $parts ) - 1 ] ); |
|
| 4319 | + return strlen( $parts[count( $parts ) - 1] ); |
|
| 4320 | 4320 | } |
| 4321 | 4321 | |
| 4322 | 4322 | /** |
@@ -4336,7 +4336,7 @@ discard block |
||
| 4336 | 4336 | |
| 4337 | 4337 | add_filter( |
| 4338 | 4338 | 'option_gmt_offset', |
| 4339 | - function ( $offset ) { |
|
| 4339 | + function( $offset ) { |
|
| 4340 | 4340 | if ( ! is_string( $offset ) || is_numeric( $offset ) ) { |
| 4341 | 4341 | // Leave a valid value alone. |
| 4342 | 4342 | return $offset; |
@@ -4433,7 +4433,7 @@ discard block |
||
| 4433 | 4433 | return; |
| 4434 | 4434 | } |
| 4435 | 4435 | |
| 4436 | - $ajax_callback = function () use ( $option ) { |
|
| 4436 | + $ajax_callback = function() use ( $option ) { |
|
| 4437 | 4437 | self::dismiss_warning_message( $option ); |
| 4438 | 4438 | }; |
| 4439 | 4439 | |
@@ -4443,7 +4443,7 @@ discard block |
||
| 4443 | 4443 | |
| 4444 | 4444 | add_filter( |
| 4445 | 4445 | 'frm_message_list', |
| 4446 | - function ( $show_messages ) use ( $message, $option ) { |
|
| 4446 | + function( $show_messages ) use ( $message, $option ) { |
|
| 4447 | 4447 | if ( get_option( $option, false ) ) { |
| 4448 | 4448 | return $show_messages; |
| 4449 | 4449 | } |