@@ -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 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | ); |
294 | 294 | |
295 | 295 | foreach ( $forms as $form ) { |
296 | - $options[ (int) $form['id'] ] = esc_html( $form['title'] ); |
|
296 | + $options[ (int)$form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return $options; |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | $has_post_fields = false; |
353 | 353 | |
354 | 354 | if ( $form ) { |
355 | - foreach ( $form['fields'] as $field ) { |
|
356 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
357 | - $fields[ "{$field['id']}" ] = array( |
|
355 | + foreach ( $form[ 'fields' ] as $field ) { |
|
356 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
357 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
358 | 358 | 'label' => \GV\Utils::get( $field, 'label' ), |
359 | 359 | 'parent' => null, |
360 | 360 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -363,10 +363,10 @@ discard block |
||
363 | 363 | ); |
364 | 364 | } |
365 | 365 | |
366 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
367 | - foreach ( $field['inputs'] as $input ) { |
|
366 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
367 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
368 | 368 | |
369 | - if ( ! empty( $input['isHidden'] ) ) { |
|
369 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
370 | 370 | continue; |
371 | 371 | } |
372 | 372 | |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | * @hack |
375 | 375 | * In case of email/email confirmation, the input for email has the same id as the parent field |
376 | 376 | */ |
377 | - if ( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
377 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
378 | 378 | continue; |
379 | 379 | } |
380 | - $fields[ "{$input['id']}" ] = array( |
|
380 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
381 | 381 | 'label' => \GV\Utils::get( $input, 'label' ), |
382 | 382 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
383 | 383 | 'parent' => $field, |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | - if ( GFCommon::is_product_field( $field['type'] ) ) { |
|
391 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
392 | 392 | $has_product_fields = true; |
393 | 393 | } |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @since 1.7 |
403 | 403 | */ |
404 | 404 | if ( $has_post_fields ) { |
405 | - $fields['post_id'] = array( |
|
405 | + $fields[ 'post_id' ] = array( |
|
406 | 406 | 'label' => __( 'Post ID', 'gk-gravityview' ), |
407 | 407 | 'type' => 'post_id', |
408 | 408 | ); |
@@ -453,9 +453,9 @@ discard block |
||
453 | 453 | $fields = array(); |
454 | 454 | |
455 | 455 | foreach ( $extra_fields as $key => $field ) { |
456 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
456 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
457 | 457 | $fields[ $key ] = array( |
458 | - 'label' => $field['label'], |
|
458 | + 'label' => $field[ 'label' ], |
|
459 | 459 | 'type' => 'entry_meta', |
460 | 460 | ); |
461 | 461 | } |
@@ -497,33 +497,33 @@ discard block |
||
497 | 497 | 'search_criteria' => null, |
498 | 498 | 'sorting' => null, |
499 | 499 | 'paging' => null, |
500 | - 'cache' => ( isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true ), |
|
500 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
501 | 501 | 'context_view_id' => null, |
502 | 502 | ); |
503 | 503 | |
504 | 504 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
505 | 505 | |
506 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
507 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
506 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
507 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
508 | 508 | |
509 | 509 | if ( ! is_array( $filter ) ) { |
510 | 510 | continue; |
511 | 511 | } |
512 | 512 | |
513 | 513 | // By default, we want searches to be wildcard for each field. |
514 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
514 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
515 | 515 | |
516 | 516 | /** |
517 | 517 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
518 | 518 | * @param string $operator Existing search operator |
519 | 519 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
520 | 520 | */ |
521 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
521 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | // don't send just the [mode] without any field filter. |
525 | - if ( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode', $criteria['search_criteria']['field_filters'] ) ) { |
|
526 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
525 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
526 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
@@ -533,37 +533,37 @@ discard block |
||
533 | 533 | */ |
534 | 534 | foreach ( array( 'start_date', 'end_date' ) as $key ) { |
535 | 535 | |
536 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
536 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
537 | 537 | |
538 | 538 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
539 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
539 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
540 | 540 | |
541 | 541 | if ( $date ) { |
542 | 542 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
543 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
543 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
544 | 544 | } else { |
545 | 545 | gravityview()->log->error( |
546 | 546 | '{key} Date format not valid:', |
547 | 547 | array( |
548 | 548 | 'key' => $key, |
549 | - $criteria['search_criteria'][ $key ], |
|
549 | + $criteria[ 'search_criteria' ][ $key ], |
|
550 | 550 | ) |
551 | 551 | ); |
552 | 552 | |
553 | 553 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
554 | - unset( $criteria['search_criteria'][ $key ] ); |
|
554 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
559 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
560 | 560 | // Calculate the context view id and send it to the advanced filter |
561 | 561 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
562 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
562 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
563 | 563 | } elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
564 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
564 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
565 | 565 | } elseif ( 'delete' === GFForms::get( 'action' ) ) { |
566 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
566 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
@@ -573,9 +573,9 @@ discard block |
||
573 | 573 | * @param array $form_ids Forms to search |
574 | 574 | * @param int $view_id ID of the view being used to search |
575 | 575 | */ |
576 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
576 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
577 | 577 | |
578 | - return (array) $criteria; |
|
578 | + return (array)$criteria; |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | /** Reduce # of database calls */ |
608 | 608 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
609 | 609 | |
610 | - if ( ! empty( $criteria['cache'] ) ) { |
|
610 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
611 | 611 | |
612 | 612 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
613 | 613 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | |
616 | 616 | // Still update the total count when using cached results |
617 | 617 | if ( ! is_null( $total ) ) { |
618 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
618 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | $return = $entries; |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | // No entries returned from gravityview_before_get_entries |
640 | 640 | if ( is_null( $entries ) ) { |
641 | 641 | |
642 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
642 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
643 | 643 | |
644 | 644 | if ( is_wp_error( $entries ) ) { |
645 | 645 | gravityview()->log->error( |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | } |
657 | 657 | } |
658 | 658 | |
659 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
659 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
660 | 660 | |
661 | 661 | // Cache results |
662 | 662 | $Cache->set( $entries, 'entries' ); |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | |
843 | 843 | // If both are timestamps, cast to string so we can use the > and < comparisons below. |
844 | 844 | if ( $timestamp_1 && $timestamp_2 ) { |
845 | - $val1 = (string) $timestamp_1; |
|
846 | - $val2 = (string) $timestamp_2; |
|
845 | + $val1 = (string)$timestamp_1; |
|
846 | + $val2 = (string)$timestamp_2; |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | switch ( $operation ) { |
@@ -877,8 +877,8 @@ discard block |
||
877 | 877 | if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
878 | 878 | |
879 | 879 | $json_in = false; |
880 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
881 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
880 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
881 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
882 | 882 | |
883 | 883 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
884 | 884 | foreach ( $json_val_1 as $item_1 ) { |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
940 | 940 | } |
941 | 941 | |
942 | - if ( empty( $entry['form_id'] ) ) { |
|
942 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
943 | 943 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
944 | 944 | } |
945 | 945 | |
@@ -954,19 +954,19 @@ discard block |
||
954 | 954 | |
955 | 955 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
956 | 956 | |
957 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
957 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
958 | 958 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
959 | 959 | } |
960 | 960 | |
961 | 961 | $view_form_id = $view->form->ID; |
962 | 962 | |
963 | 963 | if ( $view->joins ) { |
964 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
965 | - $view_form_id = $entry['form_id']; |
|
964 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
965 | + $view_form_id = $entry[ 'form_id' ]; |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | |
969 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
969 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
970 | 970 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
971 | 971 | } |
972 | 972 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | array( |
985 | 985 | 'key' => 'id', |
986 | 986 | 'operation' => 'is', |
987 | - 'value' => $entry['id'], |
|
987 | + 'value' => $entry[ 'id' ], |
|
988 | 988 | ), |
989 | 989 | ), |
990 | 990 | ) |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | /** @type \GF_Query $query */ |
996 | 996 | $query_parts = $query->_introspect(); |
997 | 997 | |
998 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
998 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
999 | 999 | |
1000 | 1000 | }, |
1001 | 1001 | 10, |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | 'gravityview_search_criteria', |
1008 | 1008 | $remove_pagenum = function( $criteria ) { |
1009 | 1009 | |
1010 | - $criteria['paging'] = array( |
|
1010 | + $criteria[ 'paging' ] = array( |
|
1011 | 1011 | 'offset' => 0, |
1012 | 1012 | 'page_size' => 25, |
1013 | 1013 | ); |
@@ -1027,19 +1027,19 @@ discard block |
||
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | // This entry is on a View with joins |
1030 | - if ( $entries[0]->is_multi() ) { |
|
1030 | + if ( $entries[ 0 ]->is_multi() ) { |
|
1031 | 1031 | |
1032 | 1032 | $multi_entry_ids = array(); |
1033 | 1033 | |
1034 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
1035 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
1034 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
1035 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
1036 | 1036 | } |
1037 | 1037 | |
1038 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
1038 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
1039 | 1039 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
1040 | 1040 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
1041 | 1041 | } |
1042 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
1042 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
1043 | 1043 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
1044 | 1044 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
1045 | 1045 | } |
@@ -1089,11 +1089,11 @@ discard block |
||
1089 | 1089 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1090 | 1090 | |
1091 | 1091 | $format = \GV\Utils::get( $atts, 'format' ); |
1092 | - $is_human = ! empty( $atts['human'] ); |
|
1093 | - $is_diff = ! empty( $atts['diff'] ); |
|
1094 | - $is_raw = ! empty( $atts['raw'] ); |
|
1095 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1096 | - $include_time = ! empty( $atts['time'] ); |
|
1092 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1093 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1094 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1095 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1096 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1097 | 1097 | |
1098 | 1098 | // If we're using time diff, we want to have a different default format |
1099 | 1099 | if ( empty( $format ) ) { |
@@ -1211,14 +1211,14 @@ discard block |
||
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | foreach ( $matches as $shortcode ) { |
1214 | - if ( $tag === $shortcode[2] ) { |
|
1214 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1215 | 1215 | |
1216 | 1216 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1217 | - $shortcodes[] = $shortcode; |
|
1217 | + $shortcodes[ ] = $shortcode; |
|
1218 | 1218 | |
1219 | - } elseif ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1219 | + } elseif ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1220 | 1220 | foreach ( $results as $result ) { |
1221 | - $shortcodes[] = $result; |
|
1221 | + $shortcodes[ ] = $result; |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | 'post_type' => 'gravityview', |
1251 | 1251 | 'posts_per_page' => 100, |
1252 | 1252 | 'meta_key' => '_gravityview_form_id', |
1253 | - 'meta_value' => (int) $form_id, |
|
1253 | + 'meta_value' => (int)$form_id, |
|
1254 | 1254 | ); |
1255 | 1255 | $args = wp_parse_args( $args, $defaults ); |
1256 | 1256 | $views = get_posts( $args ); |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | foreach ( $data as $datum ) { |
1270 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1271 | - $joined_forms[] = $view->post_id; |
|
1270 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1271 | + $joined_forms[ ] = $view->post_id; |
|
1272 | 1272 | } |
1273 | 1273 | } |
1274 | 1274 | } |
@@ -1276,10 +1276,10 @@ discard block |
||
1276 | 1276 | if ( $joined_forms ) { |
1277 | 1277 | $joined_args = array( |
1278 | 1278 | 'post_type' => 'gravityview', |
1279 | - 'posts_per_page' => $args['posts_per_page'], |
|
1279 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1280 | 1280 | 'post__in' => $joined_forms, |
1281 | 1281 | ); |
1282 | - $views = array_merge( $views, get_posts( $joined_args ) ); |
|
1282 | + $views = array_merge( $views, get_posts( $joined_args ) ); |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | return $views; |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | |
1324 | 1324 | if ( class_exists( '\GV\View_Settings' ) ) { |
1325 | 1325 | |
1326 | - return wp_parse_args( (array) $settings, \GV\View_Settings::defaults() ); |
|
1326 | + return wp_parse_args( (array)$settings, \GV\View_Settings::defaults() ); |
|
1327 | 1327 | |
1328 | 1328 | } |
1329 | 1329 | |
@@ -1469,11 +1469,11 @@ discard block |
||
1469 | 1469 | $blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null ); |
1470 | 1470 | |
1471 | 1471 | foreach ( $fields as $id => $field ) { |
1472 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1472 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1473 | 1473 | continue; |
1474 | 1474 | } |
1475 | 1475 | |
1476 | - $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field['label'] ) . '</option>'; |
|
1476 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1477 | 1477 | } |
1478 | 1478 | } |
1479 | 1479 | |
@@ -1518,14 +1518,14 @@ discard block |
||
1518 | 1518 | // TODO: Convert to using array_filter |
1519 | 1519 | foreach ( $fields as $id => $field ) { |
1520 | 1520 | |
1521 | - if ( in_array( $field['type'], $blocklist_field_types ) ) { |
|
1521 | + if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) { |
|
1522 | 1522 | unset( $fields[ $id ] ); |
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | /** |
1526 | 1526 | * Merge date and time subfields. |
1527 | 1527 | */ |
1528 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1528 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1529 | 1529 | $fields[ intval( $id ) ] = array( |
1530 | 1530 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1531 | 1531 | 'parent' => null, |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1600 | 1600 | if ( $gv_field = GravityView_Fields::get( $type ) ) { |
1601 | 1601 | if ( true === $gv_field->is_numeric ) { |
1602 | - $numeric_types[] = $gv_field->is_numeric; |
|
1602 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1603 | 1603 | } |
1604 | 1604 | } |
1605 | 1605 | |
@@ -1751,12 +1751,12 @@ discard block |
||
1751 | 1751 | $final_atts = array_filter( $final_atts ); |
1752 | 1752 | |
1753 | 1753 | // If the href wasn't passed as an attribute, use the value passed to the function |
1754 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1755 | - $final_atts['href'] = $href; |
|
1754 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1755 | + $final_atts[ 'href' ] = $href; |
|
1756 | 1756 | } |
1757 | 1757 | |
1758 | - if ( isset( $final_atts['href'] ) ) { |
|
1759 | - $final_atts['href'] = esc_url_raw( $final_atts['href'] ); |
|
1758 | + if ( isset( $final_atts[ 'href' ] ) ) { |
|
1759 | + $final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] ); |
|
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | /** |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1766 | 1766 | */ |
1767 | 1767 | if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
1768 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1768 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1769 | 1769 | } |
1770 | 1770 | |
1771 | 1771 | // Sort the attributes alphabetically, to help testing |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1805 | 1805 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1806 | 1806 | } elseif ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1807 | - $merged[] = $value; |
|
1807 | + $merged[ ] = $value; |
|
1808 | 1808 | } else { |
1809 | 1809 | $merged[ $key ] = $value; |
1810 | 1810 | } |
@@ -58,15 +58,15 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private static function disable_show_only_approved_entries( $gravityview ) { |
60 | 60 | |
61 | - if ( ! isset( $_GET['disable_setting'] ) || ! wp_verify_nonce( $_GET['gv-setting'], 'setting' ) ) { |
|
61 | + if ( ! isset( $_GET[ 'disable_setting' ] ) || ! wp_verify_nonce( $_GET[ 'gv-setting' ], 'setting' ) ) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | 65 | $settings = $gravityview->view->settings->all(); |
66 | 66 | |
67 | - $settings['show_only_approved'] = 0; |
|
67 | + $settings[ 'show_only_approved' ] = 0; |
|
68 | 68 | |
69 | - $updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings', $settings ); |
|
69 | + $updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings', $settings ); |
|
70 | 70 | |
71 | 71 | if ( ! $updated ) { |
72 | 72 | gravityview()->log->error( 'Could not update View settings => Show only approved' ); |
@@ -273,8 +273,7 @@ discard block |
||
273 | 273 | $tab = esc_html__( 'Edit Entry', 'gk-gravityview' ); |
274 | 274 | $context = 'edit'; |
275 | 275 | break; |
276 | - case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ): |
|
277 | - $tab = esc_html__( 'Single Entry', 'gk-gravityview' ); |
|
276 | + case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = esc_html__( 'Single Entry', 'gk-gravityview' ); |
|
278 | 277 | $context = 'single'; |
279 | 278 | break; |
280 | 279 | default: |
@@ -296,7 +295,7 @@ discard block |
||
296 | 295 | $action_text = sprintf( esc_html__( 'Add fields to %s', 'gk-gravityview' ), $tab ); |
297 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gk-gravityview' ); |
298 | 297 | |
299 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
300 | 299 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
301 | 300 | |
302 | 301 | echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID ); |
@@ -322,11 +321,11 @@ discard block |
||
322 | 321 | |
323 | 322 | $post_types = get_post_types(); |
324 | 323 | |
325 | - foreach( $post_types as $post_type ) { |
|
324 | + foreach ( $post_types as $post_type ) { |
|
326 | 325 | $post_type_rewrite = get_post_type_object( $post_type )->rewrite; |
327 | 326 | |
328 | 327 | if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) { |
329 | - $reserved_slugs[] = $slug; |
|
328 | + $reserved_slugs[ ] = $slug; |
|
330 | 329 | } |
331 | 330 | } |
332 | 331 |
@@ -245,19 +245,19 @@ discard block |
||
245 | 245 | |
246 | 246 | if ( ! empty( $view_id ) ) { |
247 | 247 | |
248 | - $this->context_view_id = (int) $view_id; |
|
248 | + $this->context_view_id = (int)$view_id; |
|
249 | 249 | |
250 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
250 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
251 | 251 | /** |
252 | 252 | * used on a has_multiple_views context |
253 | 253 | * |
254 | 254 | * @see GravityView_API::entry_link |
255 | 255 | */ |
256 | - $this->context_view_id = (int) $_GET['gvid']; |
|
256 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
257 | 257 | |
258 | 258 | } elseif ( ! $multiple_views ) { |
259 | 259 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
260 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
260 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
261 | 261 | unset( $array_keys ); |
262 | 262 | } |
263 | 263 | |
@@ -299,16 +299,16 @@ discard block |
||
299 | 299 | $_query = wp_parse_args( $query->query ); |
300 | 300 | |
301 | 301 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
302 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
303 | - unset( $_query['pagename'] ); |
|
302 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
303 | + unset( $_query[ 'pagename' ] ); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | // this is where will break from core WordPress |
307 | 307 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
308 | 308 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
309 | 309 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
310 | - foreach ( (array) $endpoints as $endpoint ) { |
|
311 | - $ignore[] = $endpoint[1]; |
|
310 | + foreach ( (array)$endpoints as $endpoint ) { |
|
311 | + $ignore[ ] = $endpoint[ 1 ]; |
|
312 | 312 | } |
313 | 313 | unset( $endpoints ); |
314 | 314 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
319 | 319 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
320 | 320 | |
321 | - $qv =& $query->query_vars; |
|
321 | + $qv = & $query->query_vars; |
|
322 | 322 | |
323 | 323 | // Prevent redirect when on the single entry endpoint |
324 | 324 | if ( self::is_single_entry() ) { |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | |
328 | 328 | $query->is_page = true; |
329 | 329 | $query->is_home = false; |
330 | - $qv['page_id'] = $front_page_id; |
|
330 | + $qv[ 'page_id' ] = $front_page_id; |
|
331 | 331 | |
332 | 332 | // Correct <!--nextpage--> for page_on_front |
333 | - if ( ! empty( $qv['paged'] ) ) { |
|
334 | - $qv['page'] = $qv['paged']; |
|
335 | - unset( $qv['paged'] ); |
|
333 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
334 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
335 | + unset( $qv[ 'paged' ] ); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | $blocks = parse_blocks( $post_content ); |
396 | 396 | |
397 | 397 | foreach ( $blocks as $block ) { |
398 | - if ( empty( $block['attrs']['ref'] ) ) { |
|
398 | + if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) { |
|
399 | 399 | continue; |
400 | 400 | } |
401 | 401 | |
402 | - $block_post = get_post( $block['attrs']['ref'] ); |
|
402 | + $block_post = get_post( $block[ 'attrs' ][ 'ref' ] ); |
|
403 | 403 | |
404 | 404 | if ( $block_post ) { |
405 | 405 | $post_content .= $block_post->post_content; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | // Don't modify the title for anything other than the current view/post. |
530 | 530 | // This is true for embedded shortcodes and Views. |
531 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
531 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
532 | 532 | return $passed_title; |
533 | 533 | } |
534 | 534 | |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | $title = $view->settings->get( 'single_title', $passed_title ); |
604 | 604 | |
605 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
605 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
606 | 606 | |
607 | 607 | // We are allowing HTML in the fields, so no escaping the output |
608 | 608 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | return $no_entries_text; |
718 | 718 | } |
719 | 719 | |
720 | - $no_entries_option = (int) $context->view->settings->get( 'no_entries_options', 0 ); |
|
720 | + $no_entries_option = (int)$context->view->settings->get( 'no_entries_options', 0 ); |
|
721 | 721 | |
722 | 722 | // Default is to display the message. |
723 | 723 | if ( empty( $no_entries_option ) ) { |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | } |
726 | 726 | |
727 | 727 | if ( 1 === $no_entries_option ) { |
728 | - $form_id = (int) $context->view->settings->get( 'no_entries_form' ); |
|
728 | + $form_id = (int)$context->view->settings->get( 'no_entries_form' ); |
|
729 | 729 | |
730 | 730 | if ( ! empty( $form_id ) ) { |
731 | 731 | |
@@ -877,9 +877,9 @@ discard block |
||
877 | 877 | } |
878 | 878 | } |
879 | 879 | |
880 | - if ( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
880 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
881 | 881 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
882 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
882 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
883 | 883 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
884 | 884 | } |
885 | 885 | } |
@@ -898,19 +898,19 @@ discard block |
||
898 | 898 | public static function process_search_only_approved( $args, $search_criteria ) { |
899 | 899 | |
900 | 900 | /** @since 1.19 */ |
901 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
901 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
902 | 902 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
903 | 903 | return $search_criteria; |
904 | 904 | } |
905 | 905 | |
906 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
906 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
907 | 907 | |
908 | - $search_criteria['field_filters'][] = array( |
|
908 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
909 | 909 | 'key' => GravityView_Entry_Approval::meta_key, |
910 | 910 | 'value' => GravityView_Entry_Approval_Status::APPROVED, |
911 | 911 | ); |
912 | 912 | |
913 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
913 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
914 | 914 | |
915 | 915 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
916 | 916 | } |
@@ -937,18 +937,18 @@ discard block |
||
937 | 937 | */ |
938 | 938 | public static function is_entry_approved( $entry, $args = array() ) { |
939 | 939 | |
940 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
940 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
941 | 941 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
942 | 942 | return true; |
943 | 943 | } |
944 | 944 | |
945 | 945 | /** @since 1.19 */ |
946 | - if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
946 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
947 | 947 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
948 | 948 | return true; |
949 | 949 | } |
950 | 950 | |
951 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
951 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
952 | 952 | |
953 | 953 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
954 | 954 | } |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
973 | 973 | */ |
974 | 974 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
975 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
975 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
976 | 976 | |
977 | 977 | /** |
978 | 978 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -992,19 +992,19 @@ discard block |
||
992 | 992 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' => $search_criteria ) ); |
993 | 993 | |
994 | 994 | // implicity search |
995 | - if ( ! empty( $args['search_value'] ) ) { |
|
995 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
996 | 996 | |
997 | 997 | // Search operator options. Options: `is` or `contains` |
998 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
998 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
999 | 999 | |
1000 | - $search_criteria['field_filters'][] = array( |
|
1000 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
1001 | 1001 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
1002 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
1002 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
1003 | 1003 | 'operator' => $operator, |
1004 | 1004 | ); |
1005 | 1005 | |
1006 | 1006 | // Lock search mode to "all" with implicit presearch filter. |
1007 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
1007 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | if ( $search_criteria !== $original_search_criteria ) { |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
1026 | 1026 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
1027 | 1027 | */ |
1028 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1028 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
1029 | 1029 | |
1030 | 1030 | return $search_criteria; |
1031 | 1031 | } |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | 'search_criteria' => $search_criteria, |
1142 | 1142 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1143 | 1143 | 'paging' => $paging, |
1144 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1144 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1145 | 1145 | ); |
1146 | 1146 | |
1147 | 1147 | /** |
@@ -1191,17 +1191,17 @@ discard block |
||
1191 | 1191 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1192 | 1192 | |
1193 | 1193 | // Paging & offset |
1194 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1194 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1195 | 1195 | |
1196 | 1196 | if ( -1 === $page_size ) { |
1197 | 1197 | $page_size = PHP_INT_MAX; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1200 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1201 | 1201 | $offset = ( $curr_page - 1 ) * $page_size; |
1202 | 1202 | |
1203 | - if ( ! empty( $args['offset'] ) ) { |
|
1204 | - $offset += intval( $args['offset'] ); |
|
1203 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1204 | + $offset += intval( $args[ 'offset' ] ); |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | $paging = array( |
@@ -1226,11 +1226,11 @@ discard block |
||
1226 | 1226 | public static function updateViewSorting( $args, $form_id ) { |
1227 | 1227 | $sorting = array(); |
1228 | 1228 | |
1229 | - $has_values = isset( $_GET['sort'] ); |
|
1229 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
1230 | 1230 | |
1231 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
1232 | - $sorts = array_keys( $_GET['sort'] ); |
|
1233 | - $dirs = array_values( $_GET['sort'] ); |
|
1231 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
1232 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
1233 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
1234 | 1234 | |
1235 | 1235 | if ( $has_values = array_filter( $dirs ) ) { |
1236 | 1236 | $sort_field_id = end( $sorts ); |
@@ -1239,11 +1239,11 @@ discard block |
||
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | if ( ! isset( $sort_field_id ) ) { |
1242 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1242 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | if ( ! isset( $sort_direction ) ) { |
1246 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1246 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | if ( is_array( $sort_field_id ) ) { |
@@ -1275,10 +1275,10 @@ discard block |
||
1275 | 1275 | $form = GFAPI::get_form( $form_id ); |
1276 | 1276 | |
1277 | 1277 | // Get the first GF_Field field ID, set as the key for entry randomization |
1278 | - if ( ! empty( $form['fields'] ) ) { |
|
1278 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1279 | 1279 | |
1280 | 1280 | /** @var GF_Field $field */ |
1281 | - foreach ( $form['fields'] as $field ) { |
|
1281 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1282 | 1282 | if ( ! is_a( $field, 'GF_Field' ) ) { |
1283 | 1283 | continue; |
1284 | 1284 | } |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | if ( is_array( $sort_field_id ) ) { |
1328 | 1328 | $modified_ids = array(); |
1329 | 1329 | foreach ( $sort_field_id as $_sort_field_id ) { |
1330 | - $modified_ids [] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1330 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1331 | 1331 | } |
1332 | 1332 | return $modified_ids; |
1333 | 1333 | } |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | return $sort_field_id; |
1341 | 1341 | } |
1342 | 1342 | |
1343 | - switch ( $sort_field['type'] ) { |
|
1343 | + switch ( $sort_field[ 'type' ] ) { |
|
1344 | 1344 | |
1345 | 1345 | case 'address': |
1346 | 1346 | // Sorting by full address |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | $views = $this->getGvOutputData()->get_views(); |
1468 | 1468 | |
1469 | 1469 | foreach ( $views as $view_id => $data ) { |
1470 | - $view = \GV\View::by_id( $data['id'] ); |
|
1470 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1471 | 1471 | $view_id = $view->ID; |
1472 | 1472 | $template_id = gravityview_get_template_id( $view->ID ); |
1473 | 1473 | $data = $view->as_data(); |
@@ -1497,7 +1497,7 @@ discard block |
||
1497 | 1497 | * @param \GV\View The View. |
1498 | 1498 | */ |
1499 | 1499 | $js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
1500 | - $js_dependencies[] = $js_dependency; |
|
1500 | + $js_dependencies[ ] = $js_dependency; |
|
1501 | 1501 | |
1502 | 1502 | /** |
1503 | 1503 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | * @param \GV\View The View. |
1514 | 1514 | */ |
1515 | 1515 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
1516 | - $css_dependencies[] = $css_dependency; |
|
1516 | + $css_dependencies[ ] = $css_dependency; |
|
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | /** |
@@ -1522,8 +1522,8 @@ discard block |
||
1522 | 1522 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1523 | 1523 | * @since 1.15 |
1524 | 1524 | */ |
1525 | - if ( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1526 | - $css_dependencies[] = 'dashicons'; |
|
1525 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1526 | + $css_dependencies[ ] = 'dashicons'; |
|
1527 | 1527 | } |
1528 | 1528 | |
1529 | 1529 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GV_PLUGIN_VERSION, true ); |
@@ -1534,7 +1534,7 @@ discard block |
||
1534 | 1534 | |
1535 | 1535 | wp_enqueue_script( 'gravityview-fe-view' ); |
1536 | 1536 | |
1537 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1537 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1538 | 1538 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GV_PLUGIN_VERSION, 'all' ); |
1539 | 1539 | } |
1540 | 1540 | |
@@ -1635,7 +1635,7 @@ discard block |
||
1635 | 1635 | return $label; |
1636 | 1636 | } |
1637 | 1637 | |
1638 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1638 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1639 | 1639 | return $label; |
1640 | 1640 | } |
1641 | 1641 | |
@@ -1643,20 +1643,20 @@ discard block |
||
1643 | 1643 | |
1644 | 1644 | $class = 'gv-sort'; |
1645 | 1645 | |
1646 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1646 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1647 | 1647 | |
1648 | 1648 | $sort_args = array( |
1649 | - 'sort' => $field['id'], |
|
1649 | + 'sort' => $field[ 'id' ], |
|
1650 | 1650 | 'dir' => 'asc', |
1651 | 1651 | ); |
1652 | 1652 | |
1653 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1653 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1654 | 1654 | // toggle sorting direction. |
1655 | - if ( 'asc' === $sorting['direction'] ) { |
|
1656 | - $sort_args['dir'] = 'desc'; |
|
1655 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1656 | + $sort_args[ 'dir' ] = 'desc'; |
|
1657 | 1657 | $class .= ' gv-icon-sort-desc'; |
1658 | 1658 | } else { |
1659 | - $sort_args['dir'] = 'asc'; |
|
1659 | + $sort_args[ 'dir' ] = 'asc'; |
|
1660 | 1660 | $class .= ' gv-icon-sort-asc'; |
1661 | 1661 | } |
1662 | 1662 | } else { |
@@ -1712,7 +1712,7 @@ discard block |
||
1712 | 1712 | return false; |
1713 | 1713 | } |
1714 | 1714 | |
1715 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1715 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1716 | 1716 | |
1717 | 1717 | } |
1718 | 1718 |