@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $form = false; |
147 | 147 | |
148 | 148 | if ( $entry ) { |
149 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
149 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $form; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - return (bool) $has_transaction_data; |
|
225 | + return (bool)$has_transaction_data; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
262 | 262 | |
263 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
263 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
264 | 264 | |
265 | 265 | return $result; |
266 | 266 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | foreach ( $forms as $form ) { |
296 | 296 | |
297 | 297 | // Catch if the form is false, if GFFormsModel::get_form_ids() returns a form ID that doesn't exist. |
298 | - if ( ! isset( $form['id'], $form['title'] ) ) { |
|
298 | + if ( ! isset( $form[ 'id' ], $form[ 'title' ] ) ) { |
|
299 | 299 | continue; |
300 | 300 | } |
301 | 301 | |
302 | - $options[ (int) $form['id'] ] = esc_html( $form['title'] ); |
|
302 | + $options[ (int)$form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | return $options; |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | $has_post_fields = false; |
359 | 359 | |
360 | 360 | if ( $form ) { |
361 | - foreach ( $form['fields'] as $field ) { |
|
362 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
363 | - $fields[ "{$field['id']}" ] = array( |
|
361 | + foreach ( $form[ 'fields' ] as $field ) { |
|
362 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
363 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
364 | 364 | 'label' => \GV\Utils::get( $field, 'label' ), |
365 | 365 | 'parent' => null, |
366 | 366 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | ); |
370 | 370 | } |
371 | 371 | |
372 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
373 | - foreach ( $field['inputs'] as $input ) { |
|
372 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
373 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
374 | 374 | |
375 | - if ( ! empty( $input['isHidden'] ) ) { |
|
375 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
@@ -380,10 +380,10 @@ discard block |
||
380 | 380 | * @hack |
381 | 381 | * In case of email/email confirmation, the input for email has the same id as the parent field |
382 | 382 | */ |
383 | - if ( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
383 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
384 | 384 | continue; |
385 | 385 | } |
386 | - $fields[ "{$input['id']}" ] = array( |
|
386 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
387 | 387 | 'label' => \GV\Utils::get( $input, 'label' ), |
388 | 388 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
389 | 389 | 'parent' => $field, |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
397 | - if ( GFCommon::is_product_field( $field['type'] ) ) { |
|
397 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
398 | 398 | $has_product_fields = true; |
399 | 399 | } |
400 | 400 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @since 1.7 |
409 | 409 | */ |
410 | 410 | if ( $has_post_fields ) { |
411 | - $fields['post_id'] = array( |
|
411 | + $fields[ 'post_id' ] = array( |
|
412 | 412 | 'label' => __( 'Post ID', 'gk-gravityview' ), |
413 | 413 | 'type' => 'post_id', |
414 | 414 | ); |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | $fields = array(); |
460 | 460 | |
461 | 461 | foreach ( $extra_fields as $key => $field ) { |
462 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
462 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
463 | 463 | $fields[ $key ] = array( |
464 | - 'label' => $field['label'], |
|
464 | + 'label' => $field[ 'label' ], |
|
465 | 465 | 'type' => 'entry_meta', |
466 | 466 | ); |
467 | 467 | } |
@@ -503,33 +503,33 @@ discard block |
||
503 | 503 | 'search_criteria' => null, |
504 | 504 | 'sorting' => null, |
505 | 505 | 'paging' => null, |
506 | - 'cache' => ( isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true ), |
|
506 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
507 | 507 | 'context_view_id' => null, |
508 | 508 | ); |
509 | 509 | |
510 | 510 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
511 | 511 | |
512 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
513 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
512 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
513 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
514 | 514 | |
515 | 515 | if ( ! is_array( $filter ) ) { |
516 | 516 | continue; |
517 | 517 | } |
518 | 518 | |
519 | 519 | // By default, we want searches to be wildcard for each field. |
520 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
520 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
521 | 521 | |
522 | 522 | /** |
523 | 523 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
524 | 524 | * @param string $operator Existing search operator |
525 | 525 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
526 | 526 | */ |
527 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
527 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | // don't send just the [mode] without any field filter. |
531 | - if ( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode', $criteria['search_criteria']['field_filters'] ) ) { |
|
532 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
531 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
532 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
@@ -539,37 +539,37 @@ discard block |
||
539 | 539 | */ |
540 | 540 | foreach ( array( 'start_date', 'end_date' ) as $key ) { |
541 | 541 | |
542 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
542 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
543 | 543 | |
544 | 544 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
545 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
545 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
546 | 546 | |
547 | 547 | if ( $date ) { |
548 | 548 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
549 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
549 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
550 | 550 | } else { |
551 | 551 | gravityview()->log->error( |
552 | 552 | '{key} Date format not valid:', |
553 | 553 | array( |
554 | 554 | 'key' => $key, |
555 | - $criteria['search_criteria'][ $key ], |
|
555 | + $criteria[ 'search_criteria' ][ $key ], |
|
556 | 556 | ) |
557 | 557 | ); |
558 | 558 | |
559 | 559 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
560 | - unset( $criteria['search_criteria'][ $key ] ); |
|
560 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
565 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
566 | 566 | // Calculate the context view id and send it to the advanced filter |
567 | 567 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
568 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
568 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
569 | 569 | } elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
570 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
570 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
571 | 571 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
572 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
572 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 | |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | * @param array $form_ids Forms to search |
580 | 580 | * @param int $view_id ID of the view being used to search |
581 | 581 | */ |
582 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
582 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
583 | 583 | |
584 | - return (array) $criteria; |
|
584 | + return (array)$criteria; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | /** Reduce # of database calls */ |
614 | 614 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
615 | 615 | |
616 | - if ( ! empty( $criteria['cache'] ) ) { |
|
616 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
617 | 617 | |
618 | 618 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
619 | 619 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | |
622 | 622 | // Still update the total count when using cached results |
623 | 623 | if ( ! is_null( $total ) ) { |
624 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
624 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | $return = $entries; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | // No entries returned from gravityview_before_get_entries |
646 | 646 | if ( is_null( $entries ) ) { |
647 | 647 | |
648 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
648 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
649 | 649 | |
650 | 650 | if ( is_wp_error( $entries ) ) { |
651 | 651 | gravityview()->log->error( |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | } |
664 | 664 | |
665 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
665 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
666 | 666 | |
667 | 667 | // Cache results |
668 | 668 | $Cache->set( $entries, 'entries' ); |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | |
849 | 849 | // If both are timestamps, cast to string so we can use the > and < comparisons below. |
850 | 850 | if ( $timestamp_1 && $timestamp_2 ) { |
851 | - $val1 = (string) $timestamp_1; |
|
852 | - $val2 = (string) $timestamp_2; |
|
851 | + $val1 = (string)$timestamp_1; |
|
852 | + $val2 = (string)$timestamp_2; |
|
853 | 853 | } |
854 | 854 | |
855 | 855 | switch ( $operation ) { |
@@ -883,8 +883,8 @@ discard block |
||
883 | 883 | if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
884 | 884 | |
885 | 885 | $json_in = false; |
886 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
887 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
886 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
887 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
888 | 888 | |
889 | 889 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
890 | 890 | foreach ( $json_val_1 as $item_1 ) { |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
946 | 946 | } |
947 | 947 | |
948 | - if ( empty( $entry['form_id'] ) ) { |
|
948 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
949 | 949 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
950 | 950 | } |
951 | 951 | |
@@ -960,19 +960,19 @@ discard block |
||
960 | 960 | |
961 | 961 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
962 | 962 | |
963 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
963 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
964 | 964 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
965 | 965 | } |
966 | 966 | |
967 | 967 | $view_form_id = $view->form->ID; |
968 | 968 | |
969 | 969 | if ( $view->joins ) { |
970 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
971 | - $view_form_id = $entry['form_id']; |
|
970 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
971 | + $view_form_id = $entry[ 'form_id' ]; |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
975 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
976 | 976 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
977 | 977 | } |
978 | 978 | |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | array( |
991 | 991 | 'key' => 'id', |
992 | 992 | 'operation' => 'is', |
993 | - 'value' => $entry['id'], |
|
993 | + 'value' => $entry[ 'id' ], |
|
994 | 994 | ), |
995 | 995 | ), |
996 | 996 | ) |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | /** @type \GF_Query $query */ |
1002 | 1002 | $query_parts = $query->_introspect(); |
1003 | 1003 | |
1004 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
1004 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
1005 | 1005 | |
1006 | 1006 | }, |
1007 | 1007 | 10, |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | 'gravityview_search_criteria', |
1014 | 1014 | $remove_pagenum = function( $criteria ) { |
1015 | 1015 | |
1016 | - $criteria['paging'] = array( |
|
1016 | + $criteria[ 'paging' ] = array( |
|
1017 | 1017 | 'offset' => 0, |
1018 | 1018 | 'page_size' => 25, |
1019 | 1019 | ); |
@@ -1033,19 +1033,19 @@ discard block |
||
1033 | 1033 | } |
1034 | 1034 | |
1035 | 1035 | // This entry is on a View with joins |
1036 | - if ( $entries[0]->is_multi() ) { |
|
1036 | + if ( $entries[ 0 ]->is_multi() ) { |
|
1037 | 1037 | |
1038 | 1038 | $multi_entry_ids = array(); |
1039 | 1039 | |
1040 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
1041 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
1040 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
1041 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
1042 | 1042 | } |
1043 | 1043 | |
1044 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
1044 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
1045 | 1045 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
1046 | 1046 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
1047 | 1047 | } |
1048 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
1048 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
1049 | 1049 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
1050 | 1050 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
1051 | 1051 | } |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1096 | 1096 | |
1097 | 1097 | $format = \GV\Utils::get( $atts, 'format' ); |
1098 | - $is_human = ! empty( $atts['human'] ); |
|
1099 | - $is_diff = ! empty( $atts['diff'] ); |
|
1100 | - $is_raw = ! empty( $atts['raw'] ); |
|
1101 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1102 | - $include_time = ! empty( $atts['time'] ); |
|
1098 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1099 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1100 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1101 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1102 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1103 | 1103 | |
1104 | 1104 | // If we're using time diff, we want to have a different default format |
1105 | 1105 | if ( empty( $format ) ) { |
@@ -1217,14 +1217,14 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | foreach ( $matches as $shortcode ) { |
1220 | - if ( $tag === $shortcode[2] ) { |
|
1220 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1221 | 1221 | |
1222 | 1222 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1223 | - $shortcodes[] = $shortcode; |
|
1223 | + $shortcodes[ ] = $shortcode; |
|
1224 | 1224 | |
1225 | - } elseif ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1225 | + } elseif ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1226 | 1226 | foreach ( $results as $result ) { |
1227 | - $shortcodes[] = $result; |
|
1227 | + $shortcodes[ ] = $result; |
|
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | 'post_type' => 'gravityview', |
1257 | 1257 | 'posts_per_page' => 100, |
1258 | 1258 | 'meta_key' => '_gravityview_form_id', |
1259 | - 'meta_value' => (int) $form_id, |
|
1259 | + 'meta_value' => (int)$form_id, |
|
1260 | 1260 | ); |
1261 | 1261 | $args = wp_parse_args( $args, $defaults ); |
1262 | 1262 | $views = get_posts( $args ); |
@@ -1273,8 +1273,8 @@ discard block |
||
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | foreach ( $data as $datum ) { |
1276 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1277 | - $joined_forms[] = $view->post_id; |
|
1276 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1277 | + $joined_forms[ ] = $view->post_id; |
|
1278 | 1278 | } |
1279 | 1279 | } |
1280 | 1280 | } |
@@ -1282,10 +1282,10 @@ discard block |
||
1282 | 1282 | if ( $joined_forms ) { |
1283 | 1283 | $joined_args = array( |
1284 | 1284 | 'post_type' => 'gravityview', |
1285 | - 'posts_per_page' => $args['posts_per_page'], |
|
1285 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1286 | 1286 | 'post__in' => $joined_forms, |
1287 | 1287 | ); |
1288 | - $views = array_merge( $views, get_posts( $joined_args ) ); |
|
1288 | + $views = array_merge( $views, get_posts( $joined_args ) ); |
|
1289 | 1289 | } |
1290 | 1290 | |
1291 | 1291 | return $views; |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | |
1330 | 1330 | if ( class_exists( '\GV\View_Settings' ) ) { |
1331 | 1331 | |
1332 | - return wp_parse_args( (array) $settings, \GV\View_Settings::defaults() ); |
|
1332 | + return wp_parse_args( (array)$settings, \GV\View_Settings::defaults() ); |
|
1333 | 1333 | |
1334 | 1334 | } |
1335 | 1335 | |
@@ -1475,11 +1475,11 @@ discard block |
||
1475 | 1475 | $blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null ); |
1476 | 1476 | |
1477 | 1477 | foreach ( $fields as $id => $field ) { |
1478 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1478 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1479 | 1479 | continue; |
1480 | 1480 | } |
1481 | 1481 | |
1482 | - $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field['label'] ) . '</option>'; |
|
1482 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1483 | 1483 | } |
1484 | 1484 | } |
1485 | 1485 | |
@@ -1524,14 +1524,14 @@ discard block |
||
1524 | 1524 | // TODO: Convert to using array_filter |
1525 | 1525 | foreach ( $fields as $id => $field ) { |
1526 | 1526 | |
1527 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1527 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1528 | 1528 | unset( $fields[ $id ] ); |
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | /** |
1532 | 1532 | * Merge date and time subfields. |
1533 | 1533 | */ |
1534 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1534 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1535 | 1535 | $fields[ intval( $id ) ] = array( |
1536 | 1536 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1537 | 1537 | 'parent' => null, |
@@ -1605,7 +1605,7 @@ discard block |
||
1605 | 1605 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1606 | 1606 | if ( $gv_field = GravityView_Fields::get( $type ) ) { |
1607 | 1607 | if ( true === $gv_field->is_numeric ) { |
1608 | - $numeric_types[] = $gv_field->is_numeric; |
|
1608 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1609 | 1609 | } |
1610 | 1610 | } |
1611 | 1611 | |
@@ -1757,12 +1757,12 @@ discard block |
||
1757 | 1757 | $final_atts = array_filter( $final_atts ); |
1758 | 1758 | |
1759 | 1759 | // If the href wasn't passed as an attribute, use the value passed to the function |
1760 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1761 | - $final_atts['href'] = $href; |
|
1760 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1761 | + $final_atts[ 'href' ] = $href; |
|
1762 | 1762 | } |
1763 | 1763 | |
1764 | - if ( isset( $final_atts['href'] ) ) { |
|
1765 | - $final_atts['href'] = esc_url_raw( $final_atts['href'] ); |
|
1764 | + if ( isset( $final_atts[ 'href' ] ) ) { |
|
1765 | + $final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] ); |
|
1766 | 1766 | } |
1767 | 1767 | |
1768 | 1768 | /** |
@@ -1771,7 +1771,7 @@ discard block |
||
1771 | 1771 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1772 | 1772 | */ |
1773 | 1773 | if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
1774 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1774 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1775 | 1775 | } |
1776 | 1776 | |
1777 | 1777 | // Sort the attributes alphabetically, to help testing |
@@ -1810,7 +1810,7 @@ discard block |
||
1810 | 1810 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1811 | 1811 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1812 | 1812 | } elseif ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1813 | - $merged[] = $value; |
|
1813 | + $merged[ ] = $value; |
|
1814 | 1814 | } else { |
1815 | 1815 | $merged[ $key ] = $value; |
1816 | 1816 | } |