Completed
Push — master ( d10a7f...629a27 )
by Zack
9s
created
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				'type' => 'radio',
64 64
 				'full_width' => true,
65 65
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
66
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
66
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
67 67
 				'value' => 'any',
68 68
 				'class' => 'hide-if-js',
69 69
 				'options' => array(
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
149 149
 		$script_source = empty( $script_min ) ? '/source' : '';
150 150
 
151
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
151
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
152 152
 
153 153
 
154 154
 		/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * Add admin script to the whitelist
201 201
 	 */
202 202
 	public function register_no_conflict( $required ) {
203
-		$required[] = 'gravityview_searchwidget_admin';
203
+		$required[ ] = 'gravityview_searchwidget_admin';
204 204
 		return $required;
205 205
 	}
206 206
 
@@ -213,24 +213,24 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public static function get_searchable_fields() {
215 215
 
216
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
216
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
217 217
 			exit( '0' );
218 218
 		}
219 219
 
220 220
 		$form = '';
221 221
 
222 222
 		// Fetch the form for the current View
223
-		if ( ! empty( $_POST['view_id'] ) ) {
223
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
224 224
 
225
-			$form = gravityview_get_form_id( $_POST['view_id'] );
225
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
226 226
 
227
-		} elseif ( ! empty( $_POST['formid'] ) ) {
227
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
228 228
 
229
-			$form = (int) $_POST['formid'];
229
+			$form = (int)$_POST[ 'formid' ];
230 230
 
231
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
231
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
232 232
 
233
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
233
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
234 234
 
235 235
 		}
236 236
 
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
 			)
279 279
 		);
280 280
 
281
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
282
-			$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'] );
281
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
282
+			$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' ] );
283 283
 		}
284 284
 
285 285
 		if ( ! empty( $fields ) ) {
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 
289 289
 			foreach ( $fields as $id => $field ) {
290 290
 
291
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
291
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
292 292
 					continue;
293 293
 				}
294 294
 
295
-				$types = self::get_search_input_types( $id, $field['type'] );
295
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
296 296
 
297
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
297
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
298 298
 			}
299 299
 		}
300 300
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	public static function get_search_input_types( $id = '', $field_type = null ) {
317 317
 
318 318
 		// @todo - This needs to be improved - many fields have . including products and addresses
319
-		if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) {
319
+		if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) {
320 320
 			$input_type = 'boolean'; // on/off checkbox
321 321
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
322 322
 			$input_type = 'multi'; //multiselect
@@ -358,19 +358,19 @@  discard block
 block discarded – undo
358 358
 			$post_id = 0;
359 359
 
360 360
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
361
-			if ( ! empty( $widget_args['post_id'] ) ) {
362
-				$post_id = absint( $widget_args['post_id'] );
361
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
362
+				$post_id = absint( $widget_args[ 'post_id' ] );
363 363
 			}
364 364
 			// We're in the WordPress Widget context, and the base View ID should be used
365
-			else if ( ! empty( $widget_args['view_id'] ) ) {
366
-				$post_id = absint( $widget_args['view_id'] );
365
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
366
+				$post_id = absint( $widget_args[ 'view_id' ] );
367 367
 			}
368 368
 
369 369
 			$args = gravityview_get_permalink_query_args( $post_id );
370 370
 
371 371
 			// Add hidden fields to the search form
372 372
 			foreach ( $args as $key => $value ) {
373
-				$search_fields[] = array(
373
+				$search_fields[ ] = array(
374 374
 					'name'  => $key,
375 375
 					'input' => 'hidden',
376 376
 					'value' => $value,
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function filter_entries( $search_criteria ) {
393 393
 
394
-		if( 'post' === $this->search_method ) {
394
+		if ( 'post' === $this->search_method ) {
395 395
 			$get = $_POST;
396 396
 		} else {
397 397
 			$get = $_GET;
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$get = gv_map_deep( $get, 'urldecode' );
409 409
 
410 410
 		// add free search
411
-		if ( ! empty( $get['gv_search'] ) ) {
411
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
412 412
 
413 413
 			// Search for a piece
414
-			$words = explode( ' ', $get['gv_search'] );
414
+			$words = explode( ' ', $get[ 'gv_search' ] );
415 415
 
416 416
 			$words = array_filter( $words );
417 417
 
418 418
 			foreach ( $words as $word ) {
419
-				$search_criteria['field_filters'][] = array(
419
+				$search_criteria[ 'field_filters' ][ ] = array(
420 420
 					'key' => null, // The field ID to search
421 421
 					'value' => $word, // The value to search
422 422
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 
427 427
 		//start date & end date
428
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
429
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
428
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
429
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
430 430
 
431 431
         /**
432 432
          * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
 		/**
442 442
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
443 443
 		 */
444
-		if( !empty( $curr_start ) ) {
445
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
444
+		if ( ! empty( $curr_start ) ) {
445
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
446 446
 		}
447
-		if( !empty( $curr_end ) ) {
448
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
447
+		if ( ! empty( $curr_end ) ) {
448
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
449 449
 		}
450 450
 
451 451
 		// search for a specific entry ID
452 452
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
453
-			$search_criteria['field_filters'][] = array(
453
+			$search_criteria[ 'field_filters' ][ ] = array(
454 454
 				'key' => 'id',
455 455
 				'value' => absint( $get[ 'gv_id' ] ),
456 456
 				'operator' => '=',
@@ -459,36 +459,36 @@  discard block
 block discarded – undo
459 459
 
460 460
 		// search for a specific Created_by ID
461 461
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
462
-			$search_criteria['field_filters'][] = array(
462
+			$search_criteria[ 'field_filters' ][ ] = array(
463 463
 				'key' => 'created_by',
464
-				'value' => absint( $get['gv_by'] ),
464
+				'value' => absint( $get[ 'gv_by' ] ),
465 465
 				'operator' => '=',
466 466
 			);
467 467
 		}
468 468
 
469 469
 
470 470
 		// Get search mode passed in URL
471
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
471
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
472 472
 
473 473
 		// get the other search filters
474 474
 		foreach ( $get as $key => $value ) {
475 475
 
476
-			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) {
476
+			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) {
477 477
 				continue;
478 478
 			}
479 479
 
480 480
 			// could return simple filter or multiple filters
481 481
 			$filter = $this->prepare_field_filter( $key, $value );
482 482
 
483
-			if ( isset( $filter[0]['value'] ) ) {
484
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
483
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
484
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
485 485
 
486 486
 				// if date range type, set search mode to ALL
487
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
487
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
488 488
 					$mode = 'all';
489 489
 				}
490
-			} elseif( !empty( $filter ) ) {
491
-				$search_criteria['field_filters'][] = $filter;
490
+			} elseif ( ! empty( $filter ) ) {
491
+				$search_criteria[ 'field_filters' ][ ] = $filter;
492 492
 			}
493 493
 		}
494 494
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		 * @since 1.5.1
498 498
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
499 499
 		 */
500
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
500
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
501 501
 
502 502
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
503 503
 
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 			'value' => $value,
536 536
 		);
537 537
 
538
-		switch ( $form_field['type'] ) {
538
+		switch ( $form_field[ 'type' ] ) {
539 539
 
540 540
 			case 'select':
541 541
 			case 'radio':
542
-				$filter['operator'] = 'is';
542
+				$filter[ 'operator' ] = 'is';
543 543
 				break;
544 544
 
545 545
 			case 'post_category':
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
 				foreach ( $value as $val ) {
555 555
 					$cat = get_term( $val, 'category' );
556
-					$filter[] = array(
556
+					$filter[ ] = array(
557 557
 						'key' => $field_id,
558 558
 						'value' => esc_attr( $cat->name ) . ':' . $val,
559 559
 						'operator' => 'is',
@@ -572,18 +572,18 @@  discard block
 block discarded – undo
572 572
 				$filter = array();
573 573
 
574 574
 				foreach ( $value as $val ) {
575
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
575
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
576 576
 				}
577 577
 
578 578
 				break;
579 579
 
580 580
 			case 'checkbox':
581 581
 				// convert checkbox on/off into the correct search filter
582
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
583
-					foreach ( $form_field['inputs'] as $k => $input ) {
584
-						if ( $input['id'] == $field_id ) {
585
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
586
-							$filter['operator'] = 'is';
582
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
583
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
584
+						if ( $input[ 'id' ] == $field_id ) {
585
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
586
+							$filter[ 'operator' ] = 'is';
587 587
 							break;
588 588
 						}
589 589
 					}
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 					$filter = array();
594 594
 
595 595
 					foreach ( $value as $val ) {
596
-						$filter[] = array(
596
+						$filter[ ] = array(
597 597
 								'key'   => $field_id,
598 598
 								'value' => $val,
599 599
 								'operator' => 'is',
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
 					foreach ( $words as $word ) {
615 615
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
616 616
 							// Keep the same key for each filter
617
-							$filter['value'] = $word;
617
+							$filter[ 'value' ] = $word;
618 618
 							// Add a search for the value
619
-							$filters[] = $filter;
619
+							$filters[ ] = $filter;
620 620
 						}
621 621
 					}
622 622
 
@@ -643,19 +643,19 @@  discard block
 block discarded – undo
643 643
 						 * @since 1.16.3
644 644
 						 * Safeguard until GF implements '<=' operator
645 645
 						 */
646
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
646
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
647 647
 							$operator = '<';
648 648
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
649 649
 						}
650 650
 
651
-						$filter[] = array(
651
+						$filter[ ] = array(
652 652
 							'key' => $field_id,
653 653
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
654 654
 							'operator' => $operator,
655 655
 						);
656 656
 					}
657 657
 				} else {
658
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
658
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
659 659
 				}
660 660
 
661 661
 				break;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 			'ymd_dot' => 'Y.m.d',
687 687
 		);
688 688
 
689
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
689
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
690 690
 			$format = $datepicker[ $field->dateFormat ];
691 691
 		}
692 692
 
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	public function add_template_path( $file_paths ) {
718 718
 
719 719
 		// Index 100 is the default GravityView template path.
720
-		$file_paths[102] = self::$file . 'templates/';
720
+		$file_paths[ 102 ] = self::$file . 'templates/';
721 721
 
722 722
 		return $file_paths;
723 723
 	}
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		}
740 740
 
741 741
 		// get configured search fields
742
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
742
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
743 743
 
744 744
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
745 745
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -753,24 +753,24 @@  discard block
 block discarded – undo
753 753
 
754 754
 			$updated_field = $field;
755 755
 
756
-			if ( in_array( $field['input'], array( 'date', 'date_range' ) ) ) {
756
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range' ) ) ) {
757 757
 				$has_date = true;
758 758
 			}
759 759
 
760 760
 			$updated_field = $this->get_search_filter_details( $updated_field );
761 761
 
762
-			switch ( $field['field'] ) {
762
+			switch ( $field[ 'field' ] ) {
763 763
 
764 764
 				case 'search_all':
765
-					$updated_field['key'] = 'search_all';
766
-					$updated_field['input'] = 'search_all';
767
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
765
+					$updated_field[ 'key' ] = 'search_all';
766
+					$updated_field[ 'input' ] = 'search_all';
767
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
768 768
 					break;
769 769
 
770 770
 				case 'entry_date':
771
-					$updated_field['key'] = 'entry_date';
772
-					$updated_field['input'] = 'entry_date';
773
-					$updated_field['value'] = array(
771
+					$updated_field[ 'key' ] = 'entry_date';
772
+					$updated_field[ 'input' ] = 'entry_date';
773
+					$updated_field[ 'value' ] = array(
774 774
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
775 775
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
776 776
 					);
@@ -778,16 +778,16 @@  discard block
 block discarded – undo
778 778
 					break;
779 779
 
780 780
 				case 'entry_id':
781
-					$updated_field['key'] = 'entry_id';
782
-					$updated_field['input'] = 'entry_id';
783
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
781
+					$updated_field[ 'key' ] = 'entry_id';
782
+					$updated_field[ 'input' ] = 'entry_id';
783
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
784 784
 					break;
785 785
 
786 786
 				case 'created_by':
787
-					$updated_field['key'] = 'created_by';
788
-					$updated_field['name'] = 'gv_by';
789
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
790
-					$updated_field['choices'] = self::get_created_by_choices();
787
+					$updated_field[ 'key' ] = 'created_by';
788
+					$updated_field[ 'name' ] = 'gv_by';
789
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
790
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
791 791
 					break;
792 792
 			}
793 793
 
@@ -805,16 +805,16 @@  discard block
 block discarded – undo
805 805
 		 */
806 806
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
807 807
 
808
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
808
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
809 809
 
810 810
 		/** @since 1.14 */
811
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
811
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
812 812
 
813
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
813
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
814 814
 
815 815
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
816 816
 
817
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
817
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
818 818
 
819 819
 		if ( $has_date ) {
820 820
 			// enqueue datepicker stuff only if needed!
@@ -834,10 +834,10 @@  discard block
 block discarded – undo
834 834
 	public static function get_search_class( $custom_class = '' ) {
835 835
 		$gravityview_view = GravityView_View::getInstance();
836 836
 
837
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
837
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
838 838
 
839
-		if ( ! empty( $custom_class )  ) {
840
-			$search_class .= ' '.$custom_class;
839
+		if ( ! empty( $custom_class ) ) {
840
+			$search_class .= ' ' . $custom_class;
841 841
 		}
842 842
 
843 843
 		/**
@@ -880,11 +880,11 @@  discard block
 block discarded – undo
880 880
 
881 881
 		$label = rgget( 'label', $field );
882 882
 
883
-		if( '' === $label ) {
883
+		if ( '' === $label ) {
884 884
 
885
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
885
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
886 886
 
887
-			switch( $field['field'] ) {
887
+			switch ( $field[ 'field' ] ) {
888 888
 				case 'search_all':
889 889
 					$label = __( 'Search Entries:', 'gravityview' );
890 890
 					break;
@@ -902,10 +902,10 @@  discard block
 block discarded – undo
902 902
 					break;
903 903
 				default:
904 904
 					// If this is a field input, not a field
905
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
905
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
906 906
 
907 907
 						// Get the label for the field in question, which returns an array
908
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
908
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
909 909
 
910 910
 						// Get the item with the `label` key
911 911
 						$values = wp_list_pluck( $items, 'label' );
@@ -942,32 +942,32 @@  discard block
 block discarded – undo
942 942
 		$form = $gravityview_view->getForm();
943 943
 
944 944
 		// for advanced field ids (eg, first name / last name )
945
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
945
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
946 946
 
947 947
 		// get searched value from $_GET/$_POST (string or array)
948 948
 		$value = $this->rgget_or_rgpost( $name );
949 949
 
950 950
 		// get form field details
951
-		$form_field = gravityview_get_field( $form, $field['field'] );
951
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
952 952
 
953 953
 		$filter = array(
954
-			'key' => $field['field'],
954
+			'key' => $field[ 'field' ],
955 955
 			'name' => $name,
956 956
 			'label' => self::get_field_label( $field, $form_field ),
957
-			'input' => $field['input'],
957
+			'input' => $field[ 'input' ],
958 958
 			'value' => $value,
959
-			'type' => $form_field['type'],
959
+			'type' => $form_field[ 'type' ],
960 960
 		);
961 961
 
962 962
 		// collect choices
963
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
964
-			$filter['choices'] = gravityview_get_terms_choices();
965
-		} elseif ( ! empty( $form_field['choices'] ) ) {
966
-			$filter['choices'] = $form_field['choices'];
963
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
964
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
965
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
966
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
967 967
 		}
968 968
 
969
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
970
-			$filter['value'] = array( 'start' => '', 'end' => '' );
969
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
970
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
971 971
 		}
972 972
 
973 973
 		return $filter;
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 
992 992
 		$choices = array();
993 993
 		foreach ( $users as $user ) {
994
-			$choices[] = array(
994
+			$choices[ ] = array(
995 995
 				'value' => $user->ID,
996 996
 				'text' => $user->display_name,
997 997
 			);
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 	 */
1046 1046
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1047 1047
 
1048
-		$js_dependencies[] = 'jquery-ui-datepicker';
1048
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1049 1049
 
1050 1050
 		return $js_dependencies;
1051 1051
 	}
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 			'isRTL'             => is_rtl(),
1090 1090
 		), $view_data );
1091 1091
 
1092
-		$localizations['datepicker'] = $datepicker_settings;
1092
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1093 1093
 
1094 1094
 		return $localizations;
1095 1095
 
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1113 1113
 
1114 1114
 		$scheme = is_ssl() ? 'https://' : 'http://';
1115
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1115
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1116 1116
 
1117 1117
 		/**
1118 1118
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-select.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
14
-	do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' );
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14
+	do_action( 'gravityview_log_debug', 'search-field-select.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  * @param string $default_option Default: `&mdash;` (—)
22 22
  * @param string $field_type Field type: "select" or "multiselect"
23 23
  */
24
-$default_option = apply_filters('gravityview/extension/search/select_default', '&mdash;', 'select' );
24
+$default_option = apply_filters( 'gravityview/extension/search/select_default', '&mdash;', 'select' );
25 25
 
26 26
 ?>
27 27
 <div class="gv-search-box">
28
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
29
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
28
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?>
29
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
30 30
 	<?php } ?>
31 31
 	<p>
32
-		<select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>">
33
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
32
+		<select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>">
33
+			<option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option>
34 34
 			<?php
35
-			foreach( $search_field['choices'] as $choice ) : ?>
36
-				<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
35
+			foreach ( $search_field[ 'choices' ] as $choice ) : ?>
36
+				<option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
37 37
 			<?php endforeach; ?>
38 38
 		</select>
39 39
 	</p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-multiselect.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
14
-	do_action('gravityview_log_debug', 'search-field-multiselect.php - No choices for field' );
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14
+	do_action( 'gravityview_log_debug', 'search-field-multiselect.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  * @param string $default_option Default: `&mdash;` (—)
22 22
  * @param string $field_type Field type: "select" or "multiselect"
23 23
  */
24
-$default_option = apply_filters('gravityview/extension/search/select_default', '&mdash;', 'multiselect' );
24
+$default_option = apply_filters( 'gravityview/extension/search/select_default', '&mdash;', 'multiselect' );
25 25
 
26 26
 ?>
27 27
 <div class="gv-search-box">
28
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
29
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
28
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?>
29
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
30 30
 	<?php } ?>
31 31
 	<p>
32
-		<select name="<?php echo esc_attr( $search_field['name'] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" multiple>
33
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
32
+		<select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" multiple>
33
+			<option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option>
34 34
 			<?php
35
-			foreach( $search_field['choices'] as $choice ) : ?>
36
-				<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
35
+			foreach ( $search_field[ 'choices' ] as $choice ) : ?>
36
+				<option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
37 37
 			<?php endforeach; ?>
38 38
 		</select>
39 39
 	</p>
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	$parsed_permalink = parse_url( get_permalink( $id ) );
38 38
 
39
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
39
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
40 40
 
41
-	if( empty( $permalink_args ) ) {
41
+	if ( empty( $permalink_args ) ) {
42 42
 		return array();
43 43
 	}
44 44
 
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
64 64
 
65 65
 	$output = '';
66
-	if( is_array( $current ) ) {
67
-		if( in_array( $value, $current ) ) {
66
+	if ( is_array( $current ) ) {
67
+		if ( in_array( $value, $current ) ) {
68 68
 			$output = __checked_selected_helper( true, true, false, $type );
69 69
 		}
70 70
 	} else {
71 71
 		$output = __checked_selected_helper( $value, $current, false, $type );
72 72
 	}
73 73
 
74
-	if( $echo ) {
74
+	if ( $echo ) {
75 75
 		echo $output;
76 76
 	}
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 }
80 80
 
81 81
 
82
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
82
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
83 83
 
84 84
 	/**
85 85
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
  */
126 126
 function gravityview_strip_whitespace( $string ) {
127 127
 	$string = normalize_whitespace( $string );
128
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
128
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
129 129
 }
130 130
 
131 131
 /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
  * @return string Included file contents
140 140
  */
141 141
 function gravityview_ob_include( $file_path, $object = NULL ) {
142
-	if( ! file_exists( $file_path ) ) {
142
+	if ( ! file_exists( $file_path ) ) {
143 143
 		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
144 144
 		return '';
145 145
 	}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function gravityview_get_floaty() {
157 157
 
158
-	if( function_exists('is_rtl') && is_rtl() ) {
158
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
159 159
 		$style = 'margin:10px 10px 10px 0;';
160 160
 		$class = 'alignright';
161 161
 	} else {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$class = 'alignleft';
164 164
 	}
165 165
 
166
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
166
+	return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="87" width="66" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
167 167
 }
168 168
 
169 169
 /**
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 function gravityview_number_format( $number, $decimals = '' ) {
187 187
 	global $wp_locale;
188 188
 
189
-	if( '' === $decimals ) {
189
+	if ( '' === $decimals ) {
190 190
 
191
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
191
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
192 192
 
193 193
 		/**
194 194
 		 * Calculate the position of the decimal point in the number
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	$parts = parse_url( $value );
218 218
 
219 219
 	// No domain? Strange...show the original text.
220
-	if( empty( $parts['host'] ) ) {
220
+	if ( empty( $parts[ 'host' ] ) ) {
221 221
 		return $value;
222 222
 	}
223 223
 
@@ -230,16 +230,16 @@  discard block
 block discarded – undo
230 230
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
231 231
 	 * If true: `http://example.com => example.com`
232 232
 	 */
233
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
233
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
234 234
 
235
-		if( isset( $parts['scheme'] ) ) {
236
-			$return .= $parts['scheme'];
235
+		if ( isset( $parts[ 'scheme' ] ) ) {
236
+			$return .= $parts[ 'scheme' ];
237 237
 		}
238 238
 
239 239
 	}
240 240
 
241 241
 	// The domain, which may contain a subdomain
242
-	$domain = $parts['host'];
242
+	$domain = $parts[ 'host' ];
243 243
 
244 244
 	/**
245 245
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
248 248
 	 * If true: `www.example.com => example.com`
249 249
 	 */
250
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
250
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
251 251
 
252
-	if( $strip_www ) {
253
-		$domain = str_replace('www.', '', $domain );
252
+	if ( $strip_www ) {
253
+		$domain = str_replace( 'www.', '', $domain );
254 254
 	}
255 255
 
256 256
 	/**
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
 	 * If true: `http://demo.example.com => example.com` \n
261 261
 	 * If false: `http://demo.example.com => demo.example.com`
262 262
 	 */
263
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
263
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
264 264
 
265
-	if( $strip_subdomains ) {
265
+	if ( $strip_subdomains ) {
266 266
 
267
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
267
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
268 268
 
269 269
 	}
270 270
 
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
279 279
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
280 280
 	 */
281
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
281
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
282 282
 
283
-	if( empty( $root_only ) ) {
283
+	if ( empty( $root_only ) ) {
284 284
 
285
-		if( isset( $parts['path'] ) ) {
286
-			$return .= $parts['path'];
285
+		if ( isset( $parts[ 'path' ] ) ) {
286
+			$return .= $parts[ 'path' ];
287 287
 		}
288 288
 	}
289 289
 
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
294 294
 	 * If true: `http://example.com/?query=example => example.com`
295 295
 	 */
296
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
296
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
297 297
 
298
-	if( empty( $strip_query_string ) ) {
298
+	if ( empty( $strip_query_string ) ) {
299 299
 
300
-		if( isset( $parts['query'] ) ) {
301
-			$return .= '?'.$parts['query'];
300
+		if ( isset( $parts[ 'query' ] ) ) {
301
+			$return .= '?' . $parts[ 'query' ];
302 302
 		}
303 303
 
304 304
 	}
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
317 317
 
318
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
319
-		return $matches['domain'];
318
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
319
+		return $matches[ 'domain' ];
320 320
 	} else {
321 321
 		return $string_maybe_has_subdomain;
322 322
 	}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
  */
338 338
 function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
339 339
 
340
-	if(
340
+	if (
341 341
 		! isset( $value ) // If it's not set, it's empty!
342 342
 		|| false === $value
343 343
 		|| null === $value
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 		return true;
349 349
 	}
350 350
 
351
-	if( is_string( $value ) && $allow_string_booleans ) {
351
+	if ( is_string( $value ) && $allow_string_booleans ) {
352 352
 
353 353
 		$value = trim( $value );
354 354
 		$value = strtolower( $value );
355 355
 
356 356
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
357 357
 			$value = true;
358
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
358
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
359 359
 			$value = false;
360 360
 		}
361 361
 	}
362 362
 
363 363
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
364
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
364
+	if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
365 365
 		return false;
366 366
 	}
367 367
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 function gv_map_deep( $value, $callback ) {
384 384
 
385 385
 	// Use the original function, if exists.
386
-	if( function_exists( 'map_deep') ) {
386
+	if ( function_exists( 'map_deep' ) ) {
387 387
 		return map_deep( $value, $callback );
388 388
 	}
389 389
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 
449 449
 	$exploded = explode( '.', "{$field_id}" );
450 450
 
451
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : 0;
451
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : 0;
452 452
 }
453 453
 
454 454
 /**
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
491 491
 
492
-	$terms = get_terms( $args['taxonomy'], $args );
492
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
493 493
 
494 494
 	$choices = array();
495 495
 
496 496
 	if ( is_array( $terms ) ) {
497 497
 		foreach ( $terms as $term_id => $term_name ) {
498
-			$choices[] = array(
498
+			$choices[ ] = array(
499 499
 				'text'  => $term_name,
500 500
 				'value' => $term_id
501 501
 			);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
25 25
 
26
-		if( 'edit' === $context ) {
26
+		if ( 'edit' === $context ) {
27 27
 			return $field_options;
28 28
 		}
29 29
 
30
-		$this->add_field_support('date_display', $field_options );
30
+		$this->add_field_support( 'date_display', $field_options );
31 31
 
32 32
 		return $field_options;
33 33
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$field_input_id = gravityview_get_input_id_from_id( $field_id );
52 52
 
53 53
 		$date_field_output = '';
54
-		switch( $field_input_id ) {
54
+		switch ( $field_input_id ) {
55 55
 			case 1:
56 56
 				$date_field_output = rgar( $parsed_date, 'day' );
57 57
 				break;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-list.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 		$list_rows = maybe_unserialize( $field_value );
62 62
 
63
-		if( ! is_array( $list_rows ) ) {
63
+		if ( ! is_array( $list_rows ) ) {
64 64
 			do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value );
65 65
 			return null;
66 66
 		}
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 			foreach ( $list_row as $column_key => $column_value ) {
74 74
 
75 75
 				// If the label of the column matches $column_id, or the numeric key value matches, add the value
76
-				if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
77
-					$column_values[] = $column_value;
76
+				if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) {
77
+					$column_values[ ] = $column_value;
78 78
 				}
79 79
 				$current_column++;
80 80
 			}
81 81
 		}
82 82
 
83 83
 		// Return the array of values
84
-		if( 'raw' === $format ) {
84
+		if ( 'raw' === $format ) {
85 85
 			return $column_values;
86 86
 		}
87 87
 		// Return the Gravity Forms Field output
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function _filter_field_label( $label, $field, $form, $entry ) {
106 106
 
107
-		$field_object = RGFormsModel::get_field( $form, $field['id'] );
107
+		$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
108 108
 
109 109
 		// Not a list field
110
-		if( ! $field_object || 'list' !== $field_object->type ) {
110
+		if ( ! $field_object || 'list' !== $field_object->type ) {
111 111
 			return $label;
112 112
 		}
113 113
 
114 114
 		// Custom label is defined, so use it
115
-		if( ! empty( $field['custom_label'] ) ) {
115
+		if ( ! empty( $field[ 'custom_label' ] ) ) {
116 116
 			return $label;
117 117
 		}
118 118
 
119
-		$column_id = gravityview_get_input_id_from_id( $field['id'] );
119
+		$column_id = gravityview_get_input_id_from_id( $field[ 'id' ] );
120 120
 
121 121
 		// Parent field, not column field
122
-		if( empty( $column_id ) ) {
122
+		if ( empty( $column_id ) ) {
123 123
 			return $label;
124 124
 		}
125 125
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) {
141 141
 
142 142
 		// Doesn't have columns enabled
143
-		if( ! isset( $field->choices ) || ! $field->enableColumns ) {
143
+		if ( ! isset( $field->choices ) || ! $field->enableColumns ) {
144 144
 			return $backup_label;
145 145
 		}
146 146
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
61 61
 
62
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
62
+		add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
63 63
 	}
64 64
 
65 65
 	/**
@@ -100,31 +100,31 @@  discard block
 block discarded – undo
100 100
 	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
101 101
 
102 102
 		// If the search is being sorted
103
-		if( ! empty( $criteria['sorting']['key'] ) ) {
103
+		if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) {
104 104
 
105
-			$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
105
+			$pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] );
106 106
 
107 107
 			/**
108 108
 			 * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL
109 109
 			 * @see modify_sort_id()
110 110
 			 */
111
-			if( ! empty( $pieces[1] ) ) {
111
+			if ( ! empty( $pieces[ 1 ] ) ) {
112 112
 
113 113
 				// Pass these to the _modify_query_sort_by_time_hack() method
114
-				$this->_time_format = $pieces[1];
115
-				$this->_date_format = $pieces[2];
114
+				$this->_time_format = $pieces[ 1 ];
115
+				$this->_date_format = $pieces[ 2 ];
116 116
 
117 117
 				// Remove fake input IDs (5.1 doesn't exist. Use 5)
118
-				$criteria['sorting']['key'] = floor( $pieces[0] );
118
+				$criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] );
119 119
 
120 120
 				/**
121 121
 				 * Make sure sorting is numeric (# of seconds). IMPORTANT.
122 122
 				 * @see GVCommon::is_field_numeric() is_numeric should also be set here
123 123
 				 */
124
-				$criteria['sorting']['is_numeric'] = true;
124
+				$criteria[ 'sorting' ][ 'is_numeric' ] = true;
125 125
 
126 126
 				// Modify the Gravity Forms WP Query
127
-				add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
127
+				add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
128 128
 			}
129 129
 		}
130 130
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 		 * then we want to modify the query.
148 148
 		 * @see GFFormsModel::sort_by_field_query()
149 149
 		 */
150
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
150
+		if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
151 151
 
152
-			if( $this->_time_format === '24' ) {
152
+			if ( $this->_time_format === '24' ) {
153 153
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
154 154
 			} else {
155 155
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
 		// Set variables
196 196
 		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
197 197
 
198
-		if( 'edit' === $context ) {
198
+		if ( 'edit' === $context ) {
199 199
 			return $field_options;
200 200
 		}
201 201
 
202 202
 		/**
203 203
 		 * Set default date format based on field ID and Form ID
204 204
 		 */
205
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
205
+		add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
206 206
 
207
-		$this->add_field_support('date_display', $field_options );
207
+		$this->add_field_support( 'date_display', $field_options );
208 208
 
209
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
209
+		remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
210 210
 
211 211
 		return $field_options;
212 212
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	private function _get_time_format() {
222 222
 		global $post;
223 223
 
224
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
224
+		$current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID );
225 225
 
226 226
 		return self::_get_time_format_for_field( $this->_field_id, $current_form );
227 227
 	}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		// GF defaults to 12, so should we.
241 241
 		$time_format = '12';
242 242
 
243
-		if( $form_id ) {
243
+		if ( $form_id ) {
244 244
 			$form = GFAPI::get_form( $form_id );
245 245
 
246 246
 			if ( $form ) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$default = 'h:i A';
288 288
 
289 289
 		// This doesn't take into account 24-hour
290
-		switch( $field_input_id ) {
290
+		switch ( $field_input_id ) {
291 291
 			// Hours
292 292
 			case 1:
293 293
 				return ( $time_format === '12' ) ? 'h' : 'H';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-quiz.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
20 20
 
21
-		if( 'edit' === $context ) {
21
+		if ( 'edit' === $context ) {
22 22
 			return $field_options;
23 23
 		}
24 24
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			'quiz_show_explanation' => array(
27 27
 				'type' => 'checkbox',
28 28
 				'label' => __( 'Show Answer Explanation?', 'gravityview' ),
29
-				'desc' => __('If the field has an answer explanation, show it?', 'gravityview'),
29
+				'desc' => __( 'If the field has an answer explanation, show it?', 'gravityview' ),
30 30
 				'value' => false,
31 31
 				'merge_tags' => false,
32 32
 			),
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$label = '';
32 32
 
33
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
33
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
34 34
 
35
-			$label = $field['label'];
35
+			$label = $field[ 'label' ];
36 36
 
37 37
 			// Support Gravity Forms 1.9+
38
-			if( class_exists( 'GF_Field' ) ) {
38
+			if ( class_exists( 'GF_Field' ) ) {
39 39
 
40
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
40
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
41 41
 
42
-				if( $field_object ) {
42
+				if ( $field_object ) {
43 43
 
44
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
44
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
45 45
 
46 46
 					// This is a complex field, with labels on a per-input basis
47
-					if( $input ) {
47
+					if ( $input ) {
48 48
 
49 49
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
50
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
50
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
51 51
 
52 52
 					} else {
53 53
 
54 54
 						// This is a field with one label
55
-						$label = $field_object->get_field_label( true, $field['label'] );
55
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
56 56
 
57 57
 					}
58 58
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 			}
62 62
 
63 63
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
64
-			if ( !empty( $field['custom_label'] ) ) {
64
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
65 65
 
66
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
66
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
67 67
 
68 68
 			}
69 69
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$width = NULL;
119 119
 
120
-		if( !empty( $field['width'] ) ) {
121
-			$width = absint( $field['width'] );
120
+		if ( ! empty( $field[ 'width' ] ) ) {
121
+			$width = absint( $field[ 'width' ] );
122 122
 
123 123
 			// If using percentages, limit to 100%
124
-			if( '%d%%' === $format && $width > 100 ) {
124
+			if ( '%d%%' === $format && $width > 100 ) {
125 125
 				$width = 100;
126 126
 			}
127 127
 
@@ -144,39 +144,39 @@  discard block
 block discarded – undo
144 144
 
145 145
 		$classes = array();
146 146
 
147
-		if( !empty( $field['custom_class'] ) ) {
147
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
148 148
 
149
-            $custom_class = $field['custom_class'];
149
+            $custom_class = $field[ 'custom_class' ];
150 150
 
151
-            if( !empty( $entry ) ) {
151
+            if ( ! empty( $entry ) ) {
152 152
 
153 153
                 // We want the merge tag to be formatted as a class. The merge tag may be
154 154
                 // replaced by a multiple-word value that should be output as a single class.
155 155
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
156
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
156
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
157 157
 
158
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
158
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
159 159
 
160 160
                 // And then we want life to return to normal
161
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
161
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
162 162
             }
163 163
 
164 164
 			// And now we want the spaces to be handled nicely.
165
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
165
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
166 166
 
167 167
 		}
168 168
 
169
-		if(!empty($field['id'])) {
170
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
171
-				$form_id = '-'.$form['id'];
169
+		if ( ! empty( $field[ 'id' ] ) ) {
170
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
171
+				$form_id = '-' . $form[ 'id' ];
172 172
 			} else {
173
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
173
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
174 174
 			}
175 175
 
176
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
176
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
177 177
 		}
178 178
 
179
-		return esc_attr(implode(' ', $classes));
179
+		return esc_attr( implode( ' ', $classes ) );
180 180
 	}
181 181
 
182 182
 	/**
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
195 195
 		$gravityview_view = GravityView_View::getInstance();
196
-		$id = $field['id'];
196
+		$id = $field[ 'id' ];
197 197
 
198 198
 		if ( ! empty( $id ) ) {
199
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
200
-				$form_id = '-' . $form['id'];
199
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
200
+				$form_id = '-' . $form[ 'id' ];
201 201
 			} else {
202 202
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
203 203
 			}
204 204
 
205
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
205
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
206 206
 		}
207 207
 
208 208
 		return esc_attr( $id );
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public static function field_value( $entry, $field_settings, $format = 'html' ) {
221 221
 
222
-		if( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) {
222
+		if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) {
223 223
 			return NULL;
224 224
 		}
225 225
 
226 226
 		$gravityview_view = GravityView_View::getInstance();
227 227
 
228
-		$field_id = $field_settings['id'];
228
+		$field_id = $field_settings[ 'id' ];
229 229
 		$form = $gravityview_view->getForm();
230 230
 		$field = gravityview_get_field( $form, $field_id );
231 231
 
232 232
 		// Prevent any PHP warnings that may be generated
233 233
 		ob_start();
234 234
 
235
-		if( $field && is_numeric( $field_id ) ) {
235
+		if ( $field && is_numeric( $field_id ) ) {
236 236
 			// Used as file name of field template in GV.
237 237
 			// Don't use RGFormsModel::get_input_type( $field ); we don't care if it's a radio input; we want to know it's a 'quiz' field
238 238
 			$field_type = $field->type;
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 		}
244 244
 
245 245
 		// If a Gravity Forms Field is found, get the field display
246
-		if( $field ) {
247
-			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format );
246
+		if ( $field ) {
247
+			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format );
248 248
 
249 249
 			if ( $errors = ob_get_clean() ) {
250 250
 				do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 			$display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form );
254 254
 
255 255
 			// prevent the use of merge_tags for non-admin fields
256
-			if( !empty( $field->adminOnly ) ) {
256
+			if ( ! empty( $field->adminOnly ) ) {
257 257
 				$display_value = self::replace_variables( $display_value, $form, $entry );
258 258
 			}
259 259
 		} else {
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 		// Check whether the field exists in /includes/fields/{$field_type}.php
265 265
 		// This can be overridden by user template files.
266
-		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
266
+		$field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" );
267 267
 
268 268
 		// Set the field data to be available in the templates
269 269
 		$gravityview_view->setCurrentField( array(
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 			'entry' => $entry,
278 278
 			'field_type' => $field_type, /** {@since 1.6} */
279 279
 		    'field_path' => $field_path, /** {@since 1.16} */
280
-		));
280
+		) );
281 281
 
282
-		if( ! empty( $field_path ) ) {
282
+		if ( ! empty( $field_path ) ) {
283 283
 
284
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
284
+			do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) );
285 285
 
286 286
 			ob_start();
287 287
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		}
298 298
 
299 299
 		// Get the field settings again so that the field template can override the settings
300
-		$field_settings = $gravityview_view->getCurrentField('field_settings');
300
+		$field_settings = $gravityview_view->getCurrentField( 'field_settings' );
301 301
 
302 302
 		/**
303 303
 		 * @filter `gravityview_field_entry_value_{$field_type}_pre_link` Modify the field value output for a field type before Show As Link setting is applied. Example: `gravityview_field_entry_value_number_pre_link`
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
316 316
 		 *
317 317
 		 */
318
-		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) {
318
+		if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) {
319 319
 
320
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
320
+			$link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' );
321 321
 
322 322
 			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
323 323
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		 * @param  array $field_settings Settings for the particular GV field
332 332
 		 * @param array $field Current field being displayed
333 333
 		 */
334
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
334
+		$output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
335 335
 
336 336
 		/**
337 337
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
362 362
 
363
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
363
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
364 364
 			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
365 365
 			return NULL;
366 366
 		}
367 367
 
368 368
 		$href = self::entry_link( $entry );
369 369
 
370
-		if( '' === $href ) {
370
+		if ( '' === $href ) {
371 371
 			return NULL;
372 372
 		}
373 373
 
@@ -390,19 +390,19 @@  discard block
 block discarded – undo
390 390
 	 * @param  boolean     $wpautop Apply wpautop() to the output?
391 391
 	 * @return string               HTML of "no results" text
392 392
 	 */
393
-	public static function no_results($wpautop = true) {
393
+	public static function no_results( $wpautop = true ) {
394 394
 		$gravityview_view = GravityView_View::getInstance();
395 395
 
396 396
 		$is_search = false;
397 397
 
398
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
398
+		if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
399 399
 			$is_search = true;
400 400
 		}
401 401
 
402
-		if($is_search) {
403
-			$output = __('This search returned no results.', 'gravityview');
402
+		if ( $is_search ) {
403
+			$output = __( 'This search returned no results.', 'gravityview' );
404 404
 		} else {
405
-			$output = __('No entries match your request.', 'gravityview');
405
+			$output = __( 'No entries match your request.', 'gravityview' );
406 406
 		}
407 407
 
408 408
 		/**
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 		 * @param string $output The existing "No Entries" text
411 411
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
412 412
 		 */
413
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
413
+		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search );
414 414
 
415
-		return $wpautop ? wpautop($output) : $output;
415
+		return $wpautop ? wpautop( $output ) : $output;
416 416
 	}
417 417
 
418 418
 	/**
@@ -429,37 +429,37 @@  discard block
 block discarded – undo
429 429
 
430 430
 		$gravityview_view = GravityView_View::getInstance();
431 431
 
432
-		if( empty( $post_id ) ) {
432
+		if ( empty( $post_id ) ) {
433 433
 
434 434
 			$post_id = false;
435 435
 
436 436
 			// DataTables passes the Post ID
437
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
437
+			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
438 438
 
439
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
439
+				$post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false;
440 440
 
441 441
 			} else {
442 442
 
443 443
 				// The Post ID has been passed via the shortcode
444
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
444
+				if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
445 445
 
446 446
 					$post_id = $gravityview_view->getPostId();
447 447
 
448 448
 				} else {
449 449
 
450 450
 					// This is a GravityView post type
451
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
451
+					if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
452 452
 
453 453
 						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
454 454
 
455 455
 					} else {
456 456
 
457 457
 						// This is an embedded GravityView; use the embedded post's ID as the base.
458
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
458
+						if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
459 459
 
460 460
 							$post_id = $post->ID;
461 461
 
462
-						} elseif( $gravityview_view->getViewId() ) {
462
+						} elseif ( $gravityview_view->getViewId() ) {
463 463
 
464 464
 							// The GravityView has been embedded in a widget or in a template, and
465 465
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -474,36 +474,36 @@  discard block
 block discarded – undo
474 474
 		}
475 475
 
476 476
 		// No post ID, get outta here.
477
-		if( empty( $post_id ) ) {
477
+		if ( empty( $post_id ) ) {
478 478
 			return NULL;
479 479
 		}
480 480
 
481 481
 		// If we've saved the permalink in memory, use it
482 482
 		// @since 1.3
483
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
483
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
484 484
 
485
-		if( empty( $link ) ) {
485
+		if ( empty( $link ) ) {
486 486
 
487 487
 			$link = get_permalink( $post_id );
488 488
 
489 489
 			// If not yet saved, cache the permalink.
490 490
 			// @since 1.3
491
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
491
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
492 492
 
493 493
 		}
494 494
 
495 495
 		// Deal with returning to proper pagination for embedded views
496
-		if( $link && $add_query_args ) {
496
+		if ( $link && $add_query_args ) {
497 497
 
498 498
 			$args = array();
499 499
 
500
-			if( $pagenum = rgget('pagenum') ) {
501
-				$args['pagenum'] = intval( $pagenum );
500
+			if ( $pagenum = rgget( 'pagenum' ) ) {
501
+				$args[ 'pagenum' ] = intval( $pagenum );
502 502
 			}
503 503
 
504
-			if( $sort = rgget('sort') ) {
505
-				$args['sort'] = $sort;
506
-				$args['dir'] = rgget('dir');
504
+			if ( $sort = rgget( 'sort' ) ) {
505
+				$args[ 'sort' ] = $sort;
506
+				$args[ 'dir' ] = rgget( 'dir' );
507 507
 			}
508 508
 
509 509
 			$link = add_query_arg( $args, $link );
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
527 527
 
528 528
 		// Generate an unique hash to use as the default value
529
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
529
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
530 530
 
531 531
 		/**
532 532
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
538 538
 
539 539
 		// Make sure we have something - use the original ID as backup.
540
-		if( empty( $slug ) ) {
540
+		if ( empty( $slug ) ) {
541 541
 			$slug = $id;
542 542
 		}
543 543
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
567 567
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
568 568
 		 */
569
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
569
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
570 570
 
571 571
 		// If we're using custom slug...
572 572
 		if ( $custom ) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			// If it does have a hash set, and the hash is expected, use it.
581 581
 			// This check allows users to change the hash structure using the
582 582
 			// gravityview_entry_hash filter and have the old hashes expire.
583
-			if( empty( $value ) || $value !== $hash ) {
583
+			if ( empty( $value ) || $value !== $hash ) {
584 584
 
585 585
 				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash );
586 586
 
@@ -608,12 +608,12 @@  discard block
 block discarded – undo
608 608
          * @param boolean $custom Should we process the custom entry slug?
609 609
          */
610 610
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
611
-        if( $custom ) {
611
+        if ( $custom ) {
612 612
             // create the gravityview_unique_id and save it
613 613
 
614 614
             // Get the entry hash
615
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
616
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash );
615
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
616
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash );
617 617
 
618 618
         }
619 619
     }
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
 	 */
631 631
 	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
632 632
 
633
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
633
+		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
634 634
 			$entry = GVCommon::get_entry( $entry );
635
-		} else if( empty( $entry ) ) {
635
+		} else if ( empty( $entry ) ) {
636 636
 			$entry = GravityView_frontend::getInstance()->getEntry();
637 637
 		}
638 638
 
639 639
 		// Second parameter used to be passed as $field; this makes sure it's not an array
640
-		if( !is_numeric( $post_id ) ) {
640
+		if ( ! is_numeric( $post_id ) ) {
641 641
 			$post_id = NULL;
642 642
 		}
643 643
 
@@ -645,19 +645,19 @@  discard block
 block discarded – undo
645 645
 		$directory_link = self::directory_link( $post_id, false );
646 646
 
647 647
 		// No post ID? Get outta here.
648
-		if( empty( $directory_link ) ) {
648
+		if ( empty( $directory_link ) ) {
649 649
 			return '';
650 650
 		}
651 651
 
652 652
 		$query_arg_name = GravityView_Post_Types::get_entry_var_name();
653 653
 
654
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
654
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
655 655
 
656
-		if( get_option('permalink_structure') && !is_preview() ) {
656
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
657 657
 
658 658
 			$args = array();
659 659
 
660
-			$directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/'. $entry_slug .'/';
660
+			$directory_link = trailingslashit( $directory_link ) . $query_arg_name . '/' . $entry_slug . '/';
661 661
 
662 662
 		} else {
663 663
 
@@ -667,18 +667,18 @@  discard block
 block discarded – undo
667 667
 		/**
668 668
 		 * @since 1.7.3
669 669
 		 */
670
-		if( $add_directory_args ) {
670
+		if ( $add_directory_args ) {
671 671
 
672
-			if( !empty( $_GET['pagenum'] ) ) {
673
-				$args['pagenum'] = intval( $_GET['pagenum'] );
672
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
673
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
674 674
 			}
675 675
 
676 676
 			/**
677 677
 			 * @since 1.7
678 678
 			 */
679
-			if( $sort = rgget('sort') ) {
680
-				$args['sort'] = $sort;
681
-				$args['dir'] = rgget('dir');
679
+			if ( $sort = rgget( 'sort' ) ) {
680
+				$args[ 'sort' ] = $sort;
681
+				$args[ 'dir' ] = rgget( 'dir' );
682 682
 			}
683 683
 
684 684
 		}
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
 		 * has the view id so that Advanced Filters can be applied correctly when rendering the single view
689 689
 		 * @see GravityView_frontend::get_context_view_id()
690 690
 		 */
691
-		if( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
692
-			$args['gvid'] = gravityview_get_view_id();
691
+		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
692
+			$args[ 'gvid' ] = gravityview_get_view_id();
693 693
 		}
694 694
 
695 695
 		return add_query_arg( $args, $directory_link );
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 }
708 708
 
709 709
 function gv_class( $field, $form = NULL, $entry = array() ) {
710
-	return GravityView_API::field_class( $field, $form, $entry  );
710
+	return GravityView_API::field_class( $field, $form, $entry );
711 711
 }
712 712
 
713 713
 /**
@@ -729,15 +729,15 @@  discard block
 block discarded – undo
729 729
 
730 730
 	$default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container';
731 731
 
732
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
732
+	if ( GravityView_View::getInstance()->isHideUntilSearched() ) {
733 733
 		$default_css_class .= ' hidden';
734 734
 	}
735 735
 
736
-	if( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
736
+	if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
737 737
 		$default_css_class .= ' gv-container-no-results';
738 738
 	}
739 739
 
740
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
740
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
741 741
 
742 742
 	/**
743 743
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 
749 749
 	$css_class = gravityview_sanitize_html_class( $css_class );
750 750
 
751
-	if( $echo ) {
751
+	if ( $echo ) {
752 752
 		echo $css_class;
753 753
 	}
754 754
 
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 
760 760
 	$value = GravityView_API::field_value( $entry, $field );
761 761
 
762
-	if( $value === '' ) {
762
+	if ( $value === '' ) {
763 763
 		/**
764 764
 		 * @filter `gravityview_empty_value` What to display when a field is empty
765 765
 		 * @param string $value (empty string)
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	return GravityView_API::entry_link( $entry, $post_id );
779 779
 }
780 780
 
781
-function gv_no_results($wpautop = true) {
781
+function gv_no_results( $wpautop = true ) {
782 782
 	return GravityView_API::no_results( $wpautop );
783 783
 }
784 784
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
 	$href = gv_directory_link();
793 793
 
794
-	if( empty( $href ) ) { return NULL; }
794
+	if ( empty( $href ) ) { return NULL; }
795 795
 
796 796
 	// calculate link label
797 797
 	$gravityview_view = GravityView_View::getInstance();
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 
808 808
 	$link = gravityview_get_link( $href, esc_html( $label ), array(
809 809
 		'data-viewid' => $gravityview_view->getViewId()
810
-	));
810
+	) );
811 811
 
812 812
 	return $link;
813 813
 }
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
  */
827 827
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
828 828
 
829
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
829
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
830 830
 
831 831
 		// For the complete field value as generated by Gravity Forms
832 832
 		return $display_value;
@@ -856,16 +856,16 @@  discard block
 block discarded – undo
856 856
 
857 857
 	$terms = explode( ', ', $value );
858 858
 
859
-	foreach ($terms as $term_name ) {
859
+	foreach ( $terms as $term_name ) {
860 860
 
861 861
 		// If we're processing a category,
862
-		if( $taxonomy === 'category' ) {
862
+		if ( $taxonomy === 'category' ) {
863 863
 
864 864
 			// Use rgexplode to prevent errors if : doesn't exist
865 865
 			list( $term_name, $term_id ) = rgexplode( ':', $value, 2 );
866 866
 
867 867
 			// The explode was succesful; we have the category ID
868
-			if( !empty( $term_id )) {
868
+			if ( ! empty( $term_id ) ) {
869 869
 				$term = get_term_by( 'id', $term_id, $taxonomy );
870 870
 			} else {
871 871
 			// We have to fall back to the name
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		}
879 879
 
880 880
 		// There's still a tag/category here.
881
-		if( $term ) {
881
+		if ( $term ) {
882 882
 
883 883
 			$term_link = get_term_link( $term, $taxonomy );
884 884
 
@@ -887,11 +887,11 @@  discard block
 block discarded – undo
887 887
 			    continue;
888 888
 			}
889 889
 
890
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
890
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
891 891
 		}
892 892
 	}
893 893
 
894
-	return implode(', ', $output );
894
+	return implode( ', ', $output );
895 895
 }
896 896
 
897 897
 /**
@@ -905,8 +905,8 @@  discard block
 block discarded – undo
905 905
 
906 906
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
907 907
 
908
-	if( empty( $link ) ) {
909
-		return strip_tags( $output);
908
+	if ( empty( $link ) ) {
909
+		return strip_tags( $output );
910 910
 	}
911 911
 
912 912
 	return $output;
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	$fe = GravityView_frontend::getInstance();
926 926
 
927 927
 	// Solve problem when loading content via admin-ajax.php
928
-	if( ! $fe->getGvOutputData() ) {
928
+	if ( ! $fe->getGvOutputData() ) {
929 929
 
930 930
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
931 931
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	}
934 934
 
935 935
 	// Make 100% sure that we're dealing with a properly called situation
936
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
936
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
937 937
 
938 938
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
939 939
 
@@ -953,10 +953,10 @@  discard block
 block discarded – undo
953 953
 
954 954
 	$fe = GravityView_frontend::getInstance();
955 955
 
956
-	if( ! $fe->getGvOutputData() ) { return array(); }
956
+	if ( ! $fe->getGvOutputData() ) { return array(); }
957 957
 
958 958
 	// If not set, grab the current view ID
959
-	if( empty( $view_id ) ) {
959
+	if ( empty( $view_id ) ) {
960 960
 		$view_id = $fe->get_context_view_id();
961 961
 	}
962 962
 
@@ -1021,11 +1021,11 @@  discard block
 block discarded – undo
1021 1021
 	 */
1022 1022
 	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1023 1023
 
1024
-	if( $is_edit_entry ) {
1024
+	if ( $is_edit_entry ) {
1025 1025
 		$context = 'edit';
1026
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1026
+	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1027 1027
 		$context = 'single';
1028
-	} else if( class_exists( 'GravityView_View' ) ) {
1028
+	} else if ( class_exists( 'GravityView_View' ) ) {
1029 1029
 		$context = GravityView_View::getInstance()->getContext();
1030 1030
 	}
1031 1031
 
@@ -1053,12 +1053,12 @@  discard block
 block discarded – undo
1053 1053
 function gravityview_get_files_array( $value, $gv_class = '' ) {
1054 1054
 	/** @define "GRAVITYVIEW_DIR" "../" */
1055 1055
 
1056
-	if( !class_exists( 'GravityView_Field' ) ) {
1057
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1056
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1057
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1058 1058
 	}
1059 1059
 
1060
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1061
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1060
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1061
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' );
1062 1062
 	}
1063 1063
 
1064 1064
 	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
@@ -1136,12 +1136,12 @@  discard block
 block discarded – undo
1136 1136
 	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1137 1137
 
1138 1138
 	// Required fields.
1139
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1139
+	if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1140 1140
 		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1141 1141
 		return '';
1142 1142
 	}
1143 1143
 
1144
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1144
+	$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1145 1145
 
1146 1146
 	/**
1147 1147
 	 * Create the content variables for replacing.
@@ -1157,37 +1157,37 @@  discard block
 block discarded – undo
1157 1157
 		'field_id' => '',
1158 1158
 	);
1159 1159
 
1160
-	$context['value'] = gv_value( $entry, $args['field'] );
1160
+	$context[ 'value' ] = gv_value( $entry, $args[ 'field' ] );
1161 1161
 
1162 1162
 	// If the value is empty and we're hiding empty, return empty.
1163
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1163
+	if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1164 1164
 		return '';
1165 1165
 	}
1166 1166
 
1167
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1168
-		$context['value'] = wpautop( $context['value'] );
1167
+	if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1168
+		$context[ 'value' ] = wpautop( $context[ 'value' ] );
1169 1169
 	}
1170 1170
 
1171 1171
 	// Get width setting, if exists
1172
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1172
+	$context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] );
1173 1173
 
1174 1174
 	// If replacing with CSS inline formatting, let's do it.
1175
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1175
+	$context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' );
1176 1176
 
1177 1177
 	// Grab the Class using `gv_class`
1178
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1179
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1178
+	$context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry );
1179
+	$context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry );
1180 1180
 
1181 1181
 	// Get field label if needed
1182
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1183
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1182
+	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) {
1183
+		$context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] );
1184 1184
 	}
1185 1185
 
1186 1186
 	// Default Label value
1187
-	$context['label_value'] = gv_label( $args['field'], $entry );
1187
+	$context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry );
1188 1188
 
1189
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1190
-		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1189
+	if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) {
1190
+		$context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1191 1191
 	}
1192 1192
 
1193 1193
 	/**
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 	 * @param string $markup The HTML for the markup
1197 1197
 	 * @param array $args All args for the field output
1198 1198
 	 */
1199
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1199
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args );
1200 1200
 
1201 1201
 	/**
1202 1202
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 	foreach ( $context as $tag => $value ) {
1220 1220
 
1221 1221
 		// If the tag doesn't exist just skip it
1222
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1222
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1223 1223
 			continue;
1224 1224
 		}
1225 1225
 
Please login to merge, or discard this patch.