@@ -11,10 +11,10 @@ |
||
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="gv-search-box gv-search-date"> |
14 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
16 | 16 | <?php } ?> |
17 | 17 | <p> |
18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
19 | 19 | </p> |
20 | 20 | </div> |
21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <div class="gv-search-box gv-search-field-text"> |
13 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
15 | 15 | <?php } ?> |
16 | 16 | <p> |
17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
18 | 18 | </p> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -12,8 +12,8 @@ |
||
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="gv-search-box gv-search-field-single_checkbox"> |
15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
17 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio"> |
|
16 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>> |
|
17 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?> |
|
18 | 18 | </label> |
19 | 19 | </div> |
20 | 20 | \ No newline at end of file |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | |
43 | 43 | $args = wp_parse_args( $args, $defaults ); |
44 | 44 | |
45 | - $forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] ); |
|
45 | + $forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] ); |
|
46 | 46 | |
47 | - if( array() === $args['options'] ) { |
|
47 | + if ( array() === $args[ 'options' ] ) { |
|
48 | 48 | foreach ( $forms as $form ) { |
49 | 49 | |
50 | - if ( in_array( $form['id'], $args['exclude'] ) ) { |
|
50 | + if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | - $args['options'][ $form['id'] ] = esc_html( $form['title'] ); |
|
54 | + $args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | |
84 | 84 | $args = wp_parse_args( $args, $defaults ); |
85 | 85 | |
86 | - if( empty( $args['form_id'] ) ) { |
|
86 | + if ( empty( $args[ 'form_id' ] ) ) { |
|
87 | 87 | return ''; |
88 | 88 | } |
89 | 89 | |
90 | - $fields = GVCommon::get_sortable_fields_array( $args['form_id'] ); |
|
90 | + $fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] ); |
|
91 | 91 | |
92 | - if( array() === $args['options'] ) { |
|
92 | + if ( array() === $args[ 'options' ] ) { |
|
93 | 93 | foreach ( $fields as $field_id => $field ) { |
94 | - $args['options'][ $field_id ] = esc_html( $field['label'] ); |
|
94 | + $args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] ); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -127,43 +127,43 @@ discard block |
||
127 | 127 | $args = wp_parse_args( $args, $defaults ); |
128 | 128 | |
129 | 129 | $data_elements = ''; |
130 | - foreach ( $args['data'] as $key => $value ) { |
|
130 | + foreach ( $args[ 'data' ] as $key => $value ) { |
|
131 | 131 | $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
132 | 132 | } |
133 | 133 | |
134 | - if( $args['multiple'] ) { |
|
134 | + if ( $args[ 'multiple' ] ) { |
|
135 | 135 | $multiple = ' MULTIPLE'; |
136 | 136 | } else { |
137 | 137 | $multiple = ''; |
138 | 138 | } |
139 | 139 | |
140 | - if( $args['placeholder'] ) { |
|
141 | - $placeholder = $args['placeholder']; |
|
140 | + if ( $args[ 'placeholder' ] ) { |
|
141 | + $placeholder = $args[ 'placeholder' ]; |
|
142 | 142 | } else { |
143 | 143 | $placeholder = ''; |
144 | 144 | } |
145 | 145 | |
146 | - $disabled = $args['disabled'] ? ' disabled="disabled"' : ''; |
|
147 | - $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) ); |
|
148 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>'; |
|
146 | + $disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : ''; |
|
147 | + $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) ); |
|
148 | + $output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
149 | 149 | |
150 | - if ( ! empty( $args['options'] ) ) { |
|
150 | + if ( ! empty( $args[ 'options' ] ) ) { |
|
151 | 151 | |
152 | - if ( $args['show_option_none'] ) { |
|
153 | - if( $args['multiple'] ) { |
|
154 | - $selected = selected( true, in_array( -1, $args['selected'] ), false ); |
|
152 | + if ( $args[ 'show_option_none' ] ) { |
|
153 | + if ( $args[ 'multiple' ] ) { |
|
154 | + $selected = selected( true, in_array( -1, $args[ 'selected' ] ), false ); |
|
155 | 155 | } else { |
156 | - $selected = selected( $args['selected'], -1, false ); |
|
156 | + $selected = selected( $args[ 'selected' ], -1, false ); |
|
157 | 157 | } |
158 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
158 | + $output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>'; |
|
159 | 159 | } |
160 | 160 | |
161 | - foreach( $args['options'] as $key => $option ) { |
|
161 | + foreach ( $args[ 'options' ] as $key => $option ) { |
|
162 | 162 | |
163 | - if( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
164 | - $selected = selected( true, in_array( $key, $args['selected'], true ), false ); |
|
163 | + if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) { |
|
164 | + $selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false ); |
|
165 | 165 | } else { |
166 | - $selected = selected( $args['selected'], $key, false ); |
|
166 | + $selected = selected( $args[ 'selected' ], $key, false ); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
44 | 44 | global $ultimatemember; |
45 | 45 | |
46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // @todo Support Ultimate Member 2.0 - for now, prevent fatal error |
51 | - if( ! isset( $ultimatemember->profile ) ) { |
|
51 | + if ( ! isset( $ultimatemember->profile ) ) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
67 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
68 | 68 | |
69 | 69 | wp_reset_postdata(); |
70 | 70 | } |
@@ -141,7 +141,7 @@ |
||
141 | 141 | global $wpdb; |
142 | 142 | |
143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
146 | 146 | } else { |
147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | // Make sure the keys are all set |
68 | 68 | $note = wp_parse_args( $note, $default_note ); |
69 | 69 | |
70 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
70 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
71 | 71 | |
72 | 72 | // If last_error is empty string, there was no error. |
73 | - if( empty( $wpdb->last_error ) ) { |
|
73 | + if ( empty( $wpdb->last_error ) ) { |
|
74 | 74 | $return = $wpdb->insert_id; |
75 | 75 | } else { |
76 | 76 | $return = new WP_Error( 'gravityview-add-note', $wpdb->last_error ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function delete_notes( $note_ids = array() ) { |
98 | 98 | |
99 | - if( !is_array( $note_ids ) ) { |
|
99 | + if ( ! is_array( $note_ids ) ) { |
|
100 | 100 | |
101 | 101 | gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) ); |
102 | 102 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ) |
158 | 158 | ); |
159 | 159 | |
160 | - return $results ? $results[0] : false; |
|
160 | + return $results ? $results[ 0 ] : false; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public static function filter_avatar( $avatar = '', $note = null ) { |
172 | 172 | |
173 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
174 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
173 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
174 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $avatar; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function remove() { |
78 | 78 | $shortcode = new static(); |
79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
80 | 80 | remove_shortcode( $shortcode->name ); |
81 | 81 | } |
82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
109 | 109 | |
110 | 110 | foreach ( $matches as $shortcode ) { |
111 | - $shortcode_name = $shortcode[2]; |
|
111 | + $shortcode_name = $shortcode[ 2 ]; |
|
112 | 112 | |
113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
114 | - $shortcode_content = $shortcode[5]; |
|
113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
114 | + $shortcode_content = $shortcode[ 5 ]; |
|
115 | 115 | |
116 | 116 | /** This is a registered GravityView shortcode. */ |
117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
118 | - $shortcode = clone self::$shortcodes[$shortcode_name]; |
|
117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
118 | + $shortcode = clone self::$shortcodes[ $shortcode_name ]; |
|
119 | 119 | } else { |
120 | 120 | /** This is some generic shortcode. */ |
121 | 121 | $shortcode = new self; |
@@ -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 | } |
@@ -710,10 +710,10 @@ discard block |
||
710 | 710 | /** Get connected form. */ |
711 | 711 | $view->form = GF_Form::by_id( $view->_gravityview_form_id ); |
712 | 712 | global $pagenow; |
713 | - if ( ! $view->form && 'post-new.php' !== $pagenow ) { |
|
713 | + if ( ! $view->form && 'post-new.php' !== $pagenow ) { |
|
714 | 714 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
715 | 715 | 'view_id' => $view->ID, |
716 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
716 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
717 | 717 | ) ); |
718 | 718 | } |
719 | 719 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * @since 2.0 |
844 | 844 | * @return bool Whether the offset exists or not, limited to GravityView_View_Data::$views element keys. |
845 | 845 | */ |
846 | - #[\ReturnTypeWillChange] |
|
846 | + #[\ReturnTypeWillChange ] |
|
847 | 847 | public function offsetExists( $offset ) { |
848 | 848 | $data_keys = array( 'id', 'view_id', 'form_id', 'template_id', 'atts', 'fields', 'widgets', 'form' ); |
849 | 849 | return in_array( $offset, $data_keys ); |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | * |
861 | 861 | * @return mixed The value of the requested view data key limited to GravityView_View_Data::$views element keys. If offset not found, return null. |
862 | 862 | */ |
863 | - #[\ReturnTypeWillChange] |
|
863 | + #[\ReturnTypeWillChange ] |
|
864 | 864 | public function offsetGet( $offset ) { |
865 | 865 | |
866 | 866 | gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' ); |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * |
898 | 898 | * @return void |
899 | 899 | */ |
900 | - #[\ReturnTypeWillChange] |
|
900 | + #[\ReturnTypeWillChange ] |
|
901 | 901 | public function offsetSet( $offset, $value ) { |
902 | 902 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
903 | 903 | } |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | * @since 2.0 |
911 | 911 | * @return void |
912 | 912 | */ |
913 | - #[\ReturnTypeWillChange] |
|
913 | + #[\ReturnTypeWillChange ] |
|
914 | 914 | public function offsetUnset( $offset ) { |
915 | 915 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
916 | 916 | } |
@@ -961,11 +961,11 @@ discard block |
||
961 | 961 | * Remove multiple sorting before calling legacy filters. |
962 | 962 | * This allows us to fake it till we make it. |
963 | 963 | */ |
964 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
964 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
965 | 965 | $has_multisort = true; |
966 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
967 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
968 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
966 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
967 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
968 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
@@ -974,31 +974,30 @@ discard block |
||
974 | 974 | */ |
975 | 975 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
976 | 976 | |
977 | - $parameters['context_view_id'] = $this->ID; |
|
977 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
978 | 978 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
979 | 979 | |
980 | 980 | if ( ! is_array( $parameters ) ) { |
981 | 981 | $parameters = array(); |
982 | 982 | } |
983 | 983 | |
984 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
985 | - $parameters['search_criteria'] = array(); |
|
984 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
985 | + $parameters[ 'search_criteria' ] = array(); |
|
986 | 986 | } |
987 | 987 | |
988 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
989 | - $parameters['search_criteria']['field_filters'] = array(); |
|
988 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
989 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | if ( $request instanceof REST\Request ) { |
993 | 993 | $atts = $this->settings->as_atts(); |
994 | 994 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
995 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
995 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
996 | 996 | ) ); |
997 | - $parameters['paging'] = $paging_parameters['paging']; |
|
997 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
998 | 998 | } |
999 | 999 | |
1000 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
1001 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
1000 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
1002 | 1001 | |
1003 | 1002 | /** |
1004 | 1003 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -1006,14 +1005,14 @@ discard block |
||
1006 | 1005 | $unique_field_filters = array(); |
1007 | 1006 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
1008 | 1007 | if ( 'mode' === $key ) { |
1009 | - $unique_field_filters['mode'] = $filter; |
|
1008 | + $unique_field_filters[ 'mode' ] = $filter; |
|
1010 | 1009 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
1011 | - $unique_field_filters[] = $filter; |
|
1010 | + $unique_field_filters[ ] = $filter; |
|
1012 | 1011 | } |
1013 | 1012 | } |
1014 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
1013 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
1015 | 1014 | |
1016 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
1015 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
1017 | 1016 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
1018 | 1017 | } |
1019 | 1018 | |
@@ -1022,7 +1021,7 @@ discard block |
||
1022 | 1021 | $query_class = $this->get_query_class(); |
1023 | 1022 | |
1024 | 1023 | /** @type \GF_Query $query */ |
1025 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1024 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1026 | 1025 | |
1027 | 1026 | /** |
1028 | 1027 | * Apply multisort. |
@@ -1033,15 +1032,15 @@ discard block |
||
1033 | 1032 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1034 | 1033 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1035 | 1034 | |
1036 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1035 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1037 | 1036 | |
1038 | - if( $has_sort_query_param ) { |
|
1039 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1037 | + if ( $has_sort_query_param ) { |
|
1038 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1040 | 1039 | } |
1041 | 1040 | |
1042 | 1041 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1043 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1044 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1042 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1043 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1045 | 1044 | } else { |
1046 | 1045 | $sort_field_ids = $view_setting_sort_field_ids; |
1047 | 1046 | $sort_directions = $view_setting_sort_directions; |
@@ -1049,7 +1048,7 @@ discard block |
||
1049 | 1048 | |
1050 | 1049 | $skip_first = false; |
1051 | 1050 | |
1052 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1051 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1053 | 1052 | |
1054 | 1053 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1055 | 1054 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1079,18 +1078,18 @@ discard block |
||
1079 | 1078 | |
1080 | 1079 | $merged_time = false; |
1081 | 1080 | |
1082 | - foreach ( $q['order'] as $oid => $order ) { |
|
1081 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1083 | 1082 | |
1084 | 1083 | $column = null; |
1085 | 1084 | |
1086 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1087 | - $column = $order[0]; |
|
1088 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1089 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
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 ) { |
|
1090 | 1089 | $orders[ $oid ] = $order; |
1091 | 1090 | continue; // Need something that resembles a single sort |
1092 | 1091 | } |
1093 | - $column = $order[0]->columns[0]; |
|
1092 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1094 | 1093 | } |
1095 | 1094 | |
1096 | 1095 | if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1104,7 +1103,7 @@ discard block |
||
1104 | 1103 | |
1105 | 1104 | $orders[ $oid ] = array( |
1106 | 1105 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1107 | - $order[1] // Mock it! |
|
1106 | + $order[ 1 ] // Mock it! |
|
1108 | 1107 | ); |
1109 | 1108 | |
1110 | 1109 | $merged_time = true; |
@@ -1115,15 +1114,15 @@ discard block |
||
1115 | 1114 | * ORDER again. |
1116 | 1115 | */ |
1117 | 1116 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1118 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1117 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1119 | 1118 | } |
1120 | 1119 | } |
1121 | 1120 | |
1122 | 1121 | return $sql; |
1123 | 1122 | } ); |
1124 | 1123 | |
1125 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1126 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1124 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1125 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1127 | 1126 | |
1128 | 1127 | /** |
1129 | 1128 | * Any joins? |
@@ -1146,7 +1145,7 @@ discard block |
||
1146 | 1145 | |
1147 | 1146 | $query_parameters = $query->_introspect(); |
1148 | 1147 | |
1149 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1148 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1150 | 1149 | } |
1151 | 1150 | |
1152 | 1151 | /** |
@@ -1180,7 +1179,7 @@ discard block |
||
1180 | 1179 | } |
1181 | 1180 | |
1182 | 1181 | $q = $query->_introspect(); |
1183 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1182 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1184 | 1183 | |
1185 | 1184 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1186 | 1185 | |
@@ -1205,7 +1204,7 @@ discard block |
||
1205 | 1204 | |
1206 | 1205 | $query_parameters = $query->_introspect(); |
1207 | 1206 | |
1208 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1207 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1209 | 1208 | } |
1210 | 1209 | } |
1211 | 1210 | |
@@ -1229,7 +1228,7 @@ discard block |
||
1229 | 1228 | $conditions = array(); |
1230 | 1229 | |
1231 | 1230 | foreach ( $condition->expressions as $_condition ) { |
1232 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1231 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1233 | 1232 | } |
1234 | 1233 | |
1235 | 1234 | return call_user_func_array( |
@@ -1258,10 +1257,10 @@ discard block |
||
1258 | 1257 | $q = new $query_class( $form_id ); |
1259 | 1258 | |
1260 | 1259 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1261 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1260 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1262 | 1261 | |
1263 | 1262 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1264 | - foreach ( $query_parameters['order'] as $order ) { |
|
1263 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1265 | 1264 | list( $column, $_order ) = $order; |
1266 | 1265 | |
1267 | 1266 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1275,15 +1274,15 @@ discard block |
||
1275 | 1274 | |
1276 | 1275 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1277 | 1276 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1278 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1277 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1279 | 1278 | |
1280 | 1279 | // Record the SQL |
1281 | - $unions_sql[] = array( |
|
1280 | + $unions_sql[ ] = array( |
|
1282 | 1281 | // Remove columns, we'll rebuild them |
1283 | 1282 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1284 | - 'from' => $sql['from'], |
|
1285 | - 'join' => $sql['join'], |
|
1286 | - 'where' => $sql['where'], |
|
1283 | + 'from' => $sql[ 'from' ], |
|
1284 | + 'join' => $sql[ 'join' ], |
|
1285 | + 'where' => $sql[ 'where' ], |
|
1287 | 1286 | // Remove order and limit |
1288 | 1287 | ); |
1289 | 1288 | |
@@ -1300,11 +1299,11 @@ discard block |
||
1300 | 1299 | |
1301 | 1300 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1302 | 1301 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1303 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1302 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1304 | 1303 | |
1305 | 1304 | // Remove columns, we'll rebuild them |
1306 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1307 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1305 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1306 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1308 | 1307 | |
1309 | 1308 | $unions = array(); |
1310 | 1309 | |
@@ -1315,30 +1314,30 @@ discard block |
||
1315 | 1314 | }; |
1316 | 1315 | |
1317 | 1316 | // Add all the order columns into the selects, so we can order by the whole union group |
1318 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1317 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1319 | 1318 | |
1320 | 1319 | $columns = array( |
1321 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1320 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1322 | 1321 | ); |
1323 | 1322 | |
1324 | 1323 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1325 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1324 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1326 | 1325 | |
1327 | 1326 | // Rewrite the order columns to the shared aliases |
1328 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1327 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1329 | 1328 | } |
1330 | 1329 | |
1331 | 1330 | $columns = array_unique( $columns ); |
1332 | 1331 | |
1333 | 1332 | // Add the columns to every UNION |
1334 | 1333 | foreach ( $unions_sql as $union_sql ) { |
1335 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1336 | - $unions []= implode( ' ', $union_sql ); |
|
1334 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1335 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1337 | 1336 | } |
1338 | 1337 | |
1339 | 1338 | // Add the columns to the main SELECT, but only grab the entry id column |
1340 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1341 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1339 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1340 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1342 | 1341 | |
1343 | 1342 | return $sql; |
1344 | 1343 | } ); |
@@ -1383,20 +1382,20 @@ discard block |
||
1383 | 1382 | } ); |
1384 | 1383 | } else { |
1385 | 1384 | $entries = $this->form->entries |
1386 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1385 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1387 | 1386 | ->offset( $this->settings->get( 'offset' ) ) |
1388 | - ->limit( $parameters['paging']['page_size'] ) |
|
1387 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1389 | 1388 | ->page( $page ); |
1390 | 1389 | |
1391 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1390 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1392 | 1391 | // Pluck off multisort arrays |
1393 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1392 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1394 | 1393 | } |
1395 | 1394 | |
1396 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1395 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1397 | 1396 | $field = new \GV\Field(); |
1398 | - $field->ID = $parameters['sorting']['key']; |
|
1399 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1397 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1398 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1400 | 1399 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1401 | 1400 | } |
1402 | 1401 | } |
@@ -1480,7 +1479,7 @@ discard block |
||
1480 | 1479 | $allowed = $headers = array(); |
1481 | 1480 | |
1482 | 1481 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1483 | - $allowed[] = $field; |
|
1482 | + $allowed[ ] = $field; |
|
1484 | 1483 | } |
1485 | 1484 | |
1486 | 1485 | $renderer = new Field_Renderer(); |
@@ -1502,17 +1501,17 @@ discard block |
||
1502 | 1501 | } ); |
1503 | 1502 | |
1504 | 1503 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1505 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1504 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1506 | 1505 | } |
1507 | 1506 | |
1508 | 1507 | foreach ( $allowed as $field ) { |
1509 | 1508 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1510 | 1509 | |
1511 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1510 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1512 | 1511 | |
1513 | 1512 | if ( ! $headers_done ) { |
1514 | 1513 | $label = $field->get_label( $view, $source, $entry ); |
1515 | - $headers[] = $label ? $label : $field->ID; |
|
1514 | + $headers[ ] = $label ? $label : $field->ID; |
|
1516 | 1515 | } |
1517 | 1516 | } |
1518 | 1517 | |
@@ -1610,7 +1609,7 @@ discard block |
||
1610 | 1609 | * @return void |
1611 | 1610 | */ |
1612 | 1611 | public function set_anchor_id( $counter = 1 ) { |
1613 | - $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int) $counter ); |
|
1612 | + $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int)$counter ); |
|
1614 | 1613 | } |
1615 | 1614 | |
1616 | 1615 | /** |
@@ -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 | /** |