Completed
Push — develop ( 18b299...325502 )
by
unknown
16:28
created
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +175 added lines, -175 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(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
85 85
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
86
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
86
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
87 87
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
88 88
 
89 89
 			// ajax - get the searchable fields
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
226 226
 		$script_source = empty( $script_min ) ? '/source' : '';
227 227
 
228
-		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 );
228
+		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 );
229 229
 
230 230
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
231 231
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
248 248
 	 */
249 249
 	public function register_no_conflict( $allowed ) {
250
-		$allowed[] = 'gravityview_searchwidget_admin';
250
+		$allowed[ ] = 'gravityview_searchwidget_admin';
251 251
 		return $allowed;
252 252
 	}
253 253
 
@@ -259,24 +259,24 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public static function get_searchable_fields() {
261 261
 
262
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
262
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
263 263
 			exit( '0' );
264 264
 		}
265 265
 
266 266
 		$form = '';
267 267
 
268 268
 		// Fetch the form for the current View
269
-		if ( ! empty( $_POST['view_id'] ) ) {
269
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
270 270
 
271
-			$form = gravityview_get_form_id( $_POST['view_id'] );
271
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
272 272
 
273
-		} elseif ( ! empty( $_POST['formid'] ) ) {
273
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
274 274
 
275
-			$form = (int) $_POST['formid'];
275
+			$form = (int)$_POST[ 'formid' ];
276 276
 
277
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
277
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
278 278
 
279
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
279
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
280 280
 
281 281
 		}
282 282
 
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
 		);
327 327
 
328 328
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
329
-			$custom_fields['is_approved'] = array(
329
+			$custom_fields[ 'is_approved' ] = array(
330 330
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
331 331
 				'type' => 'multi',
332 332
 			);
333 333
 		}
334 334
 
335
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
336
-			$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'] );
335
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
336
+			$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' ] );
337 337
 		}
338 338
 
339 339
 		// Get fields with sub-inputs and no parent
@@ -355,13 +355,13 @@  discard block
 block discarded – undo
355 355
 
356 356
 			foreach ( $fields as $id => $field ) {
357 357
 
358
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
358
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
359 359
 					continue;
360 360
 				}
361 361
 
362
-				$types = self::get_search_input_types( $id, $field['type'] );
362
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
363 363
 
364
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
364
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
365 365
 			}
366 366
 		}
367 367
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
385 385
 
386 386
 		// @todo - This needs to be improved - many fields have . including products and addresses
387
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
387
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
388 388
 			$input_type = 'boolean'; // on/off checkbox
389 389
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
390 390
 			$input_type = 'multi'; //multiselect
@@ -430,19 +430,19 @@  discard block
 block discarded – undo
430 430
 			$post_id = 0;
431 431
 
432 432
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
433
-			if ( ! empty( $widget_args['post_id'] ) ) {
434
-				$post_id = absint( $widget_args['post_id'] );
433
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
434
+				$post_id = absint( $widget_args[ 'post_id' ] );
435 435
 			}
436 436
 			// We're in the WordPress Widget context, and the base View ID should be used
437
-			else if ( ! empty( $widget_args['view_id'] ) ) {
438
-				$post_id = absint( $widget_args['view_id'] );
437
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
438
+				$post_id = absint( $widget_args[ 'view_id' ] );
439 439
 			}
440 440
 
441 441
 			$args = gravityview_get_permalink_query_args( $post_id );
442 442
 
443 443
 			// Add hidden fields to the search form
444 444
 			foreach ( $args as $key => $value ) {
445
-				$search_fields[] = array(
445
+				$search_fields[ ] = array(
446 446
 					'name'  => $key,
447 447
 					'input' => 'hidden',
448 448
 					'value' => $value,
@@ -481,28 +481,28 @@  discard block
 block discarded – undo
481 481
 		/**
482 482
 		 * Include the sidebar Widgets.
483 483
 		 */
484
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
484
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
485 485
 
486 486
 		foreach ( $widgets as $widget ) {
487
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
488
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
487
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
488
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
489 489
 					foreach ( $_fields as $field ) {
490
-						if ( empty( $field['form_id'] ) ) {
491
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
490
+						if ( empty( $field[ 'form_id' ] ) ) {
491
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
492 492
 						}
493
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
493
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
494 494
 					}
495 495
 				}
496 496
 			}
497 497
 		}
498 498
 
499 499
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
500
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
500
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
501 501
 				foreach ( $_fields as $field ) {
502
-					if ( empty( $field['form_id'] ) ) {
503
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
502
+					if ( empty( $field[ 'form_id' ] ) ) {
503
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
504 504
 					}
505
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
505
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
506 506
 				}
507 507
 			}
508 508
 		}
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
541 541
 		}
542 542
 
543
-		if( 'post' === $this->search_method ) {
543
+		if ( 'post' === $this->search_method ) {
544 544
 			$get = $_POST;
545 545
 		} else {
546 546
 			$get = $_GET;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		$get = gv_map_deep( $get, 'rawurldecode' );
560 560
 
561 561
 		// Make sure array key is set up
562
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
562
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
563 563
 
564 564
 		$searchable_fields = $this->get_view_searchable_fields( $view );
565 565
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
580 580
 
581 581
 		// add free search
582
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
582
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
583 583
 
584
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
584
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
585 585
 
586 586
 			if ( $split_words ) {
587 587
 				// Search for a piece
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 			}
598 598
 
599 599
 			foreach ( $words as $word ) {
600
-				$search_criteria['field_filters'][] = array(
600
+				$search_criteria[ 'field_filters' ][ ] = array(
601 601
 					'key' => null, // The field ID to search
602 602
 					'value' => $word, // The value to search
603 603
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -610,14 +610,14 @@  discard block
 block discarded – undo
610 610
 			/**
611 611
 			 * Get and normalize the dates according to the input format.
612 612
 			 */
613
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
614
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
613
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
614
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
615 615
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
616 616
 				}
617 617
 			}
618 618
 
619
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
620
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
619
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
620
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
621 621
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
622 622
 				}
623 623
 			}
@@ -652,22 +652,22 @@  discard block
 block discarded – undo
652 652
 			 */
653 653
 			if ( ! empty( $curr_start ) ) {
654 654
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
655
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
655
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
656 656
 			}
657 657
 
658 658
 			if ( ! empty( $curr_end ) ) {
659 659
 				// Fast-forward 24 hour on the end time
660 660
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
661
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
662
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
663
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
661
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
662
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
663
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
664 664
 				}
665 665
 			}
666 666
 		}
667 667
 
668 668
 		// search for a specific entry ID
669 669
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
670
-			$search_criteria['field_filters'][] = array(
670
+			$search_criteria[ 'field_filters' ][ ] = array(
671 671
 				'key' => 'id',
672 672
 				'value' => absint( $get[ 'gv_id' ] ),
673 673
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -676,22 +676,22 @@  discard block
 block discarded – undo
676 676
 
677 677
 		// search for a specific Created_by ID
678 678
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
679
-			$search_criteria['field_filters'][] = array(
679
+			$search_criteria[ 'field_filters' ][ ] = array(
680 680
 				'key' => 'created_by',
681
-				'value' => $get['gv_by'],
681
+				'value' => $get[ 'gv_by' ],
682 682
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
683 683
 			);
684 684
 		}
685 685
 
686 686
 		// Get search mode passed in URL
687
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
687
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
688 688
 
689 689
 		// get the other search filters
690 690
 		foreach ( $get as $key => $value ) {
691 691
 
692 692
 			$value = $trim_search_value ? trim( $value ) : $value;
693 693
 
694
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
694
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
695 695
 				continue; // Not a filter, or empty
696 696
 			}
697 697
 
@@ -705,21 +705,21 @@  discard block
 block discarded – undo
705 705
 				continue;
706 706
 			}
707 707
 
708
-			if ( ! isset( $filter['operator'] ) ) {
709
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
708
+			if ( ! isset( $filter[ 'operator' ] ) ) {
709
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
710 710
 			}
711 711
 
712
-			if ( isset( $filter[0]['value'] ) ) {
713
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
712
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
713
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
714 714
 
715
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
715
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
716 716
 
717 717
 				// if date range type, set search mode to ALL
718
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
718
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
719 719
 					$mode = 'all';
720 720
 				}
721
-			} elseif( !empty( $filter ) ) {
722
-				$search_criteria['field_filters'][] = $filter;
721
+			} elseif ( ! empty( $filter ) ) {
722
+				$search_criteria[ 'field_filters' ][ ] = $filter;
723 723
 			}
724 724
 		}
725 725
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 		 * @since 1.5.1
729 729
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
730 730
 		 */
731
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
731
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
732 732
 
733 733
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
734 734
 
@@ -762,19 +762,19 @@  discard block
 block discarded – undo
762 762
 
763 763
 		$query_class = $view->get_query_class();
764 764
 
765
-		if ( empty( $search_criteria['field_filters'] ) ) {
765
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
766 766
 			return;
767 767
 		}
768 768
 
769 769
 		$widgets = $view->widgets->by_id( $this->widget_id );
770 770
 		if ( $widgets->count() ) {
771 771
 			$widgets = $widgets->all();
772
-			$widget  = $widgets[0];
772
+			$widget  = $widgets[ 0 ];
773 773
 
774 774
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
775 775
 
776
-			foreach ( (array) $search_fields as $search_field ) {
777
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
776
+			foreach ( (array)$search_fields as $search_field ) {
777
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
778 778
 					$created_by_text_mode = true;
779 779
 				}
780 780
 			}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 		$extra_conditions = array();
784 784
 		$mode = 'any';
785 785
 
786
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
786
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
787 787
 			if ( ! is_array( $filter ) ) {
788 788
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
789 789
 					$mode = $filter;
@@ -792,13 +792,13 @@  discard block
 block discarded – undo
792 792
 			}
793 793
 
794 794
 			// Construct a manual query for unapproved statuses
795
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
796
-				$_tmp_query       = new $query_class( $view->form->ID, array(
795
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
796
+				$_tmp_query = new $query_class( $view->form->ID, array(
797 797
 					'field_filters' => array(
798 798
 						array(
799 799
 							'operator' => 'in',
800 800
 							'key'      => 'is_approved',
801
-							'value'    => (array) $filter['value'],
801
+							'value'    => (array)$filter[ 'value' ],
802 802
 						),
803 803
 						array(
804 804
 							'operator' => 'is',
@@ -810,30 +810,30 @@  discard block
 block discarded – undo
810 810
 				) );
811 811
 				$_tmp_query_parts = $_tmp_query->_introspect();
812 812
 
813
-				$extra_conditions[] = $_tmp_query_parts['where'];
813
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
814 814
 
815 815
 				$filter = false;
816 816
 				continue;
817 817
 			}
818 818
 
819 819
 			// Construct manual query for text mode creator search
820
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
821
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
820
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
821
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
822 822
 				$filter = false;
823 823
 				continue;
824 824
 			}
825 825
 
826 826
 			// By default, we want searches to be wildcard for each field.
827
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
827
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
828 828
 
829 829
 			// For multichoice, let's have an in (OR) search.
830
-			if ( is_array( $filter['value'] ) ) {
831
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
830
+			if ( is_array( $filter[ 'value' ] ) ) {
831
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
832 832
 			}
833 833
 
834 834
 			// Default form with joins functionality
835
-			if ( empty( $filter['form_id'] ) ) {
836
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
835
+			if ( empty( $filter[ 'form_id' ] ) ) {
836
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
837 837
 			}
838 838
 
839 839
 			/**
@@ -843,28 +843,28 @@  discard block
 block discarded – undo
843 843
 			 * @since develop
844 844
 			 * @param \GV\View $view The View we're operating on.
845 845
 			 */
846
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
846
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
847 847
 		}
848 848
 
849
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
849
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
850 850
 			$date_criteria = array();
851 851
 
852
-			if ( isset( $search_criteria['start_date'] ) ) {
853
-				$date_criteria['start_date'] = $search_criteria['start_date'];
852
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
853
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
854 854
 			}
855 855
 
856
-			if ( isset( $search_criteria['end_date'] ) ) {
857
-				$date_criteria['end_date'] = $search_criteria['end_date'];
856
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
857
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
858 858
 			}
859 859
 
860 860
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
861 861
 			$_tmp_query_parts   = $_tmp_query->_introspect();
862
-			$extra_conditions[] = $_tmp_query_parts['where'];
862
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
863 863
 		}
864 864
 
865 865
 		$search_conditions = array();
866 866
 
867
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
867
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
868 868
 			foreach ( $filters as &$filter ) {
869 869
 				if ( ! is_array( $filter ) ) {
870 870
 					continue;
@@ -876,12 +876,12 @@  discard block
 block discarded – undo
876 876
 				 * code by reusing what's inside GF_Query already as they
877 877
 				 * take care of many small things like forcing numeric, etc.
878 878
 				 */
879
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
879
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
880 880
 				$_tmp_query_parts = $_tmp_query->_introspect();
881
-				$search_condition = $_tmp_query_parts['where'];
881
+				$search_condition = $_tmp_query_parts[ 'where' ];
882 882
 
883
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
884
-					$search_conditions[] = $search_condition;
883
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
884
+					$search_conditions[ ] = $search_condition;
885 885
 				} else {
886 886
 					$left = $search_condition->left;
887 887
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 							$on = $_join->join_on;
892 892
 							$join = $_join->join;
893 893
 
894
-							$search_conditions[] = GF_Query_Condition::_or(
894
+							$search_conditions[ ] = GF_Query_Condition::_or(
895 895
 								// Join
896 896
 								new GF_Query_Condition(
897 897
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 							);
908 908
 						}
909 909
 					} else {
910
-						$search_conditions[] = new GF_Query_Condition(
910
+						$search_conditions[ ] = new GF_Query_Condition(
911 911
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
912 912
 							$search_condition->operator,
913 913
 							$search_condition->right
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 		/**
930 930
 		 * Combine the parts as a new WHERE clause.
931 931
 		 */
932
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
932
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
933 933
 		$query->where( $where );
934 934
 	}
935 935
 
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 		$field_id = str_replace( 'filter_', '', $key );
953 953
 
954 954
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
955
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
955
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
956 956
 			$field_id = str_replace( '_', '.', $field_id );
957 957
 		}
958 958
 
@@ -1009,7 +1009,7 @@  discard block
 block discarded – undo
1009 1009
 			// form is in searchable fields
1010 1010
 			$found = false;
1011 1011
 			foreach ( $searchable_fields as $field ) {
1012
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1012
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1013 1013
 					$found = true;
1014 1014
 					break;
1015 1015
 				}
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
 			case 'select':
1051 1051
 			case 'radio':
1052
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1052
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1053 1053
 				break;
1054 1054
 
1055 1055
 			case 'post_category':
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
 				foreach ( $value as $val ) {
1065 1065
 					$cat = get_term( $val, 'category' );
1066
-					$filter[] = array(
1066
+					$filter[ ] = array(
1067 1067
 						'key'      => $field_id,
1068 1068
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1069 1069
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 				$filter = array();
1083 1083
 
1084 1084
 				foreach ( $value as $val ) {
1085
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1085
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1086 1086
 				}
1087 1087
 
1088 1088
 				break;
@@ -1091,9 +1091,9 @@  discard block
 block discarded – undo
1091 1091
 				// convert checkbox on/off into the correct search filter
1092 1092
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1093 1093
 					foreach ( $form_field->inputs as $k => $input ) {
1094
-						if ( $input['id'] == $field_id ) {
1095
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1096
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1094
+						if ( $input[ 'id' ] == $field_id ) {
1095
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1096
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1097 1097
 							break;
1098 1098
 						}
1099 1099
 					}
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 					$filter = array();
1104 1104
 
1105 1105
 					foreach ( $value as $val ) {
1106
-						$filter[] = array(
1106
+						$filter[ ] = array(
1107 1107
 							'key'      => $field_id,
1108 1108
 							'value'    => $val,
1109 1109
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 					foreach ( $words as $word ) {
1125 1125
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1126 1126
 							// Keep the same key for each filter
1127
-							$filter['value'] = $word;
1127
+							$filter[ 'value' ] = $word;
1128 1128
 							// Add a search for the value
1129
-							$filters[] = $filter;
1129
+							$filters[ ] = $filter;
1130 1130
 						}
1131 1131
 					}
1132 1132
 
@@ -1140,19 +1140,19 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
 					foreach ( $searchable_fields as $searchable_field ) {
1142 1142
 
1143
-						if( $form_field->ID !== $searchable_field['field'] ) {
1143
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1144 1144
 							continue;
1145 1145
 						}
1146 1146
 
1147 1147
 						// Only exact-match dropdowns, not text search
1148
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1148
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1149 1149
 							continue;
1150 1150
 						}
1151 1151
 
1152 1152
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1153 1153
 
1154 1154
 						if ( 4 === $input_id ) {
1155
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1155
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1156 1156
 						};
1157 1157
 					}
1158 1158
 				}
@@ -1180,12 +1180,12 @@  discard block
 block discarded – undo
1180 1180
 						 * @since 1.16.3
1181 1181
 						 * Safeguard until GF implements '<=' operator
1182 1182
 						 */
1183
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1183
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1184 1184
 							$operator = '<';
1185 1185
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1186 1186
 						}
1187 1187
 
1188
-						$filter[] = array(
1188
+						$filter[ ] = array(
1189 1189
 							'key'      => $field_id,
1190 1190
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1191 1191
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1193,12 +1193,12 @@  discard block
 block discarded – undo
1193 1193
 					}
1194 1194
 				} else {
1195 1195
 					$date = $value;
1196
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1197
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1196
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1197
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1198 1198
 				}
1199 1199
 
1200
-				if ('payment_date' === $key) {
1201
-					$filter['operator'] = 'contains';
1200
+				if ( 'payment_date' === $key ) {
1201
+					$filter[ 'operator' ] = 'contains';
1202 1202
 				}
1203 1203
 
1204 1204
 				break;
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			'ymd_dot' => 'Y.m.d',
1228 1228
 		);
1229 1229
 
1230
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1230
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1231 1231
 			$format = $datepicker[ $field->dateFormat ];
1232 1232
 		}
1233 1233
 
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	public function add_template_path( $file_paths ) {
1265 1265
 
1266 1266
 		// Index 100 is the default GravityView template path.
1267
-		$file_paths[102] = self::$file . 'templates/';
1267
+		$file_paths[ 102 ] = self::$file . 'templates/';
1268 1268
 
1269 1269
 		return $file_paths;
1270 1270
 	}
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 		$has_date = false;
1284 1284
 
1285 1285
 		foreach ( $search_fields as $k => $field ) {
1286
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1286
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1287 1287
 				$has_date = true;
1288 1288
 				break;
1289 1289
 			}
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1313 1313
 
1314 1314
 		// get configured search fields
1315
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1315
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1316 1316
 
1317 1317
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1318 1318
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1326,40 +1326,40 @@  discard block
 block discarded – undo
1326 1326
 
1327 1327
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1328 1328
 
1329
-			switch ( $field['field'] ) {
1329
+			switch ( $field[ 'field' ] ) {
1330 1330
 
1331 1331
 				case 'search_all':
1332
-					$updated_field['key'] = 'search_all';
1333
-					$updated_field['input'] = 'search_all';
1334
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1332
+					$updated_field[ 'key' ] = 'search_all';
1333
+					$updated_field[ 'input' ] = 'search_all';
1334
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1335 1335
 					break;
1336 1336
 
1337 1337
 				case 'entry_date':
1338
-					$updated_field['key'] = 'entry_date';
1339
-					$updated_field['input'] = 'entry_date';
1340
-					$updated_field['value'] = array(
1338
+					$updated_field[ 'key' ] = 'entry_date';
1339
+					$updated_field[ 'input' ] = 'entry_date';
1340
+					$updated_field[ 'value' ] = array(
1341 1341
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1342 1342
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1343 1343
 					);
1344 1344
 					break;
1345 1345
 
1346 1346
 				case 'entry_id':
1347
-					$updated_field['key'] = 'entry_id';
1348
-					$updated_field['input'] = 'entry_id';
1349
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1347
+					$updated_field[ 'key' ] = 'entry_id';
1348
+					$updated_field[ 'input' ] = 'entry_id';
1349
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1350 1350
 					break;
1351 1351
 
1352 1352
 				case 'created_by':
1353
-					$updated_field['key'] = 'created_by';
1354
-					$updated_field['name'] = 'gv_by';
1355
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1356
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1353
+					$updated_field[ 'key' ] = 'created_by';
1354
+					$updated_field[ 'name' ] = 'gv_by';
1355
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1356
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1357 1357
 					break;
1358 1358
 
1359 1359
 				case 'is_approved':
1360
-					$updated_field['key'] = 'is_approved';
1361
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1362
-					$updated_field['choices'] = self::get_is_approved_choices();
1360
+					$updated_field[ 'key' ] = 'is_approved';
1361
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1362
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1363 1363
 					break;
1364 1364
 			}
1365 1365
 
@@ -1380,16 +1380,16 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1382 1382
 
1383
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1383
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1384 1384
 
1385 1385
 		/** @since 1.14 */
1386
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1386
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1387 1387
 
1388
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1388
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1389 1389
 
1390 1390
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1391 1391
 
1392
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1392
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1393 1393
 
1394 1394
 		if ( $this->has_date_field( $search_fields ) ) {
1395 1395
 			// enqueue datepicker stuff only if needed!
@@ -1411,10 +1411,10 @@  discard block
 block discarded – undo
1411 1411
 	public static function get_search_class( $custom_class = '' ) {
1412 1412
 		$gravityview_view = GravityView_View::getInstance();
1413 1413
 
1414
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1414
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1415 1415
 
1416
-		if ( ! empty( $custom_class )  ) {
1417
-			$search_class .= ' '.$custom_class;
1416
+		if ( ! empty( $custom_class ) ) {
1417
+			$search_class .= ' ' . $custom_class;
1418 1418
 		}
1419 1419
 
1420 1420
 		/**
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
 
1466 1466
 		if ( ! $label ) {
1467 1467
 
1468
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1468
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1469 1469
 
1470
-			switch( $field['field'] ) {
1470
+			switch ( $field[ 'field' ] ) {
1471 1471
 				case 'search_all':
1472 1472
 					$label = __( 'Search Entries:', 'gravityview' );
1473 1473
 					break;
@@ -1479,10 +1479,10 @@  discard block
 block discarded – undo
1479 1479
 					break;
1480 1480
 				default:
1481 1481
 					// If this is a field input, not a field
1482
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1482
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1483 1483
 
1484 1484
 						// Get the label for the field in question, which returns an array
1485
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1485
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1486 1486
 
1487 1487
 						// Get the item with the `label` key
1488 1488
 						$values = wp_list_pluck( $items, 'label' );
@@ -1523,13 +1523,13 @@  discard block
 block discarded – undo
1523 1523
 		$form = $gravityview_view->getForm();
1524 1524
 
1525 1525
 		// for advanced field ids (eg, first name / last name )
1526
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1526
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1527 1527
 
1528 1528
 		// get searched value from $_GET/$_POST (string or array)
1529 1529
 		$value = $this->rgget_or_rgpost( $name );
1530 1530
 
1531 1531
 		// get form field details
1532
-		$form_field = gravityview_get_field( $form, $field['field'] );
1532
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1533 1533
 
1534 1534
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1535 1535
 
@@ -1543,17 +1543,17 @@  discard block
 block discarded – undo
1543 1543
 		);
1544 1544
 
1545 1545
 		// collect choices
1546
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1547
-			$filter['choices'] = gravityview_get_terms_choices();
1548
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1549
-			$filter['choices'] = $form_field['choices'];
1546
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1547
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1548
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1549
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1550 1550
 		}
1551 1551
 
1552
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1553
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1552
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1553
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1554 1554
 		}
1555 1555
 
1556
-		if ( ! empty( $filter['choices'] ) ) {
1556
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1557 1557
 			/**
1558 1558
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1559 1559
 			 * @param[in,out] bool Yes or no.
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 			 * @param \GV\Context The context.
1562 1562
 			 */
1563 1563
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1564
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1564
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1565 1565
 			}
1566 1566
 		}
1567 1567
 
@@ -1590,11 +1590,11 @@  discard block
 block discarded – undo
1590 1590
 	 * @return array The filter choices.
1591 1591
 	 */
1592 1592
 	private function sieve_filter_choices( $filter, $context ) {
1593
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1593
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1594 1594
 			return $filter; // @todo Populate plugins might give us empty choices
1595 1595
 		}
1596 1596
 
1597
-		if ( ! is_numeric( $filter['key'] ) ) {
1597
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1598 1598
 			return $filter;
1599 1599
 		}
1600 1600
 
@@ -1604,29 +1604,29 @@  discard block
 block discarded – undo
1604 1604
 
1605 1605
 		$table = GFFormsModel::get_entry_meta_table_name();
1606 1606
 
1607
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1607
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1608 1608
 
1609 1609
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1610 1610
 			case 'post_category':
1611 1611
 				$choices = $wpdb->get_col( $wpdb->prepare(
1612 1612
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1613
-					$key_like, $filter['key'], $form_id
1613
+					$key_like, $filter[ 'key' ], $form_id
1614 1614
 				) );
1615 1615
 				break;
1616 1616
 			default:
1617 1617
 				$choices = $wpdb->get_col( $wpdb->prepare(
1618 1618
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1619
-					$key_like, $filter['key'], $form_id
1619
+					$key_like, $filter[ 'key' ], $form_id
1620 1620
 				) );
1621 1621
 
1622
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1622
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1623 1623
 					$choices = array_map( 'json_decode', $choices );
1624 1624
 					$_choices_array = array();
1625 1625
 					foreach ( $choices as $choice ) {
1626 1626
 						if ( is_array( $choice ) ) {
1627 1627
 							$_choices_array = array_merge( $_choices_array, $choice );
1628 1628
 						} else {
1629
-							$_choices_array []= $choice;
1629
+							$_choices_array [ ] = $choice;
1630 1630
 						}
1631 1631
 					}
1632 1632
 					$choices = array_unique( $_choices_array );
@@ -1636,9 +1636,9 @@  discard block
 block discarded – undo
1636 1636
 		endswitch;
1637 1637
 
1638 1638
 		$filter_choices = array();
1639
-		foreach ( $filter['choices'] as $choice ) {
1640
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1641
-				$filter_choices[] = $choice;
1639
+		foreach ( $filter[ 'choices' ] as $choice ) {
1640
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1641
+				$filter_choices[ ] = $choice;
1642 1642
 			}
1643 1643
 		}
1644 1644
 
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
 			 * @param \GV\View $view The view.
1674 1674
 			 */
1675 1675
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1676
-			$choices[] = array(
1676
+			$choices[ ] = array(
1677 1677
 				'value' => $user->ID,
1678 1678
 				'text' => $text,
1679 1679
 			);
@@ -1693,9 +1693,9 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 		$choices = array();
1695 1695
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1696
-			$choices[] = array(
1697
-				'value' => $status['value'],
1698
-				'text' => $status['label'],
1696
+			$choices[ ] = array(
1697
+				'value' => $status[ 'value' ],
1698
+				'text' => $status[ 'label' ],
1699 1699
 			);
1700 1700
 		}
1701 1701
 
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 	 */
1748 1748
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1749 1749
 
1750
-		$js_dependencies[] = 'jquery-ui-datepicker';
1750
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1751 1751
 
1752 1752
 		return $js_dependencies;
1753 1753
 	}
@@ -1791,7 +1791,7 @@  discard block
 block discarded – undo
1791 1791
 			'isRTL'             => is_rtl(),
1792 1792
 		), $view_data );
1793 1793
 
1794
-		$localizations['datepicker'] = $datepicker_settings;
1794
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1795 1795
 
1796 1796
 		return $localizations;
1797 1797
 
@@ -1818,7 +1818,7 @@  discard block
 block discarded – undo
1818 1818
 	 * @return void
1819 1819
 	 */
1820 1820
 	private function maybe_enqueue_flexibility() {
1821
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1821
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1822 1822
 			wp_enqueue_script( 'gv-flexibility' );
1823 1823
 		}
1824 1824
 	}
@@ -1840,7 +1840,7 @@  discard block
 block discarded – undo
1840 1840
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1841 1841
 
1842 1842
 		$scheme = is_ssl() ? 'https://' : 'http://';
1843
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1843
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1844 1844
 
1845 1845
 		/**
1846 1846
 		 * @filter `gravityview_search_datepicker_class`
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 	public function add_preview_inputs() {
1920 1920
 		global $wp;
1921 1921
 
1922
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1922
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1923 1923
 			return;
1924 1924
 		}
1925 1925
 
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
  */
1972 1972
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1973 1973
 	public function __construct( $filter, $view ) {
1974
-		$this->value = $filter['value'];
1974
+		$this->value = $filter[ 'value' ];
1975 1975
 		$this->view = $view;
1976 1976
 	}
1977 1977
 
@@ -2003,11 +2003,11 @@  discard block
 block discarded – undo
2003 2003
 		$conditions = array();
2004 2004
 
2005 2005
 		foreach ( $user_fields as $user_field ) {
2006
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2006
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2007 2007
 		}
2008 2008
 
2009 2009
 		foreach ( $user_meta_fields as $meta_field ) {
2010
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2010
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2011 2011
 		}
2012 2012
 
2013 2013
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.