Completed
Push — develop ( e7c8cf...a22b78 )
by Zack
39:37 queued 19:32
created
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'search_clear' => array(
55 55
 				'type'  => 'checkbox',
56 56
 				'label' => __( 'Show Clear button', 'gravityview' ),
57
-				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'),
57
+				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ),
58 58
 				'value' => true,
59 59
 			),
60 60
 			'search_fields' => array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 				'type' => 'radio',
68 68
 				'full_width' => true,
69 69
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
70
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
70
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
71 71
 				'value' => 'any',
72 72
 				'class' => 'hide-if-js',
73 73
 				'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
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function add_reserved_args( $args ) {
124 124
 
125
-		$args[] = 'gv_search';
126
-		$args[] = 'gv_start';
127
-		$args[] = 'gv_end';
128
-		$args[] = 'gv_id';
129
-		$args[] = 'gv_by';
130
-		$args[] = 'mode';
125
+		$args[ ] = 'gv_search';
126
+		$args[ ] = 'gv_start';
127
+		$args[ ] = 'gv_end';
128
+		$args[ ] = 'gv_id';
129
+		$args[ ] = 'gv_by';
130
+		$args[ ] = 'mode';
131 131
 
132
-		$get = (array) $_GET;
132
+		$get = (array)$_GET;
133 133
 
134 134
 		// If the fields being searched as reserved; not to be considered user-passed variables
135 135
 		foreach ( $get as $key => $value ) {
136 136
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
137
-				$args[] = $key;
137
+				$args[ ] = $key;
138 138
 			}
139 139
 		}
140 140
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
259 259
 		$script_source = empty( $script_min ) ? '/source' : '';
260 260
 
261
-		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 );
261
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
262 262
 
263 263
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
264 264
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
281 281
 	 */
282 282
 	public function register_no_conflict( $allowed ) {
283
-		$allowed[] = 'gravityview_searchwidget_admin';
283
+		$allowed[ ] = 'gravityview_searchwidget_admin';
284 284
 		return $allowed;
285 285
 	}
286 286
 
@@ -292,24 +292,24 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public static function get_searchable_fields() {
294 294
 
295
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
295
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
296 296
 			exit( '0' );
297 297
 		}
298 298
 
299 299
 		$form = '';
300 300
 
301 301
 		// Fetch the form for the current View
302
-		if ( ! empty( $_POST['view_id'] ) ) {
302
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
303 303
 
304
-			$form = gravityview_get_form_id( $_POST['view_id'] );
304
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
305 305
 
306
-		} elseif ( ! empty( $_POST['formid'] ) ) {
306
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
307 307
 
308
-			$form = (int) $_POST['formid'];
308
+			$form = (int)$_POST[ 'formid' ];
309 309
 
310
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
310
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
311 311
 
312
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
312
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
313 313
 
314 314
 		}
315 315
 
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
 		);
360 360
 
361 361
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
362
-			$custom_fields['is_approved'] = array(
362
+			$custom_fields[ 'is_approved' ] = array(
363 363
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
364 364
 				'type' => 'multi',
365 365
 			);
366 366
 		}
367 367
 
368
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
369
-			$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'] );
368
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
369
+			$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' ] );
370 370
 		}
371 371
 
372 372
 		// Get fields with sub-inputs and no parent
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
 
389 389
 			foreach ( $fields as $id => $field ) {
390 390
 
391
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
391
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
392 392
 					continue;
393 393
 				}
394 394
 
395
-				$types = self::get_search_input_types( $id, $field['type'] );
395
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
396 396
 
397
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
397
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
398 398
 			}
399 399
 		}
400 400
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
418 418
 
419 419
 		// @todo - This needs to be improved - many fields have . including products and addresses
420
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
420
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
421 421
 			$input_type = 'boolean'; // on/off checkbox
422 422
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
423 423
 			$input_type = 'multi'; //multiselect
@@ -463,19 +463,19 @@  discard block
 block discarded – undo
463 463
 			$post_id = 0;
464 464
 
465 465
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
466
-			if ( ! empty( $widget_args['post_id'] ) ) {
467
-				$post_id = absint( $widget_args['post_id'] );
466
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
467
+				$post_id = absint( $widget_args[ 'post_id' ] );
468 468
 			}
469 469
 			// We're in the WordPress Widget context, and the base View ID should be used
470
-			else if ( ! empty( $widget_args['view_id'] ) ) {
471
-				$post_id = absint( $widget_args['view_id'] );
470
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
471
+				$post_id = absint( $widget_args[ 'view_id' ] );
472 472
 			}
473 473
 
474 474
 			$args = gravityview_get_permalink_query_args( $post_id );
475 475
 
476 476
 			// Add hidden fields to the search form
477 477
 			foreach ( $args as $key => $value ) {
478
-				$search_fields[] = array(
478
+				$search_fields[ ] = array(
479 479
 					'name'  => $key,
480 480
 					'input' => 'hidden',
481 481
 					'value' => $value,
@@ -514,28 +514,28 @@  discard block
 block discarded – undo
514 514
 		/**
515 515
 		 * Include the sidebar Widgets.
516 516
 		 */
517
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
517
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
518 518
 
519 519
 		foreach ( $widgets as $widget ) {
520
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
521
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
520
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
521
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
522 522
 					foreach ( $_fields as $field ) {
523
-						if ( empty( $field['form_id'] ) ) {
524
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
523
+						if ( empty( $field[ 'form_id' ] ) ) {
524
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
525 525
 						}
526
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
526
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
527 527
 					}
528 528
 				}
529 529
 			}
530 530
 		}
531 531
 
532 532
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
533
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
533
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
534 534
 				foreach ( $_fields as $field ) {
535
-					if ( empty( $field['form_id'] ) ) {
536
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
535
+					if ( empty( $field[ 'form_id' ] ) ) {
536
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
537 537
 					}
538
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
538
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
539 539
 				}
540 540
 			}
541 541
 		}
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
574 574
 		}
575 575
 
576
-		if( 'post' === $this->search_method ) {
576
+		if ( 'post' === $this->search_method ) {
577 577
 			$get = $_POST;
578 578
 		} else {
579 579
 			$get = $_GET;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		$get = gv_map_deep( $get, 'rawurldecode' );
593 593
 
594 594
 		// Make sure array key is set up
595
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
595
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
596 596
 
597 597
 		$searchable_fields = $this->get_view_searchable_fields( $view );
598 598
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
613 613
 
614 614
 		// add free search
615
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
615
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
616 616
 
617
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
617
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
618 618
 
619 619
 			if ( $split_words ) {
620 620
 				// Search for a piece
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			}
631 631
 
632 632
 			foreach ( $words as $word ) {
633
-				$search_criteria['field_filters'][] = array(
633
+				$search_criteria[ 'field_filters' ][ ] = array(
634 634
 					'key' => null, // The field ID to search
635 635
 					'value' => $word, // The value to search
636 636
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
 			/**
644 644
 			 * Get and normalize the dates according to the input format.
645 645
 			 */
646
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
647
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
646
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
647
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
648 648
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
649 649
 				}
650 650
 			}
651 651
 
652
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
653
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
652
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
653
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
654 654
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
655 655
 				}
656 656
 			}
@@ -686,22 +686,22 @@  discard block
 block discarded – undo
686 686
 			 */
687 687
 			if ( ! empty( $curr_start ) ) {
688 688
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
689
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
689
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
690 690
 			}
691 691
 
692 692
 			if ( ! empty( $curr_end ) ) {
693 693
 				// Fast-forward 24 hour on the end time
694 694
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
695
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
696
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
697
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
695
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
696
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
697
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 
702 702
 		// search for a specific entry ID
703 703
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
704
-			$search_criteria['field_filters'][] = array(
704
+			$search_criteria[ 'field_filters' ][ ] = array(
705 705
 				'key' => 'id',
706 706
 				'value' => absint( $get[ 'gv_id' ] ),
707 707
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -710,15 +710,15 @@  discard block
 block discarded – undo
710 710
 
711 711
 		// search for a specific Created_by ID
712 712
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
713
-			$search_criteria['field_filters'][] = array(
713
+			$search_criteria[ 'field_filters' ][ ] = array(
714 714
 				'key' => 'created_by',
715
-				'value' => $get['gv_by'],
715
+				'value' => $get[ 'gv_by' ],
716 716
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
717 717
 			);
718 718
 		}
719 719
 
720 720
 		// Get search mode passed in URL
721
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
721
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
722 722
 
723 723
 		// get the other search filters
724 724
 		foreach ( $get as $key => $value ) {
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
728 728
 			}
729 729
 
730
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
730
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
731 731
 				continue; // Not a filter, or empty
732 732
 			}
733 733
 
@@ -741,21 +741,21 @@  discard block
 block discarded – undo
741 741
 				continue;
742 742
 			}
743 743
 
744
-			if ( ! isset( $filter['operator'] ) ) {
745
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
744
+			if ( ! isset( $filter[ 'operator' ] ) ) {
745
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
746 746
 			}
747 747
 
748
-			if ( isset( $filter[0]['value'] ) ) {
749
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
748
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
749
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
750 750
 
751
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
751
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
752 752
 
753 753
 				// if date range type, set search mode to ALL
754
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
754
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
755 755
 					$mode = 'all';
756 756
 				}
757
-			} elseif( !empty( $filter ) ) {
758
-				$search_criteria['field_filters'][] = $filter;
757
+			} elseif ( ! empty( $filter ) ) {
758
+				$search_criteria[ 'field_filters' ][ ] = $filter;
759 759
 			}
760 760
 		}
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 		 * @since 1.5.1
765 765
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
766 766
 		 */
767
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
767
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
768 768
 
769 769
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
770 770
 
@@ -798,19 +798,19 @@  discard block
 block discarded – undo
798 798
 
799 799
 		$query_class = $view->get_query_class();
800 800
 
801
-		if ( empty( $search_criteria['field_filters'] ) ) {
801
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
802 802
 			return;
803 803
 		}
804 804
 
805 805
 		$widgets = $view->widgets->by_id( $this->widget_id );
806 806
 		if ( $widgets->count() ) {
807 807
 			$widgets = $widgets->all();
808
-			$widget  = $widgets[0];
808
+			$widget  = $widgets[ 0 ];
809 809
 
810 810
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
811 811
 
812
-			foreach ( (array) $search_fields as $search_field ) {
813
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
812
+			foreach ( (array)$search_fields as $search_field ) {
813
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
814 814
 					$created_by_text_mode = true;
815 815
 				}
816 816
 			}
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 		$extra_conditions = array();
820 820
 		$mode = 'any';
821 821
 
822
-		foreach ( $search_criteria['field_filters'] as &$filter ) {
822
+		foreach ( $search_criteria[ 'field_filters' ] as &$filter ) {
823 823
 			if ( ! is_array( $filter ) ) {
824 824
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
825 825
 					$mode = $filter;
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
 			}
829 829
 
830 830
 			// Construct a manual query for unapproved statuses
831
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
832
-				$_tmp_query       = new $query_class( $view->form->ID, array(
831
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
832
+				$_tmp_query = new $query_class( $view->form->ID, array(
833 833
 					'field_filters' => array(
834 834
 						array(
835 835
 							'operator' => 'in',
836 836
 							'key'      => 'is_approved',
837
-							'value'    => (array) $filter['value'],
837
+							'value'    => (array)$filter[ 'value' ],
838 838
 						),
839 839
 						array(
840 840
 							'operator' => 'is',
@@ -846,30 +846,30 @@  discard block
 block discarded – undo
846 846
 				) );
847 847
 				$_tmp_query_parts = $_tmp_query->_introspect();
848 848
 
849
-				$extra_conditions[] = $_tmp_query_parts['where'];
849
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
850 850
 
851 851
 				$filter = false;
852 852
 				continue;
853 853
 			}
854 854
 
855 855
 			// Construct manual query for text mode creator search
856
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
857
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
856
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
857
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
858 858
 				$filter = false;
859 859
 				continue;
860 860
 			}
861 861
 
862 862
 			// By default, we want searches to be wildcard for each field.
863
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
863
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
864 864
 
865 865
 			// For multichoice, let's have an in (OR) search.
866
-			if ( is_array( $filter['value'] ) ) {
867
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
866
+			if ( is_array( $filter[ 'value' ] ) ) {
867
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
868 868
 			}
869 869
 
870 870
 			// Default form with joins functionality
871
-			if ( empty( $filter['form_id'] ) ) {
872
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
871
+			if ( empty( $filter[ 'form_id' ] ) ) {
872
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
873 873
 			}
874 874
 
875 875
 			/**
@@ -879,28 +879,28 @@  discard block
 block discarded – undo
879 879
 			 * @since develop
880 880
 			 * @param \GV\View $view The View we're operating on.
881 881
 			 */
882
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
882
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
883 883
 		}
884 884
 
885
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
885
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
886 886
 			$date_criteria = array();
887 887
 
888
-			if ( isset( $search_criteria['start_date'] ) ) {
889
-				$date_criteria['start_date'] = $search_criteria['start_date'];
888
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
889
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
890 890
 			}
891 891
 
892
-			if ( isset( $search_criteria['end_date'] ) ) {
893
-				$date_criteria['end_date'] = $search_criteria['end_date'];
892
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
893
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
894 894
 			}
895 895
 
896 896
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
897 897
 			$_tmp_query_parts   = $_tmp_query->_introspect();
898
-			$extra_conditions[] = $_tmp_query_parts['where'];
898
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
899 899
 		}
900 900
 
901 901
 		$search_conditions = array();
902 902
 
903
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
903
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
904 904
 			foreach ( $filters as &$filter ) {
905 905
 				if ( ! is_array( $filter ) ) {
906 906
 					continue;
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
 				 * code by reusing what's inside GF_Query already as they
913 913
 				 * take care of many small things like forcing numeric, etc.
914 914
 				 */
915
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
915
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
916 916
 				$_tmp_query_parts = $_tmp_query->_introspect();
917
-				$search_condition = $_tmp_query_parts['where'];
917
+				$search_condition = $_tmp_query_parts[ 'where' ];
918 918
 
919
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
920
-					$search_conditions[] = $search_condition;
919
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
920
+					$search_conditions[ ] = $search_condition;
921 921
 				} else {
922 922
 					$left = $search_condition->left;
923 923
 					$alias = $query->_alias( $left->field_id, $left->source, $left->is_entry_column() ? 't' : 'm' );
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 							$on = $_join->join_on;
928 928
 							$join = $_join->join;
929 929
 
930
-							$search_conditions[] = GF_Query_Condition::_or(
930
+							$search_conditions[ ] = GF_Query_Condition::_or(
931 931
 								// Join
932 932
 								new GF_Query_Condition(
933 933
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
 							);
944 944
 						}
945 945
 					} else {
946
-						$search_conditions[] = new GF_Query_Condition(
946
+						$search_conditions[ ] = new GF_Query_Condition(
947 947
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
948 948
 							$search_condition->operator,
949 949
 							$search_condition->right
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 		/**
966 966
 		 * Combine the parts as a new WHERE clause.
967 967
 		 */
968
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
968
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
969 969
 		$query->where( $where );
970 970
 	}
971 971
 
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		$field_id = str_replace( 'filter_', '', $key );
989 989
 
990 990
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
991
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
991
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
992 992
 			$field_id = str_replace( '_', '.', $field_id );
993 993
 		}
994 994
 
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 			// form is in searchable fields
1046 1046
 			$found = false;
1047 1047
 			foreach ( $searchable_fields as $field ) {
1048
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1048
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1049 1049
 					$found = true;
1050 1050
 					break;
1051 1051
 				}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 
1086 1086
 			case 'select':
1087 1087
 			case 'radio':
1088
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1088
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1089 1089
 				break;
1090 1090
 
1091 1091
 			case 'post_category':
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 				foreach ( $value as $val ) {
1101 1101
 					$cat = get_term( $val, 'category' );
1102
-					$filter[] = array(
1102
+					$filter[ ] = array(
1103 1103
 						'key'      => $field_id,
1104 1104
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1105 1105
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
 				$filter = array();
1119 1119
 
1120 1120
 				foreach ( $value as $val ) {
1121
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1121
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1122 1122
 				}
1123 1123
 
1124 1124
 				break;
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 				// convert checkbox on/off into the correct search filter
1128 1128
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1129 1129
 					foreach ( $form_field->inputs as $k => $input ) {
1130
-						if ( $input['id'] == $field_id ) {
1131
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1132
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1130
+						if ( $input[ 'id' ] == $field_id ) {
1131
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1132
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1133 1133
 							break;
1134 1134
 						}
1135 1135
 					}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 					$filter = array();
1140 1140
 
1141 1141
 					foreach ( $value as $val ) {
1142
-						$filter[] = array(
1142
+						$filter[ ] = array(
1143 1143
 							'key'      => $field_id,
1144 1144
 							'value'    => $val,
1145 1145
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1160,9 +1160,9 @@  discard block
 block discarded – undo
1160 1160
 					foreach ( $words as $word ) {
1161 1161
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1162 1162
 							// Keep the same key for each filter
1163
-							$filter['value'] = $word;
1163
+							$filter[ 'value' ] = $word;
1164 1164
 							// Add a search for the value
1165
-							$filters[] = $filter;
1165
+							$filters[ ] = $filter;
1166 1166
 						}
1167 1167
 					}
1168 1168
 
@@ -1176,19 +1176,19 @@  discard block
 block discarded – undo
1176 1176
 
1177 1177
 					foreach ( $searchable_fields as $searchable_field ) {
1178 1178
 
1179
-						if( $form_field->ID !== $searchable_field['field'] ) {
1179
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1180 1180
 							continue;
1181 1181
 						}
1182 1182
 
1183 1183
 						// Only exact-match dropdowns, not text search
1184
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1184
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1185 1185
 							continue;
1186 1186
 						}
1187 1187
 
1188 1188
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1189 1189
 
1190 1190
 						if ( 4 === $input_id ) {
1191
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1191
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1192 1192
 						};
1193 1193
 					}
1194 1194
 				}
@@ -1216,12 +1216,12 @@  discard block
 block discarded – undo
1216 1216
 						 * @since 1.16.3
1217 1217
 						 * Safeguard until GF implements '<=' operator
1218 1218
 						 */
1219
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1219
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1220 1220
 							$operator = '<';
1221 1221
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1222 1222
 						}
1223 1223
 
1224
-						$filter[] = array(
1224
+						$filter[ ] = array(
1225 1225
 							'key'      => $field_id,
1226 1226
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1227 1227
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1229,12 +1229,12 @@  discard block
 block discarded – undo
1229 1229
 					}
1230 1230
 				} else {
1231 1231
 					$date = $value;
1232
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1233
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1232
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1233
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1234 1234
 				}
1235 1235
 
1236
-				if ('payment_date' === $key) {
1237
-					$filter['operator'] = 'contains';
1236
+				if ( 'payment_date' === $key ) {
1237
+					$filter[ 'operator' ] = 'contains';
1238 1238
 				}
1239 1239
 
1240 1240
 				break;
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 			'ymd_dot' => 'Y.m.d',
1264 1264
 		);
1265 1265
 
1266
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1266
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1267 1267
 			$format = $datepicker[ $field->dateFormat ];
1268 1268
 		}
1269 1269
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	public function add_template_path( $file_paths ) {
1301 1301
 
1302 1302
 		// Index 100 is the default GravityView template path.
1303
-		$file_paths[102] = self::$file . 'templates/';
1303
+		$file_paths[ 102 ] = self::$file . 'templates/';
1304 1304
 
1305 1305
 		return $file_paths;
1306 1306
 	}
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		$has_date = false;
1320 1320
 
1321 1321
 		foreach ( $search_fields as $k => $field ) {
1322
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1322
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1323 1323
 				$has_date = true;
1324 1324
 				break;
1325 1325
 			}
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1349 1349
 
1350 1350
 		// get configured search fields
1351
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1351
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1352 1352
 
1353 1353
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1354 1354
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1362,40 +1362,40 @@  discard block
 block discarded – undo
1362 1362
 
1363 1363
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1364 1364
 
1365
-			switch ( $field['field'] ) {
1365
+			switch ( $field[ 'field' ] ) {
1366 1366
 
1367 1367
 				case 'search_all':
1368
-					$updated_field['key'] = 'search_all';
1369
-					$updated_field['input'] = 'search_all';
1370
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1368
+					$updated_field[ 'key' ] = 'search_all';
1369
+					$updated_field[ 'input' ] = 'search_all';
1370
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1371 1371
 					break;
1372 1372
 
1373 1373
 				case 'entry_date':
1374
-					$updated_field['key'] = 'entry_date';
1375
-					$updated_field['input'] = 'entry_date';
1376
-					$updated_field['value'] = array(
1374
+					$updated_field[ 'key' ] = 'entry_date';
1375
+					$updated_field[ 'input' ] = 'entry_date';
1376
+					$updated_field[ 'value' ] = array(
1377 1377
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1378 1378
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1379 1379
 					);
1380 1380
 					break;
1381 1381
 
1382 1382
 				case 'entry_id':
1383
-					$updated_field['key'] = 'entry_id';
1384
-					$updated_field['input'] = 'entry_id';
1385
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1383
+					$updated_field[ 'key' ] = 'entry_id';
1384
+					$updated_field[ 'input' ] = 'entry_id';
1385
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1386 1386
 					break;
1387 1387
 
1388 1388
 				case 'created_by':
1389
-					$updated_field['key'] = 'created_by';
1390
-					$updated_field['name'] = 'gv_by';
1391
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1392
-					$updated_field['choices'] = self::get_created_by_choices( $view );
1389
+					$updated_field[ 'key' ] = 'created_by';
1390
+					$updated_field[ 'name' ] = 'gv_by';
1391
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1392
+					$updated_field[ 'choices' ] = self::get_created_by_choices( $view );
1393 1393
 					break;
1394 1394
 
1395 1395
 				case 'is_approved':
1396
-					$updated_field['key'] = 'is_approved';
1397
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
-					$updated_field['choices'] = self::get_is_approved_choices();
1396
+					$updated_field[ 'key' ] = 'is_approved';
1397
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1398
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1399 1399
 					break;
1400 1400
 			}
1401 1401
 
@@ -1416,16 +1416,16 @@  discard block
 block discarded – undo
1416 1416
 
1417 1417
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1418 1418
 
1419
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1419
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1420 1420
 
1421 1421
 		/** @since 1.14 */
1422
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1422
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1423 1423
 
1424
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1424
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1425 1425
 
1426 1426
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1427 1427
 
1428
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1428
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1429 1429
 
1430 1430
 		if ( $this->has_date_field( $search_fields ) ) {
1431 1431
 			// enqueue datepicker stuff only if needed!
@@ -1447,10 +1447,10 @@  discard block
 block discarded – undo
1447 1447
 	public static function get_search_class( $custom_class = '' ) {
1448 1448
 		$gravityview_view = GravityView_View::getInstance();
1449 1449
 
1450
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1450
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1451 1451
 
1452
-		if ( ! empty( $custom_class )  ) {
1453
-			$search_class .= ' '.$custom_class;
1452
+		if ( ! empty( $custom_class ) ) {
1453
+			$search_class .= ' ' . $custom_class;
1454 1454
 		}
1455 1455
 
1456 1456
 		/**
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 
1502 1502
 		if ( ! $label ) {
1503 1503
 
1504
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1504
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1505 1505
 
1506
-			switch( $field['field'] ) {
1506
+			switch ( $field[ 'field' ] ) {
1507 1507
 				case 'search_all':
1508 1508
 					$label = __( 'Search Entries:', 'gravityview' );
1509 1509
 					break;
@@ -1515,10 +1515,10 @@  discard block
 block discarded – undo
1515 1515
 					break;
1516 1516
 				default:
1517 1517
 					// If this is a field input, not a field
1518
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1518
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1519 1519
 
1520 1520
 						// Get the label for the field in question, which returns an array
1521
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1521
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1522 1522
 
1523 1523
 						// Get the item with the `label` key
1524 1524
 						$values = wp_list_pluck( $items, 'label' );
@@ -1559,13 +1559,13 @@  discard block
 block discarded – undo
1559 1559
 		$form = $gravityview_view->getForm();
1560 1560
 
1561 1561
 		// for advanced field ids (eg, first name / last name )
1562
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1562
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1563 1563
 
1564 1564
 		// get searched value from $_GET/$_POST (string or array)
1565 1565
 		$value = $this->rgget_or_rgpost( $name );
1566 1566
 
1567 1567
 		// get form field details
1568
-		$form_field = gravityview_get_field( $form, $field['field'] );
1568
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1569 1569
 
1570 1570
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1571 1571
 
@@ -1579,17 +1579,17 @@  discard block
 block discarded – undo
1579 1579
 		);
1580 1580
 
1581 1581
 		// collect choices
1582
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1583
-			$filter['choices'] = gravityview_get_terms_choices();
1584
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1585
-			$filter['choices'] = $form_field['choices'];
1582
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1583
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1584
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1585
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1586 1586
 		}
1587 1587
 
1588
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1589
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1588
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1589
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1590 1590
 		}
1591 1591
 
1592
-		if ( ! empty( $filter['choices'] ) ) {
1592
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1593 1593
 			/**
1594 1594
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1595 1595
 			 * @param[in,out] bool Yes or no.
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 			 * @param \GV\Context The context.
1598 1598
 			 */
1599 1599
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1600
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1600
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1601 1601
 			}
1602 1602
 		}
1603 1603
 
@@ -1626,11 +1626,11 @@  discard block
 block discarded – undo
1626 1626
 	 * @return array The filter choices.
1627 1627
 	 */
1628 1628
 	private function sieve_filter_choices( $filter, $context ) {
1629
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1629
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1630 1630
 			return $filter; // @todo Populate plugins might give us empty choices
1631 1631
 		}
1632 1632
 
1633
-		if ( ! is_numeric( $filter['key'] ) ) {
1633
+		if ( ! is_numeric( $filter[ 'key' ] ) ) {
1634 1634
 			return $filter;
1635 1635
 		}
1636 1636
 
@@ -1640,29 +1640,29 @@  discard block
 block discarded – undo
1640 1640
 
1641 1641
 		$table = GFFormsModel::get_entry_meta_table_name();
1642 1642
 
1643
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1643
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1644 1644
 
1645 1645
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1646 1646
 			case 'post_category':
1647 1647
 				$choices = $wpdb->get_col( $wpdb->prepare(
1648 1648
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1649
-					$key_like, $filter['key'], $form_id
1649
+					$key_like, $filter[ 'key' ], $form_id
1650 1650
 				) );
1651 1651
 				break;
1652 1652
 			default:
1653 1653
 				$choices = $wpdb->get_col( $wpdb->prepare(
1654 1654
 					"SELECT DISTINCT meta_value FROM $table WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1655
-					$key_like, $filter['key'], $form_id
1655
+					$key_like, $filter[ 'key' ], $form_id
1656 1656
 				) );
1657 1657
 
1658
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1658
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1659 1659
 					$choices = array_map( 'json_decode', $choices );
1660 1660
 					$_choices_array = array();
1661 1661
 					foreach ( $choices as $choice ) {
1662 1662
 						if ( is_array( $choice ) ) {
1663 1663
 							$_choices_array = array_merge( $_choices_array, $choice );
1664 1664
 						} else {
1665
-							$_choices_array []= $choice;
1665
+							$_choices_array [ ] = $choice;
1666 1666
 						}
1667 1667
 					}
1668 1668
 					$choices = array_unique( $_choices_array );
@@ -1672,9 +1672,9 @@  discard block
 block discarded – undo
1672 1672
 		endswitch;
1673 1673
 
1674 1674
 		$filter_choices = array();
1675
-		foreach ( $filter['choices'] as $choice ) {
1676
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1677
-				$filter_choices[] = $choice;
1675
+		foreach ( $filter[ 'choices' ] as $choice ) {
1676
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1677
+				$filter_choices[ ] = $choice;
1678 1678
 			}
1679 1679
 		}
1680 1680
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 			 * @param \GV\View $view The view.
1710 1710
 			 */
1711 1711
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1712
-			$choices[] = array(
1712
+			$choices[ ] = array(
1713 1713
 				'value' => $user->ID,
1714 1714
 				'text' => $text,
1715 1715
 			);
@@ -1729,9 +1729,9 @@  discard block
 block discarded – undo
1729 1729
 
1730 1730
 		$choices = array();
1731 1731
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1732
-			$choices[] = array(
1733
-				'value' => $status['value'],
1734
-				'text' => $status['label'],
1732
+			$choices[ ] = array(
1733
+				'value' => $status[ 'value' ],
1734
+				'text' => $status[ 'label' ],
1735 1735
 			);
1736 1736
 		}
1737 1737
 
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 	 */
1784 1784
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1785 1785
 
1786
-		$js_dependencies[] = 'jquery-ui-datepicker';
1786
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1787 1787
 
1788 1788
 		return $js_dependencies;
1789 1789
 	}
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
 			'isRTL'             => is_rtl(),
1828 1828
 		), $view_data );
1829 1829
 
1830
-		$localizations['datepicker'] = $datepicker_settings;
1830
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1831 1831
 
1832 1832
 		return $localizations;
1833 1833
 
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
 	 * @return void
1855 1855
 	 */
1856 1856
 	private function maybe_enqueue_flexibility() {
1857
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1857
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1858 1858
 			wp_enqueue_script( 'gv-flexibility' );
1859 1859
 		}
1860 1860
 	}
@@ -1876,7 +1876,7 @@  discard block
 block discarded – undo
1876 1876
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1877 1877
 
1878 1878
 		$scheme = is_ssl() ? 'https://' : 'http://';
1879
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1879
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1880 1880
 
1881 1881
 		/**
1882 1882
 		 * @filter `gravityview_search_datepicker_class`
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
 	public function add_preview_inputs() {
1956 1956
 		global $wp;
1957 1957
 
1958
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
1958
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
1959 1959
 			return;
1960 1960
 		}
1961 1961
 
@@ -2007,7 +2007,7 @@  discard block
 block discarded – undo
2007 2007
  */
2008 2008
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2009 2009
 	public function __construct( $filter, $view ) {
2010
-		$this->value = $filter['value'];
2010
+		$this->value = $filter[ 'value' ];
2011 2011
 		$this->view = $view;
2012 2012
 	}
2013 2013
 
@@ -2039,11 +2039,11 @@  discard block
 block discarded – undo
2039 2039
 		$conditions = array();
2040 2040
 
2041 2041
 		foreach ( $user_fields as $user_field ) {
2042
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2042
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2043 2043
 		}
2044 2044
 
2045 2045
 		foreach ( $user_meta_fields as $meta_field ) {
2046
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2046
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2047 2047
 		}
2048 2048
 
2049 2049
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-sequence.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		$this->label = esc_html__( 'Number Sequence', 'gravityview' );
42 42
 		$this->description = esc_html__( 'Display a sequential result number for each entry.', 'gravityview' );
43 43
 
44
-		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips') );
44
+		add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'field_tooltips' ) );
45 45
 
46 46
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
47 47
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 			return $entry_default_fields;
66 66
 		}
67 67
 
68
-		$entry_default_fields['sequence'] = array(
68
+		$entry_default_fields[ 'sequence' ] = array(
69 69
 			'label' => __( 'Result Number', 'gravityview' ),
70 70
 			'type'  => $this->name,
71 71
 			'desc'  => $this->description,
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$return = $tooltips;
86 86
 
87
-		$return['reverse_sequence'] = array(
88
-			'title' => __('Reverse the order of the result numbers', 'gravityview'),
89
-			'value' => __('Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview'),
87
+		$return[ 'reverse_sequence' ] = array(
88
+			'title' => __( 'Reverse the order of the result numbers', 'gravityview' ),
89
+			'value' => __( 'Output the number sequence in descending order. If enabled, numbers will count down from high to low.', 'gravityview' ),
90 90
 		);
91 91
 
92 92
 		return $return;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
96 96
 
97
-		unset ( $field_options['search_filter'] );
97
+		unset ( $field_options[ 'search_filter' ] );
98 98
 
99 99
 		$new_fields = array(
100 100
 			'start' => array(
101 101
 				'type' => 'number',
102 102
 				'label' => __( 'First Number in the Sequence', 'gravityview' ),
103
-				'desc' => __('For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview'),
103
+				'desc' => __( 'For each entry, the displayed number will increase by one. When displaying ten entries, the first entry will display "1", and the last entry will show "10".', 'gravityview' ),
104 104
 				'value' => '1',
105 105
 				'merge_tags' => false,
106 106
 			),
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
 		$return = $text;
157 157
 
158 158
 		$context = new \GV\Template_Context();
159
-		$context->view = \GV\View::by_id( $view_data['view_id'] );
159
+		$context->view = \GV\View::by_id( $view_data[ 'view_id' ] );
160 160
 		$context->entry = \GV\GF_Entry::from_entry( $entry );
161 161
 
162 162
 		$gv_field = \GV\Internal_Field::by_id( 'sequence' );
163 163
 		$merge_tag_context = \GV\Utils::get( $legacy_field, 'UID' );
164
-		$merge_tag_context = $entry['id'] . "/{$merge_tag_context}";
164
+		$merge_tag_context = $entry[ 'id' ] . "/{$merge_tag_context}";
165 165
 
166 166
 		foreach ( $matches as $match ) {
167 167
 
168
-			$full_tag = $match[0];
169
-			$property = $match[1];
168
+			$full_tag = $match[ 0 ];
169
+			$property = $match[ 1 ];
170 170
 
171 171
 			$gv_field->reverse = false;
172 172
 			$gv_field->start = 1;
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 
186 186
 				// If there is a field with the ID of the start number, the merge tag won't work.
187 187
 				// In that case, you can use "=" instead: `{sequence start=10}`
188
-				if( 1 === sizeof( $maybe_start ) ) {
188
+				if ( 1 === sizeof( $maybe_start ) ) {
189 189
 					$maybe_start = explode( '=', $modifier );
190 190
 				}
191 191
 
192 192
 				if ( 'start' === rgar( $maybe_start, 0 ) && is_numeric( rgar( $maybe_start, 1 ) ) ) {
193
-					$gv_field->start = (int) rgar( $maybe_start, 1 );
193
+					$gv_field->start = (int)rgar( $maybe_start, 1 );
194 194
 				}
195 195
 			}
196 196
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 			$merge_tag_context_modifiers = $merge_tag_context . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
202 202
 
203 203
 			if ( ! isset( $merge_tag_sequences[ $merge_tag_context_modifiers ] ) ) {
204
-				$gv_field->UID = $legacy_field['UID'] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
204
+				$gv_field->UID = $legacy_field[ 'UID' ] . '/' . var_export( $gv_field->reverse, true ) . '/' . $gv_field->start;
205 205
 				$context->field = $gv_field;
206 206
 				$sequence = $merge_tag_sequences[ $merge_tag_context_modifiers ] = $this->get_sequence( $context );
207 207
 			} else {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$total = $context->view->get_entries()->total();
247 247
 			remove_filter( 'gform_gf_query_sql', $callback );
248 248
 
249
-			unset( $sql_query['paginate'] );
249
+			unset( $sql_query[ 'paginate' ] );
250 250
 
251 251
 			global $wpdb;
252 252
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/select-template.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -26,52 +26,52 @@
 block discarded – undo
26 26
 
27 27
 <?php // list all the available templates (type= fresh or custom ) ?>
28 28
 <div class="gv-grid">
29
-	<?php foreach( $templates as $id => $template ) {
29
+	<?php foreach ( $templates as $id => $template ) {
30 30
 		$selected     = ( $id == $current_template ) ? ' gv-selected' : '';
31
-		$placeholder  = ! empty( $template['buy_source'] );
32
-		$is_included  = ! empty( $template['included'] );
31
+		$placeholder  = ! empty( $template[ 'buy_source' ] );
32
+		$is_included  = ! empty( $template[ 'included' ] );
33 33
 		$plugin_data  = GravityView_Admin_Installer::get_wp_plugins_data( \GV\Utils::get( $template, 'textdomain', '' ) );
34 34
 		$button_text  = empty( $plugin_data ) ? esc_html__( 'Install Layout', 'gravityview' ) : esc_html__( 'Activate & Select Layout', 'gravityview' );
35 35
 		$button_class = 'gv-layout-' . ( empty( $plugin_data ) ? 'install' : 'activate' );
36
-		$template_path = isset($plugin_data['path']) ? $plugin_data['path'] : '';
36
+		$template_path = isset( $plugin_data[ 'path' ] ) ? $plugin_data[ 'path' ] : '';
37 37
 
38 38
 		?>
39 39
 		<div class="gv-grid-col-1-4">
40
-			<div class="gv-view-types-module<?php echo $selected; if( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>">
40
+			<div class="gv-view-types-module<?php echo $selected; if ( $placeholder ) { echo ' gv-view-template-placeholder'; } ?>" data-filter="<?php echo esc_attr( $template[ 'type' ] ); ?>">
41 41
 				<div class="gv-view-types-normal">
42
-					<img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>">
43
-					<h5><?php echo esc_html( $template['label'] ); ?></h5>
44
-					<p class="description"><?php echo esc_html( $template['description'] ); ?></p>
42
+					<img src="<?php echo esc_url( $template[ 'logo' ] ); ?>" alt="<?php echo esc_attr( $template[ 'label' ] ); ?>">
43
+					<h5><?php echo esc_html( $template[ 'label' ] ); ?></h5>
44
+					<p class="description"><?php echo esc_html( $template[ 'description' ] ); ?></p>
45 45
 				</div>
46 46
 				<div class="gv-view-types-hover">
47 47
 					<div>
48 48
 						<?php
49
-						if( $is_included ) {
49
+						if ( $is_included ) {
50 50
 						?>
51 51
 							<p><a href="<?php echo esc_url( admin_url( 'edit.php?post_type=gravityview&page=gv-admin-installer' ) ); ?>" class="button button-secondary button-hero <?php echo $button_class; ?>" rel="internal" data-template-path="<?php echo $template_path; ?>"><?php echo $button_text; ?></a></p>
52
-							<?php if( !empty( $template['license'] ) ) { ?>
53
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) ); ?></p>
52
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
53
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) ); ?></p>
54 54
 							<?php } ?>
55 55
 						<?php
56
-						} elseif( $placeholder ) {
57
-							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template['license'] ) . '&utm_content=' . urlencode( $template['slug'] );
56
+						} elseif ( $placeholder ) {
57
+							$utm_string = '?utm_source=plugin&utm_medium=buy_now&utm_campaign=view_type&utm_term=' . urlencode( $template[ 'license' ] ) . '&utm_content=' . urlencode( $template[ 'slug' ] );
58 58
 							?>
59
-							<p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p>
59
+							<p><a href="<?php echo esc_url( $template[ 'buy_source' ] ); ?>" class="button button-primary button-hero" rel="noreferrer noopener external"><?php esc_html_e( 'Buy Now', 'gravityview' ); ?></a></p>
60 60
 
61
-							<?php if( !empty( $template['preview'] ) ) { ?>
62
-								<p><a href="<?php echo esc_url( $template['preview'] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview'); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
61
+							<?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
62
+								<p><a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="noreferrer noopener external" class="button button-secondary"><i class="dashicons dashicons-external" style="vertical-align: middle;" title="<?php esc_html_e( 'View a live demo of this layout', 'gravityview' ); ?>"></i> <?php esc_html_e( 'Try a demo', 'gravityview' ); ?></a></p>
63 63
 							<?php } ?>
64 64
 
65
-							<?php if( ! empty( $template['license'] ) ) { ?>
66
-								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template['license'] ) ) . '</a>' ); ?></p>
65
+							<?php if ( ! empty( $template[ 'license' ] ) ) { ?>
66
+								<p class="gv-included-in"><?php echo sprintf( esc_html__( 'This layout is included in the %s license.', 'gravityview' ), '<a href="https://gravityview.co/pricing/' . esc_attr( $utm_string ) . '" rel="noreferrer noopener external">' . esc_html( str_replace( ' ', '&nbsp;', $template[ 'license' ] ) ) . '</a>' ); ?></p>
67 67
 							<?php } ?>
68 68
 						<?php }
69 69
 
70
-						if ($placeholder || $is_included) { ?> </div><div class="hidden"> <?php } ?>
70
+						if ( $placeholder || $is_included ) { ?> </div><div class="hidden"> <?php } ?>
71 71
 
72
-                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p>
73
-                        <?php if( !empty( $template['preview'] ) ) { ?>
74
-                            <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a>
72
+                        <p><a href="#gv_select_template" role="button" class="gv_select_template button button-hero button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview' ); ?></a></p>
73
+                        <?php if ( ! empty( $template[ 'preview' ] ) ) { ?>
74
+                            <a href="<?php echo esc_url( $template[ 'preview' ] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview' ); ?>"></i></a>
75 75
                         <?php } ?>
76 76
 					</div>
77 77
 				</div>
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-consent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@
 block discarded – undo
97 97
 		// Set the $_field_id var
98 98
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
99 99
 
100
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
100
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
101 101
 			$default = 'tick';
102 102
 		} else {
103 103
 			$default = 'both';
104 104
 		}
105 105
 
106
-		$field_options['choice_display'] = array(
106
+		$field_options[ 'choice_display' ] = array(
107 107
 			'type'    => 'radio',
108 108
 			'class'   => 'vertical',
109 109
 			'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-field.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
 
15 15
 		$field_info_items = array();
16 16
 
17
-		if( !empty( $this->item['adminLabel'] ) ) {
18
-			$field_info_items[] = array(
19
-				'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ),
17
+		if ( ! empty( $this->item[ 'adminLabel' ] ) ) {
18
+			$field_info_items[ ] = array(
19
+				'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ),
20 20
 				'class'	=> 'gv-sublabel'
21 21
 			);
22 22
 		}
23 23
 
24 24
 		// Fields with IDs, not like Source URL or Entry ID
25
-		if( is_numeric( $this->id ) ) {
25
+		if ( is_numeric( $this->id ) ) {
26 26
 
27
-			$field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] );
27
+			$field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] );
28 28
 
29
-			if ( ! empty( $this->item['parent'] ) ) {
30
-				$field_info_items[] = array(
31
-					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item['parent']['label'] ) ),
29
+			if ( ! empty( $this->item[ 'parent' ] ) ) {
30
+				$field_info_items[ ] = array(
31
+					'value' => sprintf( esc_html__( 'Parent: %s', 'gravityview' ), esc_attr( $this->item[ 'parent' ][ 'label' ] ) ),
32 32
 				);
33 33
 			}
34 34
 
35
-			$field_info_items[] = array(
36
-				'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ),
37
-				'hide_in_picker' => ! empty( $this->item['parent'] ),
35
+			$field_info_items[ ] = array(
36
+				'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ),
37
+				'hide_in_picker' => ! empty( $this->item[ 'parent' ] ),
38 38
 			);
39 39
 
40
-			$field_info_items[] = array(
41
-				'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ),
40
+			$field_info_items[ ] = array(
41
+				'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ),
42 42
 			);
43 43
 		}
44 44
 
45
-		if( !empty( $this->item['desc'] ) ) {
46
-			$field_info_items[] = array(
47
-				'value' => $this->item['desc']
45
+		if ( ! empty( $this->item[ 'desc' ] ) ) {
46
+			$field_info_items[ ] = array(
47
+				'value' => $this->item[ 'desc' ]
48 48
 			);
49 49
 		}
50 50
 
51
-		$field_info_items[] = array(
52
-			'value'          => sprintf( __('Form ID: %s', 'gravityview' ), $this->form_id ),
51
+		$field_info_items[ ] = array(
52
+			'value'          => sprintf( __( 'Form ID: %s', 'gravityview' ), $this->form_id ),
53 53
 			'hide_in_picker' => true,
54 54
 		);
55 55
 
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$this->id         = $item_id;
77 77
 		$this->form_id    = $form_id;
78 78
 		$this->settings   = $settings;
79
-		$this->label_type = $item['label_type'];
79
+		$this->label_type = $item[ 'label_type' ];
80 80
 	}
81 81
 
82 82
 	/**
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
 
121 121
 			foreach ( $field_info_items as $item ) {
122 122
 
123
-				if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
123
+				if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) {
124 124
 					continue;
125 125
 				}
126 126
 
127
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
127
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
128 128
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
129 129
 				$output .= '<span class="' . $class . '">';
130
-				$output .= esc_html( $item['value'] );
130
+				$output .= esc_html( $item[ 'value' ] );
131 131
 				$output .= '</span>';
132 132
 			}
133 133
 
@@ -156,39 +156,39 @@  discard block
 block discarded – undo
156 156
 
157 157
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
158 158
 		// TODO: Un-hack this
159
-		$hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
160
-		$settings_link      = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
159
+		$hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
160
+		$settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class );
161 161
 
162 162
 		// When a field label is empty, use the Field ID
163 163
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
164 164
 
165 165
 		// If there's a custom label, and show label is checked, use that as the field heading
166
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
167
-			$label = $this->settings['custom_label'];
168
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
169
-			$label = $this->item['customLabel'];
166
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
167
+			$label = $this->settings[ 'custom_label' ];
168
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
169
+			$label = $this->item[ 'customLabel' ];
170 170
 		}
171 171
 		$label = esc_attr( $label );
172 172
 
173 173
 		$field_icon = '';
174 174
 
175
-		if ( $this->item['icon'] && ! \GV\Utils::get( $this->item, 'parent' ) ) {
175
+		if ( $this->item[ 'icon' ] && ! \GV\Utils::get( $this->item, 'parent' ) ) {
176 176
 
177
-			$has_gf_icon = ( false !== strpos( $this->item['icon'], 'gform-icon' ) );
178
-			$has_dashicon = ( false !== strpos( $this->item['icon'], 'dashicons' ) );
177
+			$has_gf_icon = ( false !== strpos( $this->item[ 'icon' ], 'gform-icon' ) );
178
+			$has_dashicon = ( false !== strpos( $this->item[ 'icon' ], 'dashicons' ) );
179 179
 
180
-			if ( 0 === strpos( $this->item['icon'], 'data:' ) ) {
180
+			if ( 0 === strpos( $this->item[ 'icon' ], 'data:' ) ) {
181 181
 				// Inline icon SVG
182
-				$field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item['icon'] ) . '\');"></i>';
183
-			} elseif( $has_gf_icon && gravityview()->plugin->is_GF_25() ) {
182
+				$field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item[ 'icon' ] ) . '\');"></i>';
183
+			} elseif ( $has_gf_icon && gravityview()->plugin->is_GF_25() ) {
184 184
 				// Gravity Forms icon font
185
-				$field_icon = '<i class="gform-icon ' . esc_attr( $this->item['icon'] ) . '"></i>';
186
-			} elseif( $has_dashicon ) {
185
+				$field_icon = '<i class="gform-icon ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
186
+			} elseif ( $has_dashicon ) {
187 187
 				// Dashicon; prefix with "dashicons"
188
-				$field_icon = '<i class="dashicons ' . esc_attr( $this->item['icon'] ) . '"></i>';
188
+				$field_icon = '<i class="dashicons ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
189 189
 			} else {
190 190
 				// Not dashicon icon
191
-				$field_icon = '<i class="' . esc_attr( $this->item['icon'] ) . '"></i>';
191
+				$field_icon = '<i class="' . esc_attr( $this->item[ 'icon' ] ) . '"></i>';
192 192
 			}
193 193
 
194 194
 			$field_icon = $field_icon . ' ';
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$output .= '</h5>';
212 212
 
213
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
213
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
214 214
 
215
-		$container_class .= empty( $this->settings['show_as_link'] ) ? '' : ' has-single-entry-link';
215
+		$container_class .= empty( $this->settings[ 'show_as_link' ] ) ? '' : ' has-single-entry-link';
216 216
 
217
-		$container_class .= empty( $this->settings['only_loggedin'] ) ? '' : ' has-custom-visibility';
217
+		$container_class .= empty( $this->settings[ 'only_loggedin' ] ) ? '' : ' has-custom-visibility';
218 218
 
219
-		$data_form_id   = ! empty( $this->form_id ) ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : '';
219
+		$data_form_id = ! empty( $this->form_id ) ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : '';
220 220
 
221
-		$data_parent_label = ! empty( $this->item['parent'] ) ? ' data-parent-label="' . esc_attr( $this->item['parent']['label'] ) . '"' : '';
221
+		$data_parent_label = ! empty( $this->item[ 'parent' ] ) ? ' data-parent-label="' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . '"' : '';
222 222
 
223
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
223
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
224 224
 
225 225
 		return $output;
226 226
 	}
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 
239 239
 		$icons = array(
240 240
 			'show_as_link' => array(
241
-				'visible' => ( ! empty( $this->settings['show_as_link'] ) ),
241
+				'visible' => ( ! empty( $this->settings[ 'show_as_link' ] ) ),
242 242
 				'title' => __( 'This field links to the Single Entry', 'gravityview' ),
243 243
 				'css_class' => 'dashicons dashicons-media-default icon-link-to-single-entry',
244 244
 			),
245 245
 			'only_loggedin' => array(
246
-				'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings['allow_edit_cap'] ) && 'read' !== $this->settings['allow_edit_cap'] ),
246
+				'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings[ 'allow_edit_cap' ] ) && 'read' !== $this->settings[ 'allow_edit_cap' ] ),
247 247
 				'title' => __( 'This field has modified visibility', 'gravityview' ),
248 248
 				'css_class' => 'dashicons dashicons-lock icon-custom-visibility',
249 249
 			),
@@ -257,21 +257,21 @@  discard block
 block discarded – undo
257 257
 		 * @param array $icons Array of icons to be shown, with `visible`, `title`, `css_class` keys.
258 258
 		 * @param array $item_settings Settings for the current item (widget or field)
259 259
 		 */
260
-		$icons = (array) apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings );
260
+		$icons = (array)apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings );
261 261
 
262 262
 		foreach ( $icons as $icon ) {
263 263
 
264
-			if ( empty( $icon['css_class'] ) || empty( $icon['title'] ) ) {
264
+			if ( empty( $icon[ 'css_class' ] ) || empty( $icon[ 'title' ] ) ) {
265 265
 				continue;
266 266
 			}
267 267
 
268
-			$css_class = trim( $icon['css_class'] );
268
+			$css_class = trim( $icon[ 'css_class' ] );
269 269
 
270
-			if ( empty( $icon['visible'] ) ) {
270
+			if ( empty( $icon[ 'visible' ] ) ) {
271 271
 				$css_class .= ' hide-if-js';
272 272
 			}
273 273
 
274
-			$output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon['title'] ) . '"></span>';
274
+			$output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon[ 'title' ] ) . '"></span>';
275 275
 		}
276 276
 
277 277
 		return $output;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-source-url.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
30 30
 
31 31
 		// Don't link to entry; doesn't make sense.
32
-		unset( $field_options['show_as_link'] );
32
+		unset( $field_options[ 'show_as_link' ] );
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
38 38
 		$add_options = array();
39
-		$add_options['link_to_source'] = array(
39
+		$add_options[ 'link_to_source' ] = array(
40 40
 			'type' => 'checkbox',
41 41
 			'label' => __( 'Link to URL:', 'gravityview' ),
42
-			'desc' => __('Display as a link to the Source URL', 'gravityview'),
42
+			'desc' => __( 'Display as a link to the Source URL', 'gravityview' ),
43 43
 			'value' => false,
44 44
 			'merge_tags' => false,
45 45
 		);
46
-		$add_options['source_link_text'] = array(
46
+		$add_options[ 'source_link_text' ] = array(
47 47
 			'type' => 'text',
48 48
 			'label' => __( 'Link Text:', 'gravityview' ),
49
-			'desc' => __('Customize the link text. If empty, the link text will be the URL.', 'gravityview'),
49
+			'desc' => __( 'Customize the link text. If empty, the link text will be the URL.', 'gravityview' ),
50 50
 			'value' => NULL,
51 51
 			'merge_tags' => true,
52 52
 			'requires' => 'link_to_source',
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$setting_tabs = parent::get_app_settings_tabs();
119 119
 
120 120
 		foreach ( $setting_tabs as &$tab ) {
121
-			if ( 'uninstall' !== $tab['name'] ) {
121
+			if ( 'uninstall' !== $tab[ 'name' ] ) {
122 122
 				continue;
123 123
 			}
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			}
130 130
 
131 131
 			// Add trash can icon to resemble the look and feel of the GF Settings page
132
-			$tab['icon'] = 'dashicons-trash';
132
+			$tab[ 'icon' ] = 'dashicons-trash';
133 133
 		}
134 134
 
135 135
 		return array_filter( $setting_tabs );
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function register_no_conflict( $items ) {
146 146
 
147
-		$items[] = 'gform_settings';
148
-		$items[] = 'gv-admin-edd-license';
147
+		$items[ ] = 'gform_settings';
148
+		$items[ ] = 'gv-admin-edd-license';
149 149
 
150 150
 		return $items;
151 151
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) );
198 198
 
199
-		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
199
+		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
200 200
 
201 201
 		$html .= $uninstall_button;
202 202
 
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function settings_save( $field, $echo = true ) {
217 217
 
218
-		$field['type']  = 'submit';
219
-		$field['name']  = 'gform-settings-save';
220
-		$field['class'] = 'button button-primary primary button-hero';
221
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
218
+		$field[ 'type' ]  = 'submit';
219
+		$field[ 'name' ]  = 'gform-settings-save';
220
+		$field[ 'class' ] = 'button button-primary primary button-hero';
221
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
222 222
 
223 223
 		$html = $this->as_html( $field, false );
224 224
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function modify_app_settings_menu_title( $setting_tabs ) {
242 242
 
243
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
244
-		$setting_tabs[0]['icon']  = 'dashicons-admin-settings';
243
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
244
+		$setting_tabs[ 0 ][ 'icon' ]  = 'dashicons-admin-settings';
245 245
 
246 246
 		return $setting_tabs;
247 247
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 					$i = 0;
490 490
 					while ( $i < 11 ) {
491 491
 						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
492
-						$i ++;
492
+						$i++;
493 493
 					}
494 494
 					?>
495 495
 				</ul>
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function as_html( $field, $echo = true ) {
696 696
 
697
-		$field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit';
697
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
698 698
 
699 699
 		$attributes    = $this->get_field_attributes( $field );
700 700
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
701
-		$value         = $this->get( $field['name'], $default_value );
701
+		$value         = $this->get( $field[ 'name' ], $default_value );
702 702
 
703
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton';
704
-		$name                = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
703
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton';
704
+		$name                = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
705 705
 
706 706
 		if ( empty( $value ) ) {
707 707
 			$value = __( 'Update Settings', 'gravityview' );
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 		$attributes = $this->get_field_attributes( $field );
711 711
 
712 712
 		$html = '<input
713
-                    type="' . $field['type'] . '"
713
+                    type="' . $field[ 'type' ] . '"
714 714
                     name="' . esc_attr( $name ) . '"
715 715
                     value="' . $value . '" ' .
716 716
 				implode( ' ', $attributes ) .
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 */
745 745
 	public function is_save_postback() {
746 746
 
747
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
747
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
748 748
 	}
749 749
 
750 750
 	/**
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		$scripts = parent::scripts();
858 858
 
859
-		$scripts[] = array(
859
+		$scripts[ ] = array(
860 860
 				'handle'  => 'gform_tooltip_init',
861 861
 				'enqueue' => array(
862 862
 						array(
@@ -884,11 +884,11 @@  discard block
 block discarded – undo
884 884
 		);
885 885
 
886 886
 		// This file was removed from 2.5
887
-		if( ! gravityview()->plugin->is_GF_25() ) {
888
-			$deps[] = 'gform_tooltip';
887
+		if ( ! gravityview()->plugin->is_GF_25() ) {
888
+			$deps[ ] = 'gform_tooltip';
889 889
 		}
890 890
 
891
-		$styles[] = array(
891
+		$styles[ ] = array(
892 892
 			'handle'  => 'gravityview_settings',
893 893
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
894 894
 			'version' => Plugin::$version,
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 						'name'          => 'support-email',
976 976
 						'type'          => 'text',
977 977
 						'validate'      => 'email',
978
-						'default_value' => $default_settings['support-email'],
978
+						'default_value' => $default_settings[ 'support-email' ],
979 979
 						'label'         => __( 'Support Email', 'gravityview' ),
980 980
 						'description'   => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
981 981
 						'class'         => 'code regular-text',
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 						'name'          => 'support_port',
988 988
 						'type'          => 'radio',
989 989
 						'label'         => __( 'Show Support Port?', 'gravityview' ),
990
-						'default_value' => $default_settings['support_port'],
990
+						'default_value' => $default_settings[ 'support_port' ],
991 991
 						'horizontal'    => 1,
992 992
 						'choices'       => array(
993 993
 								array(
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 						'name'          => 'no-conflict-mode',
1007 1007
 						'type'          => 'radio',
1008 1008
 						'label'         => __( 'No-Conflict Mode', 'gravityview' ),
1009
-						'default_value' => $default_settings['no-conflict-mode'],
1009
+						'default_value' => $default_settings[ 'no-conflict-mode' ],
1010 1010
 						'horizontal'    => 1,
1011 1011
 						'choices'       => array(
1012 1012
 								array(
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 								'name'          => 'rest_api',
1029 1029
 								'type'          => 'radio',
1030 1030
 								'label'         => __( 'REST API', 'gravityview' ),
1031
-								'default_value' => $default_settings['rest_api'],
1031
+								'default_value' => $default_settings[ 'rest_api' ],
1032 1032
 								'horizontal'    => 1,
1033 1033
 								'choices'       => array(
1034 1034
 										array(
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 					'name' => 'powered_by',
1048 1048
 					'type' => 'checkbox',
1049 1049
 					'label' => __( 'Display "Powered By" Link', 'gravityview' ),
1050
-					'default_value' => $default_settings['powered_by'],
1050
+					'default_value' => $default_settings[ 'powered_by' ],
1051 1051
 					'choices' => array(
1052 1052
 						array(
1053 1053
 							'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ),
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 						'name'          => 'beta',
1073 1073
 						'type'          => 'checkbox',
1074 1074
 						'label'         => __( 'Become a Beta Tester', 'gravityview' ),
1075
-						'default_value' => $default_settings['beta'],
1075
+						'default_value' => $default_settings[ 'beta' ],
1076 1076
 						'horizontal'    => 1,
1077 1077
 						'choices'       => array(
1078 1078
 								array(
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
 		 * @since 1.7.4
1107 1107
 		 */
1108 1108
 		foreach ( $fields as &$field ) {
1109
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
1110
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
1111
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
1112
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
1109
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
1110
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
1111
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
1112
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
1113 1113
 
1114 1114
 			if ( $disabled_attribute ) {
1115
-				$field['disabled'] = $disabled_attribute;
1115
+				$field[ 'disabled' ] = $disabled_attribute;
1116 1116
 			}
1117 1117
 
1118
-			if ( empty( $field['disabled'] ) ) {
1119
-				unset( $field['disabled'] );
1118
+			if ( empty( $field[ 'disabled' ] ) ) {
1119
+				unset( $field[ 'disabled' ] );
1120 1120
 			}
1121 1121
 		}
1122 1122
 
@@ -1128,23 +1128,23 @@  discard block
 block discarded – undo
1128 1128
 					'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ),
1129 1129
 					'type' => 'edd_license',
1130 1130
 					'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
1131
-					'default_value' => $default_settings['license_key'],
1131
+					'default_value' => $default_settings[ 'license_key' ],
1132 1132
 					'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
1133 1133
 			),
1134 1134
 			array(
1135 1135
 					'name' => 'license_key_response',
1136
-					'default_value' => $default_settings['license_key_response'],
1136
+					'default_value' => $default_settings[ 'license_key_response' ],
1137 1137
 					'type' => 'hidden',
1138 1138
 			),
1139 1139
 			array(
1140 1140
 					'name' => 'license_key_status',
1141
-					'default_value' => $default_settings['license_key_status'],
1141
+					'default_value' => $default_settings[ 'license_key_status' ],
1142 1142
 					'type' => 'hidden',
1143 1143
 			),
1144 1144
 		);
1145 1145
 
1146 1146
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1147
-			$license_fields[0] = array_merge( $license_fields[0], array(
1147
+			$license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array(
1148 1148
 				'disabled' => true,
1149 1149
 				'title'    => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ),
1150 1150
 			) );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		if ( \gravityview()->plugin->is_GF_25() ) {
1157 1157
 
1158
-			$sections[] = array(
1158
+			$sections[ ] = array(
1159 1159
 					'title'       => __( 'GravityView License', 'gravityview' ),
1160 1160
 					'class'       => 'gform-settings-panel--full gv-settings-panel--license',
1161 1161
 					'description' => $version_info,
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 			) );
1174 1174
 		}
1175 1175
 
1176
-		$sections[] = array(
1176
+		$sections[ ] = array(
1177 1177
 			'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ),
1178 1178
 			'class' => 'gform-settings-panel--full gv-settings-panel--core',
1179 1179
 			'fields'      => $fields,
@@ -1197,8 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 			if ( $disabled_attribute ) {
1199 1199
 				foreach ( $extension_sections as &$section ) {
1200
-					foreach ( $section['fields'] as &$field ) {
1201
-						$field['disabled'] = $disabled_attribute;
1200
+					foreach ( $section[ 'fields' ] as &$field ) {
1201
+						$field[ 'disabled' ] = $disabled_attribute;
1202 1202
 					}
1203 1203
 				}
1204 1204
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	public function settings_edd_license( $field, $echo = true ) {
1265 1265
 
1266 1266
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1267
-			$field['input_type'] = 'password';
1267
+			$field[ 'input_type' ] = 'password';
1268 1268
 		}
1269 1269
 
1270 1270
 		$text = $this->settings_text( $field, false );
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 		?>
1318 1318
 
1319
-		<tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1319
+		<tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1320 1320
 			<td colspan="2">
1321 1321
 				<?php $this->single_setting( $field ); ?>
1322 1322
 			</td>
@@ -1342,8 +1342,8 @@  discard block
 block discarded – undo
1342 1342
 	 */
1343 1343
 	public function single_setting_row( $field ) {
1344 1344
 
1345
-		$field['gv_description'] = Utils::get( $field, 'description' );
1346
-		$field['description']    = Utils::get( $field, 'subtitle' );
1345
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1346
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1347 1347
 		parent::single_setting_row( $field );
1348 1348
 	}
1349 1349
 
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1405 1405
 		if ( ! $added_message && ( $local_key !== $response_key ) ) {
1406 1406
 
1407
-			unset( $posted_settings['license_key_response'] );
1408
-			unset( $posted_settings['license_key_status'] );
1407
+			unset( $posted_settings[ 'license_key_response' ] );
1408
+			unset( $posted_settings[ 'license_key_status' ] );
1409 1409
 
1410 1410
 			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1411 1411
 
Please login to merge, or discard this patch.
includes/class-admin-welcome.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	 * @since 1.0
34 34
 	 */
35 35
 	public function __construct() {
36
-		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
36
+		add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 );
37 37
 		add_action( 'admin_head', array( $this, 'admin_head' ) );
38
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
39
-		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
38
+		add_action( 'admin_init', array( $this, 'welcome' ) );
39
+		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 );
40 40
 	}
41 41
 
42 42
 	/**
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		// Add help page to GravityView menu
52 52
 		add_submenu_page(
53 53
 			'edit.php?post_type=gravityview',
54
-			__('GravityView: Getting Started', 'gravityview'),
55
-			__('Getting Started', 'gravityview'),
54
+			__( 'GravityView: Getting Started', 'gravityview' ),
55
+			__( 'Getting Started', 'gravityview' ),
56 56
 			$this->minimum_capability,
57 57
 			'gv-getting-started',
58 58
 			array( $this, 'getting_started_screen' )
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return boolean  $is_page   True: yep; false: nope
87 87
 	 */
88
-	public function is_dashboard_page($is_page = false, $hook = NULL) {
88
+	public function is_dashboard_page( $is_page = false, $hook = NULL ) {
89 89
 		global $plugin_page;
90 90
 
91
-		if($is_page) { return $is_page; }
91
+		if ( $is_page ) { return $is_page; }
92 92
 
93 93
 		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
94 94
 	}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
106 106
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
107 107
 
108
-		if( !$this->is_dashboard_page() ) { return; }
108
+		if ( ! $this->is_dashboard_page() ) { return; }
109 109
 
110 110
 		?>
111 111
         <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html">
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		// Don't fetch -beta, etc.
129 129
 		list( $display_version ) = explode( '-', GravityView_Plugin::version );
130 130
 
131
-		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
131
+		$selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
132 132
 
133 133
 		echo gravityview_get_floaty( 132 );
134 134
 		?>
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
138 138
 
139 139
 		<h2 class="nav-tab-wrapper clear">
140
-			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
140
+			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
141 141
 				<?php _e( "Getting Started", 'gravityview' ); ?>
142 142
 			</a>
143
-			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
143
+			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
144 144
 				<?php _e( "List of Changes", 'gravityview' ); ?>
145 145
 			</a>
146
-			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
146
+			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
147 147
 				<?php _e( 'Credits', 'gravityview' ); ?>
148 148
 			</a>
149 149
 		</h2>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 					<h3>Create a View</h3>
178 178
 
179 179
                     <ol class="ol-decimal">
180
-						<li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views &gt; New View</a></li>
180
+						<li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views &gt; New View</a></li>
181 181
 						<li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li>
182 182
 						<li>If you want to <strong>use an existing form&rsquo;s entries</strong>, select from the dropdown.</li>
183 183
 						<li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>.
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 					</ul>
530 530
 
531 531
 					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
532
-					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p>
532
+					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p>
533 533
 				</div>
534 534
 			</div>
535 535
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		global $plugin_page;
572 572
 
573 573
 		// Bail if we're just editing the plugin
574
-		if( $plugin_page === 'plugin-editor.php' ) { return; }
574
+		if ( $plugin_page === 'plugin-editor.php' ) { return; }
575 575
 
576 576
 		// Bail if no activation redirect
577 577
 		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		$upgrade = get_option( 'gv_version_upgraded_from' );
583 583
 
584 584
 		// Don't do anything if they've already seen the new version info
585
-		if( $upgrade === GravityView_Plugin::version ) {
585
+		if ( $upgrade === GravityView_Plugin::version ) {
586 586
 			return;
587 587
 		}
588 588
 
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
 		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
591 591
 
592 592
 		// Bail if activating from network, or bulk
593
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
593
+		if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; }
594 594
 
595 595
 		// First time install
596
-		if( ! $upgrade ) {
596
+		if ( ! $upgrade ) {
597 597
 			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
598 598
 		}
599 599
 		// Update
Please login to merge, or discard this patch.