Completed
Push — master ( 05ab62...574a1e )
by Zack
43:35 queued 26:02
created
future/includes/class-gv-template-view-table.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 	/**
22
-     * Constructor. Add filters to modify output.
23
-     *
22
+	 * Constructor. Add filters to modify output.
23
+	 *
24 24
 	 * @since 2.0.4
25 25
 	 *
26 26
 	 * @param View $view
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct( View $view, Entry_Collection $entries, Request $request ) {
31 31
 
32
-	    add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 );
32
+		add_filter( 'gravityview/template/field/label', array( __CLASS__, 'add_columns_sort_links' ), 100, 2 );
33 33
 
34 34
 		parent::__construct( $view, $entries, $request );
35 35
 	}
36 36
 
37 37
 	/**
38
-     * Add sorting links to HTML columns that support sorting
39
-     *
40
-     * @since 2.0.4
41
-     * @since 2.0.5 Made static
42
-     *
43
-     * @static
44
-     *
38
+	 * Add sorting links to HTML columns that support sorting
39
+	 *
40
+	 * @since 2.0.4
41
+	 * @since 2.0.5 Made static
42
+	 *
43
+	 * @static
44
+	 *
45 45
 	 * @param string $column_label Label for the table column
46 46
 	 * @param \GV\Template_Context $context
47 47
 	 *
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$sort_columns = $context->view->settings->get( 'sort_columns' );
53 53
 
54 54
 		if ( empty( $sort_columns ) ) {
55
-            return $column_label;
55
+			return $column_label;
56 56
 		}
57 57
 
58 58
 		if ( ! \GravityView_frontend::getInstance()->is_field_sortable( $context->field->ID, $context->view->form->form ) ) {
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 
115 115
 	/**
116
-     * Returns the label for a column, with support for all deprecated filters
117
-     *
118
-     * @since 2.1
119
-     *
116
+	 * Returns the label for a column, with support for all deprecated filters
117
+	 *
118
+	 * @since 2.1
119
+	 *
120 120
 	 * @param \GV\Field $field
121 121
 	 * @param \GV\Template_Context $context
122 122
 	 */
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$column_label = apply_filters( 'gravityview/template/field/label', $column_label, $context );
140 140
 
141 141
 		return $column_label;
142
-    }
142
+	}
143 143
 
144 144
 	/**
145 145
 	 * Output the entry row.
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
 				 */
209 209
 				do_action( 'gravityview/template/table/cells/before', $context );
210 210
 
211
-                /**
212
-                 * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
213
-                 * @since 1.0.7
211
+				/**
212
+				 * @action `gravityview_table_cells_before` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
213
+				 * @since 1.0.7
214 214
 				 * @param \GravityView_View $this Current GravityView_View object
215 215
 				 * @deprecated Use `gravityview/template/table/cells/before`
216
-                 */
217
-                do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
216
+				 */
217
+				do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
218 218
 
219
-                foreach ( $fields->all() as $field ) {
219
+				foreach ( $fields->all() as $field ) {
220 220
 					if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
221 221
 						if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
222 222
 							$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 				 */
237 237
 				do_action( 'gravityview/template/table/cells/after', $context );
238 238
 
239
-                /**
240
-                 * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
241
-                 * @since 1.0.7
239
+				/**
240
+				 * @action `gravityview_table_cells_after` Inside the `tr` while rendering each entry in the loop. Can be used to insert additional table cells.
241
+				 * @since 1.0.7
242 242
 				 * @param \GravityView_View $this Current GravityView_View object
243 243
 				 * @deprecated Use `gravityview/template/table/cells/after`
244
-                 */
245
-                do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() );
244
+				 */
245
+				do_action( 'gravityview_table_cells_after', \GravityView_View::getInstance() );
246 246
 
247 247
 				?>
248 248
 			</tr>
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 			'value' => $value,
284 284
 			'hide_empty' => false,
285 285
 			'zone_id' => 'directory_table-columns',
286
-            'label' => self::get_field_column_label( $field, $context ),
286
+			'label' => self::get_field_column_label( $field, $context ),
287 287
 			'markup' => '<td id="{{ field_id }}" class="{{ class }}" data-label="{{label_value:data-label}}">{{ value }}</td>',
288
-            'form' => $form,
288
+			'form' => $form,
289 289
 		);
290 290
 
291 291
 		/** Output. */
@@ -310,11 +310,11 @@  discard block
 block discarded – undo
310 310
 		do_action( 'gravityview/template/table/body/before', $context );
311 311
 
312 312
 		/**
313
-		* @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows.
314
-		* @deprecated Use `gravityview/template/table/body/before`
315
-		* @since 1.0.7
316
-		* @param \GravityView_View $gravityview_view Current GravityView_View object.
317
-		*/
313
+		 * @action `gravityview_table_body_before` Inside the `tbody`, before any rows are rendered. Can be used to insert additional rows.
314
+		 * @deprecated Use `gravityview/template/table/body/before`
315
+		 * @since 1.0.7
316
+		 * @param \GravityView_View $gravityview_view Current GravityView_View object.
317
+		 */
318 318
 		do_action( 'gravityview_table_body_before', \GravityView_View::getInstance() /** ugh! */ );
319 319
 	}
320 320
 
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 		do_action( 'gravityview/template/table/body/after', $context );
337 337
 
338 338
 		/**
339
-		* @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows.
340
-		* @deprecated Use `gravityview/template/table/body/after`
341
-		* @since 1.0.7
342
-		* @param \GravityView_View $gravityview_view Current GravityView_View object.
343
-		*/
339
+		 * @action `gravityview_table_body_after` Inside the `tbody`, after any rows are rendered. Can be used to insert additional rows.
340
+		 * @deprecated Use `gravityview/template/table/body/after`
341
+		 * @since 1.0.7
342
+		 * @param \GravityView_View $gravityview_view Current GravityView_View object.
343
+		 */
344 344
 		do_action( 'gravityview_table_body_after', \GravityView_View::getInstance() /** ugh! */ );
345 345
 	}
346 346
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
 			'dir' => 'asc',
71 71
 		);
72 72
 
73
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
73
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
74 74
 			//toggle sorting direction.
75
-			if ( 'asc' === $sorting['direction'] ) {
76
-				$sort_args['dir'] = 'desc';
75
+			if ( 'asc' === $sorting[ 'direction' ] ) {
76
+				$sort_args[ 'dir' ] = 'desc';
77 77
 				$class .= ' gv-icon-sort-desc';
78 78
 			} else {
79
-				$sort_args['dir'] = 'asc';
79
+				$sort_args[ 'dir' ] = 'asc';
80 80
 				$class .= ' gv-icon-sort-asc';
81 81
 			}
82 82
 		} else {
83 83
 			$class .= ' gv-icon-caret-up-down';
84 84
 		}
85 85
 
86
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
86
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
87 87
 
88
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $column_label;
88
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $column_label;
89 89
 	}
90 90
 
91 91
 	/**
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
                 do_action( 'gravityview_table_cells_before', \GravityView_View::getInstance() );
218 218
 
219 219
                 foreach ( $fields->all() as $field ) {
220
-					if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
221
-						if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
222
-							$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
220
+					if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) {
221
+						if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) {
222
+							$field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ];
223 223
 						} else {
224 224
 							if ( ! $field instanceof Internal_Field ) {
225 225
 								$field = Internal_Field::from_configuration( array( 'id' => 'custom' ) );
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
230 230
 		$script_source = empty( $script_min ) ? '/source' : '';
231 231
 
232
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
232
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
233 233
 
234 234
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
235 235
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
252 252
 	 */
253 253
 	public function register_no_conflict( $allowed ) {
254
-		$allowed[] = 'gravityview_searchwidget_admin';
254
+		$allowed[ ] = 'gravityview_searchwidget_admin';
255 255
 		return $allowed;
256 256
 	}
257 257
 
@@ -264,24 +264,24 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public static function get_searchable_fields() {
266 266
 
267
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
267
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
268 268
 			exit( '0' );
269 269
 		}
270 270
 
271 271
 		$form = '';
272 272
 
273 273
 		// Fetch the form for the current View
274
-		if ( ! empty( $_POST['view_id'] ) ) {
274
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
275 275
 
276
-			$form = gravityview_get_form_id( $_POST['view_id'] );
276
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
277 277
 
278
-		} elseif ( ! empty( $_POST['formid'] ) ) {
278
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
279 279
 
280
-			$form = (int) $_POST['formid'];
280
+			$form = (int)$_POST[ 'formid' ];
281 281
 
282
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
282
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
283 283
 
284
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
284
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
285 285
 
286 286
 		}
287 287
 
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		);
332 332
 
333 333
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
334
-			$custom_fields['is_approved'] = array(
334
+			$custom_fields[ 'is_approved' ] = array(
335 335
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
336 336
 				'type' => 'multi',
337 337
 			);
338 338
 		}
339 339
 
340
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
341
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
340
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
341
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
342 342
 		}
343 343
 
344 344
 		// Get fields with sub-inputs and no parent
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 
361 361
 			foreach ( $fields as $id => $field ) {
362 362
 
363
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
363
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
364 364
 					continue;
365 365
 				}
366 366
 
367
-				$types = self::get_search_input_types( $id, $field['type'] );
367
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
368 368
 
369
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
369
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
370 370
 			}
371 371
 		}
372 372
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
390 390
 
391 391
 		// @todo - This needs to be improved - many fields have . including products and addresses
392
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
392
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
393 393
 			$input_type = 'boolean'; // on/off checkbox
394 394
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
395 395
 			$input_type = 'multi'; //multiselect
@@ -433,19 +433,19 @@  discard block
 block discarded – undo
433 433
 			$post_id = 0;
434 434
 
435 435
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
436
-			if ( ! empty( $widget_args['post_id'] ) ) {
437
-				$post_id = absint( $widget_args['post_id'] );
436
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
437
+				$post_id = absint( $widget_args[ 'post_id' ] );
438 438
 			}
439 439
 			// We're in the WordPress Widget context, and the base View ID should be used
440
-			else if ( ! empty( $widget_args['view_id'] ) ) {
441
-				$post_id = absint( $widget_args['view_id'] );
440
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
441
+				$post_id = absint( $widget_args[ 'view_id' ] );
442 442
 			}
443 443
 
444 444
 			$args = gravityview_get_permalink_query_args( $post_id );
445 445
 
446 446
 			// Add hidden fields to the search form
447 447
 			foreach ( $args as $key => $value ) {
448
-				$search_fields[] = array(
448
+				$search_fields[ ] = array(
449 449
 					'name'  => $key,
450 450
 					'input' => 'hidden',
451 451
 					'value' => $value,
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
 		/**
485 485
 		 * Include the sidebar Widgets.
486 486
 		 */
487
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
487
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
488 488
 
489 489
 		foreach ( $widgets as $widget ) {
490
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
491
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
490
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
491
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
492 492
 					foreach ( $_fields as $field ) {
493
-						if ( empty( $field['form_id'] ) ) {
494
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
493
+						if ( empty( $field[ 'form_id' ] ) ) {
494
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
495 495
 						}
496
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
496
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
497 497
 					}
498 498
 				}
499 499
 			}
500 500
 		}
501 501
 
502 502
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
503
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
503
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
504 504
 				foreach ( $_fields as $field ) {
505
-					if ( empty( $field['form_id'] ) ) {
506
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
505
+					if ( empty( $field[ 'form_id' ] ) ) {
506
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
507 507
 					}
508
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
508
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
509 509
 				}
510 510
 			}
511 511
 		}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
536 536
 		}
537 537
 
538
-		if( 'post' === $this->search_method ) {
538
+		if ( 'post' === $this->search_method ) {
539 539
 			$get = $_POST;
540 540
 		} else {
541 541
 			$get = $_GET;
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
 		$get = gv_map_deep( $get, 'rawurldecode' );
555 555
 
556 556
 		// Make sure array key is set up
557
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
557
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
558 558
 
559 559
 		$searchable_fields = $this->get_view_searchable_fields( $view );
560 560
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
561 561
 
562 562
 		// add free search
563
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
563
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
564 564
 
565
-			$search_all_value = trim( $get['gv_search'] );
565
+			$search_all_value = trim( $get[ 'gv_search' ] );
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			}
588 588
 
589 589
 			foreach ( $words as $word ) {
590
-				$search_criteria['field_filters'][] = array(
590
+				$search_criteria[ 'field_filters' ][ ] = array(
591 591
 					'key' => null, // The field ID to search
592 592
 					'value' => $word, // The value to search
593 593
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -600,14 +600,14 @@  discard block
 block discarded – undo
600 600
 			/**
601 601
 			 * Get and normalize the dates according to the input format.
602 602
 			 */
603
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
604
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
603
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
604
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
605 605
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
606 606
 				}
607 607
 			}
608 608
 
609
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
610
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
609
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
610
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
611 611
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
612 612
 				}
613 613
 			}
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
 			 */
643 643
 			if ( ! empty( $curr_start ) ) {
644 644
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
645
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
645
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
646 646
 			}
647 647
 
648 648
 			if ( ! empty( $curr_end ) ) {
649 649
 				// Fast-forward 24 hour on the end time
650 650
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
651
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
651
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
654 654
 				}
655 655
 			}
656 656
 		}
657 657
 
658 658
 		// search for a specific entry ID
659 659
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
660
-			$search_criteria['field_filters'][] = array(
660
+			$search_criteria[ 'field_filters' ][ ] = array(
661 661
 				'key' => 'id',
662 662
 				'value' => absint( $get[ 'gv_id' ] ),
663 663
 				'operator' => '=',
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
 
667 667
 		// search for a specific Created_by ID
668 668
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
669
-			$search_criteria['field_filters'][] = array(
669
+			$search_criteria[ 'field_filters' ][ ] = array(
670 670
 				'key' => 'created_by',
671
-				'value' => $get['gv_by'],
671
+				'value' => $get[ 'gv_by' ],
672 672
 				'operator' => '=',
673 673
 			);
674 674
 		}
675 675
 
676 676
 		// Get search mode passed in URL
677
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
677
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
678 678
 
679 679
 		// get the other search filters
680 680
 		foreach ( $get as $key => $value ) {
681 681
 
682
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
682
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
683 683
 				continue;
684 684
 			}
685 685
 
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
 				continue;
690 690
 			}
691 691
 
692
-			if ( isset( $filter[0]['value'] ) ) {
693
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
692
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
693
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
694 694
 
695 695
 				// if date range type, set search mode to ALL
696
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
696
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
697 697
 					$mode = 'all';
698 698
 				}
699
-			} elseif( !empty( $filter ) ) {
700
-				$search_criteria['field_filters'][] = $filter;
699
+			} elseif ( ! empty( $filter ) ) {
700
+				$search_criteria[ 'field_filters' ][ ] = $filter;
701 701
 			}
702 702
 		}
703 703
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		 * @since 1.5.1
707 707
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
708 708
 		 */
709
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
709
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
710 710
 
711 711
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
712 712
 
@@ -740,19 +740,19 @@  discard block
 block discarded – undo
740 740
 
741 741
 		$query_class = $view->get_query_class();
742 742
 
743
-		if ( empty( $search_criteria['field_filters'] ) ) {
743
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
744 744
 			return;
745 745
 		}
746 746
 
747 747
 		$widgets = $view->widgets->by_id( $this->widget_id );
748 748
 		if ( $widgets->count() ) {
749 749
 			$widgets = $widgets->all();
750
-			$widget  = $widgets[0];
750
+			$widget  = $widgets[ 0 ];
751 751
 
752 752
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
753 753
 
754
-			foreach ( (array) $search_fields as $search_field ) {
755
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
754
+			foreach ( (array)$search_fields as $search_field ) {
755
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
756 756
 					$created_by_text_mode = true;
757 757
 				}
758 758
 			}
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 		$extra_conditions = array();
762 762
 		$mode = 'any';
763 763
 
764
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
764
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
765 765
 			if ( ! is_array( $filter ) ) {
766 766
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
767 767
 					$mode = $filter;
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 			}
771 771
 
772 772
 			// Construct a manual query for unapproved statuses
773
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
774
-				$_tmp_query       = new $query_class( $view->form->ID, array(
773
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
774
+				$_tmp_query = new $query_class( $view->form->ID, array(
775 775
 					'field_filters' => array(
776 776
 						array(
777 777
 							'operator' => 'in',
778 778
 							'key'      => 'is_approved',
779
-							'value'    => (array) $filter['value'],
779
+							'value'    => (array)$filter[ 'value' ],
780 780
 						),
781 781
 						array(
782 782
 							'operator' => 'is',
@@ -788,30 +788,30 @@  discard block
 block discarded – undo
788 788
 				) );
789 789
 				$_tmp_query_parts = $_tmp_query->_introspect();
790 790
 
791
-				$extra_conditions[] = $_tmp_query_parts['where'];
791
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
792 792
 
793 793
 				$filter = false;
794 794
 				continue;
795 795
 			}
796 796
 
797 797
 			// Construct manual query for text mode creator search
798
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
799
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
798
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
799
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
800 800
 				$filter = false;
801 801
 				continue;
802 802
 			}
803 803
 
804 804
 			// By default, we want searches to be wildcard for each field.
805
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
805
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
806 806
 
807 807
 			// For multichoice, let's have an in (OR) search.
808
-			if ( is_array( $filter['value'] ) ) {
809
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
808
+			if ( is_array( $filter[ 'value' ] ) ) {
809
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
810 810
 			}
811 811
 
812 812
 			// Default form with joins functionality
813
-			if ( empty( $filter['form_id'] ) ) {
814
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
813
+			if ( empty( $filter[ 'form_id' ] ) ) {
814
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
815 815
 			}
816 816
 
817 817
 			/**
@@ -821,12 +821,12 @@  discard block
 block discarded – undo
821 821
 			 * @since develop
822 822
 			 * @param \GV\View $view The View we're operating on.
823 823
 			 */
824
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
824
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
825 825
 		}
826 826
 
827 827
 		$search_conditions = array();
828 828
 
829
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
829
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
830 830
 
831 831
 			foreach ( $filters as $filter ) {
832 832
 				if ( ! is_array( $filter ) ) {
@@ -839,22 +839,22 @@  discard block
 block discarded – undo
839 839
 				 * code by reusing what's inside GF_Query already as they
840 840
 				 * take care of many small things like forcing numeric, etc.
841 841
 				 */
842
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
842
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
843 843
 				$_tmp_query_parts = $_tmp_query->_introspect();
844
-				$search_condition = $_tmp_query_parts['where'];
844
+				$search_condition = $_tmp_query_parts[ 'where' ];
845 845
 
846
-				if ( empty( $filter['key'] ) &&  $search_condition->expressions ) {
846
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
847 847
 					 foreach ( $search_condition->expressions as $condition ) {
848
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
848
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
849 849
 					 }
850 850
 				} else {
851 851
 					$left = $search_condition->left;
852 852
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
853 853
 
854 854
 					if ( $view->joins && $left->field_id == GF_Query_Column::META ) {
855
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
855
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
856 856
 					} else {
857
-						$search_conditions[] = new GF_Query_Condition(
857
+						$search_conditions[ ] = new GF_Query_Condition(
858 858
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
859 859
 							$search_condition->operator,
860 860
 							$search_condition->right
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		/**
877 877
 		 * Combine the parts as a new WHERE clause.
878 878
 		 */
879
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
879
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
880 880
 		$query->where( $where );
881 881
 	}
882 882
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 		$field_id = str_replace( 'filter_', '', $key );
900 900
 
901 901
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
902
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
902
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
903 903
 			$field_id = str_replace( '_', '.', $field_id );
904 904
 		}
905 905
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 			// form is in searchable fields
952 952
 			$found = false;
953 953
 			foreach ( $searchable_fields as $field ) {
954
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
954
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
955 955
 					$found = true;
956 956
 					break;
957 957
 				}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 
988 988
 			case 'select':
989 989
 			case 'radio':
990
-				$filter['operator'] = 'is';
990
+				$filter[ 'operator' ] = 'is';
991 991
 				break;
992 992
 
993 993
 			case 'post_category':
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 
1002 1002
 				foreach ( $value as $val ) {
1003 1003
 					$cat = get_term( $val, 'category' );
1004
-					$filter[] = array(
1004
+					$filter[ ] = array(
1005 1005
 						'key'      => $field_id,
1006 1006
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1007 1007
 						'operator' => 'is',
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 				$filter = array();
1021 1021
 
1022 1022
 				foreach ( $value as $val ) {
1023
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1023
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1024 1024
 				}
1025 1025
 
1026 1026
 				break;
@@ -1029,9 +1029,9 @@  discard block
 block discarded – undo
1029 1029
 				// convert checkbox on/off into the correct search filter
1030 1030
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1031 1031
 					foreach ( $form_field->inputs as $k => $input ) {
1032
-						if ( $input['id'] == $field_id ) {
1033
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1034
-							$filter['operator'] = 'is';
1032
+						if ( $input[ 'id' ] == $field_id ) {
1033
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1034
+							$filter[ 'operator' ] = 'is';
1035 1035
 							break;
1036 1036
 						}
1037 1037
 					}
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 					$filter = array();
1042 1042
 
1043 1043
 					foreach ( $value as $val ) {
1044
-						$filter[] = array(
1044
+						$filter[ ] = array(
1045 1045
 							'key'      => $field_id,
1046 1046
 							'value'    => $val,
1047 1047
 							'operator' => 'is',
@@ -1062,9 +1062,9 @@  discard block
 block discarded – undo
1062 1062
 					foreach ( $words as $word ) {
1063 1063
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1064 1064
 							// Keep the same key for each filter
1065
-							$filter['value'] = $word;
1065
+							$filter[ 'value' ] = $word;
1066 1066
 							// Add a search for the value
1067
-							$filters[] = $filter;
1067
+							$filters[ ] = $filter;
1068 1068
 						}
1069 1069
 					}
1070 1070
 
@@ -1078,19 +1078,19 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 					foreach ( $searchable_fields as $searchable_field ) {
1080 1080
 
1081
-						if( $form_field->ID !== $searchable_field['field'] ) {
1081
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1082 1082
 							continue;
1083 1083
 						}
1084 1084
 
1085 1085
 						// Only exact-match dropdowns, not text search
1086
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1086
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1087 1087
 							continue;
1088 1088
 						}
1089 1089
 
1090 1090
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1091 1091
 
1092 1092
 						if ( 4 === $input_id ) {
1093
-							$filter['operator'] = 'is';
1093
+							$filter[ 'operator' ] = 'is';
1094 1094
 						};
1095 1095
 					}
1096 1096
 				}
@@ -1117,12 +1117,12 @@  discard block
 block discarded – undo
1117 1117
 						 * @since 1.16.3
1118 1118
 						 * Safeguard until GF implements '<=' operator
1119 1119
 						 */
1120
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1120
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1121 1121
 							$operator = '<';
1122 1122
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1123 1123
 						}
1124 1124
 
1125
-						$filter[] = array(
1125
+						$filter[ ] = array(
1126 1126
 							'key'      => $field_id,
1127 1127
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1128 1128
 							'operator' => $operator,
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 					}
1131 1131
 				} else {
1132 1132
 					$date = $value;
1133
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1133
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1134 1134
 				}
1135 1135
 
1136 1136
 				break;
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 			'ymd_dot' => 'Y.m.d',
1162 1162
 		);
1163 1163
 
1164
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1164
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1165 1165
 			$format = $datepicker[ $field->dateFormat ];
1166 1166
 		}
1167 1167
 
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 	public function add_template_path( $file_paths ) {
1199 1199
 
1200 1200
 		// Index 100 is the default GravityView template path.
1201
-		$file_paths[102] = self::$file . 'templates/';
1201
+		$file_paths[ 102 ] = self::$file . 'templates/';
1202 1202
 
1203 1203
 		return $file_paths;
1204 1204
 	}
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 		$has_date = false;
1218 1218
 
1219 1219
 		foreach ( $search_fields as $k => $field ) {
1220
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1220
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1221 1221
 				$has_date = true;
1222 1222
 				break;
1223 1223
 			}
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 		}
1245 1245
 
1246 1246
 		// get configured search fields
1247
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1247
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1248 1248
 
1249 1249
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1250 1250
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1259,40 +1259,40 @@  discard block
 block discarded – undo
1259 1259
 
1260 1260
 			$updated_field = $this->get_search_filter_details( $updated_field );
1261 1261
 
1262
-			switch ( $field['field'] ) {
1262
+			switch ( $field[ 'field' ] ) {
1263 1263
 
1264 1264
 				case 'search_all':
1265
-					$updated_field['key'] = 'search_all';
1266
-					$updated_field['input'] = 'search_all';
1267
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1265
+					$updated_field[ 'key' ] = 'search_all';
1266
+					$updated_field[ 'input' ] = 'search_all';
1267
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1268 1268
 					break;
1269 1269
 
1270 1270
 				case 'entry_date':
1271
-					$updated_field['key'] = 'entry_date';
1272
-					$updated_field['input'] = 'entry_date';
1273
-					$updated_field['value'] = array(
1271
+					$updated_field[ 'key' ] = 'entry_date';
1272
+					$updated_field[ 'input' ] = 'entry_date';
1273
+					$updated_field[ 'value' ] = array(
1274 1274
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1275 1275
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1276 1276
 					);
1277 1277
 					break;
1278 1278
 
1279 1279
 				case 'entry_id':
1280
-					$updated_field['key'] = 'entry_id';
1281
-					$updated_field['input'] = 'entry_id';
1282
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1280
+					$updated_field[ 'key' ] = 'entry_id';
1281
+					$updated_field[ 'input' ] = 'entry_id';
1282
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1283 1283
 					break;
1284 1284
 
1285 1285
 				case 'created_by':
1286
-					$updated_field['key'] = 'created_by';
1287
-					$updated_field['name'] = 'gv_by';
1288
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1289
-					$updated_field['choices'] = self::get_created_by_choices();
1286
+					$updated_field[ 'key' ] = 'created_by';
1287
+					$updated_field[ 'name' ] = 'gv_by';
1288
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1289
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
1290 1290
 					break;
1291 1291
 				
1292 1292
 				case 'is_approved':
1293
-					$updated_field['key'] = 'is_approved';
1294
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1295
-					$updated_field['choices'] = self::get_is_approved_choices();
1293
+					$updated_field[ 'key' ] = 'is_approved';
1294
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1295
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1296 1296
 					break;
1297 1297
 			}
1298 1298
 
@@ -1311,16 +1311,16 @@  discard block
 block discarded – undo
1311 1311
 		 */
1312 1312
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1313 1313
 
1314
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1314
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1315 1315
 
1316 1316
 		/** @since 1.14 */
1317
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1317
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1318 1318
 
1319
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1319
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1320 1320
 
1321 1321
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1322 1322
 
1323
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1323
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1324 1324
 
1325 1325
 		if ( $this->has_date_field( $search_fields ) ) {
1326 1326
 			// enqueue datepicker stuff only if needed!
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
 	public static function get_search_class( $custom_class = '' ) {
1343 1343
 		$gravityview_view = GravityView_View::getInstance();
1344 1344
 
1345
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1345
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1346 1346
 
1347
-		if ( ! empty( $custom_class )  ) {
1348
-			$search_class .= ' '.$custom_class;
1347
+		if ( ! empty( $custom_class ) ) {
1348
+			$search_class .= ' ' . $custom_class;
1349 1349
 		}
1350 1350
 
1351 1351
 		/**
@@ -1389,9 +1389,9 @@  discard block
 block discarded – undo
1389 1389
 
1390 1390
 		if ( ! $label ) {
1391 1391
 
1392
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1392
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1393 1393
 
1394
-			switch( $field['field'] ) {
1394
+			switch ( $field[ 'field' ] ) {
1395 1395
 				case 'search_all':
1396 1396
 					$label = __( 'Search Entries:', 'gravityview' );
1397 1397
 					break;
@@ -1403,10 +1403,10 @@  discard block
 block discarded – undo
1403 1403
 					break;
1404 1404
 				default:
1405 1405
 					// If this is a field input, not a field
1406
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1406
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1407 1407
 
1408 1408
 						// Get the label for the field in question, which returns an array
1409
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1409
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1410 1410
 
1411 1411
 						// Get the item with the `label` key
1412 1412
 						$values = wp_list_pluck( $items, 'label' );
@@ -1445,32 +1445,32 @@  discard block
 block discarded – undo
1445 1445
 		$form = $gravityview_view->getForm();
1446 1446
 
1447 1447
 		// for advanced field ids (eg, first name / last name )
1448
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1448
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1449 1449
 
1450 1450
 		// get searched value from $_GET/$_POST (string or array)
1451 1451
 		$value = $this->rgget_or_rgpost( $name );
1452 1452
 
1453 1453
 		// get form field details
1454
-		$form_field = gravityview_get_field( $form, $field['field'] );
1454
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1455 1455
 
1456 1456
 		$filter = array(
1457
-			'key' => $field['field'],
1457
+			'key' => $field[ 'field' ],
1458 1458
 			'name' => $name,
1459 1459
 			'label' => self::get_field_label( $field, $form_field ),
1460
-			'input' => $field['input'],
1460
+			'input' => $field[ 'input' ],
1461 1461
 			'value' => $value,
1462
-			'type' => $form_field['type'],
1462
+			'type' => $form_field[ 'type' ],
1463 1463
 		);
1464 1464
 
1465 1465
 		// collect choices
1466
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1467
-			$filter['choices'] = gravityview_get_terms_choices();
1468
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1469
-			$filter['choices'] = $form_field['choices'];
1466
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1467
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1468
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1469
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1470 1470
 		}
1471 1471
 
1472
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1473
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1472
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1473
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1474 1474
 		}
1475 1475
 
1476 1476
 		return $filter;
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
 
1495 1495
 		$choices = array();
1496 1496
 		foreach ( $users as $user ) {
1497
-			$choices[] = array(
1497
+			$choices[ ] = array(
1498 1498
 				'value' => $user->ID,
1499 1499
 				'text' => $user->display_name,
1500 1500
 			);
@@ -1514,9 +1514,9 @@  discard block
 block discarded – undo
1514 1514
 
1515 1515
 		$choices = array();
1516 1516
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1517
-			$choices[] = array(
1518
-				'value' => $status['value'],
1519
-				'text' => $status['label'],
1517
+			$choices[ ] = array(
1518
+				'value' => $status[ 'value' ],
1519
+				'text' => $status[ 'label' ],
1520 1520
 			);
1521 1521
 		}
1522 1522
 
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
 	 */
1569 1569
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1570 1570
 
1571
-		$js_dependencies[] = 'jquery-ui-datepicker';
1571
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1572 1572
 
1573 1573
 		return $js_dependencies;
1574 1574
 	}
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
 			'isRTL'             => is_rtl(),
1613 1613
 		), $view_data );
1614 1614
 
1615
-		$localizations['datepicker'] = $datepicker_settings;
1615
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1616 1616
 
1617 1617
 		return $localizations;
1618 1618
 
@@ -1639,7 +1639,7 @@  discard block
 block discarded – undo
1639 1639
 	 * @return void
1640 1640
 	 */
1641 1641
 	private function maybe_enqueue_flexibility() {
1642
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1642
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1643 1643
 			wp_enqueue_script( 'gv-flexibility' );
1644 1644
 		}
1645 1645
 	}
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1662 1662
 
1663 1663
 		$scheme = is_ssl() ? 'https://' : 'http://';
1664
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1664
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1665 1665
 
1666 1666
 		/**
1667 1667
 		 * @filter `gravityview_search_datepicker_class`
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 	public function add_preview_inputs() {
1741 1741
 		global $wp;
1742 1742
 
1743
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1743
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1744 1744
 			return;
1745 1745
 		}
1746 1746
 
@@ -1765,7 +1765,7 @@  discard block
 block discarded – undo
1765 1765
  */
1766 1766
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1767 1767
 	public function __construct( $filter, $view ) {
1768
-		$this->value = $filter['value'];
1768
+		$this->value = $filter[ 'value' ];
1769 1769
 		$this->view = $view;
1770 1770
 	}
1771 1771
 
@@ -1797,11 +1797,11 @@  discard block
 block discarded – undo
1797 1797
 		$conditions = array();
1798 1798
 
1799 1799
 		foreach ( $user_fields as $user_field ) {
1800
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
1800
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
1801 1801
 		}
1802 1802
 
1803 1803
 		foreach ( $user_meta_fields as $meta_field ) {
1804
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
1804
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
1805 1805
 		}
1806 1806
 
1807 1807
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
@@ -1830,9 +1830,9 @@  discard block
 block discarded – undo
1830 1830
 
1831 1831
 		$conditions = array();
1832 1832
 
1833
-		foreach ( $parameters['aliases'] as $key => $alias ) {
1834
-			if ( 'm' == $alias[0] && preg_match( '#\d+_\d+#', $key ) ) {
1835
-				$conditions[] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1833
+		foreach ( $parameters[ 'aliases' ] as $key => $alias ) {
1834
+			if ( 'm' == $alias[ 0 ] && preg_match( '#\d+_\d+#', $key ) ) {
1835
+				$conditions[ ] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1836 1836
 					$this->search_condition->operator, $this->search_condition->right->sql( $query ), $alias );
1837 1837
 			}
1838 1838
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-template-view-list.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	public function the_field( \GV\Field $field, \GV\Entry $entry, $extras = null ) {
30 30
 		$form = $this->view->form;
31 31
 
32
-		if ( isset( $this->view->unions[ $entry['form_id'] ] ) ) {
33
-			if ( isset( $this->view->unions[ $entry['form_id'] ][ $field->ID ] ) ) {
34
-				$field = $this->view->unions[ $entry['form_id'] ][ $field->ID ];
32
+		if ( isset( $this->view->unions[ $entry[ 'form_id' ] ] ) ) {
33
+			if ( isset( $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ] ) ) {
34
+				$field = $this->view->unions[ $entry[ 'form_id' ] ][ $field->ID ];
35 35
 			} elseif ( ! $field instanceof Internal_Field ) {
36 36
 				$field = Internal_Field::from_configuration( array( 'id' => 'custom' ) );
37 37
 			}
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 		$hide_empty = apply_filters( 'gravityview/render/hide-empty-zone', Utils::get( $extras, 'hide_empty', $this->view->settings->get( 'hide_empty', false ) ), $context );
82 82
 
83 83
 		if ( is_numeric( $field->ID ) ) {
84
-			$extras['field'] = $field->as_configuration();
84
+			$extras[ 'field' ] = $field->as_configuration();
85 85
 		}
86 86
 
87
-		$extras['entry'] = $entry->as_entry();
88
-		$extras['hide_empty'] = $hide_empty;
89
-		$extras['label'] = $label;
90
-		$extras['value'] = $value;
87
+		$extras[ 'entry' ] = $entry->as_entry();
88
+		$extras[ 'hide_empty' ] = $hide_empty;
89
+		$extras[ 'label' ] = $label;
90
+		$extras[ 'value' ] = $value;
91 91
 
92 92
 		return \gravityview_field_output( $extras, $context );
93 93
 	}
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Spacing   +51 added lines, -52 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
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
 		/**
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 		$rule = array( sprintf( '%s/([^/]+)/csv/?', $slug ), 'index.php?gravityview=$matches[1]&csv=1', 'top' );
228 228
 
229 229
 		add_filter( 'query_vars', function( $query_vars ) { 
230
-			$query_vars[] = 'csv';
230
+			$query_vars[ ] = 'csv';
231 231
 			return $query_vars;
232 232
 		} );
233 233
 
234
-		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[0] ] ) ) {
234
+		if ( ! isset( $wp_rewrite->extra_rules_top[ $rule[ 0 ] ] ) ) {
235 235
 			call_user_func_array( 'add_rewrite_rule', $rule );
236 236
 		}
237 237
 	}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 			return $content;
301 301
 		}
302 302
 
303
-		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID );
303
+		$is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID );
304 304
 
305 305
 		/**
306 306
 		 * Editing a single entry.
307 307
 		 */
308 308
 		if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) {
309
-			if ( $entry['status'] != 'active' ) {
309
+			if ( $entry[ 'status' ] != 'active' ) {
310 310
 				gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
311 311
 				return __( 'You are not allowed to view this content.', 'gravityview' );
312 312
 			}
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 
319 319
 			if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) {
320
-				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
320
+				if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
321 321
 					gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
322 322
 					return __( 'You are not allowed to view this content.', 'gravityview' );
323 323
 				}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 
341 341
 			foreach ( $entryset as $e ) {
342 342
 
343
-				if ( 'active' !== $e['status'] ) {
343
+				if ( 'active' !== $e[ 'status' ] ) {
344 344
 					gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) );
345 345
 					return __( 'You are not allowed to view this content.', 'gravityview' );
346 346
 				}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 				}
352 352
 
353 353
 				if ( $show_only_approved && ! $is_admin_and_can_view ) {
354
-					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
354
+					if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
355 355
 						gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) );
356 356
 						return __( 'You are not allowed to view this content.', 'gravityview' );
357 357
 					}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 			$join_column    = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column );
527 527
 			$join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column );
528 528
 
529
-			$joins [] = new Join( $join, $join_column, $join_on, $join_on_column );
529
+			$joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column );
530 530
 		}
531 531
 
532 532
 		return $joins;
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 			}
622 622
 
623 623
 			foreach ( $_fields as $field ) {
624
-				if ( ! empty( $field['unions'] ) ) {
625
-					foreach ( $field['unions'] as $form_id => $field_id ) {
624
+				if ( ! empty( $field[ 'unions' ] ) ) {
625
+					foreach ( $field[ 'unions' ] as $form_id => $field_id ) {
626 626
 						if ( ! isset( $unions[ $form_id ] ) ) {
627 627
 							$unions[ $form_id ] = array();
628 628
 						}
629 629
 
630
-						$unions[ $form_id ][ $field['id'] ] =
630
+						$unions[ $form_id ][ $field[ 'id' ] ] =
631 631
 							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 );
632 632
 					}
633 633
 				}
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 		if ( ! $view->form ) {
677 677
 			gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array(
678 678
 				'view_id' => $view->ID,
679
-				'form_id' => $view->_gravityview_form_id ? : 0,
679
+				'form_id' => $view->_gravityview_form_id ?: 0,
680 680
 			) );
681 681
 		}
682 682
 
@@ -911,43 +911,42 @@  discard block
 block discarded – undo
911 911
 			 * @todo: Stop using _frontend and use something like $request->get_search_criteria() instead
912 912
 			 */
913 913
 			$parameters = \GravityView_frontend::get_view_entries_parameters( $this->settings->as_atts(), $this->form->ID );
914
-			$parameters['context_view_id'] = $this->ID;
914
+			$parameters[ 'context_view_id' ] = $this->ID;
915 915
 			$parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID );
916 916
 
917 917
 			if ( $request instanceof REST\Request ) {
918 918
 				$atts = $this->settings->as_atts();
919 919
 				$paging_parameters = wp_parse_args( $request->get_paging(), array(
920
-						'paging' => array( 'page_size' => $atts['page_size'] ),
920
+						'paging' => array( 'page_size' => $atts[ 'page_size' ] ),
921 921
 					) );
922
-				$parameters['paging'] = $paging_parameters['paging'];
922
+				$parameters[ 'paging' ] = $paging_parameters[ 'paging' ];
923 923
 			}
924 924
 
925
-			$page = Utils::get( $parameters['paging'], 'current_page' ) ?
926
-				: ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 );
925
+			$page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 );
927 926
 
928 927
 			/**
929 928
 			 * Cleanup duplicate field_filter parameters to simplify the query.
930 929
 			 */
931 930
 			$unique_field_filters = array();
932
-			foreach ( $parameters['search_criteria']['field_filters'] as $key => $filter ) {
931
+			foreach ( $parameters[ 'search_criteria' ][ 'field_filters' ] as $key => $filter ) {
933 932
 				if ( 'mode' === $key ) {
934
-					$unique_field_filters['mode'] = $filter;
933
+					$unique_field_filters[ 'mode' ] = $filter;
935 934
 				} else if ( ! in_array( $filter, $unique_field_filters ) ) {
936
-					$unique_field_filters[] = $filter;
935
+					$unique_field_filters[ ] = $filter;
937 936
 				}
938 937
 			}
939
-			$parameters['search_criteria']['field_filters'] = $unique_field_filters;
938
+			$parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters;
940 939
 
941
-			if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) {
940
+			if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) {
942 941
 				gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' );
943 942
 			}
944 943
 
945 944
 			if ( gravityview()->plugin->supports( Plugin::FEATURE_GFQUERY ) ) {
946 945
 				$query_class = $this->get_query_class();
947
-				$query = new $query_class( $this->form->ID, $parameters['search_criteria'], $parameters['sorting'] );
946
+				$query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], $parameters[ 'sorting' ] );
948 947
 
949
-				$query->limit( $parameters['paging']['page_size'] )
950
-					->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) );
948
+				$query->limit( $parameters[ 'paging' ][ 'page_size' ] )
949
+					->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) );
951 950
 
952 951
 				/**
953 952
 				 * Any joins?
@@ -970,7 +969,7 @@  discard block
 block discarded – undo
970 969
 
971 970
 							$query_parameters = $query->_introspect();
972 971
 
973
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
972
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
974 973
 						}
975 974
 
976 975
 
@@ -985,7 +984,7 @@  discard block
 block discarded – undo
985 984
 
986 985
 							$query_parameters = $query->_introspect();
987 986
 
988
-							$query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) );
987
+							$query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) );
989 988
 						}
990 989
 					}
991 990
 				
@@ -1009,7 +1008,7 @@  discard block
 block discarded – undo
1009 1008
 							$conditions = array();
1010 1009
 
1011 1010
 							foreach ( $condition->expressions as $_condition ) {
1012
-								$conditions[] = $recurse( $_condition, $fields, $recurse );
1011
+								$conditions[ ] = $recurse( $_condition, $fields, $recurse );
1013 1012
 							}
1014 1013
 
1015 1014
 							return call_user_func_array(
@@ -1038,10 +1037,10 @@  discard block
 block discarded – undo
1038 1037
 						$q = new $query_class( $form_id );
1039 1038
 
1040 1039
 						// Copy the WHERE clauses but substitute the field_ids to the respective ones
1041
-						$q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) );
1040
+						$q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) );
1042 1041
 
1043 1042
 						// Copy the ORDER clause and substitute the field_ids to the respective ones
1044
-						foreach ( $query_parameters['order'] as $order ) {
1043
+						foreach ( $query_parameters[ 'order' ] as $order ) {
1045 1044
 							list( $column, $_order ) = $order;
1046 1045
 
1047 1046
 							if ( $column && $column instanceof \GF_Query_Column ) {
@@ -1055,15 +1054,15 @@  discard block
 block discarded – undo
1055 1054
 
1056 1055
 						add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) {
1057 1056
 							// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1058
-							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1057
+							$select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1059 1058
 
1060 1059
 							// Record the SQL
1061
-							$unions_sql[] = array(
1060
+							$unions_sql[ ] = array(
1062 1061
 								// Remove columns, we'll rebuild them
1063 1062
 								'select'  => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ),
1064
-								'from'    => $sql['from'],
1065
-								'join'    => $sql['join'],
1066
-								'where'   => $sql['where'],
1063
+								'from'    => $sql[ 'from' ],
1064
+								'join'    => $sql[ 'join' ],
1065
+								'where'   => $sql[ 'where' ],
1067 1066
 								// Remove order and limit
1068 1067
 							);
1069 1068
 
@@ -1080,11 +1079,11 @@  discard block
 block discarded – undo
1080 1079
 
1081 1080
 					add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) {
1082 1081
 						// Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses
1083
-						$sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] );
1082
+						$sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] );
1084 1083
 
1085 1084
 						// Remove columns, we'll rebuild them
1086
-						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match );
1087
-						$sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] );
1085
+						preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match );
1086
+						$sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] );
1088 1087
 
1089 1088
 						$unions = array();
1090 1089
 
@@ -1095,30 +1094,30 @@  discard block
 block discarded – undo
1095 1094
 						};
1096 1095
 
1097 1096
 						// Add all the order columns into the selects, so we can order by the whole union group
1098
-						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches );
1097
+						preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches );
1099 1098
 						
1100 1099
 						$columns = array(
1101
-							sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) )
1100
+							sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) )
1102 1101
 						);
1103 1102
 
1104 1103
 						foreach ( array_slice( $order_matches, 1 ) as $match ) {
1105
-							$columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) );
1104
+							$columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) );
1106 1105
 
1107 1106
 							// Rewrite the order columns to the shared aliases
1108
-							$sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] );
1107
+							$sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] );
1109 1108
 						}
1110 1109
 
1111 1110
 						$columns = array_unique( $columns );
1112 1111
 
1113 1112
 						// Add the columns to every UNION
1114 1113
 						foreach ( $unions_sql as $union_sql ) {
1115
-							$union_sql['select'] .= implode( ', ', $columns );
1116
-							$unions []= implode( ' ', $union_sql );
1114
+							$union_sql[ 'select' ] .= implode( ', ', $columns );
1115
+							$unions [ ] = implode( ' ', $union_sql );
1117 1116
 						}
1118 1117
 
1119 1118
 						// Add the columns to the main SELECT, but only grab the entry id column
1120
-						$sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns );
1121
-						$sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order'];
1119
+						$sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns );
1120
+						$sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ];
1122 1121
 
1123 1122
 						return $sql;
1124 1123
 					} );
@@ -1159,15 +1158,15 @@  discard block
 block discarded – undo
1159 1158
 				} );
1160 1159
 			} else {
1161 1160
 				$entries = $this->form->entries
1162
-					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) )
1161
+					->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) )
1163 1162
 					->offset( $this->settings->get( 'offset' ) )
1164
-					->limit( $parameters['paging']['page_size'] )
1163
+					->limit( $parameters[ 'paging' ][ 'page_size' ] )
1165 1164
 					->page( $page );
1166 1165
 
1167
-				if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) {
1166
+				if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) {
1168 1167
 					$field = new \GV\Field();
1169
-					$field->ID = $parameters['sorting']['key'];
1170
-					$direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1168
+					$field->ID = $parameters[ 'sorting' ][ 'key' ];
1169
+					$direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC;
1171 1170
 					$entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) );
1172 1171
 				}
1173 1172
 			}
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	/**
90 90
 	 * @var string The REST API functionality identifier.
91 91
 	 */
92
-	const FEATURE_REST  = 'rest_api';
92
+	const FEATURE_REST = 'rest_api';
93 93
 
94 94
 	/**
95 95
 	 * Get the global instance of \GV\Plugin.
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		include_once $this->dir( 'includes/class-frontend-views.php' );
216 216
 		include_once $this->dir( 'includes/class-gravityview-admin-bar.php' );
217 217
 		include_once $this->dir( 'includes/class-gravityview-entry-list.php' );
218
-		include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
218
+		include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */
219 219
 		include_once $this->dir( 'includes/class-data.php' );
220 220
 		include_once $this->dir( 'includes/class-gravityview-shortcode.php' );
221 221
 		include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' );
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 
270 270
 		// Pre-4.6 loading
271 271
 		// TODO: Remove when GV minimum version is WordPress 4.6.0
272
-		$locale = apply_filters( 'plugin_locale', ( ( function_exists('get_user_locale') && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' );
272
+		$locale = apply_filters( 'plugin_locale', ( ( function_exists( 'get_user_locale' ) && is_admin() ) ? get_user_locale() : get_locale() ), 'gravityview' );
273 273
 
274
-		$loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir('languages'), $domain, $locale ) );
274
+		$loaded = load_textdomain( 'gravityview', sprintf( '%s/%s-%s.mo', $this->dir( 'languages' ), $domain, $locale ) );
275 275
 
276
-		if( $loaded ) {
276
+		if ( $loaded ) {
277 277
 			return;
278 278
 		}
279 279
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	public function is_compatible_wordpress( $version = null ) {
426 426
 
427
-		if( ! $version ) {
427
+		if ( ! $version ) {
428 428
 			$version = self::$min_wp_version;
429 429
 		}
430 430
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * @return string The version of PHP.
466 466
 	 */
467 467
 	private function get_php_version() {
468
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
469
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
468
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
469
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
470 470
 	}
471 471
 
472 472
 	/**
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 	 * @return string The version of WordPress.
478 478
 	 */
479 479
 	private function get_wordpress_version() {
480
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
481
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
480
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
481
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
482 482
 	}
483 483
 
484 484
 	/**
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 	 * @return string|null The version of Gravity Forms or null if inactive.
490 490
 	 */
491 491
 	private function get_gravityforms_version() {
492
-		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
492
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) {
493 493
 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
494 494
 			return null;
495 495
 		}
496 496
 
497
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
498
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
497
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
498
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
499 499
 	}
500 500
 
501 501
 	/**
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 		$tables = array();
553 553
 
554 554
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
555
-			$tables []= \GFFormsModel::get_entry_meta_table_name();
555
+			$tables [ ] = \GFFormsModel::get_entry_meta_table_name();
556 556
 		}
557
-		$tables []= \GFFormsModel::get_lead_meta_table_name();
557
+		$tables [ ] = \GFFormsModel::get_lead_meta_table_name();
558 558
 
559 559
 		foreach ( $tables as $meta_table ) {
560 560
 			$sql = "
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 		$tables = array();
573 573
 
574 574
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
575
-			$tables[] = \GFFormsModel::get_entry_notes_table_name();
575
+			$tables[ ] = \GFFormsModel::get_entry_notes_table_name();
576 576
 		}
577 577
 
578
-		$tables[] = \GFFormsModel::get_lead_notes_table_name();
578
+		$tables[ ] = \GFFormsModel::get_lead_notes_table_name();
579 579
 
580
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
581
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
580
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
581
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
582 582
 
583 583
 		$suppress = $wpdb->suppress_errors();
584 584
 		foreach ( $tables as $notes_table ) {
Please login to merge, or discard this patch.