Completed
Push — develop ( 05dc7a...4e4fee )
by Zack
18:30
created
includes/class-gravityview-change-entry-creator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 			array(
84 84
 				'ajaxurl'  => admin_url( 'admin-ajax.php' ),
85 85
 				'action'   => 'entry_creator_get_users',
86
-				'gf25'    => (bool) gravityview()->plugin->is_GF_25(),
86
+				'gf25'    => (bool)gravityview()->plugin->is_GF_25(),
87 87
 				'language' => array(
88 88
 					'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ),
89 89
 				),
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 			)
108 108
 		);
109 109
 
110
-		if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) {
110
+		if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) {
111 111
 			die();
112 112
 		}
113 113
 
114
-		$search_string = $post_var['q'];
114
+		$search_string = $post_var[ 'q' ];
115 115
 
116 116
 		if ( is_numeric( $search_string ) ) {
117 117
 			$user_args = array(
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		}
159 159
 
160 160
 		// Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing
161
-		$result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true );
161
+		$result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true );
162 162
 
163 163
 		if ( false === $result ) {
164 164
 			$status = __( 'Error', 'gravityview' );
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			return;
181 181
 		}
182 182
 
183
-		GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' );
183
+		GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' );
184 184
 
185 185
 	}
186 186
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		// If screen mode isn't set, then we're in the wrong place.
218
-		if ( empty( $_REQUEST['screen_mode'] ) ) {
218
+		if ( empty( $_REQUEST[ 'screen_mode' ] ) ) {
219 219
 			return;
220 220
 		}
221 221
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 		// If $_GET['screen_mode'] is set to edit, set $_POST value
243 243
 		if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) {
244
-			$_POST["screen_mode"] = 'edit';
244
+			$_POST[ "screen_mode" ] = 'edit';
245 245
 		}
246 246
 
247 247
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 		$entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' );
317 317
 
318 318
 		$entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) );
319
-		$entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array();
319
+		$entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array();
320 320
 
321 321
 		$output .= '<option value="0" ' . selected( true, empty( $entry_creator_user_id ), false ) . '> &mdash; ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' &mdash; </option>';
322 322
 
@@ -335,18 +335,18 @@  discard block
 block discarded – undo
335 335
 		}
336 336
 
337 337
 		$user_count      = count_users();
338
-		$user_count      = $user_count['total_users'];
338
+		$user_count      = $user_count[ 'total_users' ];
339 339
 		$users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 );
340 340
 		if ( $user_count > $users_displayed ) {
341 341
 			$remaining_users = $user_count - $users_displayed;
342
-			$user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users );
342
+			$user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users );
343 343
 			$message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' );
344 344
 			$message = sprintf( $message, $remaining_users, $user_users );
345
-			$output  .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>';
345
+			$output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>';
346 346
 		}
347 347
 
348 348
 		$output .= '</select>';
349
-		$output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />';
349
+		$output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />';
350 350
 		$output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false );
351 351
 
352 352
 		echo $output;
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @return array
361 361
 	 */
362 362
 	function register_gform_noconflict( $assets ) {
363
-		$assets[] = 'gravityview_selectwoo';
364
-		$assets[] = 'gravityview_entry_creator';
363
+		$assets[ ] = 'gravityview_selectwoo';
364
+		$assets[ ] = 'gravityview_entry_creator';
365 365
 
366 366
 		return $assets;
367 367
 	}
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			'search_clear' => array(
56 56
 				'type'  => 'checkbox',
57 57
 				'label' => __( 'Show Clear button', 'gravityview' ),
58
-				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'),
58
+				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ),
59 59
 				'value' => true,
60 60
 			),
61 61
 			'search_fields' => array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				'type' => 'radio',
69 69
 				'full_width' => true,
70 70
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
71
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
71
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
72 72
 				'value' => 'any',
73 73
 				'class' => 'hide-if-js',
74 74
 				'options' => array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
89 89
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
90
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
90
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
91 91
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
92 92
 
93 93
 			// ajax - get the searchable fields
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function add_reserved_args( $args ) {
125 125
 
126
-		$args[] = 'gv_search';
127
-		$args[] = 'gv_start';
128
-		$args[] = 'gv_end';
129
-		$args[] = 'gv_id';
130
-		$args[] = 'gv_by';
131
-		$args[] = 'mode';
126
+		$args[ ] = 'gv_search';
127
+		$args[ ] = 'gv_start';
128
+		$args[ ] = 'gv_end';
129
+		$args[ ] = 'gv_id';
130
+		$args[ ] = 'gv_by';
131
+		$args[ ] = 'mode';
132 132
 
133
-		$get = (array) $_GET;
133
+		$get = (array)$_GET;
134 134
 
135 135
 		// If the fields being searched as reserved; not to be considered user-passed variables
136 136
 		foreach ( $get as $key => $value ) {
137 137
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
138
-				$args[] = $key;
138
+				$args[ ] = $key;
139 139
 			}
140 140
 		}
141 141
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
260 260
 		$script_source = empty( $script_min ) ? '/source' : '';
261 261
 
262
-		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 );
262
+		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 );
263 263
 
264 264
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
265 265
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
282 282
 	 */
283 283
 	public function register_no_conflict( $allowed ) {
284
-		$allowed[] = 'gravityview_searchwidget_admin';
284
+		$allowed[ ] = 'gravityview_searchwidget_admin';
285 285
 		return $allowed;
286 286
 	}
287 287
 
@@ -293,24 +293,24 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public static function get_searchable_fields() {
295 295
 
296
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
296
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
297 297
 			exit( '0' );
298 298
 		}
299 299
 
300 300
 		$form = '';
301 301
 
302 302
 		// Fetch the form for the current View
303
-		if ( ! empty( $_POST['view_id'] ) ) {
303
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
304 304
 
305
-			$form = gravityview_get_form_id( $_POST['view_id'] );
305
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
306 306
 
307
-		} elseif ( ! empty( $_POST['formid'] ) ) {
307
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
308 308
 
309
-			$form = (int) $_POST['formid'];
309
+			$form = (int)$_POST[ 'formid' ];
310 310
 
311
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
311
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
312 312
 
313
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
313
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
314 314
 
315 315
 		}
316 316
 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
363
-			$custom_fields['is_approved'] = array(
363
+			$custom_fields[ 'is_approved' ] = array(
364 364
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
365 365
 				'type' => 'multi',
366 366
 			);
367 367
 		}
368 368
 
369
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
370
-			$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'] );
369
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
370
+			$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' ] );
371 371
 		}
372 372
 
373 373
 		// Get fields with sub-inputs and no parent
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 
390 390
 			foreach ( $fields as $id => $field ) {
391 391
 
392
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
392
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
393 393
 					continue;
394 394
 				}
395 395
 
396
-				$types = self::get_search_input_types( $id, $field['type'] );
396
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
397 397
 
398
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
398
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
399 399
 			}
400 400
 		}
401 401
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
419 419
 
420 420
 		// @todo - This needs to be improved - many fields have . including products and addresses
421
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
421
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
422 422
 			$input_type = 'boolean'; // on/off checkbox
423 423
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
424 424
 			$input_type = 'multi'; //multiselect
@@ -464,19 +464,19 @@  discard block
 block discarded – undo
464 464
 			$post_id = 0;
465 465
 
466 466
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
467
-			if ( ! empty( $widget_args['post_id'] ) ) {
468
-				$post_id = absint( $widget_args['post_id'] );
467
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
468
+				$post_id = absint( $widget_args[ 'post_id' ] );
469 469
 			}
470 470
 			// We're in the WordPress Widget context, and the base View ID should be used
471
-			else if ( ! empty( $widget_args['view_id'] ) ) {
472
-				$post_id = absint( $widget_args['view_id'] );
471
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
472
+				$post_id = absint( $widget_args[ 'view_id' ] );
473 473
 			}
474 474
 
475 475
 			$args = gravityview_get_permalink_query_args( $post_id );
476 476
 
477 477
 			// Add hidden fields to the search form
478 478
 			foreach ( $args as $key => $value ) {
479
-				$search_fields[] = array(
479
+				$search_fields[ ] = array(
480 480
 					'name'  => $key,
481 481
 					'input' => 'hidden',
482 482
 					'value' => $value,
@@ -515,28 +515,28 @@  discard block
 block discarded – undo
515 515
 		/**
516 516
 		 * Include the sidebar Widgets.
517 517
 		 */
518
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
518
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
519 519
 
520 520
 		foreach ( $widgets as $widget ) {
521
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
522
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
521
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
522
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
523 523
 					foreach ( $_fields as $field ) {
524
-						if ( empty( $field['form_id'] ) ) {
525
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
524
+						if ( empty( $field[ 'form_id' ] ) ) {
525
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
526 526
 						}
527
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
527
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
528 528
 					}
529 529
 				}
530 530
 			}
531 531
 		}
532 532
 
533 533
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
534
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
534
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
535 535
 				foreach ( $_fields as $field ) {
536
-					if ( empty( $field['form_id'] ) ) {
537
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
536
+					if ( empty( $field[ 'form_id' ] ) ) {
537
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
538 538
 					}
539
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
539
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
540 540
 				}
541 541
 			}
542 542
 		}
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
575 575
 		}
576 576
 
577
-		if( 'post' === $this->search_method ) {
577
+		if ( 'post' === $this->search_method ) {
578 578
 			$get = $_POST;
579 579
 		} else {
580 580
 			$get = $_GET;
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 		$get = gv_map_deep( $get, 'rawurldecode' );
594 594
 
595 595
 		// Make sure array key is set up
596
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
596
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
597 597
 
598 598
 		$searchable_fields = $this->get_view_searchable_fields( $view );
599 599
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
614 614
 
615 615
 		// add free search
616
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
616
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
617 617
 
618
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
618
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
619 619
 
620 620
 			if ( $split_words ) {
621 621
 				// Search for a piece
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 			}
632 632
 
633 633
 			foreach ( $words as $word ) {
634
-				$search_criteria['field_filters'][] = array(
634
+				$search_criteria[ 'field_filters' ][ ] = array(
635 635
 					'key' => null, // The field ID to search
636 636
 					'value' => $word, // The value to search
637 637
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 			/**
645 645
 			 * Get and normalize the dates according to the input format.
646 646
 			 */
647
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
648
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
647
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
648
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
649 649
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
650 650
 				}
651 651
 			}
652 652
 
653
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
654
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
653
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
654
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
655 655
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
656 656
 				}
657 657
 			}
@@ -687,22 +687,22 @@  discard block
 block discarded – undo
687 687
 			 */
688 688
 			if ( ! empty( $curr_start ) ) {
689 689
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
690
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
690
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
691 691
 			}
692 692
 
693 693
 			if ( ! empty( $curr_end ) ) {
694 694
 				// Fast-forward 24 hour on the end time
695 695
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
696
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
697
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
698
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
696
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
697
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
698
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
699 699
 				}
700 700
 			}
701 701
 		}
702 702
 
703 703
 		// search for a specific entry ID
704 704
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
705
-			$search_criteria['field_filters'][] = array(
705
+			$search_criteria[ 'field_filters' ][ ] = array(
706 706
 				'key' => 'id',
707 707
 				'value' => absint( $get[ 'gv_id' ] ),
708 708
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -711,15 +711,15 @@  discard block
 block discarded – undo
711 711
 
712 712
 		// search for a specific Created_by ID
713 713
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
714
-			$search_criteria['field_filters'][] = array(
714
+			$search_criteria[ 'field_filters' ][ ] = array(
715 715
 				'key' => 'created_by',
716
-				'value' => $get['gv_by'],
716
+				'value' => $get[ 'gv_by' ],
717 717
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
718 718
 			);
719 719
 		}
720 720
 
721 721
 		// Get search mode passed in URL
722
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
722
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
723 723
 
724 724
 		// get the other search filters
725 725
 		foreach ( $get as $key => $value ) {
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
729 729
 			}
730 730
 
731
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
731
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
732 732
 				continue; // Not a filter, or empty
733 733
 			}
734 734
 
@@ -742,21 +742,21 @@  discard block
 block discarded – undo
742 742
 				continue;
743 743
 			}
744 744
 
745
-			if ( ! isset( $filter['operator'] ) ) {
746
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
745
+			if ( ! isset( $filter[ 'operator' ] ) ) {
746
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
747 747
 			}
748 748
 
749
-			if ( isset( $filter[0]['value'] ) ) {
750
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
749
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
750
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
751 751
 
752
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
752
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
753 753
 
754 754
 				// if date range type, set search mode to ALL
755
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
755
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
756 756
 					$mode = 'all';
757 757
 				}
758
-			} elseif( !empty( $filter ) ) {
759
-				$search_criteria['field_filters'][] = $filter;
758
+			} elseif ( ! empty( $filter ) ) {
759
+				$search_criteria[ 'field_filters' ][ ] = $filter;
760 760
 			}
761 761
 		}
762 762
 
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		 * @since 1.5.1
766 766
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
767 767
 		 */
768
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
768
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
769 769
 
770 770
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
771 771
 
@@ -799,19 +799,19 @@  discard block
 block discarded – undo
799 799
 
800 800
 		$query_class = $view->get_query_class();
801 801
 
802
-		if ( empty( $search_criteria['field_filters'] ) ) {
802
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
803 803
 			return;
804 804
 		}
805 805
 
806 806
 		$widgets = $view->widgets->by_id( $this->widget_id );
807 807
 		if ( $widgets->count() ) {
808 808
 			$widgets = $widgets->all();
809
-			$widget  = $widgets[0];
809
+			$widget  = $widgets[ 0 ];
810 810
 
811 811
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
812 812
 
813
-			foreach ( (array) $search_fields as $search_field ) {
814
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
813
+			foreach ( (array)$search_fields as $search_field ) {
814
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
815 815
 					$created_by_text_mode = true;
816 816
 				}
817 817
 			}
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 		$extra_conditions = array();
821 821
 		$mode = 'any';
822 822
 
823
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
823
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
824 824
 			if ( ! is_array( $filter ) ) {
825 825
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
826 826
 					$mode = $filter;
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 			}
830 830
 
831 831
 			// Construct a manual query for unapproved statuses
832
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
833
-				$_tmp_query       = new $query_class( $view->form->ID, array(
832
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
833
+				$_tmp_query = new $query_class( $view->form->ID, array(
834 834
 					'field_filters' => array(
835 835
 						array(
836 836
 							'operator' => 'in',
837 837
 							'key'      => 'is_approved',
838
-							'value'    => (array) $filter['value'],
838
+							'value'    => (array)$filter[ 'value' ],
839 839
 						),
840 840
 						array(
841 841
 							'operator' => 'is',
@@ -847,30 +847,30 @@  discard block
 block discarded – undo
847 847
 				) );
848 848
 				$_tmp_query_parts = $_tmp_query->_introspect();
849 849
 
850
-				$extra_conditions[] = $_tmp_query_parts['where'];
850
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
851 851
 
852 852
 				$filter = false;
853 853
 				continue;
854 854
 			}
855 855
 
856 856
 			// Construct manual query for text mode creator search
857
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
858
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
857
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
858
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
859 859
 				$filter = false;
860 860
 				continue;
861 861
 			}
862 862
 
863 863
 			// By default, we want searches to be wildcard for each field.
864
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
864
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
865 865
 
866 866
 			// For multichoice, let's have an in (OR) search.
867
-			if ( is_array( $filter['value'] ) ) {
868
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
867
+			if ( is_array( $filter[ 'value' ] ) ) {
868
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
869 869
 			}
870 870
 
871 871
 			// Default form with joins functionality
872
-			if ( empty( $filter['form_id'] ) ) {
873
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
872
+			if ( empty( $filter[ 'form_id' ] ) ) {
873
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
874 874
 			}
875 875
 
876 876
 			/**
@@ -880,28 +880,28 @@  discard block
 block discarded – undo
880 880
 			 * @since develop
881 881
 			 * @param \GV\View $view The View we're operating on.
882 882
 			 */
883
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
883
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
884 884
 		}
885 885
 
886
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
886
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
887 887
 			$date_criteria = array();
888 888
 
889
-			if ( isset( $search_criteria['start_date'] ) ) {
890
-				$date_criteria['start_date'] = $search_criteria['start_date'];
889
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
890
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
891 891
 			}
892 892
 
893
-			if ( isset( $search_criteria['end_date'] ) ) {
894
-				$date_criteria['end_date'] = $search_criteria['end_date'];
893
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
894
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
895 895
 			}
896 896
 
897 897
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
898 898
 			$_tmp_query_parts   = $_tmp_query->_introspect();
899
-			$extra_conditions[] = $_tmp_query_parts['where'];
899
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
900 900
 		}
901 901
 
902 902
 		$search_conditions = array();
903 903
 
904
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
904
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
905 905
 			foreach ( $filters as &$filter ) {
906 906
 				if ( ! is_array( $filter ) ) {
907 907
 					continue;
@@ -913,12 +913,12 @@  discard block
 block discarded – undo
913 913
 				 * code by reusing what's inside GF_Query already as they
914 914
 				 * take care of many small things like forcing numeric, etc.
915 915
 				 */
916
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
916
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
917 917
 				$_tmp_query_parts = $_tmp_query->_introspect();
918
-				$search_condition = $_tmp_query_parts['where'];
918
+				$search_condition = $_tmp_query_parts[ 'where' ];
919 919
 
920
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
921
-					$search_conditions[] = $search_condition;
920
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
921
+					$search_conditions[ ] = $search_condition;
922 922
 				} else {
923 923
 					$left = $search_condition->left;
924 924
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 							$on = $_join->join_on;
929 929
 							$join = $_join->join;
930 930
 
931
-							$search_conditions[] = GF_Query_Condition::_or(
931
+							$search_conditions[ ] = GF_Query_Condition::_or(
932 932
 								// Join
933 933
 								new GF_Query_Condition(
934 934
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 							);
945 945
 						}
946 946
 					} else {
947
-						$search_conditions[] = new GF_Query_Condition(
947
+						$search_conditions[ ] = new GF_Query_Condition(
948 948
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
949 949
 							$search_condition->operator,
950 950
 							$search_condition->right
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		/**
967 967
 		 * Combine the parts as a new WHERE clause.
968 968
 		 */
969
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
969
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
970 970
 		$query->where( $where );
971 971
 	}
972 972
 
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 		$field_id = str_replace( 'filter_', '', $key );
990 990
 
991 991
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
992
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
992
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
993 993
 			$field_id = str_replace( '_', '.', $field_id );
994 994
 		}
995 995
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 			// form is in searchable fields
1047 1047
 			$found = false;
1048 1048
 			foreach ( $searchable_fields as $field ) {
1049
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1049
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1050 1050
 					$found = true;
1051 1051
 					break;
1052 1052
 				}
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 			case 'select':
1088 1088
 			case 'radio':
1089
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1089
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1090 1090
 				break;
1091 1091
 
1092 1092
 			case 'post_category':
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 				foreach ( $value as $val ) {
1102 1102
 					$cat = get_term( $val, 'category' );
1103
-					$filter[] = array(
1103
+					$filter[ ] = array(
1104 1104
 						'key'      => $field_id,
1105 1105
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1106 1106
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 				$filter = array();
1120 1120
 
1121 1121
 				foreach ( $value as $val ) {
1122
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1122
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1123 1123
 				}
1124 1124
 
1125 1125
 				break;
@@ -1128,9 +1128,9 @@  discard block
 block discarded – undo
1128 1128
 				// convert checkbox on/off into the correct search filter
1129 1129
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1130 1130
 					foreach ( $form_field->inputs as $k => $input ) {
1131
-						if ( $input['id'] == $field_id ) {
1132
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1133
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1131
+						if ( $input[ 'id' ] == $field_id ) {
1132
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1133
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1134 1134
 							break;
1135 1135
 						}
1136 1136
 					}
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 					$filter = array();
1141 1141
 
1142 1142
 					foreach ( $value as $val ) {
1143
-						$filter[] = array(
1143
+						$filter[ ] = array(
1144 1144
 							'key'      => $field_id,
1145 1145
 							'value'    => $val,
1146 1146
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1161,9 +1161,9 @@  discard block
 block discarded – undo
1161 1161
 					foreach ( $words as $word ) {
1162 1162
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1163 1163
 							// Keep the same key for each filter
1164
-							$filter['value'] = $word;
1164
+							$filter[ 'value' ] = $word;
1165 1165
 							// Add a search for the value
1166
-							$filters[] = $filter;
1166
+							$filters[ ] = $filter;
1167 1167
 						}
1168 1168
 					}
1169 1169
 
@@ -1177,19 +1177,19 @@  discard block
 block discarded – undo
1177 1177
 
1178 1178
 					foreach ( $searchable_fields as $searchable_field ) {
1179 1179
 
1180
-						if( $form_field->ID !== $searchable_field['field'] ) {
1180
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1181 1181
 							continue;
1182 1182
 						}
1183 1183
 
1184 1184
 						// Only exact-match dropdowns, not text search
1185
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1185
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1186 1186
 							continue;
1187 1187
 						}
1188 1188
 
1189 1189
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1190 1190
 
1191 1191
 						if ( 4 === $input_id ) {
1192
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1192
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1193 1193
 						};
1194 1194
 					}
1195 1195
 				}
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
 						 * @since 1.16.3
1218 1218
 						 * Safeguard until GF implements '<=' operator
1219 1219
 						 */
1220
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1220
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1221 1221
 							$operator = '<';
1222 1222
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1223 1223
 						}
1224 1224
 
1225
-						$filter[] = array(
1225
+						$filter[ ] = array(
1226 1226
 							'key'      => $field_id,
1227 1227
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1228 1228
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1230,12 +1230,12 @@  discard block
 block discarded – undo
1230 1230
 					}
1231 1231
 				} else {
1232 1232
 					$date = $value;
1233
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1234
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1233
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1234
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1235 1235
 				}
1236 1236
 
1237
-				if ('payment_date' === $key) {
1238
-					$filter['operator'] = 'contains';
1237
+				if ( 'payment_date' === $key ) {
1238
+					$filter[ 'operator' ] = 'contains';
1239 1239
 				}
1240 1240
 
1241 1241
 				break;
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 			'ymd_dot' => 'Y.m.d',
1265 1265
 		);
1266 1266
 
1267
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1267
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1268 1268
 			$format = $datepicker[ $field->dateFormat ];
1269 1269
 		}
1270 1270
 
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 	public function add_template_path( $file_paths ) {
1302 1302
 
1303 1303
 		// Index 100 is the default GravityView template path.
1304
-		$file_paths[102] = self::$file . 'templates/';
1304
+		$file_paths[ 102 ] = self::$file . 'templates/';
1305 1305
 
1306 1306
 		return $file_paths;
1307 1307
 	}
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		$has_date = false;
1321 1321
 
1322 1322
 		foreach ( $search_fields as $k => $field ) {
1323
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1323
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1324 1324
 				$has_date = true;
1325 1325
 				break;
1326 1326
 			}
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1350 1350
 
1351 1351
 		// get configured search fields
1352
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1352
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1353 1353
 
1354 1354
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1355 1355
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1363,39 +1363,39 @@  discard block
 block discarded – undo
1363 1363
 
1364 1364
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1365 1365
 
1366
-			switch ( $field['field'] ) {
1366
+			switch ( $field[ 'field' ] ) {
1367 1367
 
1368 1368
 				case 'search_all':
1369
-					$updated_field['key'] = 'search_all';
1370
-					$updated_field['input'] = 'search_all';
1371
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1369
+					$updated_field[ 'key' ] = 'search_all';
1370
+					$updated_field[ 'input' ] = 'search_all';
1371
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1372 1372
 					break;
1373 1373
 
1374 1374
 				case 'entry_date':
1375
-					$updated_field['key'] = 'entry_date';
1376
-					$updated_field['input'] = 'entry_date';
1377
-					$updated_field['value'] = array(
1375
+					$updated_field[ 'key' ] = 'entry_date';
1376
+					$updated_field[ 'input' ] = 'entry_date';
1377
+					$updated_field[ 'value' ] = array(
1378 1378
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1379 1379
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1380 1380
 					);
1381 1381
 					break;
1382 1382
 
1383 1383
 				case 'entry_id':
1384
-					$updated_field['key'] = 'entry_id';
1385
-					$updated_field['input'] = 'entry_id';
1386
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1384
+					$updated_field[ 'key' ] = 'entry_id';
1385
+					$updated_field[ 'input' ] = 'entry_id';
1386
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1387 1387
 					break;
1388 1388
 
1389 1389
 				case 'created_by':
1390
-					$updated_field['key'] = 'created_by';
1391
-					$updated_field['name'] = 'gv_by';
1392
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1390
+					$updated_field[ 'key' ] = 'created_by';
1391
+					$updated_field[ 'name' ] = 'gv_by';
1392
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1393 1393
 					break;
1394 1394
 
1395 1395
 				case 'is_approved':
1396
-					$updated_field['key'] = 'is_approved';
1397
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
-					$updated_field['choices'] = self::get_is_approved_choices();
1396
+					$updated_field[ 'key' ] = 'is_approved';
1397
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1399 1399
 					break;
1400 1400
 			}
1401 1401
 
@@ -1416,16 +1416,16 @@  discard block
 block discarded – undo
1416 1416
 
1417 1417
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1418 1418
 
1419
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1419
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1420 1420
 
1421 1421
 		/** @since 1.14 */
1422
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1422
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1423 1423
 
1424
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1424
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1425 1425
 
1426 1426
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1427 1427
 
1428
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1428
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1429 1429
 
1430 1430
 		if ( $this->has_date_field( $search_fields ) ) {
1431 1431
 			// enqueue datepicker stuff only if needed!
@@ -1447,10 +1447,10 @@  discard block
 block discarded – undo
1447 1447
 	public static function get_search_class( $custom_class = '' ) {
1448 1448
 		$gravityview_view = GravityView_View::getInstance();
1449 1449
 
1450
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1450
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1451 1451
 
1452
-		if ( ! empty( $custom_class )  ) {
1453
-			$search_class .= ' '.$custom_class;
1452
+		if ( ! empty( $custom_class ) ) {
1453
+			$search_class .= ' ' . $custom_class;
1454 1454
 		}
1455 1455
 
1456 1456
 		/**
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 
1502 1502
 		if ( ! $label ) {
1503 1503
 
1504
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1504
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1505 1505
 
1506
-			switch( $field['field'] ) {
1506
+			switch ( $field[ 'field' ] ) {
1507 1507
 				case 'search_all':
1508 1508
 					$label = __( 'Search Entries:', 'gravityview' );
1509 1509
 					break;
@@ -1515,10 +1515,10 @@  discard block
 block discarded – undo
1515 1515
 					break;
1516 1516
 				default:
1517 1517
 					// If this is a field input, not a field
1518
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1518
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1519 1519
 
1520 1520
 						// Get the label for the field in question, which returns an array
1521
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1521
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1522 1522
 
1523 1523
 						// Get the item with the `label` key
1524 1524
 						$values = wp_list_pluck( $items, 'label' );
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
 		$form = $gravityview_view->getForm();
1560 1560
 
1561 1561
 		// for advanced field ids (eg, first name / last name )
1562
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1562
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1563 1563
 
1564 1564
 		// get searched value from $_GET/$_POST (string or array)
1565 1565
 		$value = $this->rgget_or_rgpost( $name );
1566 1566
 
1567 1567
 		// get form field details
1568
-		$form_field = gravityview_get_field( $form, $field['field'] );
1568
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1569 1569
 
1570 1570
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1571 1571
 
@@ -1579,22 +1579,22 @@  discard block
 block discarded – undo
1579 1579
 		);
1580 1580
 
1581 1581
 		// collect choices
1582
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1583
-			$filter['choices'] = gravityview_get_terms_choices();
1584
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1585
-			$filter['choices'] = $form_field['choices'];
1582
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1583
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1584
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1585
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1586 1586
 		}
1587 1587
 
1588
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1589
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1588
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1589
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1590 1590
 		}
1591 1591
 
1592
-		if ( 'created_by' === $field['field'] ) {
1593
-			$filter['choices'] = self::get_created_by_choices( $context->view );
1594
-			$filter['type'] = 'created_by';
1592
+		if ( 'created_by' === $field[ 'field' ] ) {
1593
+			$filter[ 'choices' ] = self::get_created_by_choices( $context->view );
1594
+			$filter[ 'type' ] = 'created_by';
1595 1595
 		}
1596 1596
 
1597
-		if ( ! empty( $filter['choices'] ) ) {
1597
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1598 1598
 			/**
1599 1599
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1600 1600
 			 * @param[in,out] bool Yes or no.
@@ -1602,7 +1602,7 @@  discard block
 block discarded – undo
1602 1602
 			 * @param \GV\Context The context.
1603 1603
 			 */
1604 1604
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1605
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1605
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1606 1606
 			}
1607 1607
 		}
1608 1608
 
@@ -1631,12 +1631,12 @@  discard block
 block discarded – undo
1631 1631
 	 * @return array The filter choices.
1632 1632
 	 */
1633 1633
 	private function sieve_filter_choices( $filter, $context ) {
1634
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1634
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1635 1635
 			return $filter; // @todo Populate plugins might give us empty choices
1636 1636
 		}
1637 1637
 
1638 1638
 		// Allow only created_by and field-ids to be sieved.
1639
-		if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) {
1639
+		if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) {
1640 1640
 			return $filter;
1641 1641
 		}
1642 1642
 
@@ -1647,13 +1647,13 @@  discard block
 block discarded – undo
1647 1647
 		$entry_table_name = GFFormsModel::get_entry_table_name();
1648 1648
 		$entry_meta_table_name = GFFormsModel::get_entry_meta_table_name();
1649 1649
 
1650
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1650
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1651 1651
 
1652 1652
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1653 1653
 			case 'post_category':
1654 1654
 				$choices = $wpdb->get_col( $wpdb->prepare(
1655 1655
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1656
-					$key_like, $filter['key'], $form_id
1656
+					$key_like, $filter[ 'key' ], $form_id
1657 1657
 				) );
1658 1658
 				break;
1659 1659
 			case 'created_by':
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 			default:
1666 1666
 				$choices = $wpdb->get_col( $wpdb->prepare(
1667 1667
 					"SELECT DISTINCT meta_value FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1668
-					$key_like, $filter['key'], $form_id
1668
+					$key_like, $filter[ 'key' ], $form_id
1669 1669
 				) );
1670 1670
 
1671
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1671
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1672 1672
 					$choices = array_map( 'json_decode', $choices );
1673 1673
 					$_choices_array = array();
1674 1674
 					foreach ( $choices as $choice ) {
1675 1675
 						if ( is_array( $choice ) ) {
1676 1676
 							$_choices_array = array_merge( $_choices_array, $choice );
1677 1677
 						} else {
1678
-							$_choices_array []= $choice;
1678
+							$_choices_array [ ] = $choice;
1679 1679
 						}
1680 1680
 					}
1681 1681
 					$choices = array_unique( $_choices_array );
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
 		endswitch;
1686 1686
 
1687 1687
 		$filter_choices = array();
1688
-		foreach ( $filter['choices'] as $choice ) {
1689
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1690
-				$filter_choices[] = $choice;
1688
+		foreach ( $filter[ 'choices' ] as $choice ) {
1689
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1690
+				$filter_choices[ ] = $choice;
1691 1691
 			}
1692 1692
 		}
1693 1693
 
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
 			 * @param \GV\View $view The view.
1723 1723
 			 */
1724 1724
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1725
-			$choices[] = array(
1725
+			$choices[ ] = array(
1726 1726
 				'value' => $user->ID,
1727 1727
 				'text' => $text,
1728 1728
 			);
@@ -1742,9 +1742,9 @@  discard block
 block discarded – undo
1742 1742
 
1743 1743
 		$choices = array();
1744 1744
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1745
-			$choices[] = array(
1746
-				'value' => $status['value'],
1747
-				'text' => $status['label'],
1745
+			$choices[ ] = array(
1746
+				'value' => $status[ 'value' ],
1747
+				'text' => $status[ 'label' ],
1748 1748
 			);
1749 1749
 		}
1750 1750
 
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
 	 */
1797 1797
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1798 1798
 
1799
-		$js_dependencies[] = 'jquery-ui-datepicker';
1799
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1800 1800
 
1801 1801
 		return $js_dependencies;
1802 1802
 	}
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 			'isRTL'             => is_rtl(),
1841 1841
 		), $view_data );
1842 1842
 
1843
-		$localizations['datepicker'] = $datepicker_settings;
1843
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1844 1844
 
1845 1845
 		return $localizations;
1846 1846
 
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 	 * @return void
1868 1868
 	 */
1869 1869
 	private function maybe_enqueue_flexibility() {
1870
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1870
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1871 1871
 			wp_enqueue_script( 'gv-flexibility' );
1872 1872
 		}
1873 1873
 	}
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1890 1890
 
1891 1891
 		$scheme = is_ssl() ? 'https://' : 'http://';
1892
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1892
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1893 1893
 
1894 1894
 		/**
1895 1895
 		 * @filter `gravityview_search_datepicker_class`
@@ -1968,7 +1968,7 @@  discard block
 block discarded – undo
1968 1968
 	public function add_preview_inputs() {
1969 1969
 		global $wp;
1970 1970
 
1971
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1971
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1972 1972
 			return;
1973 1973
 		}
1974 1974
 
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
  */
2021 2021
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2022 2022
 	public function __construct( $filter, $view ) {
2023
-		$this->value = $filter['value'];
2023
+		$this->value = $filter[ 'value' ];
2024 2024
 		$this->view = $view;
2025 2025
 	}
2026 2026
 
@@ -2052,11 +2052,11 @@  discard block
 block discarded – undo
2052 2052
 		$conditions = array();
2053 2053
 
2054 2054
 		foreach ( $user_fields as $user_field ) {
2055
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2055
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2056 2056
 		}
2057 2057
 
2058 2058
 		foreach ( $user_meta_fields as $meta_field ) {
2059
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2059
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2060 2060
 		}
2061 2061
 
2062 2062
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.