@@ -62,7 +62,6 @@ |
||
62 | 62 | * |
63 | 63 | * Internal static cache for gets, and whatnot. |
64 | 64 | * This is not persistent, resets across requests. |
65 | - |
|
66 | 65 | * @internal |
67 | 66 | */ |
68 | 67 | private static $cache = array(); |
@@ -230,8 +230,9 @@ |
||
230 | 230 | * Check permissions. |
231 | 231 | */ |
232 | 232 | while ( $error = $view->can_render( null, $request ) ) { |
233 | - if ( ! is_wp_error( $error ) ) |
|
234 | - break; |
|
233 | + if ( ! is_wp_error( $error ) ) { |
|
234 | + break; |
|
235 | + } |
|
235 | 236 | |
236 | 237 | switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) { |
237 | 238 | case 'post_password_required': |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $supports = array( 'title', 'revisions' ); |
135 | 135 | |
136 | 136 | if ( $is_hierarchical ) { |
137 | - $supports[] = 'page-attributes'; |
|
137 | + $supports[ ] = 'page-attributes'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
244 | 244 | |
245 | 245 | add_filter( 'query_vars', function( $query_vars ) { |
246 | - $query_vars[] = 'csv'; |
|
247 | - $query_vars[] = 'tsv'; |
|
246 | + $query_vars[ ] = 'csv'; |
|
247 | + $query_vars[ ] = 'tsv'; |
|
248 | 248 | return $query_vars; |
249 | 249 | } ); |
250 | 250 | |
251 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
251 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
252 | 252 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
253 | 253 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
254 | 254 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gk-gravityview' ); |
311 | 311 | |
312 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gk-gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
312 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gk-gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
313 | 313 | |
314 | 314 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
315 | 315 | } |
@@ -335,13 +335,13 @@ discard block |
||
335 | 335 | return $content; |
336 | 336 | } |
337 | 337 | |
338 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
338 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
339 | 339 | |
340 | 340 | /** |
341 | 341 | * Editing a single entry. |
342 | 342 | */ |
343 | 343 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
344 | - if ( $entry['status'] != 'active' ) { |
|
344 | + if ( $entry[ 'status' ] != 'active' ) { |
|
345 | 345 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
346 | 346 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
347 | 347 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
355 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
355 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
356 | 356 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
357 | 357 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
358 | 358 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | |
376 | 376 | foreach ( $entryset as $e ) { |
377 | 377 | |
378 | - if ( 'active' !== $e['status'] ) { |
|
378 | + if ( 'active' !== $e[ 'status' ] ) { |
|
379 | 379 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
380 | 380 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
381 | 381 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } |
387 | 387 | |
388 | 388 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
389 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
389 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
390 | 390 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
391 | 391 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
392 | 392 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
562 | 562 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
563 | 563 | |
564 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
564 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | return $joins; |
@@ -651,13 +651,13 @@ discard block |
||
651 | 651 | } |
652 | 652 | |
653 | 653 | foreach ( $_fields as $field ) { |
654 | - if ( ! empty( $field['unions'] ) ) { |
|
655 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
654 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
655 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
656 | 656 | if ( ! isset( $unions[ $form_id ] ) ) { |
657 | 657 | $unions[ $form_id ] = array(); |
658 | 658 | } |
659 | 659 | |
660 | - $unions[ $form_id ][ $field['id'] ] = |
|
660 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
661 | 661 | is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
662 | 662 | } |
663 | 663 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | if ( ! $view->form ) { |
713 | 713 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
714 | 714 | 'view_id' => $view->ID, |
715 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
715 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
716 | 716 | ) ); |
717 | 717 | } |
718 | 718 | |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | * @since 2.0 |
843 | 843 | * @return bool Whether the offset exists or not, limited to GravityView_View_Data::$views element keys. |
844 | 844 | */ |
845 | - #[\ReturnTypeWillChange] |
|
845 | + #[\ReturnTypeWillChange ] |
|
846 | 846 | public function offsetExists( $offset ) { |
847 | 847 | $data_keys = array( 'id', 'view_id', 'form_id', 'template_id', 'atts', 'fields', 'widgets', 'form' ); |
848 | 848 | return in_array( $offset, $data_keys ); |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | * |
860 | 860 | * @return mixed The value of the requested view data key limited to GravityView_View_Data::$views element keys. If offset not found, return null. |
861 | 861 | */ |
862 | - #[\ReturnTypeWillChange] |
|
862 | + #[\ReturnTypeWillChange ] |
|
863 | 863 | public function offsetGet( $offset ) { |
864 | 864 | |
865 | 865 | gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' ); |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * |
897 | 897 | * @return void |
898 | 898 | */ |
899 | - #[\ReturnTypeWillChange] |
|
899 | + #[\ReturnTypeWillChange ] |
|
900 | 900 | public function offsetSet( $offset, $value ) { |
901 | 901 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
902 | 902 | } |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | * @since 2.0 |
910 | 910 | * @return void |
911 | 911 | */ |
912 | - #[\ReturnTypeWillChange] |
|
912 | + #[\ReturnTypeWillChange ] |
|
913 | 913 | public function offsetUnset( $offset ) { |
914 | 914 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
915 | 915 | } |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | * Remove multiple sorting before calling legacy filters. |
961 | 961 | * This allows us to fake it till we make it. |
962 | 962 | */ |
963 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
963 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
964 | 964 | $has_multisort = true; |
965 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
966 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
967 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
965 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
966 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
967 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
@@ -973,31 +973,30 @@ discard block |
||
973 | 973 | */ |
974 | 974 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
975 | 975 | |
976 | - $parameters['context_view_id'] = $this->ID; |
|
976 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
977 | 977 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
978 | 978 | |
979 | 979 | if ( ! is_array( $parameters ) ) { |
980 | 980 | $parameters = array(); |
981 | 981 | } |
982 | 982 | |
983 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
984 | - $parameters['search_criteria'] = array(); |
|
983 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
984 | + $parameters[ 'search_criteria' ] = array(); |
|
985 | 985 | } |
986 | 986 | |
987 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
988 | - $parameters['search_criteria']['field_filters'] = array(); |
|
987 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
988 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
989 | 989 | } |
990 | 990 | |
991 | 991 | if ( $request instanceof REST\Request ) { |
992 | 992 | $atts = $this->settings->as_atts(); |
993 | 993 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
994 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
994 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
995 | 995 | ) ); |
996 | - $parameters['paging'] = $paging_parameters['paging']; |
|
996 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
997 | 997 | } |
998 | 998 | |
999 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
1000 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
999 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
1001 | 1000 | |
1002 | 1001 | /** |
1003 | 1002 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -1005,14 +1004,14 @@ discard block |
||
1005 | 1004 | $unique_field_filters = array(); |
1006 | 1005 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
1007 | 1006 | if ( 'mode' === $key ) { |
1008 | - $unique_field_filters['mode'] = $filter; |
|
1007 | + $unique_field_filters[ 'mode' ] = $filter; |
|
1009 | 1008 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
1010 | - $unique_field_filters[] = $filter; |
|
1009 | + $unique_field_filters[ ] = $filter; |
|
1011 | 1010 | } |
1012 | 1011 | } |
1013 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
1012 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
1014 | 1013 | |
1015 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
1014 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
1016 | 1015 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
1017 | 1016 | } |
1018 | 1017 | |
@@ -1021,7 +1020,7 @@ discard block |
||
1021 | 1020 | $query_class = $this->get_query_class(); |
1022 | 1021 | |
1023 | 1022 | /** @type \GF_Query $query */ |
1024 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1023 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1025 | 1024 | |
1026 | 1025 | /** |
1027 | 1026 | * Apply multisort. |
@@ -1032,15 +1031,15 @@ discard block |
||
1032 | 1031 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1033 | 1032 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1034 | 1033 | |
1035 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1034 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1036 | 1035 | |
1037 | - if( $has_sort_query_param ) { |
|
1038 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1036 | + if ( $has_sort_query_param ) { |
|
1037 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1039 | 1038 | } |
1040 | 1039 | |
1041 | 1040 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1042 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1043 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1041 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1042 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1044 | 1043 | } else { |
1045 | 1044 | $sort_field_ids = $view_setting_sort_field_ids; |
1046 | 1045 | $sort_directions = $view_setting_sort_directions; |
@@ -1048,7 +1047,7 @@ discard block |
||
1048 | 1047 | |
1049 | 1048 | $skip_first = false; |
1050 | 1049 | |
1051 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1050 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1052 | 1051 | |
1053 | 1052 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1054 | 1053 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1078,18 +1077,18 @@ discard block |
||
1078 | 1077 | |
1079 | 1078 | $merged_time = false; |
1080 | 1079 | |
1081 | - foreach ( $q['order'] as $oid => $order ) { |
|
1080 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1082 | 1081 | |
1083 | 1082 | $column = null; |
1084 | 1083 | |
1085 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1086 | - $column = $order[0]; |
|
1087 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1088 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
1084 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
1085 | + $column = $order[ 0 ]; |
|
1086 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
1087 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
1089 | 1088 | $orders[ $oid ] = $order; |
1090 | 1089 | continue; // Need something that resembles a single sort |
1091 | 1090 | } |
1092 | - $column = $order[0]->columns[0]; |
|
1091 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1093 | 1092 | } |
1094 | 1093 | |
1095 | 1094 | if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1103,7 +1102,7 @@ discard block |
||
1103 | 1102 | |
1104 | 1103 | $orders[ $oid ] = array( |
1105 | 1104 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1106 | - $order[1] // Mock it! |
|
1105 | + $order[ 1 ] // Mock it! |
|
1107 | 1106 | ); |
1108 | 1107 | |
1109 | 1108 | $merged_time = true; |
@@ -1114,15 +1113,15 @@ discard block |
||
1114 | 1113 | * ORDER again. |
1115 | 1114 | */ |
1116 | 1115 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1117 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1116 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1118 | 1117 | } |
1119 | 1118 | } |
1120 | 1119 | |
1121 | 1120 | return $sql; |
1122 | 1121 | } ); |
1123 | 1122 | |
1124 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1125 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1123 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1124 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1126 | 1125 | |
1127 | 1126 | /** |
1128 | 1127 | * Any joins? |
@@ -1145,7 +1144,7 @@ discard block |
||
1145 | 1144 | |
1146 | 1145 | $query_parameters = $query->_introspect(); |
1147 | 1146 | |
1148 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1147 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1149 | 1148 | } |
1150 | 1149 | |
1151 | 1150 | /** |
@@ -1179,7 +1178,7 @@ discard block |
||
1179 | 1178 | } |
1180 | 1179 | |
1181 | 1180 | $q = $query->_introspect(); |
1182 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1181 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1183 | 1182 | |
1184 | 1183 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1185 | 1184 | |
@@ -1204,7 +1203,7 @@ discard block |
||
1204 | 1203 | |
1205 | 1204 | $query_parameters = $query->_introspect(); |
1206 | 1205 | |
1207 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1206 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1208 | 1207 | } |
1209 | 1208 | } |
1210 | 1209 | |
@@ -1228,7 +1227,7 @@ discard block |
||
1228 | 1227 | $conditions = array(); |
1229 | 1228 | |
1230 | 1229 | foreach ( $condition->expressions as $_condition ) { |
1231 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1230 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1232 | 1231 | } |
1233 | 1232 | |
1234 | 1233 | return call_user_func_array( |
@@ -1257,10 +1256,10 @@ discard block |
||
1257 | 1256 | $q = new $query_class( $form_id ); |
1258 | 1257 | |
1259 | 1258 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1260 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1259 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1261 | 1260 | |
1262 | 1261 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1263 | - foreach ( $query_parameters['order'] as $order ) { |
|
1262 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1264 | 1263 | list( $column, $_order ) = $order; |
1265 | 1264 | |
1266 | 1265 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1274,15 +1273,15 @@ discard block |
||
1274 | 1273 | |
1275 | 1274 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1276 | 1275 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1277 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1276 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1278 | 1277 | |
1279 | 1278 | // Record the SQL |
1280 | - $unions_sql[] = array( |
|
1279 | + $unions_sql[ ] = array( |
|
1281 | 1280 | // Remove columns, we'll rebuild them |
1282 | 1281 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1283 | - 'from' => $sql['from'], |
|
1284 | - 'join' => $sql['join'], |
|
1285 | - 'where' => $sql['where'], |
|
1282 | + 'from' => $sql[ 'from' ], |
|
1283 | + 'join' => $sql[ 'join' ], |
|
1284 | + 'where' => $sql[ 'where' ], |
|
1286 | 1285 | // Remove order and limit |
1287 | 1286 | ); |
1288 | 1287 | |
@@ -1299,11 +1298,11 @@ discard block |
||
1299 | 1298 | |
1300 | 1299 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1301 | 1300 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1302 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1301 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1303 | 1302 | |
1304 | 1303 | // Remove columns, we'll rebuild them |
1305 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1306 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1304 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1305 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1307 | 1306 | |
1308 | 1307 | $unions = array(); |
1309 | 1308 | |
@@ -1314,30 +1313,30 @@ discard block |
||
1314 | 1313 | }; |
1315 | 1314 | |
1316 | 1315 | // Add all the order columns into the selects, so we can order by the whole union group |
1317 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1316 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1318 | 1317 | |
1319 | 1318 | $columns = array( |
1320 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1319 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1321 | 1320 | ); |
1322 | 1321 | |
1323 | 1322 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1324 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1323 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1325 | 1324 | |
1326 | 1325 | // Rewrite the order columns to the shared aliases |
1327 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1326 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1328 | 1327 | } |
1329 | 1328 | |
1330 | 1329 | $columns = array_unique( $columns ); |
1331 | 1330 | |
1332 | 1331 | // Add the columns to every UNION |
1333 | 1332 | foreach ( $unions_sql as $union_sql ) { |
1334 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1335 | - $unions []= implode( ' ', $union_sql ); |
|
1333 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1334 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1336 | 1335 | } |
1337 | 1336 | |
1338 | 1337 | // Add the columns to the main SELECT, but only grab the entry id column |
1339 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1340 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1338 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1339 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1341 | 1340 | |
1342 | 1341 | return $sql; |
1343 | 1342 | } ); |
@@ -1382,20 +1381,20 @@ discard block |
||
1382 | 1381 | } ); |
1383 | 1382 | } else { |
1384 | 1383 | $entries = $this->form->entries |
1385 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1384 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1386 | 1385 | ->offset( $this->settings->get( 'offset' ) ) |
1387 | - ->limit( $parameters['paging']['page_size'] ) |
|
1386 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1388 | 1387 | ->page( $page ); |
1389 | 1388 | |
1390 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1389 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1391 | 1390 | // Pluck off multisort arrays |
1392 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1391 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1393 | 1392 | } |
1394 | 1393 | |
1395 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1394 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1396 | 1395 | $field = new \GV\Field(); |
1397 | - $field->ID = $parameters['sorting']['key']; |
|
1398 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1396 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1397 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1399 | 1398 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1400 | 1399 | } |
1401 | 1400 | } |
@@ -1479,7 +1478,7 @@ discard block |
||
1479 | 1478 | $allowed = $headers = array(); |
1480 | 1479 | |
1481 | 1480 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1482 | - $allowed[] = $field; |
|
1481 | + $allowed[ ] = $field; |
|
1483 | 1482 | } |
1484 | 1483 | |
1485 | 1484 | $renderer = new Field_Renderer(); |
@@ -1501,17 +1500,17 @@ discard block |
||
1501 | 1500 | } ); |
1502 | 1501 | |
1503 | 1502 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1504 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1503 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1505 | 1504 | } |
1506 | 1505 | |
1507 | 1506 | foreach ( $allowed as $field ) { |
1508 | 1507 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1509 | 1508 | |
1510 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1509 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1511 | 1510 | |
1512 | 1511 | if ( ! $headers_done ) { |
1513 | 1512 | $label = $field->get_label( $view, $source, $entry ); |
1514 | - $headers[] = $label ? $label : $field->ID; |
|
1513 | + $headers[ ] = $label ? $label : $field->ID; |
|
1515 | 1514 | } |
1516 | 1515 | } |
1517 | 1516 | |
@@ -1609,7 +1608,7 @@ discard block |
||
1609 | 1608 | * @return void |
1610 | 1609 | */ |
1611 | 1610 | public function set_anchor_id( $counter = 1 ) { |
1612 | - $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int) $counter ); |
|
1611 | + $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int)$counter ); |
|
1613 | 1612 | } |
1614 | 1613 | |
1615 | 1614 | /** |
@@ -163,14 +163,14 @@ |
||
163 | 163 | return $settings; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
166 | + /** |
|
167 | 167 | * Get the Widget ID. |
168 | 168 | * |
169 | - * @return string The Widget ID. |
|
170 | - */ |
|
171 | - public function get_widget_id() { |
|
172 | - return $this->widget_id; |
|
173 | - } |
|
169 | + * @return string The Widget ID. |
|
170 | + */ |
|
171 | + public function get_widget_id() { |
|
172 | + return $this->widget_id; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Get the widget settings |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
166 | 166 | |
167 | 167 | if ( $enable_custom_class ) { |
168 | - $settings['custom_class'] = array( |
|
168 | + $settings[ 'custom_class' ] = array( |
|
169 | 169 | 'type' => 'text', |
170 | 170 | 'label' => __( 'Custom CSS Class:', 'gk-gravityview' ), |
171 | 171 | 'desc' => __( 'This class will be added to the widget container', 'gk-gravityview' ), |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | '1-1' => array( |
224 | 224 | array( |
225 | 225 | 'areaid' => 'top', |
226 | - 'title' => __( 'Top', 'gk-gravityview' ) , |
|
226 | + 'title' => __( 'Top', 'gk-gravityview' ), |
|
227 | 227 | 'subtitle' => '' |
228 | 228 | ), |
229 | 229 | ), |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | '1-2' => array( |
233 | 233 | array( |
234 | 234 | 'areaid' => 'left', |
235 | - 'title' => __( 'Left', 'gk-gravityview' ) , |
|
235 | + 'title' => __( 'Left', 'gk-gravityview' ), |
|
236 | 236 | 'subtitle' => '' |
237 | 237 | ), |
238 | 238 | ), |
239 | 239 | '2-2' => array( |
240 | 240 | array( |
241 | 241 | 'areaid' => 'right', |
242 | - 'title' => __( 'Right', 'gk-gravityview' ) , |
|
242 | + 'title' => __( 'Right', 'gk-gravityview' ), |
|
243 | 243 | 'subtitle' => '' |
244 | 244 | ), |
245 | 245 | ), |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | $widgets[ $this->get_widget_id() ] = array( |
277 | - 'label' => $this->widget_label , |
|
277 | + 'label' => $this->widget_label, |
|
278 | 278 | 'description' => $this->widget_description, |
279 | 279 | 'subtitle' => $this->widget_subtitle, |
280 | 280 | 'icon' => $this->icon, |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
298 | 298 | if ( $this->get_widget_id() === $widget ) { |
299 | - if( $settings = $this->get_settings() ) { |
|
299 | + if ( $settings = $this->get_settings() ) { |
|
300 | 300 | $options = array_merge( $options, $settings ); |
301 | 301 | } |
302 | 302 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return; |
351 | 351 | } |
352 | 352 | |
353 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
353 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -34,7 +34,7 @@ |
||
34 | 34 | global $post; |
35 | 35 | |
36 | 36 | if ( $post ) { |
37 | - $context['post'] = $post; |
|
37 | + $context[ 'post' ] = $post; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |
@@ -113,18 +113,18 @@ |
||
113 | 113 | global $post; |
114 | 114 | |
115 | 115 | if ( ! $this->request->is_view() && $post ) { |
116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
120 | 120 | } |
121 | 121 | |
122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
126 | 126 | |
127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
128 | 128 | |
129 | 129 | return array_merge( $specifics, $templates ); |
130 | 130 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | if ( $this->field ) { |
79 | 79 | return array( |
80 | 80 | 'key' => $this->field->ID, |
81 | - 'direction' => $this->direction ? : self::ASC, |
|
81 | + 'direction' => $this->direction ?: self::ASC, |
|
82 | 82 | 'is_numeric' => self::ALPHA ? true : false, |
83 | 83 | ); |
84 | 84 | } |
@@ -50,8 +50,8 @@ |
||
50 | 50 | /** |
51 | 51 | * By array. |
52 | 52 | */ |
53 | - if ( is_array( $view ) && ! empty( $view['id'] ) ) { |
|
54 | - return $this->get( $view['id'] ); |
|
53 | + if ( is_array( $view ) && ! empty( $view[ 'id' ] ) ) { |
|
54 | + return $this->get( $view[ 'id' ] ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -21,7 +21,7 @@ |
||
21 | 21 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-route.php' ); |
22 | 22 | require_once gravityview()->plugin->dir( 'future/includes/rest/class-gv-rest-views-route.php' ); |
23 | 23 | |
24 | - self::$routes['views'] = $views = new Views_Route(); |
|
24 | + self::$routes[ 'views' ] = $views = new Views_Route(); |
|
25 | 25 | $views->register_routes(); |
26 | 26 | } |
27 | 27 |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | */ |
44 | 44 | $atts = apply_filters( 'gravityview/shortcodes/gvfield/atts', $atts ); |
45 | 45 | |
46 | - if ( ! $view = \GV\View::by_id( $atts['view_id'] ) ) { |
|
47 | - gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
46 | + if ( ! $view = \GV\View::by_id( $atts[ 'view_id' ] ) ) { |
|
47 | + gravityview()->log->error( 'View #{view_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
48 | 48 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, null, null, $atts ); |
49 | 49 | } |
50 | 50 | |
51 | - switch( $atts['entry_id'] ): |
|
51 | + switch ( $atts[ 'entry_id' ] ): |
|
52 | 52 | case 'last': |
53 | 53 | if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) { |
54 | 54 | /** |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | * Since we're using \GF_Query shorthand initialization we have to reverse the order parameters here. |
58 | 58 | */ |
59 | 59 | add_filter( 'gravityview_get_entries', $filter = function( $parameters, $args, $form_id ) { |
60 | - if ( ! empty( $parameters['sorting'] ) ) { |
|
60 | + if ( ! empty( $parameters[ 'sorting' ] ) ) { |
|
61 | 61 | /** |
62 | 62 | * Reverse existing sorts. |
63 | 63 | */ |
64 | - $sort = &$parameters['sorting']; |
|
65 | - $sort['direction'] = $sort['direction'] == 'RAND' ? : ( $sort['direction'] == 'ASC' ? 'DESC' : 'ASC' ); |
|
64 | + $sort = &$parameters[ 'sorting' ]; |
|
65 | + $sort[ 'direction' ] = $sort[ 'direction' ] == 'RAND' ?: ( $sort[ 'direction' ] == 'ASC' ? 'DESC' : 'ASC' ); |
|
66 | 66 | } else { |
67 | 67 | /** |
68 | 68 | * Otherwise, sort by date_created. |
69 | 69 | */ |
70 | - $parameters['sorting'] = array( |
|
70 | + $parameters[ 'sorting' ] = array( |
|
71 | 71 | 'key' => 'id', |
72 | 72 | 'direction' => 'ASC', |
73 | 73 | 'is_numeric' => true |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | /** If a sort already exists, reverse it. */ |
84 | 84 | if ( $sort = end( $entries->sorts ) ) { |
85 | - $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ? : ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
85 | + $entries = $entries->sort( new \GV\Entry_Sort( $sort->field, $sort->direction == \GV\Entry_Sort::RAND ?: ( $sort->direction == \GV\Entry_Sort::ASC ? \GV\Entry_Sort::DESC : \GV\Entry_Sort::ASC ) ), $sort->mode ); |
|
86 | 86 | } else { |
87 | 87 | /** Otherwise, sort by date_created */ |
88 | 88 | $entries = $entries->sort( new \GV\Entry_Sort( \GV\Internal_Field::by_id( 'id' ), \GV\Entry_Sort::ASC ), \GV\Entry_Sort::NUMERIC ); |
@@ -99,20 +99,20 @@ discard block |
||
99 | 99 | } |
100 | 100 | break; |
101 | 101 | default: |
102 | - if ( ! $entry = \GV\GF_Entry::by_id( $atts['entry_id'] ) ) { |
|
103 | - gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts['view_id'] ) ); |
|
102 | + if ( ! $entry = \GV\GF_Entry::by_id( $atts[ 'entry_id' ] ) ) { |
|
103 | + gravityview()->log->error( 'Entry #{entry_id} not found', array( 'view_id' => $atts[ 'view_id' ] ) ); |
|
104 | 104 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, null, $atts ); |
105 | 105 | } |
106 | 106 | endswitch; |
107 | 107 | |
108 | - $field = is_numeric( $atts['field_id'] ) ? \GV\GF_Field::by_id( $view->form, $atts['field_id'] ) : \GV\Internal_Field::by_id( $atts['field_id'] ); |
|
108 | + $field = is_numeric( $atts[ 'field_id' ] ) ? \GV\GF_Field::by_id( $view->form, $atts[ 'field_id' ] ) : \GV\Internal_Field::by_id( $atts[ 'field_id' ] ); |
|
109 | 109 | |
110 | 110 | if ( ! $field ) { |
111 | - gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts['field_id'] ) ); |
|
111 | + gravityview()->log->error( 'Field #{field_id} not found', array( 'view_id' => $atts[ 'field_id' ] ) ); |
|
112 | 112 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $field, $atts ); |
113 | 113 | } |
114 | 114 | |
115 | - if ( $view->form->ID != $entry['form_id'] ) { |
|
115 | + if ( $view->form->ID != $entry[ 'form_id' ] ) { |
|
116 | 116 | gravityview()->log->error( 'Entry does not belong to view (form mismatch)' ); |
117 | 117 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
118 | 118 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return apply_filters( 'gravityview/shortcodes/gvfield/output', get_the_password_form( $view->ID ), $view, $entry, $atts ); |
123 | 123 | } |
124 | 124 | |
125 | - if ( ! $view->form ) { |
|
125 | + if ( ! $view->form ) { |
|
126 | 126 | gravityview()->log->notice( 'View #{id} has no form attached to it.', array( 'id' => $view->ID ) ); |
127 | 127 | |
128 | 128 | /** |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** Unapproved entries. */ |
148 | - if ( $entry['status'] != 'active' ) { |
|
148 | + if ( $entry[ 'status' ] != 'active' ) { |
|
149 | 149 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
150 | 150 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
151 | 151 | } |
152 | 152 | |
153 | 153 | if ( $view->settings->get( 'show_only_approved' ) ) { |
154 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
154 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
155 | 155 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
156 | 156 | return apply_filters( 'gravityview/shortcodes/gvfield/output', '', $view, $entry, $atts ); |
157 | 157 | } |
@@ -108,13 +108,13 @@ |
||
108 | 108 | global $post; |
109 | 109 | |
110 | 110 | if ( ! $this->request->is_view() && $post ) { |
111 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
112 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
111 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
112 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
117 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
116 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
117 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
118 | 118 | |
119 | 119 | return array_merge( $specifics, $templates ); |
120 | 120 | } |