@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | $form = false; |
127 | 127 | |
128 | - if( $entry ) { |
|
129 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
128 | + if ( $entry ) { |
|
129 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $form; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | - return (bool) $has_transaction_data; |
|
205 | + return (bool)$has_transaction_data; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
242 | 242 | |
243 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
243 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
244 | 244 | |
245 | 245 | return $result; |
246 | 246 | } |
@@ -260,13 +260,13 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
262 | 262 | */ |
263 | - public static function get_forms( $active = true, $trash = false, $order_by = 'date_created', $order = 'ASC' ) { |
|
263 | + public static function get_forms( $active = true, $trash = false, $order_by = 'date_created', $order = 'ASC' ) { |
|
264 | 264 | $forms = array(); |
265 | 265 | if ( ! class_exists( 'GFAPI' ) ) { |
266 | 266 | return array(); |
267 | 267 | } |
268 | 268 | |
269 | - if( 'any' === $active ) { |
|
269 | + if ( 'any' === $active ) { |
|
270 | 270 | $active_forms = GFAPI::get_forms( true, $trash ); |
271 | 271 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
272 | 272 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | $has_post_fields = false; |
300 | 300 | |
301 | 301 | if ( $form ) { |
302 | - foreach ( $form['fields'] as $field ) { |
|
303 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
304 | - $fields["{$field['id']}"] = array( |
|
302 | + foreach ( $form[ 'fields' ] as $field ) { |
|
303 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
304 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
305 | 305 | 'label' => \GV\Utils::get( $field, 'label' ), |
306 | 306 | 'parent' => null, |
307 | 307 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | ); |
311 | 311 | } |
312 | 312 | |
313 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
314 | - foreach ( $field['inputs'] as $input ) { |
|
313 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
314 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
315 | 315 | |
316 | - if( ! empty( $input['isHidden'] ) ) { |
|
316 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | 319 | |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | * @hack |
322 | 322 | * In case of email/email confirmation, the input for email has the same id as the parent field |
323 | 323 | */ |
324 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
324 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
325 | 325 | continue; |
326 | 326 | } |
327 | - $fields["{$input['id']}"] = array( |
|
327 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
328 | 328 | 'label' => \GV\Utils::get( $input, 'label' ), |
329 | 329 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
330 | 330 | 'parent' => $field, |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | |
339 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
339 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
340 | 340 | $has_product_fields = true; |
341 | 341 | } |
342 | 342 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @since 1.7 |
351 | 351 | */ |
352 | 352 | if ( $has_post_fields ) { |
353 | - $fields['post_id'] = array( |
|
353 | + $fields[ 'post_id' ] = array( |
|
354 | 354 | 'label' => __( 'Post ID', 'gravityview' ), |
355 | 355 | 'type' => 'post_id', |
356 | 356 | ); |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | foreach ( $payment_fields as $payment_field ) { |
364 | 364 | |
365 | 365 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
366 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
366 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
367 | 367 | continue; |
368 | 368 | } |
369 | 369 | |
370 | - $fields["{$payment_field->name}"] = array( |
|
370 | + $fields[ "{$payment_field->name}" ] = array( |
|
371 | 371 | 'label' => $payment_field->label, |
372 | 372 | 'desc' => $payment_field->description, |
373 | 373 | 'type' => $payment_field->name, |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | |
400 | 400 | $fields = array(); |
401 | 401 | |
402 | - foreach ( $extra_fields as $key => $field ){ |
|
403 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
404 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
402 | + foreach ( $extra_fields as $key => $field ) { |
|
403 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
404 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
405 | 405 | } |
406 | 406 | } |
407 | 407 | |
@@ -441,33 +441,33 @@ discard block |
||
441 | 441 | 'search_criteria' => null, |
442 | 442 | 'sorting' => null, |
443 | 443 | 'paging' => null, |
444 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
444 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
445 | 445 | 'context_view_id' => null, |
446 | 446 | ); |
447 | 447 | |
448 | 448 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
449 | 449 | |
450 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) { |
|
451 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
450 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
451 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
452 | 452 | |
453 | 453 | if ( ! is_array( $filter ) ) { |
454 | 454 | continue; |
455 | 455 | } |
456 | 456 | |
457 | 457 | // By default, we want searches to be wildcard for each field. |
458 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
458 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
459 | 459 | |
460 | 460 | /** |
461 | 461 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
462 | 462 | * @param string $operator Existing search operator |
463 | 463 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
464 | 464 | */ |
465 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
465 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | // don't send just the [mode] without any field filter. |
469 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
470 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
469 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
470 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | } |
@@ -478,33 +478,33 @@ discard block |
||
478 | 478 | * Prepare date formats to be in Gravity Forms DB format; |
479 | 479 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
480 | 480 | */ |
481 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
481 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
482 | 482 | |
483 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
483 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
484 | 484 | |
485 | 485 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
486 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
486 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
487 | 487 | |
488 | 488 | if ( $date ) { |
489 | 489 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
490 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
490 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
491 | 491 | } else { |
492 | - gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) ); |
|
492 | + gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) ); |
|
493 | 493 | |
494 | 494 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
495 | - unset( $criteria['search_criteria'][ $key ] ); |
|
495 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
500 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
501 | 501 | // Calculate the context view id and send it to the advanced filter |
502 | 502 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
503 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
503 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
504 | 504 | } else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
505 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
505 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
506 | 506 | } else if ( 'delete' === GFForms::get( 'action' ) ) { |
507 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
507 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param array $form_ids Forms to search |
515 | 515 | * @param int $view_id ID of the view being used to search |
516 | 516 | */ |
517 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
517 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
518 | 518 | |
519 | 519 | return (array)$criteria; |
520 | 520 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | /** Reduce # of database calls */ |
550 | 550 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
551 | 551 | |
552 | - if ( ! empty( $criteria['cache'] ) ) { |
|
552 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
553 | 553 | |
554 | 554 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
555 | 555 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | // Still update the total count when using cached results |
559 | 559 | if ( ! is_null( $total ) ) { |
560 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
560 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | $return = $entries; |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | $entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) ); |
580 | 580 | |
581 | 581 | // No entries returned from gravityview_before_get_entries |
582 | - if( is_null( $entries ) ) { |
|
582 | + if ( is_null( $entries ) ) { |
|
583 | 583 | |
584 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
584 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
585 | 585 | |
586 | 586 | if ( is_wp_error( $entries ) ) { |
587 | 587 | gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) ); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
595 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
596 | 596 | |
597 | 597 | // Cache results |
598 | 598 | $Cache->set( $entries, 'entries' ); |
@@ -706,18 +706,18 @@ discard block |
||
706 | 706 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view ); |
707 | 707 | |
708 | 708 | // Is the entry allowed |
709 | - if( $check_entry_display ) { |
|
709 | + if ( $check_entry_display ) { |
|
710 | 710 | |
711 | 711 | $gvid = \GV\Utils::_GET( 'gvid' ); |
712 | 712 | |
713 | - if( $gvid ) { |
|
713 | + if ( $gvid ) { |
|
714 | 714 | $view = \GV\View::by_id( $gvid ); |
715 | 715 | } |
716 | 716 | |
717 | 717 | $entry = self::check_entry_display( $entry, $view ); |
718 | 718 | } |
719 | 719 | |
720 | - if( is_wp_error( $entry ) ) { |
|
720 | + if ( is_wp_error( $entry ) ) { |
|
721 | 721 | gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); |
722 | 722 | return false; |
723 | 723 | } |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | |
752 | 752 | $value = false; |
753 | 753 | |
754 | - if( 'context' === $val1 ) { |
|
754 | + if ( 'context' === $val1 ) { |
|
755 | 755 | |
756 | 756 | $matching_contexts = array( $val2 ); |
757 | 757 | |
758 | 758 | // We allow for non-standard contexts. |
759 | - switch( $val2 ) { |
|
759 | + switch ( $val2 ) { |
|
760 | 760 | // Check for either single or edit |
761 | 761 | case 'singular': |
762 | 762 | $matching_contexts = array( 'single', 'edit' ); |
@@ -799,18 +799,18 @@ discard block |
||
799 | 799 | $json_val_1 = json_decode( $val1, true ); |
800 | 800 | $json_val_2 = json_decode( $val2, true ); |
801 | 801 | |
802 | - if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
802 | + if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
803 | 803 | |
804 | 804 | $json_in = false; |
805 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
806 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
805 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
806 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
807 | 807 | |
808 | 808 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
809 | 809 | foreach ( $json_val_1 as $item_1 ) { |
810 | 810 | foreach ( $json_val_2 as $item_2 ) { |
811 | 811 | $json_in = self::matches_operation( $item_1, $item_2, 'is' ); |
812 | 812 | |
813 | - if( $json_in ) { |
|
813 | + if ( $json_in ) { |
|
814 | 814 | break 2; |
815 | 815 | } |
816 | 816 | } |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | public static function check_entry_display( $entry, $view = null ) { |
862 | 862 | |
863 | 863 | if ( ! $entry || is_wp_error( $entry ) ) { |
864 | - return new WP_Error('entry_not_found', 'Entry was not found.', $entry ); |
|
864 | + return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
|
865 | 865 | } |
866 | 866 | |
867 | - if ( empty( $entry['form_id'] ) ) { |
|
867 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
868 | 868 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
869 | 869 | } |
870 | 870 | |
@@ -879,19 +879,19 @@ discard block |
||
879 | 879 | |
880 | 880 | $_gvid = \GV\Utils::_GET( 'gvid' ); |
881 | 881 | |
882 | - if ( $_gvid && $view->ID !== (int) $_gvid ) { |
|
882 | + if ( $_gvid && $view->ID !== (int)$_gvid ) { |
|
883 | 883 | return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID ); |
884 | 884 | } |
885 | 885 | |
886 | 886 | $view_form_id = $view->form->ID; |
887 | 887 | |
888 | 888 | if ( $view->joins ) { |
889 | - if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
890 | - $view_form_id = $entry['form_id']; |
|
889 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
890 | + $view_form_id = $entry[ 'form_id' ]; |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
894 | - if ( (int) $view_form_id !== (int) $entry['form_id'] ) { |
|
894 | + if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) { |
|
895 | 895 | return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry ); |
896 | 896 | } |
897 | 897 | |
@@ -899,13 +899,13 @@ discard block |
||
899 | 899 | * Check whether the entry is in the entries subset by running a modified query. |
900 | 900 | */ |
901 | 901 | add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) { |
902 | - $_tmp_query = new \GF_Query( $view_form_id, array( |
|
902 | + $_tmp_query = new \GF_Query( $view_form_id, array( |
|
903 | 903 | 'field_filters' => array( |
904 | 904 | 'mode' => 'all', |
905 | 905 | array( |
906 | 906 | 'key' => 'id', |
907 | 907 | 'operation' => 'is', |
908 | - 'value' => $entry['id'] |
|
908 | + 'value' => $entry[ 'id' ] |
|
909 | 909 | ) |
910 | 910 | ) |
911 | 911 | ) ); |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | /** @var \GF_Query $query */ |
916 | 916 | $query_parts = $query->_introspect(); |
917 | 917 | |
918 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
918 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
919 | 919 | |
920 | 920 | }, 10, 3 ); |
921 | 921 | |
922 | 922 | // Prevent page offset from being applied to the single entry query; it's used to return to the referring page number |
923 | 923 | add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) { |
924 | 924 | |
925 | - $criteria['paging'] = array( |
|
925 | + $criteria[ 'paging' ] = array( |
|
926 | 926 | 'offset' => 0, |
927 | 927 | 'page_size' => 25 |
928 | 928 | ); |
@@ -941,20 +941,20 @@ discard block |
||
941 | 941 | } |
942 | 942 | |
943 | 943 | // This entry is on a View with joins |
944 | - if ( $entries[0]->is_multi() ) { |
|
944 | + if ( $entries[ 0 ]->is_multi() ) { |
|
945 | 945 | |
946 | 946 | $multi_entry_ids = array(); |
947 | 947 | |
948 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
949 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
948 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
949 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
950 | 950 | } |
951 | 951 | |
952 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
952 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
953 | 953 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
954 | 954 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
955 | 955 | } |
956 | 956 | |
957 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
957 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
958 | 958 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
959 | 959 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
960 | 960 | } |
@@ -999,18 +999,18 @@ discard block |
||
999 | 999 | * Gravity Forms code to adjust date to locally-configured Time Zone |
1000 | 1000 | * @see GFCommon::format_date() for original code |
1001 | 1001 | */ |
1002 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1002 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1003 | 1003 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1004 | 1004 | |
1005 | - $format = \GV\Utils::get( $atts, 'format' ); |
|
1006 | - $is_human = ! empty( $atts['human'] ); |
|
1007 | - $is_diff = ! empty( $atts['diff'] ); |
|
1008 | - $is_raw = ! empty( $atts['raw'] ); |
|
1009 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1010 | - $include_time = ! empty( $atts['time'] ); |
|
1005 | + $format = \GV\Utils::get( $atts, 'format' ); |
|
1006 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1007 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1008 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1009 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1010 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1011 | 1011 | |
1012 | 1012 | // If we're using time diff, we want to have a different default format |
1013 | - if( empty( $format ) ) { |
|
1013 | + if ( empty( $format ) ) { |
|
1014 | 1014 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
1015 | 1015 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
1016 | 1016 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | // If raw was specified, don't modify the stored value |
1019 | 1019 | if ( $is_raw ) { |
1020 | 1020 | $formatted_date = $date_string; |
1021 | - } elseif( $is_timestamp ) { |
|
1021 | + } elseif ( $is_timestamp ) { |
|
1022 | 1022 | $formatted_date = $date_local_timestamp; |
1023 | 1023 | } elseif ( $is_diff ) { |
1024 | 1024 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | $label = \GV\Utils::get( $field, 'label' ); |
1054 | 1054 | |
1055 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1055 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1056 | 1056 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
1057 | 1057 | } |
1058 | 1058 | |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | $form = GFAPI::get_form( $form ); |
1081 | 1081 | } |
1082 | 1082 | |
1083 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
1083 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
1084 | 1084 | return GFFormsModel::get_field( $form, $field_id ); |
1085 | 1085 | } else { |
1086 | 1086 | return null; |
@@ -1127,19 +1127,19 @@ discard block |
||
1127 | 1127 | $shortcodes = array(); |
1128 | 1128 | |
1129 | 1129 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1130 | - if ( empty( $matches ) ){ |
|
1130 | + if ( empty( $matches ) ) { |
|
1131 | 1131 | return false; |
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | foreach ( $matches as $shortcode ) { |
1135 | - if ( $tag === $shortcode[2] ) { |
|
1135 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1136 | 1136 | |
1137 | 1137 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1138 | - $shortcodes[] = $shortcode; |
|
1138 | + $shortcodes[ ] = $shortcode; |
|
1139 | 1139 | |
1140 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1141 | - foreach( $results as $result ) { |
|
1142 | - $shortcodes[] = $result; |
|
1140 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1141 | + foreach ( $results as $result ) { |
|
1142 | + $shortcodes[ ] = $result; |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | 'post_type' => 'gravityview', |
1172 | 1172 | 'posts_per_page' => 100, |
1173 | 1173 | 'meta_key' => '_gravityview_form_id', |
1174 | - 'meta_value' => (int) $form_id, |
|
1174 | + 'meta_value' => (int)$form_id, |
|
1175 | 1175 | ); |
1176 | 1176 | $args = wp_parse_args( $args, $defaults ); |
1177 | 1177 | $views = get_posts( $args ); |
@@ -1183,21 +1183,21 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | $data = unserialize( $view->meta_value ); |
1185 | 1185 | |
1186 | - if( ! $data || ! is_array( $data ) ) { |
|
1186 | + if ( ! $data || ! is_array( $data ) ) { |
|
1187 | 1187 | continue; |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | foreach ( $data as $datum ) { |
1191 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1192 | - $joined_forms[] = $view->post_id; |
|
1191 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1192 | + $joined_forms[ ] = $view->post_id; |
|
1193 | 1193 | } |
1194 | 1194 | } |
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | if ( $joined_forms ) { |
1198 | - $joined_args = array( |
|
1198 | + $joined_args = array( |
|
1199 | 1199 | 'post_type' => 'gravityview', |
1200 | - 'posts_per_page' => $args['posts_per_page'], |
|
1200 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1201 | 1201 | 'post__in' => $joined_forms, |
1202 | 1202 | ); |
1203 | 1203 | $views = array_merge( $views, get_posts( $joined_args ) ); |
@@ -1353,7 +1353,7 @@ discard block |
||
1353 | 1353 | |
1354 | 1354 | $directory_widgets = wp_parse_args( $view_widgets, $defaults ); |
1355 | 1355 | |
1356 | - if( $json_decode ) { |
|
1356 | + if ( $json_decode ) { |
|
1357 | 1357 | $directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' ); |
1358 | 1358 | } |
1359 | 1359 | |
@@ -1369,7 +1369,7 @@ discard block |
||
1369 | 1369 | * @return string html |
1370 | 1370 | */ |
1371 | 1371 | public static function get_sortable_fields( $formid, $current = '' ) { |
1372 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1372 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1373 | 1373 | |
1374 | 1374 | if ( empty( $formid ) ) { |
1375 | 1375 | return $output; |
@@ -1382,11 +1382,11 @@ discard block |
||
1382 | 1382 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1383 | 1383 | |
1384 | 1384 | foreach ( $fields as $id => $field ) { |
1385 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1385 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1386 | 1386 | continue; |
1387 | 1387 | } |
1388 | 1388 | |
1389 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1389 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1390 | 1390 | } |
1391 | 1391 | } |
1392 | 1392 | |
@@ -1421,16 +1421,16 @@ discard block |
||
1421 | 1421 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1422 | 1422 | |
1423 | 1423 | // TODO: Convert to using array_filter |
1424 | - foreach( $fields as $id => $field ) { |
|
1424 | + foreach ( $fields as $id => $field ) { |
|
1425 | 1425 | |
1426 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1426 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1427 | 1427 | unset( $fields[ $id ] ); |
1428 | 1428 | } |
1429 | 1429 | |
1430 | 1430 | /** |
1431 | 1431 | * Merge date and time subfields. |
1432 | 1432 | */ |
1433 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1433 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1434 | 1434 | $fields[ intval( $id ) ] = array( |
1435 | 1435 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1436 | 1436 | 'parent' => null, |
@@ -1480,14 +1480,14 @@ discard block |
||
1480 | 1480 | * @param int|array $field field key or field array |
1481 | 1481 | * @return boolean |
1482 | 1482 | */ |
1483 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1483 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1484 | 1484 | |
1485 | 1485 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1486 | 1486 | $form = self::get_form( $form ); |
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | // If entry meta, it's a string. Otherwise, numeric |
1490 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1490 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1491 | 1491 | $type = $field; |
1492 | 1492 | } else { |
1493 | 1493 | $type = self::get_field_type( $form, $field ); |
@@ -1501,9 +1501,9 @@ discard block |
||
1501 | 1501 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1502 | 1502 | |
1503 | 1503 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1504 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1505 | - if( true === $gv_field->is_numeric ) { |
|
1506 | - $numeric_types[] = $gv_field->is_numeric; |
|
1504 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1505 | + if ( true === $gv_field->is_numeric ) { |
|
1506 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1653,18 +1653,18 @@ discard block |
||
1653 | 1653 | $final_atts = array_filter( $final_atts ); |
1654 | 1654 | |
1655 | 1655 | // If the href wasn't passed as an attribute, use the value passed to the function |
1656 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1657 | - $final_atts['href'] = $href; |
|
1656 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1657 | + $final_atts[ 'href' ] = $href; |
|
1658 | 1658 | } |
1659 | 1659 | |
1660 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1660 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1661 | 1661 | |
1662 | 1662 | /** |
1663 | 1663 | * Fix potential security issue with target=_blank |
1664 | 1664 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1665 | 1665 | */ |
1666 | - if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1667 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1666 | + if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1667 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | // Sort the attributes alphabetically, to help testing |
@@ -1676,7 +1676,7 @@ discard block |
||
1676 | 1676 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1677 | 1677 | } |
1678 | 1678 | |
1679 | - if( '' !== $output ) { |
|
1679 | + if ( '' !== $output ) { |
|
1680 | 1680 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1681 | 1681 | } |
1682 | 1682 | |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1704 | 1704 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1705 | 1705 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1706 | - $merged[] = $value; |
|
1706 | + $merged[ ] = $value; |
|
1707 | 1707 | } else { |
1708 | 1708 | $merged[ $key ] = $value; |
1709 | 1709 | } |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1737 | 1737 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1738 | 1738 | */ |
1739 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1739 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1740 | 1740 | |
1741 | 1741 | return get_users( $get_users_settings ); |
1742 | 1742 | } |
@@ -1756,11 +1756,11 @@ discard block |
||
1756 | 1756 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1757 | 1757 | |
1758 | 1758 | // If $cap is defined, only show notice if user has capability |
1759 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1759 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1760 | 1760 | return ''; |
1761 | 1761 | } |
1762 | 1762 | |
1763 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1763 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1764 | 1764 | } |
1765 | 1765 | |
1766 | 1766 | /** |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | private function __construct() {} |
86 | 86 | |
87 | 87 | private function initialize() { |
88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
91 | 91 | |
92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -234,18 +234,18 @@ discard block |
||
234 | 234 | |
235 | 235 | if ( ! empty( $view_id ) ) { |
236 | 236 | |
237 | - $this->context_view_id = (int) $view_id; |
|
237 | + $this->context_view_id = (int)$view_id; |
|
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | */ |
244 | - $this->context_view_id = (int) $_GET['gvid']; |
|
244 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
245 | 245 | |
246 | 246 | } elseif ( ! $multiple_views ) { |
247 | 247 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
248 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
248 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
249 | 249 | unset( $array_keys ); |
250 | 250 | } |
251 | 251 | |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | global $wp_rewrite; |
279 | 279 | |
280 | 280 | $is_front_page = ( $query->is_home || $query->is_page ); |
281 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
282 | - $front_page_id = get_option('page_on_front'); |
|
281 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
282 | + $front_page_id = get_option( 'page_on_front' ); |
|
283 | 283 | |
284 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | 285 | |
286 | 286 | // Force to be an array, potentially a query string ( entry=16 ) |
287 | 287 | $_query = wp_parse_args( $query->query ); |
288 | 288 | |
289 | 289 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
290 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
291 | - unset( $_query['pagename'] ); |
|
290 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
291 | + unset( $_query[ 'pagename' ] ); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // this is where will break from core wordpress |
295 | 295 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
296 | 296 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
297 | 297 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
352 | 352 | |
353 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
353 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
354 | 354 | $this->setPostId( $post_id ); |
355 | 355 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
356 | 356 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
388 | 388 | |
389 | - if( 'post' === $search_method ) { |
|
389 | + if ( 'post' === $search_method ) { |
|
390 | 390 | $get = $_POST; |
391 | 391 | } else { |
392 | 392 | $get = $_GET; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $gventry = gravityview()->request->is_entry(); |
434 | 434 | |
435 | 435 | // If this is the directory view, return. |
436 | - if( ! $gventry ) { |
|
436 | + if ( ! $gventry ) { |
|
437 | 437 | return $passed_title; |
438 | 438 | } |
439 | 439 | |
@@ -451,19 +451,19 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | // WooCommerce doesn't $post_id |
454 | - if ( empty( $passed_post_id ) ) { |
|
454 | + if ( empty( $passed_post_id ) ) { |
|
455 | 455 | return $passed_title; |
456 | 456 | } |
457 | 457 | |
458 | 458 | // Don't modify the title for anything other than the current view/post. |
459 | 459 | // This is true for embedded shortcodes and Views. |
460 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
460 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
461 | 461 | return $passed_title; |
462 | 462 | } |
463 | 463 | |
464 | 464 | $view = gravityview()->request->is_view(); |
465 | 465 | |
466 | - if( $view ) { |
|
466 | + if ( $view ) { |
|
467 | 467 | return $this->_get_single_entry_title( $view, $entry, $passed_title ); |
468 | 468 | } |
469 | 469 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $view_collection = \GV\View_Collection::from_post( $post ); |
483 | 483 | |
484 | 484 | // We have multiple Views, but no gvid...this isn't valid security |
485 | - if( 1 < $view_collection->count() ) { |
|
485 | + if ( 1 < $view_collection->count() ) { |
|
486 | 486 | return $passed_title; |
487 | 487 | } |
488 | 488 | |
@@ -508,13 +508,13 @@ discard block |
||
508 | 508 | |
509 | 509 | $check_display = GVCommon::check_entry_display( $entry, $view ); |
510 | 510 | |
511 | - if( is_wp_error( $check_display ) ) { |
|
511 | + if ( is_wp_error( $check_display ) ) { |
|
512 | 512 | return $passed_title; |
513 | 513 | } |
514 | 514 | |
515 | 515 | $title = $view->settings->get( 'single_title', $passed_title ); |
516 | 516 | |
517 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
517 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
518 | 518 | |
519 | 519 | // We are allowing HTML in the fields, so no escaping the output |
520 | 520 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | $context = GravityView_View::getInstance()->getContext(); |
588 | 588 | |
589 | - switch( $context ) { |
|
589 | + switch ( $context ) { |
|
590 | 590 | case 'directory': |
591 | 591 | $tab = __( 'Multiple Entries', 'gravityview' ); |
592 | 592 | break; |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | } |
601 | 601 | |
602 | 602 | |
603 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
603 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
604 | 604 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
605 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
605 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
606 | 606 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
607 | 607 | |
608 | - $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 ) ) ); |
|
608 | + $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 ) ) ); |
|
609 | 609 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
610 | 610 | |
611 | 611 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID ); |
654 | 654 | $embed_only = $view->settings->get( 'embed_only' ); |
655 | 655 | |
656 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
656 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
657 | 657 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
658 | 658 | } |
659 | 659 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $datetime_format = 'Y-m-d H:i:s'; |
701 | 701 | $search_is_outside_view_bounds = false; |
702 | 702 | |
703 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
703 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
704 | 704 | |
705 | 705 | $search_date = strtotime( $search_criteria[ $key ] ); |
706 | 706 | |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
729 | 729 | |
730 | 730 | // Then we override the search and re-set the start date |
731 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
731 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
732 | 732 | } |
733 | 733 | } |
734 | 734 | } |
735 | 735 | |
736 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
736 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
737 | 737 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
738 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
738 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
739 | 739 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
740 | 740 | } |
741 | 741 | } |
@@ -754,19 +754,19 @@ discard block |
||
754 | 754 | public static function process_search_only_approved( $args, $search_criteria ) { |
755 | 755 | |
756 | 756 | /** @since 1.19 */ |
757 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
757 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
758 | 758 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
759 | 759 | return $search_criteria; |
760 | 760 | } |
761 | 761 | |
762 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
762 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
763 | 763 | |
764 | - $search_criteria['field_filters'][] = array( |
|
764 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
765 | 765 | 'key' => GravityView_Entry_Approval::meta_key, |
766 | 766 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
767 | 767 | ); |
768 | 768 | |
769 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
769 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
770 | 770 | |
771 | 771 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
772 | 772 | } |
@@ -793,18 +793,18 @@ discard block |
||
793 | 793 | */ |
794 | 794 | public static function is_entry_approved( $entry, $args = array() ) { |
795 | 795 | |
796 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
796 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
797 | 797 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
798 | 798 | return true; |
799 | 799 | } |
800 | 800 | |
801 | 801 | /** @since 1.19 */ |
802 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
802 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
803 | 803 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
804 | 804 | return true; |
805 | 805 | } |
806 | 806 | |
807 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
807 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
808 | 808 | |
809 | 809 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
810 | 810 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
829 | 829 | */ |
830 | 830 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
831 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
831 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
832 | 832 | |
833 | 833 | /** |
834 | 834 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -848,29 +848,29 @@ discard block |
||
848 | 848 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) ); |
849 | 849 | |
850 | 850 | // implicity search |
851 | - if ( ! empty( $args['search_value'] ) ) { |
|
851 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
852 | 852 | |
853 | 853 | // Search operator options. Options: `is` or `contains` |
854 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
854 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
855 | 855 | |
856 | - $search_criteria['field_filters'][] = array( |
|
856 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
857 | 857 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
858 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
858 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
859 | 859 | 'operator' => $operator, |
860 | 860 | ); |
861 | 861 | |
862 | 862 | // Lock search mode to "all" with implicit presearch filter. |
863 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
863 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
864 | 864 | } |
865 | 865 | |
866 | - if( $search_criteria !== $original_search_criteria ) { |
|
866 | + if ( $search_criteria !== $original_search_criteria ) { |
|
867 | 867 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) ); |
868 | 868 | } |
869 | 869 | |
870 | 870 | // Handle setting date range |
871 | 871 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
872 | 872 | |
873 | - if( $search_criteria !== $original_search_criteria ) { |
|
873 | + if ( $search_criteria !== $original_search_criteria ) { |
|
874 | 874 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) ); |
875 | 875 | } |
876 | 876 | |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
882 | 882 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
883 | 883 | */ |
884 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
884 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
885 | 885 | |
886 | 886 | return $search_criteria; |
887 | 887 | } |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | 'search_criteria' => $search_criteria, |
995 | 995 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
996 | 996 | 'paging' => $paging, |
997 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
997 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
998 | 998 | ); |
999 | 999 | |
1000 | 1000 | /** |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1020 | 1020 | * @param array $args View configuration args. |
1021 | 1021 | */ |
1022 | - $parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1022 | + $parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1023 | 1023 | |
1024 | 1024 | gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) ); |
1025 | 1025 | |
@@ -1044,17 +1044,17 @@ discard block |
||
1044 | 1044 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1045 | 1045 | |
1046 | 1046 | // Paging & offset |
1047 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1047 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1048 | 1048 | |
1049 | 1049 | if ( -1 === $page_size ) { |
1050 | 1050 | $page_size = PHP_INT_MAX; |
1051 | 1051 | } |
1052 | 1052 | |
1053 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1053 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1054 | 1054 | $offset = ( $curr_page - 1 ) * $page_size; |
1055 | 1055 | |
1056 | - if ( ! empty( $args['offset'] ) ) { |
|
1057 | - $offset += intval( $args['offset'] ); |
|
1056 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1057 | + $offset += intval( $args[ 'offset' ] ); |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $paging = array( |
@@ -1079,11 +1079,11 @@ discard block |
||
1079 | 1079 | public static function updateViewSorting( $args, $form_id ) { |
1080 | 1080 | $sorting = array(); |
1081 | 1081 | |
1082 | - $has_values = isset( $_GET['sort'] ); |
|
1082 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
1083 | 1083 | |
1084 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
1085 | - $sorts = array_keys( $_GET['sort'] ); |
|
1086 | - $dirs = array_values( $_GET['sort'] ); |
|
1084 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
1085 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
1086 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
1087 | 1087 | |
1088 | 1088 | if ( $has_values = array_filter( $dirs ) ) { |
1089 | 1089 | $sort_field_id = end( $sorts ); |
@@ -1092,11 +1092,11 @@ discard block |
||
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | if ( ! isset( $sort_field_id ) ) { |
1095 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1095 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | if ( ! isset( $sort_direction ) ) { |
1099 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1099 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | if ( is_array( $sort_field_id ) ) { |
@@ -1128,10 +1128,10 @@ discard block |
||
1128 | 1128 | $form = GFAPI::get_form( $form_id ); |
1129 | 1129 | |
1130 | 1130 | // Get the first GF_Field field ID, set as the key for entry randomization |
1131 | - if ( ! empty( $form['fields'] ) ) { |
|
1131 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1132 | 1132 | |
1133 | 1133 | /** @var GF_Field $field */ |
1134 | - foreach ( $form['fields'] as $field ) { |
|
1134 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1135 | 1135 | if ( ! is_a( $field, 'GF_Field' ) ) { |
1136 | 1136 | continue; |
1137 | 1137 | } |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | if ( is_array( $sort_field_id ) ) { |
1177 | 1177 | $modified_ids = array(); |
1178 | 1178 | foreach ( $sort_field_id as $_sort_field_id ) { |
1179 | - $modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1179 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1180 | 1180 | } |
1181 | 1181 | return $modified_ids; |
1182 | 1182 | } |
@@ -1185,11 +1185,11 @@ discard block |
||
1185 | 1185 | |
1186 | 1186 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1187 | 1187 | |
1188 | - if( ! $sort_field ) { |
|
1188 | + if ( ! $sort_field ) { |
|
1189 | 1189 | return $sort_field_id; |
1190 | 1190 | } |
1191 | 1191 | |
1192 | - switch ( $sort_field['type'] ) { |
|
1192 | + switch ( $sort_field[ 'type' ] ) { |
|
1193 | 1193 | |
1194 | 1194 | case 'address': |
1195 | 1195 | // Sorting by full address |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | */ |
1207 | 1207 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1208 | 1208 | |
1209 | - switch( strtolower( $address_part ) ){ |
|
1209 | + switch ( strtolower( $address_part ) ) { |
|
1210 | 1210 | case 'street': |
1211 | 1211 | $sort_field_id .= '.1'; |
1212 | 1212 | break; |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | if ( ! class_exists( '\GV\Entry' ) ) { |
1280 | 1280 | |
1281 | 1281 | // Not using gravityview()->log->error(), since that may not exist yet either! |
1282 | - do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1282 | + do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1283 | 1283 | |
1284 | 1284 | return null; |
1285 | 1285 | } |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1298 | 1298 | |
1299 | - if ( empty( $single_entry ) ){ |
|
1299 | + if ( empty( $single_entry ) ) { |
|
1300 | 1300 | return false; |
1301 | 1301 | } else { |
1302 | 1302 | return $single_entry; |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | $views = $this->getGvOutputData()->get_views(); |
1319 | 1319 | |
1320 | 1320 | foreach ( $views as $view_id => $data ) { |
1321 | - $view = \GV\View::by_id( $data['id'] ); |
|
1321 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1322 | 1322 | $view_id = $view->ID; |
1323 | 1323 | $template_id = gravityview_get_template_id( $view->ID ); |
1324 | 1324 | $data = $view->as_data(); |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1328 | 1328 | * @since 1.15 |
1329 | 1329 | */ |
1330 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1330 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1331 | 1331 | continue; |
1332 | 1332 | } |
1333 | 1333 | |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | * @param \GV\View The View. |
1361 | 1361 | */ |
1362 | 1362 | apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
1363 | - $js_dependencies[] = $js_dependency; |
|
1363 | + $js_dependencies[ ] = $js_dependency; |
|
1364 | 1364 | |
1365 | 1365 | if ( ! empty( $wp_filter[ 'gravity_view_lightbox_style' ] ) ) { |
1366 | 1366 | gravityview()->log->warning( 'gravity_view_lightbox_style filter is deprecated use gravityview_lightbox_style instead' ); |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | * @param \GV\View The View. |
1381 | 1381 | */ |
1382 | 1382 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
1383 | - $css_dependencies[] = $css_dependency; |
|
1383 | + $css_dependencies[ ] = $css_dependency; |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | /** |
@@ -1388,19 +1388,19 @@ discard block |
||
1388 | 1388 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1389 | 1389 | * @since 1.15 |
1390 | 1390 | */ |
1391 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1392 | - $css_dependencies[] = 'dashicons'; |
|
1391 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1392 | + $css_dependencies[ ] = 'dashicons'; |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1396 | 1396 | |
1397 | 1397 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1398 | 1398 | |
1399 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
1399 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
1400 | 1400 | |
1401 | 1401 | wp_enqueue_script( 'gravityview-fe-view' ); |
1402 | 1402 | |
1403 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1403 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1404 | 1404 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1405 | 1405 | } |
1406 | 1406 | |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | public static function add_style( $template_id ) { |
1464 | 1464 | |
1465 | 1465 | if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
1466 | - gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1466 | + gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1467 | 1467 | wp_enqueue_style( 'gravityview_style_' . $template_id ); |
1468 | 1468 | } elseif ( empty( $template_id ) ) { |
1469 | 1469 | gravityview()->log->error( 'Cannot add template style; template_id is empty' ); |
@@ -1494,11 +1494,11 @@ discard block |
||
1494 | 1494 | * Not a table-based template; don't add sort icons |
1495 | 1495 | * @since 1.12 |
1496 | 1496 | */ |
1497 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1497 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1498 | 1498 | return $label; |
1499 | 1499 | } |
1500 | 1500 | |
1501 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1501 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1502 | 1502 | return $label; |
1503 | 1503 | } |
1504 | 1504 | |
@@ -1506,29 +1506,29 @@ discard block |
||
1506 | 1506 | |
1507 | 1507 | $class = 'gv-sort'; |
1508 | 1508 | |
1509 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1509 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1510 | 1510 | |
1511 | 1511 | $sort_args = array( |
1512 | - 'sort' => $field['id'], |
|
1512 | + 'sort' => $field[ 'id' ], |
|
1513 | 1513 | 'dir' => 'asc', |
1514 | 1514 | ); |
1515 | 1515 | |
1516 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1516 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1517 | 1517 | //toggle sorting direction. |
1518 | - if ( 'asc' === $sorting['direction'] ) { |
|
1519 | - $sort_args['dir'] = 'desc'; |
|
1518 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1519 | + $sort_args[ 'dir' ] = 'desc'; |
|
1520 | 1520 | $class .= ' gv-icon-sort-desc'; |
1521 | 1521 | } else { |
1522 | - $sort_args['dir'] = 'asc'; |
|
1522 | + $sort_args[ 'dir' ] = 'asc'; |
|
1523 | 1523 | $class .= ' gv-icon-sort-asc'; |
1524 | 1524 | } |
1525 | 1525 | } else { |
1526 | 1526 | $class .= ' gv-icon-caret-up-down'; |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1529 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1530 | 1530 | |
1531 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1531 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1532 | 1532 | |
1533 | 1533 | } |
1534 | 1534 | |
@@ -1546,7 +1546,7 @@ discard block |
||
1546 | 1546 | |
1547 | 1547 | $field_type = $field_id; |
1548 | 1548 | |
1549 | - if( is_numeric( $field_id ) ) { |
|
1549 | + if ( is_numeric( $field_id ) ) { |
|
1550 | 1550 | $field = GFFormsModel::get_field( $form, $field_id ); |
1551 | 1551 | $field_type = $field ? $field->type : $field_id; |
1552 | 1552 | } |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | return false; |
1570 | 1570 | } |
1571 | 1571 | |
1572 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1572 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1573 | 1573 | |
1574 | 1574 | } |
1575 | 1575 |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | // WooCommerce doesn't $post_id |
454 | - if ( empty( $passed_post_id ) ) { |
|
454 | + if ( empty( $passed_post_id ) ) { |
|
455 | 455 | return $passed_title; |
456 | 456 | } |
457 | 457 | |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | */ |
1207 | 1207 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1208 | 1208 | |
1209 | - switch( strtolower( $address_part ) ){ |
|
1209 | + switch( strtolower( $address_part ) ) { |
|
1210 | 1210 | case 'street': |
1211 | 1211 | $sort_field_id .= '.1'; |
1212 | 1212 | break; |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1298 | 1298 | |
1299 | - if ( empty( $single_entry ) ){ |
|
1299 | + if ( empty( $single_entry ) ) { |
|
1300 | 1300 | return false; |
1301 | 1301 | } else { |
1302 | 1302 | return $single_entry; |