Completed
Pull Request — master (#1147)
by Gennady
17:40
created
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 
25 25
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
26 26
 
27
-		unset( $field_options['search_filter'] );
27
+		unset( $field_options[ 'search_filter' ] );
28 28
 
29
-		if( 'edit' === $context ) {
29
+		if ( 'edit' === $context ) {
30 30
 			return $field_options;
31 31
 		}
32 32
 
33
-		$add_options['link_to_file'] = array(
33
+		$add_options[ 'link_to_file' ] = array(
34 34
 			'type' => 'checkbox',
35 35
 			'label' => __( 'Display as a Link:', 'gravityview' ),
36
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
36
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
37 37
 			'value' => false,
38 38
 			'merge_tags' => false,
39 39
 		);
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 			$base_id = null;
120 120
 
121 121
 			$is_single = gravityview_get_context() === 'single';
122
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
122
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
123 123
 			$field_compat = $gravityview_view->getCurrentField();
124 124
 		}
125 125
 
126 126
 		$output_arr = array();
127 127
 
128 128
 		// Get an array of file paths for the field.
129
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
129
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
130 130
 
131 131
 		// The $value JSON was probably truncated; let's check lead_detail_long.
132 132
 		if ( ! is_array( $file_paths ) ) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			$text = $rendered = null;
146 146
 
147 147
 			// If the site is HTTPS, use HTTPS
148
-			if ( function_exists('set_url_scheme') ) {
148
+			if ( function_exists( 'set_url_scheme' ) ) {
149 149
 				$file_path = set_url_scheme( $file_path );
150 150
 			}
151 151
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			$file_path_info = pathinfo( $file_path );
169 169
 
170 170
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
171
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
171
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
172 172
 
173 173
 			// Audio
174 174
 			if ( in_array( $extension, wp_get_audio_extensions() ) ) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 					 */
183 183
 					$audio_settings = apply_filters( 'gravityview_audio_settings', array(
184 184
 						'src' => $file_path,
185
-						'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
185
+						'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
186 186
 					), $context );
187 187
 
188 188
 					/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					 */
207 207
 					$video_settings = apply_filters( 'gravityview_video_settings', array(
208 208
 						'src' => $file_path,
209
-						'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
209
+						'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
210 210
 					), $context );
211 211
 
212 212
 					/**
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 			} else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) {
227 227
 				$image_atts = array(
228 228
 					'src' => $file_path,
229
-					'class' => 'gv-image gv-field-id-'.$field_settings['id'],
230
-					'alt' => $field_settings['label'],
229
+					'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
230
+					'alt' => $field_settings[ 'label' ],
231 231
 					'width' => ( $is_single ? NULL : 250 )
232 232
 				);
233 233
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 
242 242
 				$image = new GravityView_Image( $image_atts );
243 243
 
244
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
244
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
245 245
 
246 246
 				$text = $image->html();
247 247
 
248
-				if ( $lightbox && empty( $field_settings['show_as_link'] ) ) {
248
+				if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) {
249 249
 					$lightbox_link_atts = array(
250 250
 						'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ),
251 251
 						'class' => 'thickbox',
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context );
270 270
 
271 271
 			// Output textualized content where 
272
-			if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) && empty( $field_settings['show_as_link'] ) ) ) {
273
-				$content = empty( $text ) ? $file_path_info['basename'] : $text;
272
+			if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) && empty( $field_settings[ 'show_as_link' ] ) ) ) {
273
+				$content = empty( $text ) ? $file_path_info[ 'basename' ] : $text;
274 274
 
275 275
 				/**
276 276
 				 * Modify the link text (defaults to the file name)
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 
296 296
 				$content = gravityview_get_link( $file_path, $content, $link_atts );
297 297
 			} else {
298
-				$content = empty( $rendered ) ? ( empty( $text ) ? $file_path_info['basename'] : $text ) : $rendered;
298
+				$content = empty( $rendered ) ? ( empty( $text ) ? $file_path_info[ 'basename' ] : $text ) : $rendered;
299 299
 			}
300 300
 
301
-			$output_arr[] = array(
301
+			$output_arr[ ] = array(
302 302
 				'file_path' => $file_path,
303 303
 				'content' => $content
304 304
 			);
Please login to merge, or discard this patch.
future/includes/class-gv-shortcode-gravityview.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 			'detail' => null,
42 42
 		) );
43 43
 		
44
-		if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) {
45
-			if ( $atts['detail'] && $view = $request->is_view() ) {
44
+		if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) {
45
+			if ( $atts[ 'detail' ] && $view = $request->is_view() ) {
46 46
 				$view_id = $view->ID;
47 47
 			}
48 48
 		}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 			}
111 111
 		}
112 112
 
113
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
113
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
114 114
 
115 115
 		/**
116 116
 		 * View details.
117 117
 		 */
118
-		if ( $atts['detail'] ) {
118
+		if ( $atts[ 'detail' ] ) {
119 119
 			$entries = $view->get_entries( $request );
120 120
 			return self::_return( $this->detail( $view, $entries, $atts ) );
121 121
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				return self::_return( '' );
133 133
 			}
134 134
 
135
-			if ( $entry['status'] != 'active' ) {
135
+			if ( $entry[ 'status' ] != 'active' ) {
136 136
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
137 137
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
138 138
 			}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			}
144 144
 
145 145
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
146
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
146
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
147 147
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
148 148
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
149 149
 				}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				return self::_return( '' );
164 164
 			}
165 165
 
166
-			if ( $entry['status'] != 'active' ) {
166
+			if ( $entry[ 'status' ] != 'active' ) {
167 167
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
168 168
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
169 169
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			}
175 175
 
176 176
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
177
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
177
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
178 178
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
179 179
 					return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
180 180
 				}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
184 184
 
185
-			if( is_wp_error( $error ) ) {
185
+			if ( is_wp_error( $error ) ) {
186 186
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
187 187
 				return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) );
188 188
 			}
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 				
199 199
 				// Mock the request with the actual View, not the global one
200 200
 				$mock_request = new \GV\Mock_Request();
201
-				$mock_request->returns['is_view'] = $view;
202
-				$mock_request->returns['is_entry'] = $request->is_entry();
203
-				$mock_request->returns['is_edit_entry'] = $request->is_edit_entry();
204
-				$mock_request->returns['is_search'] = $request->is_search();
201
+				$mock_request->returns[ 'is_view' ] = $view;
202
+				$mock_request->returns[ 'is_entry' ] = $request->is_entry();
203
+				$mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry();
204
+				$mock_request->returns[ 'is_search' ] = $request->is_search();
205 205
 
206 206
 				$request = $mock_request;
207 207
 			}
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
238 238
 
239 239
 		// Only keep the passed attributes after making sure that they're valid pairs
240
-		$filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts );
240
+		$filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts );
241 241
 
242 242
 		$atts = array();
243 243
 
244
-		foreach( $filtered_atts as $key => $passed_value ) {
244
+		foreach ( $filtered_atts as $key => $passed_value ) {
245 245
 
246 246
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
247 247
 			$passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value );
248 248
 
249
-			switch( $defaults[ $key ]['type'] ) {
249
+			switch ( $defaults[ $key ][ 'type' ] ) {
250 250
 
251 251
 				/**
252 252
 				 * Make sure number fields are numeric.
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
255 255
 				 */
256 256
 				case 'number':
257
-					if( is_numeric( $passed_value ) ) {
257
+					if ( is_numeric( $passed_value ) ) {
258 258
 						$atts[ $key ] = ( $passed_value + 0 );
259 259
 					}
260 260
 					break;
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				 */
270 270
 				case 'select':
271 271
 				case 'radio':
272
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
273
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
272
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
273
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
274 274
 						$atts[ $key ] = $passed_value;
275 275
 					}
276 276
 					break;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 			}
283 283
 		}
284 284
 
285
-		$atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null );
285
+		$atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null );
286 286
 
287 287
 		return $atts;
288 288
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	private function detail( $view, $entries, $atts ) {
300 300
 		$output = '';
301 301
 
302
-		switch ( $key = $atts['detail'] ):
302
+		switch ( $key = $atts[ 'detail' ] ):
303 303
 			case 'total_entries':
304 304
 				$output = number_format_i18n( $entries->total() );
305 305
 				break;
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +25 added lines, -26 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		$supports = array( 'title', 'revisions' );
109 109
 
110 110
 		if ( $is_hierarchical ) {
111
-			$supports[] = 'page-attributes';
111
+			$supports[ ] = 'page-attributes';
112 112
 		}
113 113
 
114 114
 		/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
211 211
 
212 212
 		add_filter( 'query_vars', function( $query_vars ) { 
213
-			$query_vars[] = 'csv';
213
+			$query_vars[ ] = 'csv';
214 214
 			return $query_vars;
215 215
 		} );
216 216
 
217
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
217
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
218 218
 			call_user_func_array( 'add_rewrite_rule', $rule );
219 219
 		}
220 220
 	}
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
 			return $content;
283 283
 		}
284 284
 
285
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
285
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
286 286
 
287 287
 		/**
288 288
 		 * Editing a single entry.
289 289
 		 */
290 290
 		if ( $entry = $request->is_edit_entry() ) {
291
-			if ( $entry['status'] != 'active' ) {
291
+			if ( $entry[ 'status' ] != 'active' ) {
292 292
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
293 293
 				return __( 'You are not allowed to view this content.', 'gravityview' );
294 294
 			}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			}
300 300
 
301 301
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
302
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
302
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
303 303
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
304 304
 					return __( 'You are not allowed to view this content.', 'gravityview' );
305 305
 				}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		 * Viewing a single entry.
313 313
 		 */
314 314
 		} else if ( $entry = $request->is_entry() ) {
315
-			if ( $entry['status'] != 'active' ) {
315
+			if ( $entry[ 'status' ] != 'active' ) {
316 316
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
317 317
 				return __( 'You are not allowed to view this content.', 'gravityview' );
318 318
 			}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			}
324 324
 
325 325
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
326
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
326
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
327 327
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
328 328
 					return __( 'You are not allowed to view this content.', 'gravityview' );
329 329
 				}
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
 			$error = \GVCommon::check_entry_display( $entry->as_entry(), $view );
333 333
 
334
-			if( is_wp_error( $error ) ) {
334
+			if ( is_wp_error( $error ) ) {
335 335
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) );
336 336
 				return __( 'You are not allowed to view this content.', 'gravityview' );
337 337
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field( $join_column );
490 490
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field( $join_on_column );
491 491
 
492
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
492
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
493 493
 		}
494 494
 
495 495
 		return $joins;
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 
532 532
 			list( $join, $join_column, $join_on, $join_on_column ) = $meta;
533 533
 
534
-			$forms_ids [] = GF_Form::by_id( $join_on );
534
+			$forms_ids [ ] = GF_Form::by_id( $join_on );
535 535
 		}
536 536
 
537
-		return ( !empty( $forms_ids) ) ? $forms_ids : null;
537
+		return ( ! empty( $forms_ids ) ) ? $forms_ids : null;
538 538
 	}
539 539
 
540 540
 	/**
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 		if ( ! $view->form ) {
566 566
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
567 567
 				'view_id' => $view->ID,
568
-				'form_id' => $view->_gravityview_form_id ? : 0,
568
+				'form_id' => $view->_gravityview_form_id ?: 0,
569 569
 			) );
570 570
 		}
571 571
 
@@ -791,28 +791,27 @@  discard block
 block discarded – undo
791 791
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
792 792
 			 */
793 793
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID );
794
-			$parameters['context_view_id'] = $this->ID;
794
+			$parameters[ 'context_view_id' ] = $this->ID;
795 795
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
796 796
 
797 797
 			if ( $request instanceof REST\Request ) {
798 798
 				$atts = $this->settings->as_atts();
799 799
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
800
-						'paging' => array( 'page_size' => $atts['page_size'] ),
800
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
801 801
 					) );
802
-				$parameters['paging'] = $paging_parameters['paging'];
802
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
803 803
 			}
804 804
 
805
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
806
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
805
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
807 806
 
808 807
 			if ( gravityview()->plugin->supports( Plugin::FEATURE_GFQUERY ) ) {
809 808
 				/**
810 809
 				 * New \GF_Query stuff :)
811 810
 				 */
812
-				$query = new \GF_Query( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
811
+				$query = new \GF_Query( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
813 812
 
814
-				$query->limit( $parameters['paging']['page_size'] )
815
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
813
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
814
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
816 815
 
817 816
 				/**
818 817
 				 * Any joins?
@@ -852,15 +851,15 @@  discard block
 block discarded – undo
852 851
 				} );
853 852
 			} else {
854 853
 				$entries = $this->form->entries
855
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
854
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
856 855
 					->offset( $this->settings->get( 'offset' ) )
857
-					->limit( $parameters['paging']['page_size'] )
856
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
858 857
 					->page( $page );
859 858
 
860
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
859
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
861 860
 					$field = new \GV\Field();
862
-					$field->ID = $parameters['sorting']['key'];
863
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
861
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
862
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
864 863
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
865 864
 				}
866 865
 			}
Please login to merge, or discard this patch.