Completed
Push — develop ( d22d9f...f27933 )
by
unknown
17:42
created
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			'search_clear' => array(
56 56
 				'type'  => 'checkbox',
57 57
 				'label' => __( 'Show Clear button', 'gravityview' ),
58
-				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview'),
58
+				'desc'  => __( 'When a search is performed, display a button that removes all search values.', 'gravityview' ),
59 59
 				'value' => true,
60 60
 			),
61 61
 			'search_fields' => array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 				'type' => 'radio',
69 69
 				'full_width' => true,
70 70
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
71
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
71
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
72 72
 				'value' => 'any',
73 73
 				'class' => 'hide-if-js',
74 74
 				'options' => array(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
89 89
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
90
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
90
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
91 91
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
92 92
 
93 93
 			// ajax - get the searchable fields
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function add_reserved_args( $args ) {
125 125
 
126
-		$args[] = 'gv_search';
127
-		$args[] = 'gv_start';
128
-		$args[] = 'gv_end';
129
-		$args[] = 'gv_id';
130
-		$args[] = 'gv_by';
131
-		$args[] = 'mode';
126
+		$args[ ] = 'gv_search';
127
+		$args[ ] = 'gv_start';
128
+		$args[ ] = 'gv_end';
129
+		$args[ ] = 'gv_id';
130
+		$args[ ] = 'gv_by';
131
+		$args[ ] = 'mode';
132 132
 
133
-		$get = (array) $_GET;
133
+		$get = (array)$_GET;
134 134
 
135 135
 		// If the fields being searched as reserved; not to be considered user-passed variables
136 136
 		foreach ( $get as $key => $value ) {
137 137
 			if ( $key !== $this->convert_request_key_to_filter_key( $key ) ) {
138
-				$args[] = $key;
138
+				$args[ ] = $key;
139 139
 			}
140 140
 		}
141 141
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
260 260
 		$script_source = empty( $script_min ) ? '/source' : '';
261 261
 
262
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
262
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
263 263
 
264 264
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
265 265
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
282 282
 	 */
283 283
 	public function register_no_conflict( $allowed ) {
284
-		$allowed[] = 'gravityview_searchwidget_admin';
284
+		$allowed[ ] = 'gravityview_searchwidget_admin';
285 285
 		return $allowed;
286 286
 	}
287 287
 
@@ -293,24 +293,24 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public static function get_searchable_fields() {
295 295
 
296
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
296
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
297 297
 			exit( '0' );
298 298
 		}
299 299
 
300 300
 		$form = '';
301 301
 
302 302
 		// Fetch the form for the current View
303
-		if ( ! empty( $_POST['view_id'] ) ) {
303
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
304 304
 
305
-			$form = gravityview_get_form_id( $_POST['view_id'] );
305
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
306 306
 
307
-		} elseif ( ! empty( $_POST['formid'] ) ) {
307
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
308 308
 
309
-			$form = (int) $_POST['formid'];
309
+			$form = (int)$_POST[ 'formid' ];
310 310
 
311
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
311
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
312 312
 
313
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
313
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
314 314
 
315 315
 		}
316 316
 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		if ( gravityview()->plugin->supports( \GV\Plugin::FEATURE_GFQUERY ) ) {
363
-			$custom_fields['is_approved'] = array(
363
+			$custom_fields[ 'is_approved' ] = array(
364 364
 				'text' => esc_html__( 'Approval Status', 'gravityview' ),
365 365
 				'type' => 'multi',
366 366
 			);
367 367
 		}
368 368
 
369
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
370
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
369
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
370
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
371 371
 		}
372 372
 
373 373
 		// Get fields with sub-inputs and no parent
@@ -389,13 +389,13 @@  discard block
 block discarded – undo
389 389
 
390 390
 			foreach ( $fields as $id => $field ) {
391 391
 
392
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
392
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
393 393
 					continue;
394 394
 				}
395 395
 
396
-				$types = self::get_search_input_types( $id, $field['type'] );
396
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
397 397
 
398
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
398
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
399 399
 			}
400 400
 		}
401 401
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
419 419
 
420 420
 		// @todo - This needs to be improved - many fields have . including products and addresses
421
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
421
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
422 422
 			$input_type = 'boolean'; // on/off checkbox
423 423
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
424 424
 			$input_type = 'multi'; //multiselect
@@ -464,19 +464,19 @@  discard block
 block discarded – undo
464 464
 			$post_id = 0;
465 465
 
466 466
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
467
-			if ( ! empty( $widget_args['post_id'] ) ) {
468
-				$post_id = absint( $widget_args['post_id'] );
467
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
468
+				$post_id = absint( $widget_args[ 'post_id' ] );
469 469
 			}
470 470
 			// We're in the WordPress Widget context, and the base View ID should be used
471
-			else if ( ! empty( $widget_args['view_id'] ) ) {
472
-				$post_id = absint( $widget_args['view_id'] );
471
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
472
+				$post_id = absint( $widget_args[ 'view_id' ] );
473 473
 			}
474 474
 
475 475
 			$args = gravityview_get_permalink_query_args( $post_id );
476 476
 
477 477
 			// Add hidden fields to the search form
478 478
 			foreach ( $args as $key => $value ) {
479
-				$search_fields[] = array(
479
+				$search_fields[ ] = array(
480 480
 					'name'  => $key,
481 481
 					'input' => 'hidden',
482 482
 					'value' => $value,
@@ -515,28 +515,28 @@  discard block
 block discarded – undo
515 515
 		/**
516 516
 		 * Include the sidebar Widgets.
517 517
 		 */
518
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
518
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
519 519
 
520 520
 		foreach ( $widgets as $widget ) {
521
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
522
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
521
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
522
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
523 523
 					foreach ( $_fields as $field ) {
524
-						if ( empty( $field['form_id'] ) ) {
525
-							$field['form_id'] = $view->form ? $view->form->ID : 0;
524
+						if ( empty( $field[ 'form_id' ] ) ) {
525
+							$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
526 526
 						}
527
-						$searchable_fields[] = $with_full_field ? $field : $field['field'];
527
+						$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
528 528
 					}
529 529
 				}
530 530
 			}
531 531
 		}
532 532
 
533 533
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
534
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
534
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
535 535
 				foreach ( $_fields as $field ) {
536
-					if ( empty( $field['form_id'] ) ) {
537
-						$field['form_id'] = $view->form ? $view->form->ID : 0;
536
+					if ( empty( $field[ 'form_id' ] ) ) {
537
+						$field[ 'form_id' ] = $view->form ? $view->form->ID : 0;
538 538
 					}
539
-					$searchable_fields[] = $with_full_field ? $field : $field['field'];
539
+					$searchable_fields[ ] = $with_full_field ? $field : $field[ 'field' ];
540 540
 				}
541 541
 			}
542 542
 		}
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			return $search_criteria; // Return the original criteria, GF_Query modification kicks in later
583 583
 		}
584 584
 
585
-		if( 'post' === $this->search_method ) {
585
+		if ( 'post' === $this->search_method ) {
586 586
 			$get = $_POST;
587 587
 		} else {
588 588
 			$get = $_GET;
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		$get = gv_map_deep( $get, 'rawurldecode' );
604 604
 
605 605
 		// Make sure array key is set up
606
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
606
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
607 607
 
608 608
 		$searchable_fields = $this->get_view_searchable_fields( $view );
609 609
 		$searchable_field_objects = $this->get_view_searchable_fields( $view, true );
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
 		$trim_search_value = apply_filters( 'gravityview/search-trim-input', true );
624 624
 
625 625
 		// add free search
626
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
626
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
627 627
 
628
-			$search_all_value = $trim_search_value ? trim( $get['gv_search'] ) : $get['gv_search'];
628
+			$search_all_value = $trim_search_value ? trim( $get[ 'gv_search' ] ) : $get[ 'gv_search' ];
629 629
 
630 630
 			if ( $split_words ) {
631 631
 				// Search for a piece
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 			}
642 642
 
643 643
 			foreach ( $words as $word ) {
644
-				$search_criteria['field_filters'][] = array(
644
+				$search_criteria[ 'field_filters' ][ ] = array(
645 645
 					'key' => null, // The field ID to search
646 646
 					'value' => $word, // The value to search
647 647
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -654,14 +654,14 @@  discard block
 block discarded – undo
654 654
 			/**
655 655
 			 * Get and normalize the dates according to the input format.
656 656
 			 */
657
-			if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) {
658
-				if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
657
+			if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) {
658
+				if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) {
659 659
 					$curr_start = $curr_start_date->format( 'Y-m-d' );
660 660
 				}
661 661
 			}
662 662
 
663
-			if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) {
664
-				if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
663
+			if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) {
664
+				if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) {
665 665
 					$curr_end = $curr_end_date->format( 'Y-m-d' );
666 666
 				}
667 667
 			}
@@ -697,22 +697,22 @@  discard block
 block discarded – undo
697 697
 			 */
698 698
 			if ( ! empty( $curr_start ) ) {
699 699
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
700
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
700
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
701 701
 			}
702 702
 
703 703
 			if ( ! empty( $curr_end ) ) {
704 704
 				// Fast-forward 24 hour on the end time
705 705
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
706
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
707
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
708
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
706
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
707
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
708
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
709 709
 				}
710 710
 			}
711 711
 		}
712 712
 
713 713
 		// search for a specific entry ID
714 714
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
715
-			$search_criteria['field_filters'][] = array(
715
+			$search_criteria[ 'field_filters' ][ ] = array(
716 716
 				'key' => 'id',
717 717
 				'value' => absint( $get[ 'gv_id' ] ),
718 718
 				'operator' => $this->get_operator( $get, 'gv_id', array( '=' ), '=' ),
@@ -721,15 +721,15 @@  discard block
 block discarded – undo
721 721
 
722 722
 		// search for a specific Created_by ID
723 723
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
724
-			$search_criteria['field_filters'][] = array(
724
+			$search_criteria[ 'field_filters' ][ ] = array(
725 725
 				'key' => 'created_by',
726
-				'value' => $get['gv_by'],
726
+				'value' => $get[ 'gv_by' ],
727 727
 				'operator' => $this->get_operator( $get, 'gv_by', array( '=' ), '=' ),
728 728
 			);
729 729
 		}
730 730
 
731 731
 		// Get search mode passed in URL
732
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
732
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
733 733
 
734 734
 		// get the other search filters
735 735
 		foreach ( $get as $key => $value ) {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 				$value = is_array( $value ) ? array_map( 'trim', $value ) : trim( $value );
748 748
 			}
749 749
 
750
-			if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
750
+			if ( gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
751 751
 				/**
752 752
 				 * @filter `gravityview/search/ignore-empty-values` Filter to control if empty field values should be ignored or strictly matched (default: true)
753 753
 				 * @since  2.14.2.1
@@ -778,21 +778,21 @@  discard block
 block discarded – undo
778 778
 				continue;
779 779
 			}
780 780
 
781
-			if ( ! isset( $filter['operator'] ) ) {
782
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
781
+			if ( ! isset( $filter[ 'operator' ] ) ) {
782
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'contains' ), 'contains' );
783 783
 			}
784 784
 
785
-			if ( isset( $filter[0]['value'] ) ) {
786
-				$filter[0]['value'] = $trim_search_value ? trim( $filter[0]['value'] ) : $filter[0]['value'];
785
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
786
+				$filter[ 0 ][ 'value' ] = $trim_search_value ? trim( $filter[ 0 ][ 'value' ] ) : $filter[ 0 ][ 'value' ];
787 787
 
788
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
788
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
789 789
 
790 790
 				// if date range type, set search mode to ALL
791
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
791
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
792 792
 					$mode = 'all';
793 793
 				}
794
-			} elseif( !empty( $filter ) ) {
795
-				$search_criteria['field_filters'][] = $filter;
794
+			} elseif ( ! empty( $filter ) ) {
795
+				$search_criteria[ 'field_filters' ][ ] = $filter;
796 796
 			}
797 797
 		}
798 798
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		 * @since 1.5.1
802 802
 		 * @param string $mode Search mode (`any` vs `all`)
803 803
 		 */
804
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
804
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
805 805
 
806 806
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
807 807
 
@@ -835,19 +835,19 @@  discard block
 block discarded – undo
835 835
 
836 836
 		$query_class = $view->get_query_class();
837 837
 
838
-		if ( empty( $search_criteria['field_filters'] ) ) {
838
+		if ( empty( $search_criteria[ 'field_filters' ] ) ) {
839 839
 			return;
840 840
 		}
841 841
 
842 842
 		$widgets = $view->widgets->by_id( $this->widget_id );
843 843
 		if ( $widgets->count() ) {
844 844
 			$widgets = $widgets->all();
845
-			$widget  = $widgets[0];
845
+			$widget  = $widgets[ 0 ];
846 846
 
847 847
 			$search_fields = json_decode( $widget->configuration->get( 'search_fields' ), true );
848 848
 
849
-			foreach ( (array) $search_fields as $search_field ) {
850
-				if ( 'created_by' === $search_field['field'] && 'input_text' === $search_field['input'] ) {
849
+			foreach ( (array)$search_fields as $search_field ) {
850
+				if ( 'created_by' === $search_field[ 'field' ] && 'input_text' === $search_field[ 'input' ] ) {
851 851
 					$created_by_text_mode = true;
852 852
 				}
853 853
 			}
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 		$extra_conditions = array();
857 857
 		$mode = 'any';
858 858
 
859
-		foreach ( $search_criteria['field_filters'] as $key => &$filter ) {
859
+		foreach ( $search_criteria[ 'field_filters' ] as $key => &$filter ) {
860 860
 			if ( ! is_array( $filter ) ) {
861 861
 				if ( in_array( strtolower( $filter ), array( 'any', 'all' ) ) ) {
862 862
 					$mode = $filter;
@@ -865,13 +865,13 @@  discard block
 block discarded – undo
865 865
 			}
866 866
 
867 867
 			// Construct a manual query for unapproved statuses
868
-			if ( 'is_approved' === $filter['key'] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array) $filter['value'] ) ) {
869
-				$_tmp_query       = new $query_class( $view->form->ID, array(
868
+			if ( 'is_approved' === $filter[ 'key' ] && in_array( \GravityView_Entry_Approval_Status::UNAPPROVED, (array)$filter[ 'value' ] ) ) {
869
+				$_tmp_query = new $query_class( $view->form->ID, array(
870 870
 					'field_filters' => array(
871 871
 						array(
872 872
 							'operator' => 'in',
873 873
 							'key'      => 'is_approved',
874
-							'value'    => (array) $filter['value'],
874
+							'value'    => (array)$filter[ 'value' ],
875 875
 						),
876 876
 						array(
877 877
 							'operator' => 'is',
@@ -883,30 +883,30 @@  discard block
 block discarded – undo
883 883
 				) );
884 884
 				$_tmp_query_parts = $_tmp_query->_introspect();
885 885
 
886
-				$extra_conditions[] = $_tmp_query_parts['where'];
886
+				$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
887 887
 
888 888
 				$filter = false;
889 889
 				continue;
890 890
 			}
891 891
 
892 892
 			// Construct manual query for text mode creator search
893
-			if ( 'created_by' === $filter['key'] && ! empty( $created_by_text_mode ) ) {
894
-				$extra_conditions[] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
893
+			if ( 'created_by' === $filter[ 'key' ] && ! empty( $created_by_text_mode ) ) {
894
+				$extra_conditions[ ] = new GravityView_Widget_Search_Author_GF_Query_Condition( $filter, $view );
895 895
 				$filter = false;
896 896
 				continue;
897 897
 			}
898 898
 
899 899
 			// By default, we want searches to be wildcard for each field.
900
-			$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
900
+			$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
901 901
 
902 902
 			// For multichoice, let's have an in (OR) search.
903
-			if ( is_array( $filter['value'] ) ) {
904
-				$filter['operator'] = 'in'; // @todo what about in contains (OR LIKE chains)?
903
+			if ( is_array( $filter[ 'value' ] ) ) {
904
+				$filter[ 'operator' ] = 'in'; // @todo what about in contains (OR LIKE chains)?
905 905
 			}
906 906
 
907 907
 			// Default form with joins functionality
908
-			if ( empty( $filter['form_id'] ) ) {
909
-				$filter['form_id'] = $view->form ? $view->form->ID : 0;
908
+			if ( empty( $filter[ 'form_id' ] ) ) {
909
+				$filter[ 'form_id' ] = $view->form ? $view->form->ID : 0;
910 910
 			}
911 911
 
912 912
 			/**
@@ -916,32 +916,32 @@  discard block
 block discarded – undo
916 916
 			 * @param array $filter array with `key`, `value`, `operator`, `type` keys
917 917
 			 * @param \GV\View $view The View we're operating on.
918 918
 			 */
919
-			$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter, $view );
919
+			$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter, $view );
920 920
 
921
-			if ( 'is' !== $filter['operator'] && '' === $filter['value'] ) {
922
-				unset( $search_criteria['field_filters'][ $key ] );
921
+			if ( 'is' !== $filter[ 'operator' ] && '' === $filter[ 'value' ] ) {
922
+				unset( $search_criteria[ 'field_filters' ][ $key ] );
923 923
 			}
924 924
 		}
925 925
 
926
-		if ( ! empty( $search_criteria['start_date'] ) || ! empty( $search_criteria['end_date'] ) ) {
926
+		if ( ! empty( $search_criteria[ 'start_date' ] ) || ! empty( $search_criteria[ 'end_date' ] ) ) {
927 927
 			$date_criteria = array();
928 928
 
929
-			if ( isset( $search_criteria['start_date'] ) ) {
930
-				$date_criteria['start_date'] = $search_criteria['start_date'];
929
+			if ( isset( $search_criteria[ 'start_date' ] ) ) {
930
+				$date_criteria[ 'start_date' ] = $search_criteria[ 'start_date' ];
931 931
 			}
932 932
 
933
-			if ( isset( $search_criteria['end_date'] ) ) {
934
-				$date_criteria['end_date'] = $search_criteria['end_date'];
933
+			if ( isset( $search_criteria[ 'end_date' ] ) ) {
934
+				$date_criteria[ 'end_date' ] = $search_criteria[ 'end_date' ];
935 935
 			}
936 936
 
937 937
 			$_tmp_query         = new $query_class( $view->form->ID, $date_criteria );
938 938
 			$_tmp_query_parts   = $_tmp_query->_introspect();
939
-			$extra_conditions[] = $_tmp_query_parts['where'];
939
+			$extra_conditions[ ] = $_tmp_query_parts[ 'where' ];
940 940
 		}
941 941
 
942 942
 		$search_conditions = array();
943 943
 
944
-		if ( $filters = array_filter( $search_criteria['field_filters'] ) ) {
944
+		if ( $filters = array_filter( $search_criteria[ 'field_filters' ] ) ) {
945 945
 			foreach ( $filters as &$filter ) {
946 946
 				if ( ! is_array( $filter ) ) {
947 947
 					continue;
@@ -953,12 +953,12 @@  discard block
 block discarded – undo
953 953
 				 * code by reusing what's inside GF_Query already as they
954 954
 				 * take care of many small things like forcing numeric, etc.
955 955
 				 */
956
-				$_tmp_query       = new $query_class( $filter['form_id'], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
956
+				$_tmp_query       = new $query_class( $filter[ 'form_id' ], array( 'mode' => 'any', 'field_filters' => array( $filter ) ) );
957 957
 				$_tmp_query_parts = $_tmp_query->_introspect();
958
-				$search_condition = $_tmp_query_parts['where'];
958
+				$search_condition = $_tmp_query_parts[ 'where' ];
959 959
 
960
-				if ( empty( $filter['key'] ) && $search_condition->expressions ) {
961
-					$search_conditions[] = $search_condition;
960
+				if ( empty( $filter[ 'key' ] ) && $search_condition->expressions ) {
961
+					$search_conditions[ ] = $search_condition;
962 962
 				} else {
963 963
 					$left = $search_condition->left;
964 964
 
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
 
971 971
 							$value = $reflectionProperty->getValue( $left );
972 972
 
973
-							if ( ! empty( $value[0] ) && $value[0] instanceof GF_Query_Column ) {
974
-								$left = $value[0];
973
+							if ( ! empty( $value[ 0 ] ) && $value[ 0 ] instanceof GF_Query_Column ) {
974
+								$left = $value[ 0 ];
975 975
 							} else {
976 976
 								continue;
977 977
 							}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 							$on = $_join->join_on;
988 988
 							$join = $_join->join;
989 989
 
990
-							$search_conditions[] = GF_Query_Condition::_or(
990
+							$search_conditions[ ] = GF_Query_Condition::_or(
991 991
 								// Join
992 992
 								new GF_Query_Condition(
993 993
 									new GF_Query_Column( GF_Query_Column::META, $join->ID, $query->_alias( GF_Query_Column::META, $join->ID, 'm' ) ),
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 							);
1004 1004
 						}
1005 1005
 					} else {
1006
-						$search_conditions[] = new GF_Query_Condition(
1006
+						$search_conditions[ ] = new GF_Query_Condition(
1007 1007
 							new GF_Query_Column( $left->field_id, $left->source, $alias ),
1008 1008
 							$search_condition->operator,
1009 1009
 							$search_condition->right
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		/**
1026 1026
 		 * Combine the parts as a new WHERE clause.
1027 1027
 		 */
1028
-		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts['where'] ), $search_conditions, $extra_conditions ) );
1028
+		$where = call_user_func_array( '\GF_Query_Condition::_and', array_merge( array( $query_parts[ 'where' ] ), $search_conditions, $extra_conditions ) );
1029 1029
 		$query->where( $where );
1030 1030
 	}
1031 1031
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 		$field_id = str_replace( array( 'filter_', 'input_' ), '', $key );
1049 1049
 
1050 1050
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
1051
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
1051
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
1052 1052
 			$field_id = str_replace( '_', '.', $field_id );
1053 1053
 		}
1054 1054
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			// form is in searchable fields
1106 1106
 			$found = false;
1107 1107
 			foreach ( $searchable_fields as $field ) {
1108
-				if ( $field_id == $field['field'] && $form->ID == $field['form_id'] ) {
1108
+				if ( $field_id == $field[ 'field' ] && $form->ID == $field[ 'form_id' ] ) {
1109 1109
 					$found = true;
1110 1110
 					break;
1111 1111
 				}
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 			case 'select':
1147 1147
 			case 'radio':
1148
-				$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1148
+				$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1149 1149
 				break;
1150 1150
 
1151 1151
 			case 'post_category':
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 				foreach ( $value as $val ) {
1161 1161
 					$cat = get_term( $val, 'category' );
1162
-					$filter[] = array(
1162
+					$filter[ ] = array(
1163 1163
 						'key'      => $field_id,
1164 1164
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
1165 1165
 						'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 				$filter = array();
1179 1179
 
1180 1180
 				foreach ( $value as $val ) {
1181
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
1181
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
1182 1182
 				}
1183 1183
 
1184 1184
 				break;
@@ -1187,9 +1187,9 @@  discard block
 block discarded – undo
1187 1187
 				// convert checkbox on/off into the correct search filter
1188 1188
 				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
1189 1189
 					foreach ( $form_field->inputs as $k => $input ) {
1190
-						if ( $input['id'] == $field_id ) {
1191
-							$filter['value'] = $form_field->choices[ $k ]['value'];
1192
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1190
+						if ( $input[ 'id' ] == $field_id ) {
1191
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
1192
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1193 1193
 							break;
1194 1194
 						}
1195 1195
 					}
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 					$filter = array();
1200 1200
 
1201 1201
 					foreach ( $value as $val ) {
1202
-						$filter[] = array(
1202
+						$filter[ ] = array(
1203 1203
 							'key'      => $field_id,
1204 1204
 							'value'    => $val,
1205 1205
 							'operator' => $this->get_operator( $get, $key, array( 'is' ), 'is' ),
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
 					foreach ( $words as $word ) {
1221 1221
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
1222 1222
 							// Keep the same key for each filter
1223
-							$filter['value'] = $word;
1223
+							$filter[ 'value' ] = $word;
1224 1224
 							// Add a search for the value
1225
-							$filters[] = $filter;
1225
+							$filters[ ] = $filter;
1226 1226
 						}
1227 1227
 					}
1228 1228
 
@@ -1236,19 +1236,19 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 					foreach ( $searchable_fields as $searchable_field ) {
1238 1238
 
1239
-						if( $form_field->ID !== $searchable_field['field'] ) {
1239
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
1240 1240
 							continue;
1241 1241
 						}
1242 1242
 
1243 1243
 						// Only exact-match dropdowns, not text search
1244
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
1244
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
1245 1245
 							continue;
1246 1246
 						}
1247 1247
 
1248 1248
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
1249 1249
 
1250 1250
 						if ( 4 === $input_id ) {
1251
-							$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1251
+							$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1252 1252
 						};
1253 1253
 					}
1254 1254
 				}
@@ -1276,12 +1276,12 @@  discard block
 block discarded – undo
1276 1276
 						 * @since 1.16.3
1277 1277
 						 * Safeguard until GF implements '<=' operator
1278 1278
 						 */
1279
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1279
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
1280 1280
 							$operator = '<';
1281 1281
 							$date = date( 'Y-m-d', strtotime( self::get_formatted_date( $date, 'Y-m-d', $date_format ) . ' +1 day' ) );
1282 1282
 						}
1283 1283
 
1284
-						$filter[] = array(
1284
+						$filter[ ] = array(
1285 1285
 							'key'      => $field_id,
1286 1286
 							'value'    => self::get_formatted_date( $date, 'Y-m-d', $date_format ),
1287 1287
 							'operator' => $this->get_operator( $get, $key, array( $operator ), $operator ),
@@ -1289,12 +1289,12 @@  discard block
 block discarded – undo
1289 1289
 					}
1290 1290
 				} else {
1291 1291
 					$date = $value;
1292
-					$filter['value'] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1293
-					$filter['operator'] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1292
+					$filter[ 'value' ] = self::get_formatted_date( $date, 'Y-m-d', $date_format );
1293
+					$filter[ 'operator' ] = $this->get_operator( $get, $key, array( 'is' ), 'is' );
1294 1294
 				}
1295 1295
 
1296
-				if ('payment_date' === $key) {
1297
-					$filter['operator'] = 'contains';
1296
+				if ( 'payment_date' === $key ) {
1297
+					$filter[ 'operator' ] = 'contains';
1298 1298
 				}
1299 1299
 
1300 1300
 				break;
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 			'ymd_dot' => 'Y.m.d',
1324 1324
 		);
1325 1325
 
1326
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
1326
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
1327 1327
 			$format = $datepicker[ $field->dateFormat ];
1328 1328
 		}
1329 1329
 
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 	public function add_template_path( $file_paths ) {
1361 1361
 
1362 1362
 		// Index 100 is the default GravityView template path.
1363
-		$file_paths[102] = self::$file . 'templates/';
1363
+		$file_paths[ 102 ] = self::$file . 'templates/';
1364 1364
 
1365 1365
 		return $file_paths;
1366 1366
 	}
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		$has_date = false;
1380 1380
 
1381 1381
 		foreach ( $search_fields as $k => $field ) {
1382
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
1382
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
1383 1383
 				$has_date = true;
1384 1384
 				break;
1385 1385
 			}
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 		$view = \GV\View::by_id( $gravityview_view->view_id );
1409 1409
 
1410 1410
 		// get configured search fields
1411
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
1411
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
1412 1412
 
1413 1413
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
1414 1414
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -1422,39 +1422,39 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
 			$updated_field = $this->get_search_filter_details( $updated_field, $context );
1424 1424
 
1425
-			switch ( $field['field'] ) {
1425
+			switch ( $field[ 'field' ] ) {
1426 1426
 
1427 1427
 				case 'search_all':
1428
-					$updated_field['key'] = 'search_all';
1429
-					$updated_field['input'] = 'search_all';
1430
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
1428
+					$updated_field[ 'key' ] = 'search_all';
1429
+					$updated_field[ 'input' ] = 'search_all';
1430
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1431 1431
 					break;
1432 1432
 
1433 1433
 				case 'entry_date':
1434
-					$updated_field['key'] = 'entry_date';
1435
-					$updated_field['input'] = 'entry_date';
1436
-					$updated_field['value'] = array(
1434
+					$updated_field[ 'key' ] = 'entry_date';
1435
+					$updated_field[ 'input' ] = 'entry_date';
1436
+					$updated_field[ 'value' ] = array(
1437 1437
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1438 1438
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1439 1439
 					);
1440 1440
 					break;
1441 1441
 
1442 1442
 				case 'entry_id':
1443
-					$updated_field['key'] = 'entry_id';
1444
-					$updated_field['input'] = 'entry_id';
1445
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1443
+					$updated_field[ 'key' ] = 'entry_id';
1444
+					$updated_field[ 'input' ] = 'entry_id';
1445
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1446 1446
 					break;
1447 1447
 
1448 1448
 				case 'created_by':
1449
-					$updated_field['key'] = 'created_by';
1450
-					$updated_field['name'] = 'gv_by';
1451
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1449
+					$updated_field[ 'key' ] = 'created_by';
1450
+					$updated_field[ 'name' ] = 'gv_by';
1451
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1452 1452
 					break;
1453 1453
 
1454 1454
 				case 'is_approved':
1455
-					$updated_field['key'] = 'is_approved';
1456
-					$updated_field['value'] = $this->rgget_or_rgpost( 'filter_is_approved' );
1457
-					$updated_field['choices'] = self::get_is_approved_choices();
1455
+					$updated_field[ 'key' ] = 'is_approved';
1456
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'filter_is_approved' );
1457
+					$updated_field[ 'choices' ] = self::get_is_approved_choices();
1458 1458
 					break;
1459 1459
 			}
1460 1460
 
@@ -1475,16 +1475,16 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 		$gravityview_view->permalink_fields = $this->add_no_permalink_fields( array(), $this, $widget_args );
1477 1477
 
1478
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1478
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1479 1479
 
1480 1480
 		/** @since 1.14 */
1481
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1481
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1482 1482
 
1483
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1483
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1484 1484
 
1485 1485
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1486 1486
 
1487
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1487
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1488 1488
 
1489 1489
 		if ( $this->has_date_field( $search_fields ) ) {
1490 1490
 			// enqueue datepicker stuff only if needed!
@@ -1506,10 +1506,10 @@  discard block
 block discarded – undo
1506 1506
 	public static function get_search_class( $custom_class = '' ) {
1507 1507
 		$gravityview_view = GravityView_View::getInstance();
1508 1508
 
1509
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1509
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1510 1510
 
1511
-		if ( ! empty( $custom_class )  ) {
1512
-			$search_class .= ' '.$custom_class;
1511
+		if ( ! empty( $custom_class ) ) {
1512
+			$search_class .= ' ' . $custom_class;
1513 1513
 		}
1514 1514
 
1515 1515
 		/**
@@ -1560,9 +1560,9 @@  discard block
 block discarded – undo
1560 1560
 
1561 1561
 		if ( ! $label ) {
1562 1562
 
1563
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1563
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1564 1564
 
1565
-			switch( $field['field'] ) {
1565
+			switch ( $field[ 'field' ] ) {
1566 1566
 				case 'search_all':
1567 1567
 					$label = __( 'Search Entries:', 'gravityview' );
1568 1568
 					break;
@@ -1574,10 +1574,10 @@  discard block
 block discarded – undo
1574 1574
 					break;
1575 1575
 				default:
1576 1576
 					// If this is a field input, not a field
1577
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1577
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1578 1578
 
1579 1579
 						// Get the label for the field in question, which returns an array
1580
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1580
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1581 1581
 
1582 1582
 						// Get the item with the `label` key
1583 1583
 						$values = wp_list_pluck( $items, 'label' );
@@ -1618,13 +1618,13 @@  discard block
 block discarded – undo
1618 1618
 		$form = $gravityview_view->getForm();
1619 1619
 
1620 1620
 		// for advanced field ids (eg, first name / last name )
1621
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1621
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1622 1622
 
1623 1623
 		// get searched value from $_GET/$_POST (string or array)
1624 1624
 		$value = $this->rgget_or_rgpost( $name );
1625 1625
 
1626 1626
 		// get form field details
1627
-		$form_field = gravityview_get_field( $form, $field['field'] );
1627
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1628 1628
 
1629 1629
 		$form_field_type = \GV\Utils::get( $form_field, 'type' );
1630 1630
 
@@ -1638,22 +1638,22 @@  discard block
 block discarded – undo
1638 1638
 		);
1639 1639
 
1640 1640
 		// collect choices
1641
-		if ( 'post_category' === $form_field_type && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1642
-			$filter['choices'] = gravityview_get_terms_choices();
1643
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1644
-			$filter['choices'] = $form_field['choices'];
1641
+		if ( 'post_category' === $form_field_type && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1642
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1643
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1644
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1645 1645
 		}
1646 1646
 
1647
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1648
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1647
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1648
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1649 1649
 		}
1650 1650
 
1651
-		if ( 'created_by' === $field['field'] ) {
1652
-			$filter['choices'] = self::get_created_by_choices( $context->view );
1653
-			$filter['type'] = 'created_by';
1651
+		if ( 'created_by' === $field[ 'field' ] ) {
1652
+			$filter[ 'choices' ] = self::get_created_by_choices( $context->view );
1653
+			$filter[ 'type' ] = 'created_by';
1654 1654
 		}
1655 1655
 
1656
-		if ( ! empty( $filter['choices'] ) ) {
1656
+		if ( ! empty( $filter[ 'choices' ] ) ) {
1657 1657
 			/**
1658 1658
 			 * @filter `gravityview/search/sieve_choices` Only output used choices for this field.
1659 1659
 			 * @param bool Yes or no.
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
 			 * @param \GV\Context The context.
1662 1662
 			 */
1663 1663
 			if ( apply_filters( 'gravityview/search/sieve_choices', false, $field, $context ) ) {
1664
-				$filter['choices'] = $this->sieve_filter_choices( $filter, $context );
1664
+				$filter[ 'choices' ] = $this->sieve_filter_choices( $filter, $context );
1665 1665
 			}
1666 1666
 		}
1667 1667
 
@@ -1690,12 +1690,12 @@  discard block
 block discarded – undo
1690 1690
 	 * @return array The filter choices.
1691 1691
 	 */
1692 1692
 	private function sieve_filter_choices( $filter, $context ) {
1693
-		if ( empty( $filter['key'] ) || empty( $filter['choices'] ) ) {
1693
+		if ( empty( $filter[ 'key' ] ) || empty( $filter[ 'choices' ] ) ) {
1694 1694
 			return $filter; // @todo Populate plugins might give us empty choices
1695 1695
 		}
1696 1696
 
1697 1697
 		// Allow only created_by and field-ids to be sieved.
1698
-		if ( 'created_by' !== $filter['key'] && ! is_numeric( $filter['key'] ) ) {
1698
+		if ( 'created_by' !== $filter[ 'key' ] && ! is_numeric( $filter[ 'key' ] ) ) {
1699 1699
 			return $filter;
1700 1700
 		}
1701 1701
 
@@ -1706,13 +1706,13 @@  discard block
 block discarded – undo
1706 1706
 		$entry_table_name = GFFormsModel::get_entry_table_name();
1707 1707
 		$entry_meta_table_name = GFFormsModel::get_entry_meta_table_name();
1708 1708
 
1709
-		$key_like = $wpdb->esc_like( $filter['key'] ) . '.%';
1709
+		$key_like = $wpdb->esc_like( $filter[ 'key' ] ) . '.%';
1710 1710
 
1711 1711
 		switch ( \GV\Utils::get( $filter, 'type' ) ):
1712 1712
 			case 'post_category':
1713 1713
 				$choices = $wpdb->get_col( $wpdb->prepare(
1714 1714
 					"SELECT DISTINCT SUBSTRING_INDEX(meta_value, ':', 1) FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1715
-					$key_like, $filter['key'], $form_id
1715
+					$key_like, $filter[ 'key' ], $form_id
1716 1716
 				) );
1717 1717
 				break;
1718 1718
 			case 'created_by':
@@ -1724,17 +1724,17 @@  discard block
 block discarded – undo
1724 1724
 			default:
1725 1725
 				$choices = $wpdb->get_col( $wpdb->prepare(
1726 1726
 					"SELECT DISTINCT meta_value FROM $entry_meta_table_name WHERE (meta_key LIKE %s OR meta_key = %d) AND form_id = %d",
1727
-					$key_like, $filter['key'], $form_id
1727
+					$key_like, $filter[ 'key' ], $form_id
1728 1728
 				) );
1729 1729
 
1730
-				if ( ( $field = gravityview_get_field( $form_id, $filter['key'] ) ) && 'json' === $field->storageType ) {
1730
+				if ( ( $field = gravityview_get_field( $form_id, $filter[ 'key' ] ) ) && 'json' === $field->storageType ) {
1731 1731
 					$choices = array_map( 'json_decode', $choices );
1732 1732
 					$_choices_array = array();
1733 1733
 					foreach ( $choices as $choice ) {
1734 1734
 						if ( is_array( $choice ) ) {
1735 1735
 							$_choices_array = array_merge( $_choices_array, $choice );
1736 1736
 						} else {
1737
-							$_choices_array []= $choice;
1737
+							$_choices_array [ ] = $choice;
1738 1738
 						}
1739 1739
 					}
1740 1740
 					$choices = array_unique( $_choices_array );
@@ -1744,9 +1744,9 @@  discard block
 block discarded – undo
1744 1744
 		endswitch;
1745 1745
 
1746 1746
 		$filter_choices = array();
1747
-		foreach ( $filter['choices'] as $choice ) {
1748
-			if ( in_array( $choice['text'], $choices, true ) || in_array( $choice['value'], $choices, true ) ) {
1749
-				$filter_choices[] = $choice;
1747
+		foreach ( $filter[ 'choices' ] as $choice ) {
1748
+			if ( in_array( $choice[ 'text' ], $choices, true ) || in_array( $choice[ 'value' ], $choices, true ) ) {
1749
+				$filter_choices[ ] = $choice;
1750 1750
 			}
1751 1751
 		}
1752 1752
 
@@ -1781,7 +1781,7 @@  discard block
 block discarded – undo
1781 1781
 			 * @param \GV\View $view The view.
1782 1782
 			 */
1783 1783
 			$text = apply_filters( 'gravityview/search/created_by/text', $user->display_name, $user, $view );
1784
-			$choices[] = array(
1784
+			$choices[ ] = array(
1785 1785
 				'value' => $user->ID,
1786 1786
 				'text' => $text,
1787 1787
 			);
@@ -1801,9 +1801,9 @@  discard block
 block discarded – undo
1801 1801
 
1802 1802
 		$choices = array();
1803 1803
 		foreach ( GravityView_Entry_Approval_Status::get_all() as $status ) {
1804
-			$choices[] = array(
1805
-				'value' => $status['value'],
1806
-				'text' => $status['label'],
1804
+			$choices[ ] = array(
1805
+				'value' => $status[ 'value' ],
1806
+				'text' => $status[ 'label' ],
1807 1807
 			);
1808 1808
 		}
1809 1809
 
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
 	 */
1856 1856
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1857 1857
 
1858
-		$js_dependencies[] = 'jquery-ui-datepicker';
1858
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1859 1859
 
1860 1860
 		return $js_dependencies;
1861 1861
 	}
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
 			'isRTL'             => is_rtl(),
1900 1900
 		), $view_data );
1901 1901
 
1902
-		$localizations['datepicker'] = $datepicker_settings;
1902
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1903 1903
 
1904 1904
 		return $localizations;
1905 1905
 
@@ -1926,7 +1926,7 @@  discard block
 block discarded – undo
1926 1926
 	 * @return void
1927 1927
 	 */
1928 1928
 	private function maybe_enqueue_flexibility() {
1929
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1929
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1930 1930
 			wp_enqueue_script( 'gv-flexibility' );
1931 1931
 		}
1932 1932
 	}
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1949 1949
 
1950 1950
 		$scheme = is_ssl() ? 'https://' : 'http://';
1951
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1951
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1952 1952
 
1953 1953
 		/**
1954 1954
 		 * @filter `gravityview_search_datepicker_class`
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 	public function add_preview_inputs() {
2028 2028
 		global $wp;
2029 2029
 
2030
-		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews') ) {
2030
+		if ( ! is_preview() || ! current_user_can( 'publish_gravityviews' ) ) {
2031 2031
 			return;
2032 2032
 		}
2033 2033
 
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
  */
2086 2086
 class GravityView_Widget_Search_Author_GF_Query_Condition extends \GF_Query_Condition {
2087 2087
 	public function __construct( $filter, $view ) {
2088
-		$this->value = $filter['value'];
2088
+		$this->value = $filter[ 'value' ];
2089 2089
 		$this->view = $view;
2090 2090
 	}
2091 2091
 
@@ -2117,11 +2117,11 @@  discard block
 block discarded – undo
2117 2117
 		$conditions = array();
2118 2118
 
2119 2119
 		foreach ( $user_fields as $user_field ) {
2120
-			$conditions[] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) .  '%' );
2120
+			$conditions[ ] = $wpdb->prepare( "`u`.`$user_field` LIKE %s", '%' . $wpdb->esc_like( $this->value ) . '%' );
2121 2121
 		}
2122 2122
 
2123 2123
 		foreach ( $user_meta_fields as $meta_field ) {
2124
-			$conditions[] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) .  '%' );
2124
+			$conditions[ ] = $wpdb->prepare( "(`um`.`meta_key` = %s AND `um`.`meta_value` LIKE %s)", $meta_field, '%' . $wpdb->esc_like( $this->value ) . '%' );
2125 2125
 		}
2126 2126
 
2127 2127
 		$conditions = '(' . implode( ' OR ', $conditions ) . ')';
Please login to merge, or discard this patch.
future/includes/class-gv-renderer.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	private static function disable_show_only_approved_entries( $gravityview ) {
60 60
 
61
-		if ( ! isset( $_GET['disable_setting'] ) || ! wp_verify_nonce( $_GET['gv-setting'], 'setting' ) ) {
61
+		if ( ! isset( $_GET[ 'disable_setting' ] ) || ! wp_verify_nonce( $_GET[ 'gv-setting' ], 'setting' ) ) {
62 62
 			return;
63 63
 		}
64 64
 
65 65
 		$settings = $gravityview->view->settings->all();
66 66
 
67
-		$settings['show_only_approved'] = 0;
67
+		$settings[ 'show_only_approved' ] = 0;
68 68
 
69
-		$updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings',  $settings );
69
+		$updated = update_post_meta( $gravityview->view->ID, '_gravityview_template_settings', $settings );
70 70
 
71 71
 		if ( ! $updated ) {
72 72
 			gravityview()->log->error( 'Could not update View settings => Show only approved' );
@@ -273,8 +273,7 @@  discard block
 block discarded – undo
273 273
 				$tab = __( 'Edit Entry', 'gravityview' );
274 274
 				$context = 'edit';
275 275
 				break;
276
-			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ):
277
-				$tab = __( 'Single Entry', 'gravityview' );
276
+			case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' );
278 277
 				$context = 'single';
279 278
 				break;
280 279
 			default:
@@ -296,7 +295,7 @@  discard block
 block discarded – undo
296 295
 		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
297 296
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
298 297
 
299
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
298
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
300 299
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
301 300
 
302 301
 		echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID );
@@ -322,11 +321,11 @@  discard block
 block discarded – undo
322 321
 
323 322
 		$post_types = get_post_types();
324 323
 
325
-		foreach( $post_types as $post_type ) {
324
+		foreach ( $post_types as $post_type ) {
326 325
 			$post_type_rewrite = get_post_type_object( $post_type )->rewrite;
327 326
 
328 327
 			if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) {
329
-				$reserved_slugs[] = $slug;
328
+				$reserved_slugs[ ] = $slug;
330 329
 			}
331 330
 		}
332 331
 
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-recent-entries-widget.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	function __construct( ) {
14 14
 
15
-		$name = __('GravityView Recent Entries', 'gravityview');
15
+		$name = __( 'GravityView Recent Entries', 'gravityview' );
16 16
 
17 17
 		$widget_options = array(
18 18
 			'description' => __( 'Display the most recent entries for a View', 'gravityview' ),
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	private function initialize() {
27 27
 
28
-		add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
28
+		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
29 29
 
30 30
 		add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) );
31 31
 
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	function ajax_get_view_merge_tag_data() {
40 40
 
41
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) {
41
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) {
42 42
 			exit( false );
43 43
 		}
44 44
 
45
-		$form_id  = gravityview_get_form_id( $_POST['view_id'] );
45
+		$form_id = gravityview_get_form_id( $_POST[ 'view_id' ] );
46 46
 
47 47
 		$form = RGFormsModel::get_form_meta( $form_id );
48 48
 
49 49
 		$output = array(
50 50
 			'form' => array(
51
-				'id' => $form['id'],
52
-				'title' => $form['title'],
53
-				'fields' => $form['fields'],
51
+				'id' => $form[ 'id' ],
52
+				'title' => $form[ 'title' ],
53
+				'fields' => $form[ 'fields' ],
54 54
 			),
55
-			'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ),
55
+			'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ),
56 56
 		);
57 57
 
58 58
 		echo json_encode( $output );
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 	function admin_enqueue_scripts() {
69 69
 		global $pagenow;
70 70
 
71
-		if( $pagenow === 'widgets.php' ) {
71
+		if ( $pagenow === 'widgets.php' ) {
72 72
 
73
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
73
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
74 74
 
75
-			wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
75
+			wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
76 76
 
77 77
 			wp_localize_script( 'gravityview_widgets', 'GVWidgets', array(
78 78
 				'nonce' => wp_create_nonce( 'gravityview_ajax_widget' )
79
-			));
79
+			) );
80 80
 
81
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version );
81
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version );
82 82
 		}
83 83
 
84 84
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	function widget( $args, $instance ) {
94 94
 
95 95
 		// Don't have the Customizer render too soon.
96
-		if( empty( $instance['view_id'] ) ) {
96
+		if ( empty( $instance[ 'view_id' ] ) ) {
97 97
 			return;
98 98
 		}
99 99
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 			return false;
102 102
 		}
103 103
 
104
-		$args['id']        = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries';
105
-		$instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
104
+		$args[ 'id' ]        = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries';
105
+		$instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';
106 106
 
107
-		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] );
107
+		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] );
108 108
 
109
-		echo $args['before_widget'];
109
+		echo $args[ 'before_widget' ];
110 110
 
111
-		if ( !empty( $title ) ) {
112
-			echo $args['before_title'] . $title . $args['after_title'];
111
+		if ( ! empty( $title ) ) {
112
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
113 113
 		}
114 114
 
115 115
 		/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		 */
130 130
 		do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance );
131 131
 
132
-		echo $args['after_widget'];
132
+		echo $args[ 'after_widget' ];
133 133
 	}
134 134
 
135 135
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	private function get_output( $instance ) {
145 145
 
146
-		$form_id = gravityview_get_form_id( $instance['view_id'] );
146
+		$form_id = gravityview_get_form_id( $instance[ 'view_id' ] );
147 147
 
148 148
 		$form = gravityview_get_form( $form_id );
149 149
 
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 		 * @since 1.6.1
154 154
 		 * @var int $entry_link_post_id The ID to use as the parent post for the entry
155 155
 		 */
156
-		$entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id'];
156
+		$entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ];
157 157
 
158 158
 		/**
159 159
 		 * Generate list output
160 160
 		 * @since 1.7.2
161 161
 		 */
162
-		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget', null, $instance['view_id'] );
162
+		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget', null, $instance[ 'view_id' ] );
163 163
 
164 164
 		$output = $List->get_output();
165 165
 
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	private function get_entries( $instance, $form_id ) {
186 186
 
187
-		$view = \GV\View::by_id( $instance['view_id'] );
187
+		$view = \GV\View::by_id( $instance[ 'view_id' ] );
188 188
 
189
-		$limit = isset( $instance['limit'] ) ? $instance['limit'] : 10;
189
+		$limit = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10;
190 190
 
191 191
 		$view->settings->set( 'page_size', $limit );
192 192
 
@@ -209,23 +209,23 @@  discard block
 block discarded – undo
209 209
 		$instance = $new_instance;
210 210
 
211 211
 		// Force positive number
212
-		$instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] );
212
+		$instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] );
213 213
 
214
-		$instance['view_id'] = intval( $instance['view_id'] );
214
+		$instance[ 'view_id' ] = intval( $instance[ 'view_id' ] );
215 215
 
216
-		$instance['link_format'] = trim( rtrim( $instance['link_format'] ) );
216
+		$instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) );
217 217
 
218
-		$instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format'];
218
+		$instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ];
219 219
 
220
-		$instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] );
220
+		$instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] );
221 221
 
222
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
222
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
223 223
 
224 224
 		//check if post_id is a valid post with embedded View
225
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
225
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
226 226
 
227 227
 		// Share that the widget isn't brand new
228
-		$instance['updated']  = 1;
228
+		$instance[ 'updated' ] = 1;
229 229
 
230 230
 		/**
231 231
 		 * Modify the updated instance. This will allow for validating any added instance settings externally.
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
 
248 248
 		// Set up some default widget settings.
249 249
 		$defaults = array(
250
-			'title' 			=> __('Recent Entries', 'gravityview'),
250
+			'title' 			=> __( 'Recent Entries', 'gravityview' ),
251 251
 			'view_id'           => NULL,
252 252
 			'post_id'           => NULL,
253 253
 			'limit'            => 10,
254
-			'link_format'       => __('Entry #{entry_id}', 'gravityview'),
254
+			'link_format'       => __( 'Entry #{entry_id}', 'gravityview' ),
255 255
 			'after_link'        => ''
256 256
 		);
257 257
 
258
-		$instance = wp_parse_args( (array) $instance, $defaults );
258
+		$instance = wp_parse_args( (array)$instance, $defaults );
259 259
 
260 260
 		?>
261 261
 
262 262
 		<!-- Title -->
263 263
 		<p>
264 264
 			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label>
265
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
265
+			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" />
266 266
 		</p>
267 267
 
268 268
 		<!-- Download -->
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$views = get_posts( $args );
276 276
 
277 277
 		// If there are no views set up yet, we get outta here.
278
-		if( empty( $views ) ) {
278
+		if ( empty( $views ) ) {
279 279
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
280 280
 			return;
281 281
 		}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 		 * Display errors generated for invalid embed IDs
288 288
 		 * @see GravityView_View_Data::is_valid_embed_id
289 289
 		 */
290
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
290
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
291 291
 			?>
292 292
 			<div class="error inline hide-on-view-change">
293
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
293
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
294 294
 			</div>
295 295
 			<?php
296 296
 			unset ( $error );
@@ -298,14 +298,14 @@  discard block
 block discarded – undo
298 298
 		?>
299 299
 
300 300
 		<p>
301
-			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label>
301
+			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label>
302 302
 			<select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>">
303 303
 				<option value=""><?php esc_html_e( '&mdash; Select a View as Entries Source &mdash;', 'gravityview' ); ?></option>
304 304
 				<?php
305 305
 
306
-				foreach( $views as $view ) {
307
-					$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
308
-					echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
306
+				foreach ( $views as $view ) {
307
+					$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
308
+					echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
309 309
 				}
310 310
 
311 311
 				?>
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 		 * Display errors generated for invalid embed IDs
318 318
 		 * @see GravityView_View_Data::is_valid_embed_id
319 319
 		 */
320
-		if( !empty( $instance['error_post_id'] ) ) {
320
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
321 321
 			?>
322 322
 			<div class="error inline">
323
-				<p><?php echo $instance['error_post_id']; ?></p>
323
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
324 324
 			</div>
325 325
 			<?php
326 326
 			unset ( $error );
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 		?>
329 329
 
330 330
 		<p>
331
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" />
331
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
332
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" />
333 333
 			<span class="howto gv-howto"><?php
334
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
334
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
335
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
336 336
 				?></span>
337 337
 		</p>
338 338
 
@@ -340,21 +340,21 @@  discard block
 block discarded – undo
340 340
 			<label for="<?php echo $this->get_field_id( 'limit' ); ?>">
341 341
 				<span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span>
342 342
 			</label>
343
-			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" />
343
+			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" />
344 344
 		</p>
345 345
 
346 346
 		<p>
347 347
 			<label for="<?php echo $this->get_field_id( 'link_format' ); ?>">
348 348
 				<span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span>
349 349
 			</label>
350
-			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
350
+			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
351 351
 		</p>
352 352
 
353 353
 		<p>
354 354
 			<label for="<?php echo $this->get_field_id( 'after_link' ); ?>">
355 355
 				<span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span>
356 356
 			</label>
357
-			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea>
357
+			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea>
358 358
 		</p>
359 359
 
360 360
 		<?php
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		 * @param GravityView_Recent_Entries_Widget $this WP_Widget object
365 365
 		 * @param array $instance Current widget instance
366 366
 		 */
367
-		do_action( 'gravityview_recent_entries_widget_form' , $this, $instance );
367
+		do_action( 'gravityview_recent_entries_widget_form', $this, $instance );
368 368
 
369 369
 		?>
370 370
 
Please login to merge, or discard this patch.
includes/wordpress-widgets/class-gravityview-search-wp-widget.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 		$widget_ops = array(
13 13
 			'classname' => 'widget_gravityview_search',
14
-			'description' => __( 'A search form for a specific GravityView.', 'gravityview')
14
+			'description' => __( 'A search form for a specific GravityView.', 'gravityview' )
15 15
 		);
16 16
 
17 17
 		$widget_display = array(
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	}
35 35
 
36 36
 	private function load_required_files() {
37
-		if( !class_exists( 'GravityView_Widget_Search' ) ) {
37
+		if ( ! class_exists( 'GravityView_Widget_Search' ) ) {
38 38
 			gravityview_register_gravityview_widgets();
39 39
 		}
40 40
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 
59 59
 		// Don't show unless a View ID has been set.
60
-		if( empty( $instance['view_id'] ) ) {
60
+		if ( empty( $instance[ 'view_id' ] ) ) {
61 61
 
62 62
 			gravityview()->log->debug( 'No View ID has been defined. Not showing the widget.', array( 'data' => $instance ) );
63 63
 
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 
72 72
 		/** This filter is documented in wp-includes/default-widgets.php */
73
-		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
73
+		$title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base );
74 74
 
75
-		echo $args['before_widget'];
75
+		echo $args[ 'before_widget' ];
76 76
 
77 77
 		if ( $title ) {
78
-			echo $args['before_title'] . $title . $args['after_title'];
78
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
79 79
 		}
80 80
 
81 81
 		// @todo Add to the widget configuration form
82
-		$instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
82
+		$instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance );
83 83
 
84
-		$instance['context'] = 'wp_widget';
84
+		$instance[ 'context' ] = 'wp_widget';
85 85
 
86 86
 		// form
87
-		$instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] );
88
-		$instance['form'] = GVCommon::get_form( $instance['form_id'] );
87
+		$instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] );
88
+		$instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] );
89 89
 
90 90
 		// We don't want to overwrite existing context, etc.
91 91
 		$previous_view = GravityView_View::getInstance();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 */
102 102
 		new GravityView_View( $previous_view );
103 103
 
104
-		echo $args['after_widget'];
104
+		echo $args[ 'after_widget' ];
105 105
 	}
106 106
 
107 107
 	/**
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 
112 112
 		$instance = $old_instance;
113 113
 
114
-		if( $this->is_preview() ) {
114
+		if ( $this->is_preview() ) {
115 115
 			//Oh! Sorry but still not fully compatible with customizer
116 116
 			return $instance;
117 117
 		}
118 118
 
119
-		$new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() );
119
+		$new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() );
120 120
 
121
-		$instance['title'] = strip_tags( $new_instance['title'] );
122
-		$instance['view_id'] = absint( $new_instance['view_id'] );
123
-		$instance['search_fields'] = $new_instance['search_fields'];
124
-		$instance['post_id'] = $new_instance['post_id'];
125
-		$instance['search_clear'] = $new_instance['search_clear'];
126
-		$instance['search_mode'] = $new_instance['search_mode'];
121
+		$instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] );
122
+		$instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] );
123
+		$instance[ 'search_fields' ] = $new_instance[ 'search_fields' ];
124
+		$instance[ 'post_id' ] = $new_instance[ 'post_id' ];
125
+		$instance[ 'search_clear' ] = $new_instance[ 'search_clear' ];
126
+		$instance[ 'search_mode' ] = $new_instance[ 'search_mode' ];
127 127
 
128
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'], true );
128
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ], true );
129 129
 
130 130
 		//check if post_id is a valid post with embedded View
131
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
131
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
132 132
 
133 133
 		// Share that the widget isn't brand new
134
-		$instance['updated']  = 1;
134
+		$instance[ 'updated' ] = 1;
135 135
 
136 136
 		return $instance;
137 137
 	}
@@ -142,28 +142,28 @@  discard block
 block discarded – undo
142 142
 	public function form( $instance ) {
143 143
 
144 144
 		// @todo Make compatible with Customizer
145
-		if( $this->is_preview() ) {
145
+		if ( $this->is_preview() ) {
146 146
 
147
-			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' );
147
+			$warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' );
148 148
 
149 149
 			echo wpautop( GravityView_Admin::get_floaty() . $warning );
150 150
 
151 151
 			return;
152 152
 		}
153 153
 
154
-		$instance = wp_parse_args( (array) $instance, self::get_defaults() );
154
+		$instance = wp_parse_args( (array)$instance, self::get_defaults() );
155 155
 
156
-		$title    = $instance['title'];
157
-		$view_id  = $instance['view_id'];
158
-		$post_id  = $instance['post_id'];
159
-		$search_fields = $instance['search_fields'];
160
-		$search_clear = $instance['search_clear'];
161
-		$search_mode = $instance['search_mode'];
156
+		$title    = $instance[ 'title' ];
157
+		$view_id  = $instance[ 'view_id' ];
158
+		$post_id  = $instance[ 'post_id' ];
159
+		$search_fields = $instance[ 'search_fields' ];
160
+		$search_clear = $instance[ 'search_clear' ];
161
+		$search_mode = $instance[ 'search_mode' ];
162 162
 
163 163
 		$views = GVCommon::get_all_views();
164 164
 
165 165
 		// If there are no views set up yet, we get outta here.
166
-		if( empty( $views ) ) { ?>
166
+		if ( empty( $views ) ) { ?>
167 167
 			<div id="select_gravityview_view">
168 168
 				<div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div>
169 169
 			</div>
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 		?>
173 173
 
174
-		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
174
+		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
175 175
 
176 176
 		<?php
177 177
 		/**
178 178
 		 * Display errors generated for invalid embed IDs
179 179
 		 * @see GravityView_View_Data::is_valid_embed_id
180 180
 		 */
181
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
181
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
182 182
 			?>
183 183
 			<div class="error inline hide-on-view-change">
184
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
184
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
185 185
 			</div>
186 186
 			<?php
187 187
 			unset ( $error );
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 
191 191
 		<p>
192 192
 			<label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label>
193
-			<select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat">
193
+			<select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat">
194 194
 				<option value=""><?php esc_html_e( '&mdash; Select a View &mdash;', 'gravityview' ); ?></option>
195 195
 				<?php
196
-				foreach( $views as $view_option ) {
197
-					$title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title;
198
-					echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>';
196
+				foreach ( $views as $view_option ) {
197
+					$title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title;
198
+					echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>';
199 199
 				}
200 200
 				?>
201 201
 			</select>
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 		 * Display errors generated for invalid embed IDs
208 208
 		 * @see GravityView_View_Data::is_valid_embed_id
209 209
 		 */
210
-		if( !empty( $instance['error_post_id'] ) ) {
210
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
211 211
 			?>
212 212
 			<div class="error inline">
213
-				<p><?php echo $instance['error_post_id']; ?></p>
213
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
214 214
 			</div>
215 215
 			<?php
216 216
 			unset ( $error );
@@ -218,40 +218,40 @@  discard block
 block discarded – undo
218 218
 		?>
219 219
 
220 220
 		<p>
221
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
221
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
222
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" />
223 223
 			<span class="howto gv-howto"><?php
224
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
-				echo ' '.gravityview_get_link('https://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
224
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
225
+				echo ' ' . gravityview_get_link( 'https://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
226 226
 				?></span>
227 227
 		</p>
228 228
 
229 229
 		<p>
230
-			<label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
-			<input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0">
232
-			<input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
230
+			<label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label>
231
+			<input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0">
232
+			<input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>>
233 233
 		</p>
234 234
 
235 235
 		<p>
236 236
 			<label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label>
237
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_any">
238
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
237
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any">
238
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>>
239 239
 				<?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?>
240 240
 			</label>
241
-			<label for="<?php echo $this->get_field_id('search_mode'); ?>_all">
242
-				<input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
241
+			<label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all">
242
+				<input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>>
243 243
 				<?php esc_html_e( 'Match All Fields', 'gravityview' ); ?>
244 244
 			</label>
245
-			<span class="howto gv-howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span
245
+			<span class="howto gv-howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span
246 246
 		</p>
247 247
 
248 248
 		<hr />
249 249
 
250 250
 		<?php // @todo: move style to CSS ?>
251 251
 		<div style="margin-bottom: 1em;">
252
-			<label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
-			<div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>">
254
-				<input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
252
+			<label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label>
253
+			<div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>">
254
+				<input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value">
255 255
 			</div>
256 256
 
257 257
 		</div>
Please login to merge, or discard this patch.
includes/class-gravityview-entry-notes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 		// Make sure the keys are all set
68 68
 		$note = wp_parse_args( $note, $default_note );
69 69
 
70
-		GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) );
70
+		GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) );
71 71
 
72 72
 		// If last_error is empty string, there was no error.
73
-		if( empty( $wpdb->last_error ) ) {
73
+		if ( empty( $wpdb->last_error ) ) {
74 74
 			$return = $wpdb->insert_id;
75 75
 		} else {
76 76
 			$return = new WP_Error( 'gravityview-add-note', $wpdb->last_error );
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public static function delete_notes( $note_ids = array() ) {
98 98
 
99
-		if( !is_array( $note_ids ) ) {
99
+		if ( ! is_array( $note_ids ) ) {
100 100
 
101 101
 			gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) );
102 102
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			)
158 158
 		);
159 159
 
160
-		return $results ? $results[0] : false;
160
+		return $results ? $results[ 0 ] : false;
161 161
 	}
162 162
 
163 163
 	/**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public static function filter_avatar( $avatar = '', $note = null ) {
172 172
 
173
-		if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
174
-			$avatar =  sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
173
+		if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) {
174
+			$avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) );
175 175
 		}
176 176
 
177 177
 		return $avatar;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-image.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
27 27
 
28
-		unset ( $field_options['search_filter'] );
28
+		unset ( $field_options[ 'search_filter' ] );
29 29
 
30
-		if( 'edit' === $context ) {
30
+		if ( 'edit' === $context ) {
31 31
 			return $field_options;
32 32
 		}
33 33
 
34
-		$this->add_field_support('link_to_post', $field_options );
34
+		$this->add_field_support( 'link_to_post', $field_options );
35 35
 
36 36
 		// @since 1.5.4
37
-		$this->add_field_support('dynamic_data', $field_options );
37
+		$this->add_field_support( 'dynamic_data', $field_options );
38 38
 
39 39
 		return $field_options;
40 40
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		$url = $title = $caption = $description = '';
62 62
 
63 63
 		// If there's a |:| match, process. Otherwise, empty array!
64
-		if( preg_match( '/\|\:\|/', $value ) ) {
64
+		if ( preg_match( '/\|\:\|/', $value ) ) {
65 65
 			list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false );
66 66
 		}
67 67
 
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field = null ) {
92 92
 
93
-		$id = (int) $field->id;
94
-		$form_id = $form['id'];
93
+		$id = (int)$field->id;
94
+		$form_id = $form[ 'id' ];
95 95
 		$input_name = "input_{$id}";
96 96
 		$field_id = sprintf( 'input_%d_%d', $form_id, $id );
97 97
 		$img_name = null;
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
 		// Convert |:| to associative array
100 100
 		$img_array = self::explode_value( $value );
101 101
 
102
-		if( ! empty( $img_array['url'] ) ) {
102
+		if ( ! empty( $img_array[ 'url' ] ) ) {
103 103
 
104
-			$img_name = basename( $img_array['url'] );
104
+			$img_name = basename( $img_array[ 'url' ] );
105 105
 
106 106
 			/**
107 107
 			 * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden
108 108
 			 * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code
109 109
 			 * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code
110 110
 			 */
111
-			if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
111
+			if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
112 112
 				GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name;
113 113
 			}
114 114
 		}
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
 		 * @hack
138 138
 		 */
139 139
 		if ( null !== $img_name ) {
140
-			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) );
141
-			$gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output );
140
+			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) );
141
+			$gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output );
142 142
 		}
143 143
 
144 144
 		return $gf_post_image_field_output;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-content.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
28 28
 
29
-		unset( $field_options['show_as_link'] );
29
+		unset( $field_options[ 'show_as_link' ] );
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ( 'edit' === $context ) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$this->add_field_support('dynamic_data', $field_options );
35
+		$this->add_field_support( 'dynamic_data', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field = null ) {
51 51
 
52
-		$id    = (int) $field->id;
52
+		$id    = (int)$field->id;
53 53
 		$input_name = "input_{$id}";
54 54
 		$class = esc_attr( $field->size );
55 55
 		$tabindex = $field->get_tabindex();
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
 		add_filter( 'gravityview_blocklist_field_types', array( $this, 'default_field_blocklist' ), 10, 2 );
28 28
 
29 29
 		// Tooltips
30
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
30
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
31 31
 
32 32
 		add_filter( 'admin_body_class', array( $this, 'add_gf_version_css_class' ) );
33 33
 
34 34
 		// adding styles and scripts
35
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
36
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
38
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
39
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
40
-
41
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
42
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
43
-		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 );
44
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
45
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
46
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
35
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
36
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
38
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
39
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
40
+
41
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
42
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
43
+		add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 );
44
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
45
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
46
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
47 47
 
48 48
 		// @todo check if this hook is needed..
49 49
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
50 50
 
51 51
 		// Add Connected Form column
52
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
52
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
53 53
 
54 54
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
55 55
 		add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
56 56
 
57
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
57
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
58 58
 
59 59
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
60 60
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$major_version = explode( '.', GFForms::$version );
87 87
 
88 88
 		if ( 2 <= sizeof( $major_version ) ) {
89
-			$class .= ' gf-minor-version-' . esc_attr( $major_version[0] . '-' . $major_version[1] );
89
+			$class .= ' gf-minor-version-' . esc_attr( $major_version[ 0 ] . '-' . $major_version[ 1 ] );
90 90
 		}
91 91
 
92 92
 		return $class;
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	function suggest_support_articles( $localization_data = array() ) {
103 103
 
104
-	    if( ! gravityview()->request->is_view() ) {
104
+	    if ( ! gravityview()->request->is_view() ) {
105 105
 	        return $localization_data;
106 106
         }
107 107
 
108
-		$localization_data['suggest'] = array(
108
+		$localization_data[ 'suggest' ] = array(
109 109
             '57ef23539033602e61d4a560',
110 110
             '54c67bb9e4b0512429885513',
111 111
             '54c67bb9e4b0512429885512',
@@ -134,20 +134,20 @@  discard block
 block discarded – undo
134 134
 			return;
135 135
 		}
136 136
 
137
-		if ( ! isset( $query->query_vars['post_type'] ) ) {
137
+		if ( ! isset( $query->query_vars[ 'post_type' ] ) ) {
138 138
 			return;
139 139
 		}
140 140
 
141
-		if ( 'gravityview' !== $query->query_vars['post_type'] ) {
141
+		if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) {
142 142
 			return;
143 143
 		}
144 144
 
145
-		$form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' );
145
+		$form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' );
146 146
 
147 147
 		$meta_query = array();
148 148
 
149 149
 		if ( $form_id ) {
150
-			$meta_query[] = array(
150
+			$meta_query[ ] = array(
151 151
 					'key'   => '_gravityview_form_id',
152 152
 					'value' => $form_id,
153 153
 			);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		$layout_id = \GV\Utils::_GET( 'gravityview_layout' );
157 157
 
158 158
 		if ( $layout_id ) {
159
-			$meta_query[] = array(
159
+			$meta_query[ ] = array(
160 160
 					'key'   => '_gravityview_directory_template',
161 161
 					'value' => esc_attr( $layout_id ),
162 162
 			);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	public function add_view_dropdown() {
174 174
 		$current_screen = get_current_screen();
175 175
 
176
-		if( 'gravityview' !== $current_screen->post_type ) {
176
+		if ( 'gravityview' !== $current_screen->post_type ) {
177 177
 			return;
178 178
 		}
179 179
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 		$current_form = \GV\Utils::_GET( 'gravityview_form_id' );
182 182
 
183 183
 		// If there are no forms to select, show no forms.
184
-		if( ! empty( $forms ) ) { ?>
184
+		if ( ! empty( $forms ) ) { ?>
185 185
 			<label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label>
186 186
 			<select name="gravityview_form_id" id="gravityview_form_id">
187 187
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
188
-				<?php foreach( $forms as $form ) { ?>
189
-					<option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
188
+				<?php foreach ( $forms as $form ) { ?>
189
+					<option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
190 190
 				<?php } ?>
191 191
 			</select>
192 192
 		<?php }
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 		$current_layout = \GV\Utils::_GET( 'gravityview_layout' );
196 196
 
197 197
 		// If there are no forms to select, show no forms.
198
-		if( ! empty( $layouts ) ) { ?>
198
+		if ( ! empty( $layouts ) ) { ?>
199 199
 			<label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label>
200 200
 			<select name="gravityview_layout" id="gravityview_layout_name">
201 201
 				<option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option>
202 202
 				<optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>">
203
-				<?php foreach( $layouts as $layout_id => $layout ) {
204
-					if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) {
203
+				<?php foreach ( $layouts as $layout_id => $layout ) {
204
+					if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) {
205 205
 						continue;
206 206
 					}
207 207
 					?>
208
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
208
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
209 209
 				<?php } ?>
210 210
 				</optgroup>
211 211
 				<optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>">
212
-				<?php foreach( $layouts as $layout_id => $layout ) {
213
-					if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) {
212
+				<?php foreach ( $layouts as $layout_id => $layout ) {
213
+					if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) {
214 214
 						continue;
215 215
 					}
216 216
 					?>
217
-					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option>
217
+					<option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option>
218 218
 				<?php } ?>
219 219
 				</optgroup>
220 220
 			</select>
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
230 230
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
231
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
231
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
232 232
 	}
233 233
 
234 234
 	/**
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 
259 259
 		$priority = 0;
260 260
 
261
-		if( 'form_list' === GFForms::get_page() ) {
261
+		if ( 'form_list' === GFForms::get_page() ) {
262 262
 			$priority = 790;
263 263
         }
264 264
 
265
-		if( empty( $connected_views ) ) {
265
+		if ( empty( $connected_views ) ) {
266 266
 
267
-		    $menu_items['gravityview'] = array(
267
+		    $menu_items[ 'gravityview' ] = array(
268 268
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
269 269
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', // Only appears in GF pre-2.5
270 270
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -280,23 +280,23 @@  discard block
 block discarded – undo
280 280
 		$sub_menu_items = array();
281 281
 		foreach ( (array)$connected_views as $view ) {
282 282
 
283
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
283
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
284 284
 				continue;
285 285
 			}
286 286
 
287
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
287
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
288 288
 
289
-			$sub_menu_items[] = array(
289
+			$sub_menu_items[ ] = array(
290 290
 				'label' => esc_attr( $label ),
291
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
291
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
292 292
 				'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
293 293
 			);
294 294
 		}
295 295
 
296 296
 		// If there were no items added, then let's create the parent menu
297
-		if( $sub_menu_items ) {
297
+		if ( $sub_menu_items ) {
298 298
 
299
-		    $sub_menu_items[] = array(
299
+		    $sub_menu_items[ ] = array(
300 300
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
301 301
 			    'icon' => '<span class="dashicons dashicons-plus"></span>',
302 302
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
             );
306 306
 
307 307
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
308
-			$sub_menu_items[] = array(
308
+			$sub_menu_items[ ] = array(
309 309
 				'url' => '#',
310 310
 				'label' => '',
311 311
 				'menu_class' => 'hidden',
312 312
 				'capabilities' => '',
313 313
 			);
314 314
 
315
-			$menu_items['gravityview'] = array(
315
+			$menu_items[ 'gravityview' ] = array(
316 316
 				'label'          => __( 'Connected Views', 'gravityview' ),
317 317
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
318 318
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 		$add = array( 'captcha', 'page' );
344 344
 
345 345
 		// Don't allowing editing the following values:
346
-		if( $context === 'edit' ) {
347
-			$add[] = 'post_id';
346
+		if ( $context === 'edit' ) {
347
+			$add[ ] = 'post_id';
348 348
 		}
349 349
 
350 350
 		$return = array_merge( $array, $add );
@@ -375,27 +375,27 @@  discard block
 block discarded – undo
375 375
 		foreach ( $default_args as $key => $arg ) {
376 376
 
377 377
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
378
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
378
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
379 379
 
380 380
 			// By default, use `tooltip` if defined.
381
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
381
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
382 382
 
383 383
 			// If there's no tooltip set, continue
384
-			if( empty( $tooltip ) ) {
384
+			if ( empty( $tooltip ) ) {
385 385
 				continue;
386 386
 			}
387 387
 
388 388
 			// Add the tooltip
389
-			$gv_tooltips[ 'gv_'.$key ] = array(
390
-				'title'	=> $arg['label'],
389
+			$gv_tooltips[ 'gv_' . $key ] = array(
390
+				'title'	=> $arg[ 'label' ],
391 391
 				'value'	=> $tooltip,
392 392
 			);
393 393
 
394 394
 		}
395 395
 
396
-		$gv_tooltips['gv_css_merge_tags'] = array(
397
-			'title' => __('CSS Merge Tags', 'gravityview'),
398
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
396
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
397
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
398
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
399 399
 		);
400 400
 
401 401
 		/**
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 
414 414
 		foreach ( $gv_tooltips as $key => $tooltip ) {
415 415
 
416
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
416
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
417 417
 
418
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
418
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
419 419
 		}
420 420
 
421 421
 		return $tooltips;
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 *
430 430
 	 * @return void
431 431
 	 */
432
-	public function add_custom_column_content( $column_name = null, $post_id = 0 )	{
432
+	public function add_custom_column_content( $column_name = null, $post_id = 0 ) {
433 433
 
434 434
 		$output = '';
435 435
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
452 452
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
453 453
 
454
-				$output = $template ? $template['label'] : $template_id_pretty;
454
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
455 455
 
456 456
 				break;
457 457
 
@@ -492,12 +492,12 @@  discard block
 block discarded – undo
492 492
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
493 493
 
494 494
 		// Either the form is empty or the form ID is 0, not yet set.
495
-		if( empty( $form ) ) {
495
+		if ( empty( $form ) ) {
496 496
 			return '';
497 497
 		}
498 498
 
499 499
 		// The $form is passed as the form ID
500
-		if( !is_array( $form ) ) {
500
+		if ( ! is_array( $form ) ) {
501 501
 			$form = gravityview_get_form( $form );
502 502
 		}
503 503
 
@@ -505,35 +505,35 @@  discard block
 block discarded – undo
505 505
 			return '';
506 506
 		}
507 507
 
508
-		$form_id = $form['id'];
508
+		$form_id = $form[ 'id' ];
509 509
 		$links = array();
510 510
 
511
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
511
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
512 512
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
513
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
514
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
513
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
514
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
515 515
 		} else {
516
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
516
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
517 517
 		}
518 518
 
519
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
519
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
520 520
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
521
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
521
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
522 522
 		}
523 523
 
524
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
524
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
525 525
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
526
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
526
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
527 527
 		}
528 528
 
529
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
529
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
530 530
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
531
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
531
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
532 532
 		}
533 533
 
534 534
 		$output = '';
535 535
 
536
-		if( !empty( $include_form_link ) ) {
536
+		if ( ! empty( $include_form_link ) ) {
537 537
 			$output .= $form_link;
538 538
 		}
539 539
 
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
 		$css_class = 'row-actions';
549 549
 
550 550
 		// Is Screen Options > View mode set to "Extended view"? If so, keep actions visible.
551
-		if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) {
551
+		if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) {
552 552
 			$css_class = 'row-actions visible';
553 553
 		}
554 554
 
555
-		$output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>';
555
+		$output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>';
556 556
 
557 557
 		return $output;
558 558
 	}
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 		// Get the date column and save it for later to add back in.
567 567
 		// This adds it after the Data Source column.
568 568
 		// This way, we don't need to do array_slice, array_merge, etc.
569
-		$date = $columns['date'];
570
-		unset( $columns['date'] );
569
+		$date = $columns[ 'date' ];
570
+		unset( $columns[ 'date' ] );
571 571
 
572 572
 		$data_source_required_caps = array(
573 573
 			'gravityforms_edit_forms',
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
 			'gravityforms_preview_forms',
579 579
 		);
580 580
 
581
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
582
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
581
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
582
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
583 583
 		}
584 584
 
585
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
585
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
586 586
 
587 587
 		// Add the date back in.
588
-		$columns['date'] = $date;
588
+		$columns[ 'date' ] = $date;
589 589
 
590 590
 		return $columns;
591 591
 	}
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
 	 */
599 599
 	function save_postdata( $post_id ) {
600 600
 
601
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
601
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
602 602
 			return;
603 603
 		}
604 604
 
605 605
 		// validate post_type
606
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
606
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
607 607
 			return;
608 608
 		}
609 609
 
@@ -618,63 +618,63 @@  discard block
 block discarded – undo
618 618
 		$statii = array();
619 619
 
620 620
 		// check if this is a start fresh View
621
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
621
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
622 622
 
623
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
623
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
624 624
 			// save form id
625
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
625
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
626 626
 
627 627
 		}
628 628
 
629
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
629
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
630 630
 			gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) );
631 631
 			return;
632 632
 		}
633 633
 
634 634
 		// Was this a start fresh?
635
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
636
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
635
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
636
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
637 637
 		} else {
638
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
638
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
639 639
 		}
640 640
 
641 641
 		// Check if we have a template id
642
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
642
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
643 643
 
644
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
644
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
645 645
 
646 646
 			// now save template id
647
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
647
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
648 648
 		}
649 649
 
650 650
 
651 651
 		// save View Configuration metabox
652
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
652
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
653 653
 
654 654
 			// template settings
655
-			if( empty( $_POST['template_settings'] ) ) {
656
-				$_POST['template_settings'] = array();
655
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
656
+				$_POST[ 'template_settings' ] = array();
657 657
 			}
658
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
658
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
659 659
 
660 660
 			// guard against unloaded View configuration page
661
-			if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) {
661
+			if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) {
662 662
 				$fields = array();
663 663
 
664
-				if ( ! empty( $_POST['gv_fields'] ) ) {
664
+				if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
665 665
 					$fields = _gravityview_process_posted_fields();
666 666
 				}
667 667
 
668 668
 				$fields = wp_slash( $fields );
669 669
 
670
-				$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
670
+				$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
671 671
 			}
672 672
 
673 673
 			// Directory Visible Widgets
674
-			if( empty( $_POST['widgets'] ) ) {
675
-				$_POST['widgets'] = array();
674
+			if ( empty( $_POST[ 'widgets' ] ) ) {
675
+				$_POST[ 'widgets' ] = array();
676 676
 			}
677
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
677
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
678 678
 
679 679
 		} // end save view configuration
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
685 685
 		 * @since 1.17.2
686 686
 		 */
687
-		do_action('gravityview_view_saved', $post_id, $statii );
687
+		do_action( 'gravityview_view_saved', $post_id, $statii );
688 688
 
689 689
 		gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) );
690 690
 	}
@@ -735,20 +735,20 @@  discard block
 block discarded – undo
735 735
 
736 736
 		$output = '';
737 737
 
738
-		if( !empty( $fields ) ) {
738
+		if ( ! empty( $fields ) ) {
739 739
 
740
-			foreach( $fields as $id => $details ) {
740
+			foreach ( $fields as $id => $details ) {
741 741
 
742
-				if( in_array( $details['type'], (array) $blocklist_field_types ) ) {
742
+				if ( in_array( $details[ 'type' ], (array)$blocklist_field_types ) ) {
743 743
 					continue;
744 744
 				}
745 745
 
746 746
 				// Edit mode only allows editing the parent fields, not single inputs.
747
-				if( $context === 'edit' && ! empty( $details['parent'] ) ) {
747
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
748 748
 					continue;
749 749
 				}
750 750
 
751
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form );
751
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form );
752 752
 
753 753
 			} // End foreach
754 754
 		}
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		echo $output;
757 757
 
758 758
 		// For the EDIT view we only want to allow the form fields.
759
-		if( $context === 'edit' ) {
759
+		if ( $context === 'edit' ) {
760 760
 			return;
761 761
 		}
762 762
 
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 		$additional_fields = array(
776 776
 			array(
777 777
 				'label_text' => __( 'Add All Form Fields', 'gravityview' ),
778
-				'desc' => __('Insert all the form fields at once.', 'gravityview'),
778
+				'desc' => __( 'Insert all the form fields at once.', 'gravityview' ),
779 779
 				'field_id' => 'all-fields',
780 780
 				'label_type' => 'field',
781 781
 				'input_type' => null,
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		 */
792 792
 		$additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields );
793 793
 
794
-		foreach ( (array) $additional_fields as $item ) {
794
+		foreach ( (array)$additional_fields as $item ) {
795 795
 
796 796
 			// Prevent items from not having index set
797 797
 			$item = wp_parse_args( $item, array(
@@ -802,16 +802,16 @@  discard block
 block discarded – undo
802 802
 				'field_options' => null,
803 803
 				'settings_html'	=> null,
804 804
 				'icon' => null,
805
-			));
805
+			) );
806 806
 
807 807
 			// Backward compat.
808
-			if( !empty( $item['field_options'] ) ) {
808
+			if ( ! empty( $item[ 'field_options' ] ) ) {
809 809
 				// Use settings_html from now on.
810
-				$item['settings_html'] = $item['field_options'];
810
+				$item[ 'settings_html' ] = $item[ 'field_options' ];
811 811
 			}
812 812
 
813 813
 			// Render a label for each of them
814
-			echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form );
814
+			echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form );
815 815
 
816 816
 		}
817 817
 
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
824 824
 	 * @return array
825 825
 	 */
826
-	function get_entry_default_fields($form, $zone) {
826
+	function get_entry_default_fields( $form, $zone ) {
827 827
 
828 828
 		$entry_default_fields = array();
829 829
 
830 830
 		// if in zone directory or single
831
-		if( in_array( $zone, array( 'directory', 'single' ), true ) ) {
831
+		if ( in_array( $zone, array( 'directory', 'single' ), true ) ) {
832 832
 
833 833
 			$meta_fields = GravityView_Fields::get_all( array( 'meta', 'gravityview', 'add-ons' ) );
834 834
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		 * @param  string|array $form form_ID or form object
846 846
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
847 847
 		 */
848
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
848
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
849 849
 	}
850 850
 
851 851
 	/**
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	function get_available_fields( $form = '', $zone = NULL ) {
858 858
 
859
-		if( empty( $form ) ) {
859
+		if ( empty( $form ) ) {
860 860
 			gravityview()->log->error( '$form is empty' );
861 861
 			return array();
862 862
 		}
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 		$fields = gravityview_get_form_fields( $form, true );
866 866
 
867 867
 		// get meta fields ( only if form was already created )
868
-		if( !is_array( $form ) ) {
868
+		if ( ! is_array( $form ) ) {
869 869
 			$meta_fields = gravityview_get_entry_meta( $form );
870 870
 		} else {
871 871
 			$meta_fields = array();
@@ -878,8 +878,8 @@  discard block
 block discarded – undo
878 878
 		$fields = $fields + $meta_fields + $default_fields;
879 879
 
880 880
 		// Move Custom Content to top
881
-		if ( isset( $fields['custom'] ) ) {
882
-			$fields = array( 'custom' => $fields['custom'] ) + $fields;
881
+		if ( isset( $fields[ 'custom' ] ) ) {
882
+			$fields = array( 'custom' => $fields[ 'custom' ] ) + $fields;
883 883
 		}
884 884
 
885 885
 		$gv_fields = GravityView_Fields::get_all();
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 		foreach ( $fields as &$field ) {
888 888
 			foreach ( $gv_fields as $gv_field ) {
889 889
 				if ( \GV\Utils::get( $field, 'type' ) === $gv_field->name ) {
890
-					$field['icon'] = \GV\Utils::get( $gv_field, 'icon' );
890
+					$field[ 'icon' ] = \GV\Utils::get( $gv_field, 'icon' );
891 891
 				}
892 892
 			}
893 893
 		}
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		}
916 916
 
917 917
 		foreach ( $widgets as $id => $details ) {
918
-			echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
918
+			echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
919 919
 		}
920 920
 
921 921
 	}
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
946 946
 		global $post;
947 947
 
948
-		if( $type === 'widget' ) {
948
+		if ( $type === 'widget' ) {
949 949
 			$button_label = __( 'Add Widget', 'gravityview' );
950 950
 		} else {
951 951
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -971,10 +971,10 @@  discard block
 block discarded – undo
971 971
 		$form_id = null;
972 972
 
973 973
 		// if saved values, get available fields to label everyone
974
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
974
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
975 975
 
976
-			if( !empty( $_POST['template_id'] ) ) {
977
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
976
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
977
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
978 978
 			} else {
979 979
 				$form_id = $form = gravityview_get_form_id( $post->ID );
980 980
 			}
@@ -992,53 +992,53 @@  discard block
 block discarded – undo
992 992
 			}
993 993
 		}
994 994
 
995
-		foreach( $rows as $row ) :
996
-			foreach( $row as $col => $areas ) :
997
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
995
+		foreach ( $rows as $row ) :
996
+			foreach ( $row as $col => $areas ) :
997
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
998 998
 
999 999
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
1000 1000
 
1001
-					<?php foreach( $areas as $area ) : 	?>
1001
+					<?php foreach ( $areas as $area ) : 	?>
1002 1002
 
1003
-						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1004
-                            <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area['subtitle'] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>>
1005
-								<strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area['title'] ); ?></strong>
1003
+						<div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>">
1004
+                            <p class="gv-droppable-area-title" <?php if ( 'widget' === $type && empty( $area[ 'subtitle' ] ) ) { echo ' style="margin: 0; padding: 0;"'; } ?>>
1005
+								<strong <?php if ( 'widget' === $type ) { echo 'class="screen-reader-text"'; } ?>><?php echo esc_html( $area[ 'title' ] ); ?></strong>
1006 1006
 
1007 1007
 								<?php if ( 'widget' !== $type ) { ?>
1008
-									<a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a>
1008
+									<a class="clear-all-fields alignright" role="button" href="#" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php esc_html_e( 'Clear all fields', 'gravityview' ); ?></a>
1009 1009
 								<?php } ?>
1010 1010
 
1011
-                                <?php if ( ! empty( $area['subtitle'] ) ) { ?>
1012
-									<span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area['subtitle'] ); ?>"></span></span>
1011
+                                <?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?>
1012
+									<span class="gv-droppable-area-subtitle"><span class="gf_tooltip gv_tooltip tooltip" title="<?php echo esc_attr( $area[ 'subtitle' ] ); ?>"></span></span>
1013 1013
 								<?php } ?>
1014 1014
 							</p>
1015 1015
 							<div class="active-drop-container active-drop-container-<?php echo esc_attr( $type ); ?>">
1016
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"><?php // render saved fields
1017
-								if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
1016
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"><?php // render saved fields
1017
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
1018 1018
 
1019
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
1019
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
1020 1020
 
1021 1021
 										// Maybe has a form ID
1022
-										$form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id'];
1022
+										$form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ];
1023 1023
 
1024 1024
 										$input_type = NULL;
1025 1025
 
1026 1026
 										if ( $form_id ) {
1027
-											$original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ;
1027
+											$original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false;
1028 1028
                                         } else {
1029
-											$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
1029
+											$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
1030 1030
                                         }
1031 1031
 
1032
-										if ( !$original_item ) {
1033
-											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) );
1032
+										if ( ! $original_item ) {
1033
+											gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) );
1034 1034
 
1035 1035
 											$original_item = $field;
1036 1036
 										} else {
1037
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
1037
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
1038 1038
 										}
1039 1039
 
1040 1040
 										// Field options dialog box
1041
-										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
1041
+										$field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
1042 1042
 
1043 1043
 										$item = array(
1044 1044
 											'input_type' => $input_type,
@@ -1051,12 +1051,12 @@  discard block
 block discarded – undo
1051 1051
 											$item = wp_parse_args( $item, $original_item );
1052 1052
 										}
1053 1053
 
1054
-										switch( $type ) {
1054
+										switch ( $type ) {
1055 1055
 											case 'widget':
1056
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
1056
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
1057 1057
 												break;
1058 1058
 											default:
1059
-												echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id );
1059
+												echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id );
1060 1060
 										}
1061 1061
 									}
1062 1062
 
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 								<div class="gv-droppable-area-action">
1065 1065
 									<a href="#" class="gv-add-field button button-link button-hero" title=""
1066 1066
 									   data-objecttype="<?php echo esc_attr( $type ); ?>"
1067
-									   data-areaid="<?php echo esc_attr( $zone . '_' . $area['areaid'] ); ?>"
1067
+									   data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"
1068 1068
 									   data-context="<?php echo esc_attr( $zone ); ?>"
1069 1069
 									   data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '<span class="dashicons dashicons-plus-alt"></span>' . esc_html( $button_label ); ?></a>
1070 1070
 								</div>
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 				// This is a new View, prefill the widgets
1098 1098
 				$widgets = array(
1099 1099
 					'header_top' => array(
1100
-						substr( md5( microtime( true ) ), 0, 13 ) => array (
1100
+						substr( md5( microtime( true ) ), 0, 13 ) => array(
1101 1101
 							'id' => 'search_bar',
1102 1102
 							'label' => __( 'Search Bar', 'gravityview' ),
1103 1103
 							'search_layout' => 'horizontal',
@@ -1172,12 +1172,12 @@  discard block
 block discarded – undo
1172 1172
 		if ( $post ) {
1173 1173
 			$source_form_id = gravityview_get_form_id( $post->ID );
1174 1174
 			if ( $source_form_id ) {
1175
-				$form_ids[] = $source_form_id;
1175
+				$form_ids[ ] = $source_form_id;
1176 1176
 			}
1177 1177
 
1178 1178
 			$joined_forms = \GV\View::get_joined_forms( $post->ID );
1179 1179
 			foreach ( $joined_forms as $joined_form ) {
1180
-				$form_ids[] = $joined_form->ID;
1180
+				$form_ids[ ] = $joined_form->ID;
1181 1181
 			}
1182 1182
 		}
1183 1183
 		foreach ( array_unique( $form_ids ) as $form_id ) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 	 * @return string HTML of the active areas
1216 1216
 	 */
1217 1217
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
1218
-		if( empty( $template_id ) ) {
1218
+		if ( empty( $template_id ) ) {
1219 1219
 			gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) );
1220 1220
 			return '';
1221 1221
 		}
@@ -1229,12 +1229,12 @@  discard block
 block discarded – undo
1229 1229
 		 */
1230 1230
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
1231 1231
 
1232
-		if( empty( $template_areas ) ) {
1232
+		if ( empty( $template_areas ) ) {
1233 1233
 
1234 1234
 			gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) );
1235 1235
 			$output = '<div>';
1236
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
1237
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
1236
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
1237
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
1238 1238
 			$output .= '</div>';
1239 1239
 		} else {
1240 1240
 
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
 		}
1251 1251
 
1252
-		if( $echo ) {
1252
+		if ( $echo ) {
1253 1253
 			echo $output;
1254 1254
 		}
1255 1255
 
@@ -1277,18 +1277,18 @@  discard block
 block discarded – undo
1277 1277
 		}
1278 1278
 
1279 1279
 		// Add the GV font (with the Astronaut)
1280
-        wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version );
1280
+        wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version );
1281 1281
 		wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version );
1282 1282
 
1283
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true );
1283
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true );
1284 1284
 
1285
-		if( GFForms::get_page() === 'form_list' ) {
1285
+		if ( GFForms::get_page() === 'form_list' ) {
1286 1286
 			wp_enqueue_style( 'gravityview_views_styles' );
1287 1287
 			return;
1288 1288
         }
1289 1289
 
1290 1290
 		// Don't process any scripts below here if it's not a GravityView page.
1291
-		if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1291
+		if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) {
1292 1292
 		    return;
1293 1293
 		}
1294 1294
 
@@ -1296,15 +1296,15 @@  discard block
 block discarded – undo
1296 1296
 
1297 1297
         wp_enqueue_script( 'jquery-ui-datepicker' );
1298 1298
 
1299
-        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version );
1299
+        wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version );
1300 1300
 
1301 1301
         // Enqueue scripts
1302 1302
         wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version );
1303 1303
 
1304
-        wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1304
+        wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1305 1305
             'cookiepath' => COOKIEPATH,
1306 1306
             'admin_cookiepath' => ADMIN_COOKIE_PATH,
1307
-            'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ),
1307
+            'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ),
1308 1308
             'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1309 1309
             'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1310 1310
             'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ),
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
             'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1320 1320
             'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1321 1321
             'remove_all_fields' => __( 'Would you like to remove all fields in this zone?', 'gravityview' ),
1322
-        ));
1322
+        ) );
1323 1323
 
1324 1324
 		wp_enqueue_style( 'gravityview_views_styles' );
1325 1325
 
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
         self::enqueue_gravity_forms_scripts();
1328 1328
 
1329 1329
 		// 2.5 changed how Merge Tags are enqueued
1330
-		if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) {
1330
+		if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) {
1331 1331
 			GFCommon::output_hooks_javascript();
1332 1332
 		}
1333 1333
 	}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 		);
1352 1352
 
1353 1353
 		if ( wp_is_mobile() ) {
1354
-		    $scripts[] = 'jquery-touch-punch';
1354
+		    $scripts[ ] = 'jquery-touch-punch';
1355 1355
 		}
1356 1356
 
1357 1357
 		wp_enqueue_script( $scripts );
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 
66 66
 		add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) );
67 67
 
68
-		add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 );
69
-		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') );
70
-		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') );
68
+		add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 );
69
+		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
70
+		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
71 71
 
72
-		add_action( 'wp', array( $this, 'maybe_add_note'), 1000 );
73
-		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') );
74
-		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') );
72
+		add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 );
73
+		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) );
74
+		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) );
75 75
 
76 76
 		// add template path to check for field
77 77
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
78 78
 		add_filter( 'gravityview/template/fields_template_paths', array( $this, 'add_template_path' ) );
79 79
 
80
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
80
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
81 81
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
82 82
 
83 83
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 );
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function add_entry_default_field( $entry_default_fields, $form, $zone ) {
101 101
 
102
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
103
-			$entry_default_fields['notes'] = array(
102
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
103
+			$entry_default_fields[ 'notes' ] = array(
104 104
 				'label' => __( 'Entry Notes', 'gravityview' ),
105 105
 				'type'  => 'notes',
106 106
 				'desc'  => __( 'Display, add, and delete notes for an entry.', 'gravityview' ),
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
 	public function enqueue_scripts() {
135 135
 		global $wp_actions;
136 136
 
137
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
137
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
138 138
 			wp_enqueue_style( 'gravityview-notes' );
139 139
 			wp_enqueue_script( 'gravityview-notes' );
140 140
 		}
141 141
 
142
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
142
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
143 143
 
144 144
 			$strings = self::strings();
145 145
 
146 146
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
147 147
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
148 148
 				'text' => array(
149
-					'processing' => $strings['processing'],
150
-					'delete_confirm' => $strings['delete-confirm'],
151
-					'note_added' => $strings['added-note'],
152
-					'error_invalid' => $strings['error-invalid'],
153
-					'error_empty_note' => $strings['error-empty-note'],
149
+					'processing' => $strings[ 'processing' ],
150
+					'delete_confirm' => $strings[ 'delete-confirm' ],
151
+					'note_added' => $strings[ 'added-note' ],
152
+					'error_invalid' => $strings[ 'error-invalid' ],
153
+					'error_empty_note' => $strings[ 'error-empty-note' ],
154 154
 				),
155 155
 			) );
156 156
 		}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return void
167 167
 	 */
168 168
 	function maybe_add_note() {
169
-		if ( ! isset( $_POST['action'] ) || 'gv_note_add' !== $_POST['action'] ) {
169
+		if ( ! isset( $_POST[ 'action' ] ) || 'gv_note_add' !== $_POST[ 'action' ] ) {
170 170
 			return;
171 171
 		}
172 172
 
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 		$post = wp_unslash( $_POST );
180 180
 
181 181
 		if ( $this->doing_ajax ) {
182
-			parse_str( $post['data'], $data );
182
+			parse_str( $post[ 'data' ], $data );
183 183
 		} else {
184 184
 			$data = $post;
185 185
 		}
186 186
 
187
-		$this->process_add_note( (array) $data );
187
+		$this->process_add_note( (array)$data );
188 188
 	}
189 189
 
190 190
 	/**
@@ -210,23 +210,23 @@  discard block
 block discarded – undo
210 210
 		$error = false;
211 211
 		$success = false;
212 212
 
213
-		if( empty( $data['entry-slug'] ) ) {
213
+		if ( empty( $data[ 'entry-slug' ] ) ) {
214 214
 
215
-			$error = self::strings('error-invalid');
215
+			$error = self::strings( 'error-invalid' );
216 216
 			gravityview()->log->error( 'The note is missing an Entry ID.' );
217 217
 
218 218
 		} else {
219 219
 
220
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
220
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
221 221
 
222 222
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
223 223
 
224
-			if( ! $has_cap ) {
224
+			if ( ! $has_cap ) {
225 225
 				$error = self::strings( 'error-cap-add' );
226 226
 				gravityview()->log->error( 'Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
227 227
 			} elseif ( $valid ) {
228 228
 
229
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
229
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
230 230
 
231 231
 				$added = $this->add_note( $entry, $data );
232 232
 
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
 					$this->maybe_send_entry_notes( $note, $entry, $data );
245 245
 
246 246
 					if ( $note ) {
247
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
247
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
248 248
 						gravityview()->log->debug( 'The note was successfully created', array( 'data' => compact( 'note', 'data' ) ) );
249 249
 					} else {
250
-						$error = self::strings('error-add-note');
250
+						$error = self::strings( 'error-add-note' );
251 251
 						gravityview()->log->error( 'The note was not successfully created', array( 'data' => compact( 'note', 'data' ) ) );
252 252
 					}
253 253
 				}
254 254
 			} else {
255
-				$error = self::strings('error-invalid');
255
+				$error = self::strings( 'error-invalid' );
256 256
 				gravityview()->log->error( 'Nonce validation failed; the note was not created' );
257 257
 			}
258 258
 		}
259 259
 
260 260
 
261
-		if( $this->doing_ajax ) {
262
-			if( $success ) {
261
+		if ( $this->doing_ajax ) {
262
+			if ( $success ) {
263 263
 				wp_send_json_success( array( 'html' => $success ) );
264 264
 			} else {
265 265
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -285,11 +285,11 @@  discard block
 block discarded – undo
285 285
 			return;
286 286
 		}
287 287
 
288
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
288
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
289 289
 
290 290
 			$post = wp_unslash( $_POST );
291 291
 			if ( $this->doing_ajax ) {
292
-				parse_str( $post['data'], $data );
292
+				parse_str( $post[ 'data' ], $data );
293 293
 			} else {
294 294
 				$data = $post;
295 295
 			}
@@ -320,18 +320,18 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	function process_delete_notes( $data ) {
322 322
 
323
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
323
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
324 324
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
325 325
 		$success = false;
326 326
 
327 327
 		if ( $valid && $has_cap ) {
328
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
328
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
329 329
 			$success = true;
330 330
 		}
331 331
 
332
-		if( $this->doing_ajax ) {
332
+		if ( $this->doing_ajax ) {
333 333
 
334
-			if( $success ) {
334
+			if ( $success ) {
335 335
 				wp_send_json_success();
336 336
 			} else {
337 337
 				if ( ! $valid ) {
@@ -364,13 +364,13 @@  discard block
 block discarded – undo
364 364
 
365 365
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
366 366
 
367
-		unset( $field_options['show_as_link'] );
367
+		unset( $field_options[ 'show_as_link' ] );
368 368
 
369 369
 		$notes_options = array(
370 370
 			'notes' => array(
371 371
 				'type' => 'checkboxes',
372
-				'label' => __('Note Settings', 'gravityview'),
373
-				'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
372
+				'label' => __( 'Note Settings', 'gravityview' ),
373
+				'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
374 374
 				'options' => array(
375 375
 					'view' => array(
376 376
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
423 423
 			'other-email' => __( 'Other email address', 'gravityview' ),
424 424
 			'email-label' => __( 'Email address', 'gravityview' ),
425
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
425
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
426 426
 			'subject-label' => __( 'Subject', 'gravityview' ),
427 427
 			'subject' => __( 'Email subject', 'gravityview' ),
428 428
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		 */
443 443
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
444 444
 
445
-		if( $key ) {
445
+		if ( $key ) {
446 446
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
447 447
 		}
448 448
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	 */
465 465
 	static public function display_note( $note, $show_delete = false, $context = null ) {
466 466
 
467
-		if( ! is_object( $note ) ) {
467
+		if ( ! is_object( $note ) ) {
468 468
 			return '';
469 469
 		}
470 470
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		}
520 520
 
521 521
 		$replacements = array(
522
-			'{note_id}' => $note_content['note_id'],
522
+			'{note_id}' => $note_content[ 'note_id' ],
523 523
 			'{row_class}' => 'gv-note',
524 524
 			'{note_detail}' => $note_detail_html
525 525
 		);
@@ -551,13 +551,13 @@  discard block
 block discarded – undo
551 551
 
552 552
 		$user_data = get_userdata( $current_user->ID );
553 553
 
554
-		$note_content = trim( $data['gv-note-content'] );
554
+		$note_content = trim( $data[ 'gv-note-content' ] );
555 555
 
556
-		if( empty( $note_content ) ) {
556
+		if ( empty( $note_content ) ) {
557 557
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
558 558
 		}
559 559
 
560
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
560
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
561 561
 
562 562
 		return $return;
563 563
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 
578 578
 		$atts = shortcode_atts( array( 'entry' => null ), $atts );
579 579
 
580
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
580
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
581 581
 			gravityview()->log->error( 'User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
582 582
 			return '';
583 583
 		}
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
 
600 600
 			$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
601 601
 
602
-			if ( $atts['entry'] ) {
603
-				$entry = GFAPI::get_entry( $atts['entry'] );
602
+			if ( $atts[ 'entry' ] ) {
603
+				$entry = GFAPI::get_entry( $atts[ 'entry' ] );
604 604
 			}
605 605
 
606 606
 			if ( ! isset( $entry ) || ! $entry ) {
@@ -618,14 +618,14 @@  discard block
 block discarded – undo
618 618
 
619 619
 		// Only generate the dropdown if the field settings allow it
620 620
 		$email_fields = '';
621
-		if( ! empty( $visibility_settings['email'] ) ) {
621
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
622 622
 			$email_fields = self::get_note_email_fields( $entry_slug );
623 623
 		}
624 624
 
625 625
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
626 626
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
627
-		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings['delete'] ) ? 0 : $visibility_settings['delete'] ), $add_note_html );
628
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
627
+		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings[ 'delete' ] ) ? 0 : $visibility_settings[ 'delete' ] ), $add_note_html );
628
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
629 629
 		$add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html );
630 630
 
631 631
 		return $add_note_html;
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
 		$note_emails = array();
651 651
 
652 652
 		foreach ( $email_fields as $email_field ) {
653
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
654
-				$note_emails[] = $entry["{$email_field->id}"];
653
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
654
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
655 655
 			}
656 656
 		}
657 657
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		 */
664 664
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
665 665
 
666
-		return (array) $note_emails;
666
+		return (array)$note_emails;
667 667
 	}
668 668
 
669 669
 	/**
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 */
680 680
 	private static function get_note_email_fields( $entry_slug = '' ) {
681 681
 
682
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
682
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
683 683
 			gravityview()->log->error( 'User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
684 684
 			return '';
685 685
 		}
@@ -701,27 +701,27 @@  discard block
 block discarded – undo
701 701
 
702 702
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
703 703
 			<div class="gv-note-email-container">
704
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
704
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
705 705
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
706
-					<option value=""><?php echo $strings['also-email'];  ?></option>
706
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
707 707
 					<?php foreach ( $note_emails as  $email ) {
708 708
 						?>
709 709
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
710 710
 					<?php }
711
-					if( $include_custom ) { ?>
712
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
711
+					if ( $include_custom ) { ?>
712
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
713 713
 					<?php } ?>
714 714
 				</select>
715 715
 				<fieldset class="gv-note-to-container">
716
-					<?php if( $include_custom ) { ?>
716
+					<?php if ( $include_custom ) { ?>
717 717
 					<div class='gv-note-to-custom-container'>
718
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
719
-						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
718
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
719
+						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
720 720
 					</div>
721 721
 					<?php } ?>
722 722
 		            <div class='gv-note-subject-container'>
723
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
724
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
723
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
724
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
725 725
 		            </div>
726 726
 				</fieldset>
727 727
 			</div>
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 */
745 745
 	private function maybe_send_entry_notes( $note = false, $entry = array(), $data = array() ) {
746 746
 
747
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
747
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
748 748
 			gravityview()->log->debug( 'User doesn\'t have "gravityview_email_entry_notes" cap, or $note is empty', array( 'data' => $note ) );
749 749
 			return;
750 750
 		}
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 		gravityview()->log->debug( '$data', array( 'data' => $data ) );
753 753
 
754 754
 		//emailing notes if configured
755
-		if ( ! empty( $data['gv-note-to'] ) ) {
755
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
756 756
 
757 757
 			$default_data = array(
758 758
 				'gv-note-to' => '',
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
                 'current-url' => '',
763 763
 			);
764 764
 
765
-			$current_user  = wp_get_current_user();
765
+			$current_user = wp_get_current_user();
766 766
 			$email_data = wp_parse_args( $data, $default_data );
767 767
 
768
-			$from    = $current_user->user_email;
769
-			$to = $email_data['gv-note-to'];
768
+			$from = $current_user->user_email;
769
+			$to = $email_data[ 'gv-note-to' ];
770 770
 
771 771
 			/**
772 772
 			 * Documented in get_note_email_fields
@@ -774,8 +774,8 @@  discard block
 block discarded – undo
774 774
 			 */
775 775
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
776 776
 
777
-			if( 'custom' === $to && $include_custom ) {
778
-				$to = $email_data['gv-note-to-custom'];
777
+			if ( 'custom' === $to && $include_custom ) {
778
+				$to = $email_data[ 'gv-note-to-custom' ];
779 779
 				gravityview()->log->debug( 'Sending note to a custom email address: {to}', array( 'to' => $to ) );
780 780
 			}
781 781
 
@@ -786,13 +786,13 @@  discard block
 block discarded – undo
786 786
 
787 787
 			$bcc = false;
788 788
 			$reply_to = $from;
789
-			$subject = trim( $email_data['gv-note-subject'] );
789
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
790 790
 
791 791
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
792 792
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
793
-			$message = $email_data['gv-note-content'];
793
+			$message = $email_data[ 'gv-note-content' ];
794 794
 			$email_footer = self::strings( 'email-footer' );
795
-			$from_name     = $current_user->display_name;
795
+			$from_name = $current_user->display_name;
796 796
 			$message_format = 'html';
797 797
 
798 798
 			/**
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 
824 824
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
825 825
 
826
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
826
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
827 827
 
828 828
 			/**
829 829
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 
850 850
 	    $output = '';
851 851
 
852
-		if( ! empty( $email_footer ) ) {
852
+		if ( ! empty( $email_footer ) ) {
853 853
 		    $url = \GV\Utils::get( $email_data, 'current-url' );
854 854
 			$url = html_entity_decode( $url );
855 855
 			$url = site_url( $url );
Please login to merge, or discard this patch.