@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | * @return \GV\GF_Field|null The field implementation or null on error. |
28 | 28 | */ |
29 | 29 | public static function from_configuration( $configuration ) { |
30 | - if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) { |
|
30 | + if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) { |
|
31 | 31 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] ) ) { |
|
35 | + if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) { |
|
36 | 36 | gravityview()->log->error( 'Invalid configuration[form_id] supplied.' ); |
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | |
40 | - $field = self::by_id( $form, $configuration['id'] ); |
|
40 | + $field = self::by_id( $form, $configuration[ 'id' ] ); |
|
41 | 41 | |
42 | 42 | if ( ! $field ) { |
43 | 43 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | /** This is a complex Gravity Forms input. */ |
113 | 113 | if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) { |
114 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
114 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
115 | 115 | } else { |
116 | 116 | /** This is a field with one label. */ |
117 | 117 | $label = $this->field->get_field_label( true, $this->label ); |
@@ -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': |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $supports = array( 'title', 'revisions' ); |
126 | 126 | |
127 | 127 | if ( $is_hierarchical ) { |
128 | - $supports[] = 'page-attributes'; |
|
128 | + $supports[ ] = 'page-attributes'; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
230 | 230 | |
231 | 231 | add_filter( 'query_vars', function( $query_vars ) { |
232 | - $query_vars[] = 'csv'; |
|
233 | - $query_vars[] = 'tsv'; |
|
232 | + $query_vars[ ] = 'csv'; |
|
233 | + $query_vars[ ] = 'tsv'; |
|
234 | 234 | return $query_vars; |
235 | 235 | } ); |
236 | 236 | |
237 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
237 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
238 | 238 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
239 | 239 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
240 | 240 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
297 | 297 | |
298 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
299 | 299 | |
300 | 300 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
301 | 301 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
324 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
324 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Editing a single entry. |
328 | 328 | */ |
329 | 329 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
330 | - if ( $entry['status'] != 'active' ) { |
|
330 | + if ( $entry[ 'status' ] != 'active' ) { |
|
331 | 331 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
332 | 332 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
341 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
341 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
342 | 342 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
343 | 343 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | foreach ( $entryset as $e ) { |
363 | 363 | |
364 | - if ( 'active' !== $e['status'] ) { |
|
364 | + if ( 'active' !== $e[ 'status' ] ) { |
|
365 | 365 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
366 | 366 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
375 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
375 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
376 | 376 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
377 | 377 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
378 | 378 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
548 | 548 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
549 | 549 | |
550 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
550 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | return $joins; |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | } |
638 | 638 | |
639 | 639 | foreach ( $_fields as $field ) { |
640 | - if ( ! empty( $field['unions'] ) ) { |
|
641 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
640 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
641 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
642 | 642 | if ( ! isset( $unions[ $form_id ] ) ) { |
643 | 643 | $unions[ $form_id ] = array(); |
644 | 644 | } |
645 | 645 | |
646 | - $unions[ $form_id ][ $field['id'] ] = |
|
646 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
647 | 647 | 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 ); |
648 | 648 | } |
649 | 649 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | if ( ! $view->form ) { |
699 | 699 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
700 | 700 | 'view_id' => $view->ID, |
701 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
701 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
702 | 702 | ) ); |
703 | 703 | } |
704 | 704 | |
@@ -942,11 +942,11 @@ discard block |
||
942 | 942 | * Remove multiple sorting before calling legacy filters. |
943 | 943 | * This allows us to fake it till we make it. |
944 | 944 | */ |
945 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
945 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
946 | 946 | $has_multisort = true; |
947 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
948 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
949 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
947 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
948 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
949 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
950 | 950 | } |
951 | 951 | } |
952 | 952 | |
@@ -955,31 +955,30 @@ discard block |
||
955 | 955 | */ |
956 | 956 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
957 | 957 | |
958 | - $parameters['context_view_id'] = $this->ID; |
|
958 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
959 | 959 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
960 | 960 | |
961 | 961 | if ( ! is_array( $parameters ) ) { |
962 | 962 | $parameters = array(); |
963 | 963 | } |
964 | 964 | |
965 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
966 | - $parameters['search_criteria'] = array(); |
|
965 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
966 | + $parameters[ 'search_criteria' ] = array(); |
|
967 | 967 | } |
968 | 968 | |
969 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
970 | - $parameters['search_criteria']['field_filters'] = array(); |
|
969 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
970 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
971 | 971 | } |
972 | 972 | |
973 | 973 | if ( $request instanceof REST\Request ) { |
974 | 974 | $atts = $this->settings->as_atts(); |
975 | 975 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
976 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
976 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
977 | 977 | ) ); |
978 | - $parameters['paging'] = $paging_parameters['paging']; |
|
978 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
979 | 979 | } |
980 | 980 | |
981 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
982 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
981 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
983 | 982 | |
984 | 983 | /** |
985 | 984 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -987,14 +986,14 @@ discard block |
||
987 | 986 | $unique_field_filters = array(); |
988 | 987 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
989 | 988 | if ( 'mode' === $key ) { |
990 | - $unique_field_filters['mode'] = $filter; |
|
989 | + $unique_field_filters[ 'mode' ] = $filter; |
|
991 | 990 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
992 | - $unique_field_filters[] = $filter; |
|
991 | + $unique_field_filters[ ] = $filter; |
|
993 | 992 | } |
994 | 993 | } |
995 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
994 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
996 | 995 | |
997 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
996 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
998 | 997 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
999 | 998 | } |
1000 | 999 | |
@@ -1003,7 +1002,7 @@ discard block |
||
1003 | 1002 | $query_class = $this->get_query_class(); |
1004 | 1003 | |
1005 | 1004 | /** @type \GF_Query $query */ |
1006 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1005 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1007 | 1006 | |
1008 | 1007 | /** |
1009 | 1008 | * Apply multisort. |
@@ -1014,15 +1013,15 @@ discard block |
||
1014 | 1013 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1015 | 1014 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1016 | 1015 | |
1017 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1016 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1018 | 1017 | |
1019 | - if( $has_sort_query_param ) { |
|
1020 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1018 | + if ( $has_sort_query_param ) { |
|
1019 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1021 | 1020 | } |
1022 | 1021 | |
1023 | 1022 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1024 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1025 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1023 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1024 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1026 | 1025 | } else { |
1027 | 1026 | $sort_field_ids = $view_setting_sort_field_ids; |
1028 | 1027 | $sort_directions = $view_setting_sort_directions; |
@@ -1030,7 +1029,7 @@ discard block |
||
1030 | 1029 | |
1031 | 1030 | $skip_first = false; |
1032 | 1031 | |
1033 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1032 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1034 | 1033 | |
1035 | 1034 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1036 | 1035 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1060,18 +1059,18 @@ discard block |
||
1060 | 1059 | |
1061 | 1060 | $merged_time = false; |
1062 | 1061 | |
1063 | - foreach ( $q['order'] as $oid => $order ) { |
|
1062 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1064 | 1063 | |
1065 | 1064 | $column = null; |
1066 | 1065 | |
1067 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1068 | - $column = $order[0]; |
|
1069 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1070 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
1066 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
1067 | + $column = $order[ 0 ]; |
|
1068 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
1069 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
1071 | 1070 | $orders[ $oid ] = $order; |
1072 | 1071 | continue; // Need something that resembles a single sort |
1073 | 1072 | } |
1074 | - $column = $order[0]->columns[0]; |
|
1073 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1075 | 1074 | } |
1076 | 1075 | |
1077 | 1076 | if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1085,7 +1084,7 @@ discard block |
||
1085 | 1084 | |
1086 | 1085 | $orders[ $oid ] = array( |
1087 | 1086 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1088 | - $order[1] // Mock it! |
|
1087 | + $order[ 1 ] // Mock it! |
|
1089 | 1088 | ); |
1090 | 1089 | |
1091 | 1090 | $merged_time = true; |
@@ -1096,15 +1095,15 @@ discard block |
||
1096 | 1095 | * ORDER again. |
1097 | 1096 | */ |
1098 | 1097 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1099 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1098 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1100 | 1099 | } |
1101 | 1100 | } |
1102 | 1101 | |
1103 | 1102 | return $sql; |
1104 | 1103 | } ); |
1105 | 1104 | |
1106 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1107 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1105 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1106 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1108 | 1107 | |
1109 | 1108 | /** |
1110 | 1109 | * Any joins? |
@@ -1127,7 +1126,7 @@ discard block |
||
1127 | 1126 | |
1128 | 1127 | $query_parameters = $query->_introspect(); |
1129 | 1128 | |
1130 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1129 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1131 | 1130 | } |
1132 | 1131 | |
1133 | 1132 | /** |
@@ -1161,7 +1160,7 @@ discard block |
||
1161 | 1160 | } |
1162 | 1161 | |
1163 | 1162 | $q = $query->_introspect(); |
1164 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1163 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1165 | 1164 | |
1166 | 1165 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1167 | 1166 | |
@@ -1186,7 +1185,7 @@ discard block |
||
1186 | 1185 | |
1187 | 1186 | $query_parameters = $query->_introspect(); |
1188 | 1187 | |
1189 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1188 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1190 | 1189 | } |
1191 | 1190 | } |
1192 | 1191 | |
@@ -1210,7 +1209,7 @@ discard block |
||
1210 | 1209 | $conditions = array(); |
1211 | 1210 | |
1212 | 1211 | foreach ( $condition->expressions as $_condition ) { |
1213 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1212 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1214 | 1213 | } |
1215 | 1214 | |
1216 | 1215 | return call_user_func_array( |
@@ -1239,10 +1238,10 @@ discard block |
||
1239 | 1238 | $q = new $query_class( $form_id ); |
1240 | 1239 | |
1241 | 1240 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1242 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1241 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1243 | 1242 | |
1244 | 1243 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1245 | - foreach ( $query_parameters['order'] as $order ) { |
|
1244 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1246 | 1245 | list( $column, $_order ) = $order; |
1247 | 1246 | |
1248 | 1247 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1256,15 +1255,15 @@ discard block |
||
1256 | 1255 | |
1257 | 1256 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1258 | 1257 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1259 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1258 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1260 | 1259 | |
1261 | 1260 | // Record the SQL |
1262 | - $unions_sql[] = array( |
|
1261 | + $unions_sql[ ] = array( |
|
1263 | 1262 | // Remove columns, we'll rebuild them |
1264 | 1263 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1265 | - 'from' => $sql['from'], |
|
1266 | - 'join' => $sql['join'], |
|
1267 | - 'where' => $sql['where'], |
|
1264 | + 'from' => $sql[ 'from' ], |
|
1265 | + 'join' => $sql[ 'join' ], |
|
1266 | + 'where' => $sql[ 'where' ], |
|
1268 | 1267 | // Remove order and limit |
1269 | 1268 | ); |
1270 | 1269 | |
@@ -1281,11 +1280,11 @@ discard block |
||
1281 | 1280 | |
1282 | 1281 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1283 | 1282 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1284 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1283 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1285 | 1284 | |
1286 | 1285 | // Remove columns, we'll rebuild them |
1287 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1288 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1286 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1287 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1289 | 1288 | |
1290 | 1289 | $unions = array(); |
1291 | 1290 | |
@@ -1296,30 +1295,30 @@ discard block |
||
1296 | 1295 | }; |
1297 | 1296 | |
1298 | 1297 | // Add all the order columns into the selects, so we can order by the whole union group |
1299 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1298 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1300 | 1299 | |
1301 | 1300 | $columns = array( |
1302 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1301 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1303 | 1302 | ); |
1304 | 1303 | |
1305 | 1304 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1306 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1305 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1307 | 1306 | |
1308 | 1307 | // Rewrite the order columns to the shared aliases |
1309 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1308 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1310 | 1309 | } |
1311 | 1310 | |
1312 | 1311 | $columns = array_unique( $columns ); |
1313 | 1312 | |
1314 | 1313 | // Add the columns to every UNION |
1315 | 1314 | foreach ( $unions_sql as $union_sql ) { |
1316 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1317 | - $unions []= implode( ' ', $union_sql ); |
|
1315 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1316 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1318 | 1317 | } |
1319 | 1318 | |
1320 | 1319 | // Add the columns to the main SELECT, but only grab the entry id column |
1321 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1322 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1320 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1321 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1323 | 1322 | |
1324 | 1323 | return $sql; |
1325 | 1324 | } ); |
@@ -1364,20 +1363,20 @@ discard block |
||
1364 | 1363 | } ); |
1365 | 1364 | } else { |
1366 | 1365 | $entries = $this->form->entries |
1367 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1366 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1368 | 1367 | ->offset( $this->settings->get( 'offset' ) ) |
1369 | - ->limit( $parameters['paging']['page_size'] ) |
|
1368 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1370 | 1369 | ->page( $page ); |
1371 | 1370 | |
1372 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1371 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1373 | 1372 | // Pluck off multisort arrays |
1374 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1373 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1375 | 1374 | } |
1376 | 1375 | |
1377 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1376 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1378 | 1377 | $field = new \GV\Field(); |
1379 | - $field->ID = $parameters['sorting']['key']; |
|
1380 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1378 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1379 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1381 | 1380 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1382 | 1381 | } |
1383 | 1382 | } |
@@ -1461,7 +1460,7 @@ discard block |
||
1461 | 1460 | $allowed = $headers = array(); |
1462 | 1461 | |
1463 | 1462 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1464 | - $allowed[] = $field; |
|
1463 | + $allowed[ ] = $field; |
|
1465 | 1464 | } |
1466 | 1465 | |
1467 | 1466 | $renderer = new Field_Renderer(); |
@@ -1483,17 +1482,17 @@ discard block |
||
1483 | 1482 | } ); |
1484 | 1483 | |
1485 | 1484 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1486 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1485 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1487 | 1486 | } |
1488 | 1487 | |
1489 | 1488 | foreach ( $allowed as $field ) { |
1490 | 1489 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1491 | 1490 | |
1492 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1491 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1493 | 1492 | |
1494 | 1493 | if ( ! $headers_done ) { |
1495 | 1494 | $label = $field->get_label( $view, $source, $entry ); |
1496 | - $headers[] = $label ? $label : $field->ID; |
|
1495 | + $headers[ ] = $label ? $label : $field->ID; |
|
1497 | 1496 | } |
1498 | 1497 | } |
1499 | 1498 |
@@ -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:', 'gravityview' ), |
171 | 171 | 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | '1-1' => array( |
224 | 224 | array( |
225 | 225 | 'areaid' => 'top', |
226 | - 'title' => __( 'Top', 'gravityview' ) , |
|
226 | + 'title' => __( 'Top', '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', 'gravityview' ) , |
|
235 | + 'title' => __( 'Left', 'gravityview' ), |
|
236 | 236 | 'subtitle' => '' |
237 | 237 | ), |
238 | 238 | ), |
239 | 239 | '2-2' => array( |
240 | 240 | array( |
241 | 241 | 'areaid' => 'right', |
242 | - 'title' => __( 'Right', 'gravityview' ) , |
|
242 | + 'title' => __( 'Right', '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 | } |