@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $supports = array( 'title', 'revisions' ); |
109 | 109 | |
110 | 110 | if ( $is_hierarchical ) { |
111 | - $supports[] = 'page-attributes'; |
|
111 | + $supports[ ] = 'page-attributes'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | $rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' ); |
211 | 211 | |
212 | 212 | add_filter( 'query_vars', function( $query_vars ) { |
213 | - $query_vars[] = 'csv'; |
|
213 | + $query_vars[ ] = 'csv'; |
|
214 | 214 | return $query_vars; |
215 | 215 | } ); |
216 | 216 | |
217 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) { |
|
217 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) { |
|
218 | 218 | call_user_func_array( 'add_rewrite_rule', $rule ); |
219 | 219 | } |
220 | 220 | } |
@@ -283,13 +283,13 @@ discard block |
||
283 | 283 | return $content; |
284 | 284 | } |
285 | 285 | |
286 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
286 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
287 | 287 | |
288 | 288 | /** |
289 | 289 | * Editing a single entry. |
290 | 290 | */ |
291 | 291 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
292 | - if ( $entry['status'] != 'active' ) { |
|
292 | + if ( $entry[ 'status' ] != 'active' ) { |
|
293 | 293 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
294 | 294 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
295 | 295 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
303 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
303 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
304 | 304 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
305 | 305 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
306 | 306 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * Viewing a single entry. |
314 | 314 | */ |
315 | 315 | } else if ( $entry = $request->is_entry( $view->form ? $view->form->ID : 0 ) ) { |
316 | - if ( $entry['status'] != 'active' ) { |
|
316 | + if ( $entry[ 'status' ] != 'active' ) { |
|
317 | 317 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
318 | 318 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
319 | 319 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
327 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
327 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
328 | 328 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
329 | 329 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
330 | 330 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column ); |
499 | 499 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column ); |
500 | 500 | |
501 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
501 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return $joins; |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | |
541 | 541 | list( $join, $join_column, $join_on, $join_on_column ) = $meta; |
542 | 542 | |
543 | - $forms_ids [] = GF_Form::by_id( $join_on ); |
|
543 | + $forms_ids [ ] = GF_Form::by_id( $join_on ); |
|
544 | 544 | } |
545 | 545 | |
546 | - return ( !empty( $forms_ids) ) ? $forms_ids : null; |
|
546 | + return ( ! empty( $forms_ids ) ) ? $forms_ids : null; |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | if ( ! $view->form ) { |
582 | 582 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
583 | 583 | 'view_id' => $view->ID, |
584 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
584 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
585 | 585 | ) ); |
586 | 586 | } |
587 | 587 | |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | * Remove multiple sorting before calling legacy filters. |
817 | 817 | * This allows us to fake it till we make it. |
818 | 818 | */ |
819 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
819 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
820 | 820 | $has_multisort = true; |
821 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
822 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
823 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
821 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
822 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
823 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | |
@@ -828,34 +828,33 @@ discard block |
||
828 | 828 | * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead |
829 | 829 | */ |
830 | 830 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
831 | - $parameters['context_view_id'] = $this->ID; |
|
831 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
832 | 832 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
833 | 833 | |
834 | 834 | if ( $request instanceof REST\Request ) { |
835 | 835 | $atts = $this->settings->as_atts(); |
836 | 836 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
837 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
837 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
838 | 838 | ) ); |
839 | - $parameters['paging'] = $paging_parameters['paging']; |
|
839 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
840 | 840 | } |
841 | 841 | |
842 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
843 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
842 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
844 | 843 | |
845 | 844 | /** |
846 | 845 | * Cleanup duplicate field_filter parameters to simplify the query. |
847 | 846 | */ |
848 | 847 | $unique_field_filters = array(); |
849 | - foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) { |
|
848 | + foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) { |
|
850 | 849 | if ( 'mode' === $key ) { |
851 | - $unique_field_filters['mode'] = $filter; |
|
850 | + $unique_field_filters[ 'mode' ] = $filter; |
|
852 | 851 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
853 | - $unique_field_filters[] = $filter; |
|
852 | + $unique_field_filters[ ] = $filter; |
|
854 | 853 | } |
855 | 854 | } |
856 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
855 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
857 | 856 | |
858 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
857 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
859 | 858 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
860 | 859 | } |
861 | 860 | |
@@ -863,7 +862,7 @@ discard block |
||
863 | 862 | /** |
864 | 863 | * New \GF_Query stuff :) |
865 | 864 | */ |
866 | - $query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] ); |
|
865 | + $query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] ); |
|
867 | 866 | |
868 | 867 | /** |
869 | 868 | * Apply multisort. |
@@ -896,8 +895,8 @@ discard block |
||
896 | 895 | } |
897 | 896 | } |
898 | 897 | |
899 | - $query->limit( $parameters['paging']['page_size'] ) |
|
900 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
898 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
899 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
901 | 900 | |
902 | 901 | /** |
903 | 902 | * Any joins? |
@@ -939,15 +938,15 @@ discard block |
||
939 | 938 | } ); |
940 | 939 | } else { |
941 | 940 | $entries = $this->form->entries |
942 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
941 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
943 | 942 | ->offset( $this->settings->get( 'offset' ) ) |
944 | - ->limit( $parameters['paging']['page_size'] ) |
|
943 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
945 | 944 | ->page( $page ); |
946 | 945 | |
947 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
946 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
948 | 947 | $field = new \GV\Field(); |
949 | - $field->ID = $parameters['sorting']['key']; |
|
950 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
948 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
949 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
951 | 950 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
952 | 951 | } |
953 | 952 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][1] ); |
34 | 34 | } else { |
35 | 35 | $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ); |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | 39 | GravityView_Render_Settings::render_setting_row( 'sort_field', $current_settings, sprintf( $sort_fields_input, $primary_sort_fields ) ); |
@@ -28,11 +28,11 @@ |
||
28 | 28 | |
29 | 29 | $sort_fields_input = '<select name="template_settings[sort_field][]" id="gravityview_sort_field">%s</select>'; |
30 | 30 | |
31 | - if ( is_array( $current_settings['sort_field'] ) ) { |
|
32 | - $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][0] ); |
|
33 | - $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'][1] ); |
|
31 | + if ( is_array( $current_settings[ 'sort_field' ] ) ) { |
|
32 | + $primary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 0 ] ); |
|
33 | + $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ][ 1 ] ); |
|
34 | 34 | } else { |
35 | - $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings['sort_field'] ); |
|
35 | + $primary_sort_fields = $secondary_sort_fields = gravityview_get_sortable_fields( $curr_form, $current_settings[ 'sort_field' ] ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 |