Completed
Push — develop ( c7374d...2f9743 )
by Gennady
16:41
created
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
230 230
 		$script_source = empty( $script_min ) ? '/source' : '';
231 231
 
232
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
232
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
233 233
 
234 234
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
235 235
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
252 252
 	 */
253 253
 	public function register_no_conflict( $allowed ) {
254
-		$allowed[] = 'gravityview_searchwidget_admin';
254
+		$allowed[ ] = 'gravityview_searchwidget_admin';
255 255
 		return $allowed;
256 256
 	}
257 257
 
@@ -264,24 +264,24 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	public static function get_searchable_fields() {
266 266
 
267
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
267
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
268 268
 			exit( '0' );
269 269
 		}
270 270
 
271 271
 		$form = '';
272 272
 
273 273
 		// Fetch the form for the current View
274
-		if ( ! empty( $_POST['view_id'] ) ) {
274
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
275 275
 
276
-			$form = gravityview_get_form_id( $_POST['view_id'] );
276
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
277 277
 
278
-		} elseif ( ! empty( $_POST['formid'] ) ) {
278
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
279 279
 
280
-			$form = (int) $_POST['formid'];
280
+			$form = (int)$_POST[ 'formid' ];
281 281
 
282
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
282
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
283 283
 
284
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
284
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
285 285
 
286 286
 		}
287 287
 
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		);
332 332
 
333 333
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
334
-			$custom_fields['is_approved'] = array(
334
+			$custom_fields[ 'is_approved' ] = array(
335 335
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
336 336
 				'type' => 'multi',
337 337
 			);
338 338
 		}
339 339
 
340
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
341
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
340
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
341
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
342 342
 		}
343 343
 
344 344
 		// Get fields with sub-inputs and no parent
@@ -360,13 +360,13 @@  discard block
 block discarded – undo
360 360
 
361 361
 			foreach ( $fields as $id => $field ) {
362 362
 
363
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
363
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
364 364
 					continue;
365 365
 				}
366 366
 
367
-				$types = self::get_search_input_types( $id, $field['type'] );
367
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
368 368
 
369
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
369
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
370 370
 			}
371 371
 		}
372 372
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
390 390
 
391 391
 		// @todo - This needs to be improved - many fields have . including products and addresses
392
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
392
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
393 393
 			$input_type = 'boolean'; // on/off checkbox
394 394
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
395 395
 			$input_type = 'multi'; //multiselect
@@ -433,19 +433,19 @@  discard block
 block discarded – undo
433 433
 			$post_id = 0;
434 434
 
435 435
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
436
-			if ( ! empty( $widget_args['post_id'] ) ) {
437
-				$post_id = absint( $widget_args['post_id'] );
436
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
437
+				$post_id = absint( $widget_args[ 'post_id' ] );
438 438
 			}
439 439
 			// We're in the WordPress Widget context, and the base View ID should be used
440
-			else if ( ! empty( $widget_args['view_id'] ) ) {
441
-				$post_id = absint( $widget_args['view_id'] );
440
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
441
+				$post_id = absint( $widget_args[ 'view_id' ] );
442 442
 			}
443 443
 
444 444
 			$args = gravityview_get_permalink_query_args( $post_id );
445 445
 
446 446
 			// Add hidden fields to the search form
447 447
 			foreach ( $args as $key => $value ) {
448
-				$search_fields[] = array(
448
+				$search_fields[ ] = array(
449 449
 					'name'  => $key,
450 450
 					'input' => 'hidden',
451 451
 					'value' => $value,
@@ -484,28 +484,28 @@  discard block
 block discarded – undo
484 484
 		/**
485 485
 		 * Include the sidebar Widgets.
486 486
 		 */
487
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
487
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
488 488
 
489 489
 		foreach ( $widgets as $widget ) {
490
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
491
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
490
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
491
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
492 492
 					foreach ( $_fields as $field ) {
493
-						if ( empty( $field['form_id'] ) ) {
494
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
493
+						if ( empty( $field[ 'form_id' ] ) ) {
494
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
495 495
 						}
496
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
496
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
497 497
 					}
498 498
 				}
499 499
 			}
500 500
 		}
501 501
 
502 502
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
503
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
503
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
504 504
 				foreach ( $_fields as $field ) {
505
-					if ( empty( $field['form_id'] ) ) {
506
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
505
+					if ( empty( $field[ 'form_id' ] ) ) {
506
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
507 507
 					}
508
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
508
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
509 509
 				}
510 510
 			}
511 511
 		}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
536 536
 		}
537 537
 
538
-		if( 'post' === $this->search_method ) {
538
+		if ( 'post' === $this->search_method ) {
539 539
 			$get = $_POST;
540 540
 		} else {
541 541
 			$get = $_GET;
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
 		$get = gv_map_deep( $get, 'rawurldecode' );
555 555
 
556 556
 		// Make sure array key is set up
557
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
557
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
558 558
 
559 559
 		$searchable_fields = $this->get_view_searchable_fields( $view );
560 560
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
561 561
 
562 562
 		// add free search
563
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
563
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
564 564
 
565
-			$search_all_value = trim( $get['gv_search'] );
565
+			$search_all_value = trim( $get[ 'gv_search' ] );
566 566
 
567 567
 			/**
568 568
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			}
588 588
 
589 589
 			foreach ( $words as $word ) {
590
-				$search_criteria['field_filters'][] = array(
590
+				$search_criteria[ 'field_filters' ][ ] = array(
591 591
 					'key' => null, // The field ID to search
592 592
 					'value' => $word, // The value to search
593 593
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -600,14 +600,14 @@  discard block
 block discarded – undo
600 600
 			/**
601 601
 			 * Get and normalize the dates according to the input format.
602 602
 			 */
603
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
604
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
603
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
604
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
605 605
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
606 606
 				}
607 607
 			}
608 608
 
609
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
610
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
609
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
610
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
611 611
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
612 612
 				}
613 613
 			}
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
 			 */
643 643
 			if ( ! empty( $curr_start ) ) {
644 644
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
645
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
645
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
646 646
 			}
647 647
 
648 648
 			if ( ! empty( $curr_end ) ) {
649 649
 				// Fast-forward 24 hour on the end time
650 650
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
651
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
651
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
652
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
653
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
654 654
 				}
655 655
 			}
656 656
 		}
657 657
 
658 658
 		// search for a specific entry ID
659 659
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
660
-			$search_criteria['field_filters'][] = array(
660
+			$search_criteria[ 'field_filters' ][ ] = array(
661 661
 				'key' => 'id',
662 662
 				'value' => absint( $get[ 'gv_id' ] ),
663 663
 				'operator' => '=',
@@ -666,20 +666,20 @@  discard block
 block discarded – undo
666 666
 
667 667
 		// search for a specific Created_by ID
668 668
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
669
-			$search_criteria['field_filters'][] = array(
669
+			$search_criteria[ 'field_filters' ][ ] = array(
670 670
 				'key' => 'created_by',
671
-				'value' => $get['gv_by'],
671
+				'value' => $get[ 'gv_by' ],
672 672
 				'operator' => '=',
673 673
 			);
674 674
 		}
675 675
 
676 676
 		// Get search mode passed in URL
677
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
677
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
678 678
 
679 679
 		// get the other search filters
680 680
 		foreach ( $get as $key => $value ) {
681 681
 
682
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
682
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
683 683
 				continue;
684 684
 			}
685 685
 
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
 				continue;
690 690
 			}
691 691
 
692
-			if ( isset( $filter[0]['value'] ) ) {
693
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
692
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
693
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
694 694
 
695 695
 				// if date range type, set search mode to ALL
696
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
696
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
697 697
 					$mode = 'all';
698 698
 				}
699
-			} elseif( !empty( $filter ) ) {
700
-				$search_criteria['field_filters'][] = $filter;
699
+			} elseif ( ! empty( $filter ) ) {
700
+				$search_criteria[ 'field_filters' ][ ] = $filter;
701 701
 			}
702 702
 		}
703 703
 
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		 * @since 1.5.1
707 707
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
708 708
 		 */
709
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
709
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
710 710
 
711 711
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
712 712
 
@@ -733,19 +733,19 @@  discard block
 block discarded – undo
733 733
 
734 734
 		$query_class = $view->get_query_class();
735 735
 
736
-		if ( empty( $search_criteria['field_filters'] ) ) {
736
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
737 737
 			return;
738 738
 		}
739 739
 
740 740
 		$widgets = $view->widgets->by_id( $this->widget_id );
741 741
 		if ( $widgets->count() ) {
742 742
 			$widgets = $widgets->all();
743
-			$widget  = $widgets[0];
743
+			$widget  = $widgets[ 0 ];
744 744
 
745 745
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
746 746
 
747
-			foreach ( (array) $search_fields as $search_field ) {
748
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
747
+			foreach ( (array)$search_fields as $search_field ) {
748
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
749 749
 					$created_by_text_mode = true;
750 750
 				}
751 751
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		$extra_conditions = array();
755 755
 		$mode = 'any';
756 756
 
757
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
757
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
758 758
 			if ( ! is_array( $filter ) ) {
759 759
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
760 760
 					$mode = $filter;
@@ -763,13 +763,13 @@  discard block
 block discarded – undo
763 763
 			}
764 764
 
765 765
 			// Construct a manual query for unapproved statuses
766
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
767
-				$_tmp_query       = new $query_class( $view->form->ID, array(
766
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
767
+				$_tmp_query = new $query_class( $view->form->ID, array(
768 768
 					'field_filters' => array(
769 769
 						array(
770 770
 							'operator' => 'in',
771 771
 							'key'      => 'is_approved',
772
-							'value'    => (array) $filter['value'],
772
+							'value'    => (array)$filter[ 'value' ],
773 773
 						),
774 774
 						array(
775 775
 							'operator' => 'is',
@@ -781,30 +781,30 @@  discard block
 block discarded – undo
781 781
 				) );
782 782
 				$_tmp_query_parts = $_tmp_query->_introspect();
783 783
 
784
-				$extra_conditions[] = $_tmp_query_parts['where'];
784
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
785 785
 
786 786
 				$filter = false;
787 787
 				continue;
788 788
 			}
789 789
 
790 790
 			// Construct manual query for text mode creator search
791
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
792
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
791
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
792
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
793 793
 				$filter = false;
794 794
 				continue;
795 795
 			}
796 796
 
797 797
 			// By default, we want searches to be wildcard for each field.
798
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
798
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
799 799
 
800 800
 			// For multichoice, let's have an in (OR) search.
801
-			if ( is_array( $filter['value'] ) ) {
802
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
801
+			if ( is_array( $filter[ 'value' ] ) ) {
802
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
803 803
 			}
804 804
 
805 805
 			// Default form with joins functionality
806
-			if ( empty( $filter['form_id'] ) ) {
807
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
806
+			if ( empty( $filter[ 'form_id' ] ) ) {
807
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
808 808
 			}
809 809
 
810 810
 			/**
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
 			 * @param string $operator Existing search operator
813 813
 			 * @param array $filter array with `key`, `value`, `operator`, `type` keys
814 814
 			 */
815
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
815
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
816 816
 		}
817 817
 
818 818
 		$search_conditions = array();
819 819
 
820
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
820
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
821 821
 
822 822
 			foreach ( $filters as $filter ) {
823 823
 				if ( ! is_array( $filter ) ) {
@@ -830,22 +830,22 @@  discard block
 block discarded – undo
830 830
 				 * code by reusing what's inside GF_Query already as they
831 831
 				 * take care of many small things like forcing numeric, etc.
832 832
 				 */
833
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
833
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
834 834
 				$_tmp_query_parts = $_tmp_query->_introspect();
835
-				$search_condition = $_tmp_query_parts['where'];
835
+				$search_condition = $_tmp_query_parts[ 'where' ];
836 836
 
837
-				if ( empty( $filter['key'] ) &&  $search_condition->expressions ) {
837
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
838 838
 					 foreach ( $search_condition->expressions as $condition ) {
839
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
839
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $condition, $view );
840 840
 					 }
841 841
 				} else {
842 842
 					$left = $search_condition->left;
843 843
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
844 844
 
845 845
 					if ( $view->joins && $left->field_id == GF_Query_Column::META ) {
846
-						$search_conditions[] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
846
+						$search_conditions[ ] = new GravityView_Widget_Search_All_GF_Query_Condition( $search_condition, $view );
847 847
 					} else {
848
-						$search_conditions[] = new GF_Query_Condition(
848
+						$search_conditions[ ] = new GF_Query_Condition(
849 849
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
850 850
 							$search_condition->operator,
851 851
 							$search_condition->right
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 		/**
868 868
 		 * Combine the parts as a new WHERE clause.
869 869
 		 */
870
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
870
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
871 871
 		$query->where( $where );
872 872
 	}
873 873
 
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 		$field_id = str_replace( 'filter_', '', $key );
891 891
 
892 892
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
893
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
893
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
894 894
 			$field_id = str_replace( '_', '.', $field_id );
895 895
 		}
896 896
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 			// form is in searchable fields
943 943
 			$found = false;
944 944
 			foreach ( $searchable_fields as $field ) {
945
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
945
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
946 946
 					$found = true;
947 947
 					break;
948 948
 				}
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 
979 979
 			case 'select':
980 980
 			case 'radio':
981
-				$filter['operator'] = 'is';
981
+				$filter[ 'operator' ] = 'is';
982 982
 				break;
983 983
 
984 984
 			case 'post_category':
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 				foreach ( $value as $val ) {
994 994
 					$cat = get_term( $val, 'category' );
995
-					$filter[] = array(
995
+					$filter[ ] = array(
996 996
 						'key'      => $field_id,
997 997
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
998 998
 						'operator' => 'is',
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 				$filter = array();
1012 1012
 
1013 1013
 				foreach ( $value as $val ) {
1014
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1014
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1015 1015
 				}
1016 1016
 
1017 1017
 				break;
@@ -1020,9 +1020,9 @@  discard block
 block discarded – undo
1020 1020
 				// convert checkbox on/off into the correct search filter
1021 1021
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1022 1022
 					foreach ( $form_field->inputs as $k => $input ) {
1023
-						if ( $input['id'] == $field_id ) {
1024
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1025
-							$filter['operator'] = 'is';
1023
+						if ( $input[ 'id' ] == $field_id ) {
1024
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1025
+							$filter[ 'operator' ] = 'is';
1026 1026
 							break;
1027 1027
 						}
1028 1028
 					}
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 					$filter = array();
1033 1033
 
1034 1034
 					foreach ( $value as $val ) {
1035
-						$filter[] = array(
1035
+						$filter[ ] = array(
1036 1036
 							'key'      => $field_id,
1037 1037
 							'value'    => $val,
1038 1038
 							'operator' => 'is',
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
 					foreach ( $words as $word ) {
1054 1054
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1055 1055
 							// Keep the same key for each filter
1056
-							$filter['value'] = $word;
1056
+							$filter[ 'value' ] = $word;
1057 1057
 							// Add a search for the value
1058
-							$filters[] = $filter;
1058
+							$filters[ ] = $filter;
1059 1059
 						}
1060 1060
 					}
1061 1061
 
@@ -1069,19 +1069,19 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 					foreach ( $searchable_fields as $searchable_field ) {
1071 1071
 
1072
-						if( $form_field->ID !== $searchable_field['field'] ) {
1072
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1073 1073
 							continue;
1074 1074
 						}
1075 1075
 
1076 1076
 						// Only exact-match dropdowns, not text search
1077
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1077
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1078 1078
 							continue;
1079 1079
 						}
1080 1080
 
1081 1081
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1082 1082
 
1083 1083
 						if ( 4 === $input_id ) {
1084
-							$filter['operator'] = 'is';
1084
+							$filter[ 'operator' ] = 'is';
1085 1085
 						};
1086 1086
 					}
1087 1087
 				}
@@ -1108,12 +1108,12 @@  discard block
 block discarded – undo
1108 1108
 						 * @since 1.16.3
1109 1109
 						 * Safeguard until GF implements '<=' operator
1110 1110
 						 */
1111
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1111
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1112 1112
 							$operator = '<';
1113 1113
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1114 1114
 						}
1115 1115
 
1116
-						$filter[] = array(
1116
+						$filter[ ] = array(
1117 1117
 							'key'      => $field_id,
1118 1118
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1119 1119
 							'operator' => $operator,
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 					}
1122 1122
 				} else {
1123 1123
 					$date = $value;
1124
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1124
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1125 1125
 				}
1126 1126
 
1127 1127
 				break;
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 			'ymd_dot' => 'Y.m.d',
1153 1153
 		);
1154 1154
 
1155
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1155
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1156 1156
 			$format = $datepicker[ $field->dateFormat ];
1157 1157
 		}
1158 1158
 
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 	public function add_template_path( $file_paths ) {
1190 1190
 
1191 1191
 		// Index 100 is the default GravityView template path.
1192
-		$file_paths[102] = self::$file . 'templates/';
1192
+		$file_paths[ 102 ] = self::$file . 'templates/';
1193 1193
 
1194 1194
 		return $file_paths;
1195 1195
 	}
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		$has_date = false;
1209 1209
 
1210 1210
 		foreach ( $search_fields as $k => $field ) {
1211
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1211
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1212 1212
 				$has_date = true;
1213 1213
 				break;
1214 1214
 			}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 
1237 1237
 		// get configured search fields
1238
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1238
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1239 1239
 
1240 1240
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1241 1241
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1250,40 +1250,40 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 			$updated_field = $this->get_search_filter_details( $updated_field );
1252 1252
 
1253
-			switch ( $field['field'] ) {
1253
+			switch ( $field[ 'field' ] ) {
1254 1254
 
1255 1255
 				case 'search_all':
1256
-					$updated_field['key'] = 'search_all';
1257
-					$updated_field['input'] = 'search_all';
1258
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1256
+					$updated_field[ 'key' ] = 'search_all';
1257
+					$updated_field[ 'input' ] = 'search_all';
1258
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1259 1259
 					break;
1260 1260
 
1261 1261
 				case 'entry_date':
1262
-					$updated_field['key'] = 'entry_date';
1263
-					$updated_field['input'] = 'entry_date';
1264
-					$updated_field['value'] = array(
1262
+					$updated_field[ 'key' ] = 'entry_date';
1263
+					$updated_field[ 'input' ] = 'entry_date';
1264
+					$updated_field[ 'value' ] = array(
1265 1265
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1266 1266
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1267 1267
 					);
1268 1268
 					break;
1269 1269
 
1270 1270
 				case 'entry_id':
1271
-					$updated_field['key'] = 'entry_id';
1272
-					$updated_field['input'] = 'entry_id';
1273
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1271
+					$updated_field[ 'key' ] = 'entry_id';
1272
+					$updated_field[ 'input' ] = 'entry_id';
1273
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1274 1274
 					break;
1275 1275
 
1276 1276
 				case 'created_by':
1277
-					$updated_field['key'] = 'created_by';
1278
-					$updated_field['name'] = 'gv_by';
1279
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1280
-					$updated_field['choices'] = self::get_created_by_choices();
1277
+					$updated_field[ 'key' ] = 'created_by';
1278
+					$updated_field[ 'name' ] = 'gv_by';
1279
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1280
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
1281 1281
 					break;
1282 1282
 				
1283 1283
 				case 'is_approved':
1284
-					$updated_field['key'] = 'is_approved';
1285
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1286
-					$updated_field['choices'] = self::get_is_approved_choices();
1284
+					$updated_field[ 'key' ] = 'is_approved';
1285
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1286
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1287 1287
 					break;
1288 1288
 			}
1289 1289
 
@@ -1302,16 +1302,16 @@  discard block
 block discarded – undo
1302 1302
 		 */
1303 1303
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1304 1304
 
1305
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1305
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1306 1306
 
1307 1307
 		/** @since 1.14 */
1308
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1308
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1309 1309
 
1310
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1310
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1311 1311
 
1312 1312
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1313 1313
 
1314
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1314
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1315 1315
 
1316 1316
 		if ( $this->has_date_field( $search_fields ) ) {
1317 1317
 			// enqueue datepicker stuff only if needed!
@@ -1333,10 +1333,10 @@  discard block
 block discarded – undo
1333 1333
 	public static function get_search_class( $custom_class = '' ) {
1334 1334
 		$gravityview_view = GravityView_View::getInstance();
1335 1335
 
1336
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1336
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1337 1337
 
1338
-		if ( ! empty( $custom_class )  ) {
1339
-			$search_class .= ' '.$custom_class;
1338
+		if ( ! empty( $custom_class ) ) {
1339
+			$search_class .= ' ' . $custom_class;
1340 1340
 		}
1341 1341
 
1342 1342
 		/**
@@ -1380,9 +1380,9 @@  discard block
 block discarded – undo
1380 1380
 
1381 1381
 		if ( ! $label ) {
1382 1382
 
1383
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1383
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1384 1384
 
1385
-			switch( $field['field'] ) {
1385
+			switch ( $field[ 'field' ] ) {
1386 1386
 				case 'search_all':
1387 1387
 					$label = __( 'Search Entries:', 'gravityview' );
1388 1388
 					break;
@@ -1394,10 +1394,10 @@  discard block
 block discarded – undo
1394 1394
 					break;
1395 1395
 				default:
1396 1396
 					// If this is a field input, not a field
1397
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1397
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1398 1398
 
1399 1399
 						// Get the label for the field in question, which returns an array
1400
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1400
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1401 1401
 
1402 1402
 						// Get the item with the `label` key
1403 1403
 						$values = wp_list_pluck( $items, 'label' );
@@ -1436,32 +1436,32 @@  discard block
 block discarded – undo
1436 1436
 		$form = $gravityview_view->getForm();
1437 1437
 
1438 1438
 		// for advanced field ids (eg, first name / last name )
1439
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1439
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1440 1440
 
1441 1441
 		// get searched value from $_GET/$_POST (string or array)
1442 1442
 		$value = $this->rgget_or_rgpost( $name );
1443 1443
 
1444 1444
 		// get form field details
1445
-		$form_field = gravityview_get_field( $form, $field['field'] );
1445
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1446 1446
 
1447 1447
 		$filter = array(
1448
-			'key' => $field['field'],
1448
+			'key' => $field[ 'field' ],
1449 1449
 			'name' => $name,
1450 1450
 			'label' => self::get_field_label( $field, $form_field ),
1451
-			'input' => $field['input'],
1451
+			'input' => $field[ 'input' ],
1452 1452
 			'value' => $value,
1453
-			'type' => $form_field['type'],
1453
+			'type' => $form_field[ 'type' ],
1454 1454
 		);
1455 1455
 
1456 1456
 		// collect choices
1457
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1458
-			$filter['choices'] = gravityview_get_terms_choices();
1459
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1460
-			$filter['choices'] = $form_field['choices'];
1457
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1458
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1459
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1460
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1461 1461
 		}
1462 1462
 
1463
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1464
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1463
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1464
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1465 1465
 		}
1466 1466
 
1467 1467
 		return $filter;
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 
1486 1486
 		$choices = array();
1487 1487
 		foreach ( $users as $user ) {
1488
-			$choices[] = array(
1488
+			$choices[ ] = array(
1489 1489
 				'value' => $user->ID,
1490 1490
 				'text' => $user->display_name,
1491 1491
 			);
@@ -1505,9 +1505,9 @@  discard block
 block discarded – undo
1505 1505
 
1506 1506
 		$choices = array();
1507 1507
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1508
-			$choices[] = array(
1509
-				'value' => $status['value'],
1510
-				'text' => $status['label'],
1508
+			$choices[ ] = array(
1509
+				'value' => $status[ 'value' ],
1510
+				'text' => $status[ 'label' ],
1511 1511
 			);
1512 1512
 		}
1513 1513
 
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 	 */
1560 1560
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1561 1561
 
1562
-		$js_dependencies[] = 'jquery-ui-datepicker';
1562
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1563 1563
 
1564 1564
 		return $js_dependencies;
1565 1565
 	}
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 			'isRTL'             => is_rtl(),
1604 1604
 		), $view_data );
1605 1605
 
1606
-		$localizations['datepicker'] = $datepicker_settings;
1606
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1607 1607
 
1608 1608
 		return $localizations;
1609 1609
 
@@ -1630,7 +1630,7 @@  discard block
 block discarded – undo
1630 1630
 	 * @return void
1631 1631
 	 */
1632 1632
 	private function maybe_enqueue_flexibility() {
1633
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1633
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1634 1634
 			wp_enqueue_script( 'gv-flexibility' );
1635 1635
 		}
1636 1636
 	}
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1653 1653
 
1654 1654
 		$scheme = is_ssl() ? 'https://' : 'http://';
1655
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1655
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1656 1656
 
1657 1657
 		/**
1658 1658
 		 * @filter `gravityview_search_datepicker_class`
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 	public function add_preview_inputs() {
1732 1732
 		global $wp;
1733 1733
 
1734
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1734
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1735 1735
 			return;
1736 1736
 		}
1737 1737
 
@@ -1756,7 +1756,7 @@  discard block
 block discarded – undo
1756 1756
  */
1757 1757
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
1758 1758
 	public function __construct( $filter, $view ) {
1759
-		$this->value = $filter['value'];
1759
+		$this->value = $filter[ 'value' ];
1760 1760
 		$this->view = $view;
1761 1761
 	}
1762 1762
 
@@ -1788,11 +1788,11 @@  discard block
 block discarded – undo
1788 1788
 		$conditions = array();
1789 1789
 
1790 1790
 		foreach ( $user_fields as $user_field ) {
1791
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
1791
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
1792 1792
 		}
1793 1793
 
1794 1794
 		foreach ( $user_meta_fields as $meta_field ) {
1795
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
1795
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
1796 1796
 		}
1797 1797
 
1798 1798
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
@@ -1821,9 +1821,9 @@  discard block
 block discarded – undo
1821 1821
 
1822 1822
 		$conditions = array();
1823 1823
 
1824
-		foreach ( $parameters['aliases'] as $key => $alias ) {
1825
-			if ( 'm' == $alias[0] && preg_match( '#\d+_\d+#', $key ) ) {
1826
-				$conditions[] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1824
+		foreach ( $parameters[ 'aliases' ] as $key => $alias ) {
1825
+			if ( 'm' == $alias[ 0 ] && preg_match( '#\d+_\d+#', $key ) ) {
1826
+				$conditions[ ] = sprintf( "EXISTS(SELECT * FROM `$table` WHERE `meta_value` %s %s AND `entry_id` = `%s`.`entry_id`)",
1827 1827
 					$this->search_condition->operator, $this->search_condition->right->sql( $query ), $alias );
1828 1828
 			}
1829 1829
 		}
Please login to merge, or discard this patch.