Completed
Push — develop ( 2f78cb...e17da6 )
by Zack
11:21
created
includes/widgets/search-widget/templates/search-field-search_all.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
 
8 8
 $gravityview_view = GravityView_View::getInstance();
9 9
 $view_id = $gravityview_view->getViewId();
10
-$value = $gravityview_view->search_field['value'];
11
-$label = $gravityview_view->search_field['label'];
10
+$value = $gravityview_view->search_field[ 'value' ];
11
+$label = $gravityview_view->search_field[ 'label' ];
12 12
 
13 13
 ?>
14 14
 
15 15
 <div class="gv-search-box gv-search-field-text gv-search-field-search_all">
16 16
 	<div class="gv-search">
17
-	<?php if( ! gv_empty( $label, false, false ) ) { ?>
17
+	<?php if ( ! gv_empty( $label, false, false ) ) { ?>
18 18
 		<label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label>
19 19
 	<?php } ?>
20 20
 		<p><input type="text" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo $value; ?>" /></p>
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-single_checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 ?>
13 13
 
14 14
 <div class="gv-search-box gv-search-field-single_checkbox">
15
-	<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio">
16
-		<input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>>
17
-			<?php if( ! gv_empty( $search_field['label'], false, false ) ) { echo esc_html(  $search_field['label'] ); } ?>
15
+	<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio">
16
+		<input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>>
17
+			<?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?>
18 18
 	</label>
19 19
 </div>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +107 added lines, -107 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(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
87 87
 		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
88
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
88
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
89 89
 		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
90 90
 
91 91
 		// ajax - get the searchable fields
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
222 222
 		$script_source = empty( $script_min ) ? '/source' : '';
223 223
 
224
-		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 );
224
+		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 );
225 225
 
226 226
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
227 227
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
244 244
 	 */
245 245
 	public function register_no_conflict( $allowed ) {
246
-		$allowed[] = 'gravityview_searchwidget_admin';
246
+		$allowed[ ] = 'gravityview_searchwidget_admin';
247 247
 		return $allowed;
248 248
 	}
249 249
 
@@ -256,24 +256,24 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public static function get_searchable_fields() {
258 258
 
259
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
259
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
260 260
 			exit( '0' );
261 261
 		}
262 262
 
263 263
 		$form = '';
264 264
 
265 265
 		// Fetch the form for the current View
266
-		if ( ! empty( $_POST['view_id'] ) ) {
266
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
267 267
 
268
-			$form = gravityview_get_form_id( $_POST['view_id'] );
268
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
269 269
 
270
-		} elseif ( ! empty( $_POST['formid'] ) ) {
270
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
271 271
 
272
-			$form = (int) $_POST['formid'];
272
+			$form = (int)$_POST[ 'formid' ];
273 273
 
274
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
274
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
275 275
 
276
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
276
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
277 277
 
278 278
 		}
279 279
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 			)
319 319
 		);
320 320
 
321
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
322
-			$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'] );
321
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
322
+			$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' ] );
323 323
 		}
324 324
 
325 325
 		// Get fields with sub-inputs and no parent
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 
342 342
 			foreach ( $fields as $id => $field ) {
343 343
 
344
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
344
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
345 345
 					continue;
346 346
 				}
347 347
 
348
-				$types = self::get_search_input_types( $id, $field['type'] );
348
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
349 349
 
350
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
350
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
351 351
 			}
352 352
 		}
353 353
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
371 371
 
372 372
 		// @todo - This needs to be improved - many fields have . including products and addresses
373
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
373
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
374 374
 			$input_type = 'boolean'; // on/off checkbox
375 375
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
376 376
 			$input_type = 'multi'; //multiselect
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 			$post_id = 0;
415 415
 
416 416
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
417
-			if ( ! empty( $widget_args['post_id'] ) ) {
418
-				$post_id = absint( $widget_args['post_id'] );
417
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
418
+				$post_id = absint( $widget_args[ 'post_id' ] );
419 419
 			}
420 420
 			// We're in the WordPress Widget context, and the base View ID should be used
421
-			else if ( ! empty( $widget_args['view_id'] ) ) {
422
-				$post_id = absint( $widget_args['view_id'] );
421
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
422
+				$post_id = absint( $widget_args[ 'view_id' ] );
423 423
 			}
424 424
 
425 425
 			$args = gravityview_get_permalink_query_args( $post_id );
426 426
 
427 427
 			// Add hidden fields to the search form
428 428
 			foreach ( $args as $key => $value ) {
429
-				$search_fields[] = array(
429
+				$search_fields[ ] = array(
430 430
 					'name'  => $key,
431 431
 					'input' => 'hidden',
432 432
 					'value' => $value,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function filter_entries( $search_criteria ) {
449 449
 
450
-		if( 'post' === $this->search_method ) {
450
+		if ( 'post' === $this->search_method ) {
451 451
 			$get = $_POST;
452 452
 		} else {
453 453
 			$get = $_GET;
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
 		$get = gv_map_deep( $get, 'rawurldecode' );
465 465
 
466 466
 		// Make sure array key is set up
467
-		$search_criteria['field_filters'] = rgar( $search_criteria, 'field_filters', array() );
467
+		$search_criteria[ 'field_filters' ] = rgar( $search_criteria, 'field_filters', array() );
468 468
 
469 469
 		// add free search
470
-		if ( ! empty( $get['gv_search'] ) ) {
470
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
471 471
 
472
-			$search_all_value = trim( $get['gv_search'] );
472
+			$search_all_value = trim( $get[ 'gv_search' ] );
473 473
 
474 474
 			/**
475 475
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			 */
479 479
 			$split_words = apply_filters( 'gravityview/search-all-split-words', true );
480 480
 
481
-			if( $split_words ) {
481
+			if ( $split_words ) {
482 482
 
483 483
 				// Search for a piece
484 484
 				$words = explode( ' ', $search_all_value );
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 			}
495 495
 
496 496
 			foreach ( $words as $word ) {
497
-				$search_criteria['field_filters'][] = array(
497
+				$search_criteria[ 'field_filters' ][ ] = array(
498 498
 					'key' => null, // The field ID to search
499 499
 					'value' => $word, // The value to search
500 500
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 
505 505
 		//start date & end date
506
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
507
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
506
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
507
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
508 508
 
509 509
 		/**
510 510
 		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -519,16 +519,16 @@  discard block
 block discarded – undo
519 519
 		/**
520 520
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
521 521
 		 */
522
-		if( !empty( $curr_start ) ) {
523
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
522
+		if ( ! empty( $curr_start ) ) {
523
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
524 524
 		}
525
-		if( !empty( $curr_end ) ) {
526
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
525
+		if ( ! empty( $curr_end ) ) {
526
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
527 527
 		}
528 528
 
529 529
 		// search for a specific entry ID
530 530
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
531
-			$search_criteria['field_filters'][] = array(
531
+			$search_criteria[ 'field_filters' ][ ] = array(
532 532
 				'key' => 'id',
533 533
 				'value' => absint( $get[ 'gv_id' ] ),
534 534
 				'operator' => '=',
@@ -537,36 +537,36 @@  discard block
 block discarded – undo
537 537
 
538 538
 		// search for a specific Created_by ID
539 539
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
540
-			$search_criteria['field_filters'][] = array(
540
+			$search_criteria[ 'field_filters' ][ ] = array(
541 541
 				'key' => 'created_by',
542
-				'value' => absint( $get['gv_by'] ),
542
+				'value' => absint( $get[ 'gv_by' ] ),
543 543
 				'operator' => '=',
544 544
 			);
545 545
 		}
546 546
 
547 547
 
548 548
 		// Get search mode passed in URL
549
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
549
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
550 550
 
551 551
 		// get the other search filters
552 552
 		foreach ( $get as $key => $value ) {
553 553
 
554
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
554
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
555 555
 				continue;
556 556
 			}
557 557
 
558 558
 			// could return simple filter or multiple filters
559 559
 			$filter = $this->prepare_field_filter( $key, $value );
560 560
 
561
-			if ( isset( $filter[0]['value'] ) ) {
562
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
561
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
562
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
563 563
 
564 564
 				// if date range type, set search mode to ALL
565
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
565
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
566 566
 					$mode = 'all';
567 567
 				}
568
-			} elseif( !empty( $filter ) ) {
569
-				$search_criteria['field_filters'][] = $filter;
568
+			} elseif ( ! empty( $filter ) ) {
569
+				$search_criteria[ 'field_filters' ][ ] = $filter;
570 570
 			}
571 571
 		}
572 572
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		 * @since 1.5.1
576 576
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
577 577
 		 */
578
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
578
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
579 579
 
580 580
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
581 581
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		$field_id = str_replace( 'filter_', '', $key );
602 602
 
603 603
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
604
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
604
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
605 605
 			$field_id = str_replace( '_', '.', $field_id );
606 606
 		}
607 607
 
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 			'value' => $value,
616 616
 		);
617 617
 
618
-		switch ( $form_field['type'] ) {
618
+		switch ( $form_field[ 'type' ] ) {
619 619
 
620 620
 			case 'select':
621 621
 			case 'radio':
622
-				$filter['operator'] = 'is';
622
+				$filter[ 'operator' ] = 'is';
623 623
 				break;
624 624
 
625 625
 			case 'post_category':
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 				foreach ( $value as $val ) {
635 635
 					$cat = get_term( $val, 'category' );
636
-					$filter[] = array(
636
+					$filter[ ] = array(
637 637
 						'key' => $field_id,
638 638
 						'value' => esc_attr( $cat->name ) . ':' . $val,
639 639
 						'operator' => 'is',
@@ -652,18 +652,18 @@  discard block
 block discarded – undo
652 652
 				$filter = array();
653 653
 
654 654
 				foreach ( $value as $val ) {
655
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
655
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
656 656
 				}
657 657
 
658 658
 				break;
659 659
 
660 660
 			case 'checkbox':
661 661
 				// convert checkbox on/off into the correct search filter
662
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
663
-					foreach ( $form_field['inputs'] as $k => $input ) {
664
-						if ( $input['id'] == $field_id ) {
665
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
666
-							$filter['operator'] = 'is';
662
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
663
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
664
+						if ( $input[ 'id' ] == $field_id ) {
665
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
666
+							$filter[ 'operator' ] = 'is';
667 667
 							break;
668 668
 						}
669 669
 					}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 					$filter = array();
674 674
 
675 675
 					foreach ( $value as $val ) {
676
-						$filter[] = array(
676
+						$filter[ ] = array(
677 677
 							'key'   => $field_id,
678 678
 							'value' => $val,
679 679
 							'operator' => 'is',
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 					foreach ( $words as $word ) {
695 695
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
696 696
 							// Keep the same key for each filter
697
-							$filter['value'] = $word;
697
+							$filter[ 'value' ] = $word;
698 698
 							// Add a search for the value
699
-							$filters[] = $filter;
699
+							$filters[ ] = $filter;
700 700
 						}
701 701
 					}
702 702
 
@@ -723,19 +723,19 @@  discard block
 block discarded – undo
723 723
 						 * @since 1.16.3
724 724
 						 * Safeguard until GF implements '<=' operator
725 725
 						 */
726
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
726
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
727 727
 							$operator = '<';
728 728
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
729 729
 						}
730 730
 
731
-						$filter[] = array(
731
+						$filter[ ] = array(
732 732
 							'key' => $field_id,
733 733
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
734 734
 							'operator' => $operator,
735 735
 						);
736 736
 					}
737 737
 				} else {
738
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
738
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
739 739
 				}
740 740
 
741 741
 				break;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 			'ymd_dot' => 'Y.m.d',
767 767
 		);
768 768
 
769
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
769
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
770 770
 			$format = $datepicker[ $field->dateFormat ];
771 771
 		}
772 772
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	public function add_template_path( $file_paths ) {
798 798
 
799 799
 		// Index 100 is the default GravityView template path.
800
-		$file_paths[102] = self::$file . 'templates/';
800
+		$file_paths[ 102 ] = self::$file . 'templates/';
801 801
 
802 802
 		return $file_paths;
803 803
 	}
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 		$has_date = false;
817 817
 
818 818
 		foreach ( $search_fields as $k => $field ) {
819
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
819
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
820 820
 				$has_date = true;
821 821
 				break;
822 822
 			}
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		}
844 844
 
845 845
 		// get configured search fields
846
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
846
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
847 847
 
848 848
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
849 849
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -858,34 +858,34 @@  discard block
 block discarded – undo
858 858
 
859 859
 			$updated_field = $this->get_search_filter_details( $updated_field );
860 860
 
861
-			switch ( $field['field'] ) {
861
+			switch ( $field[ 'field' ] ) {
862 862
 
863 863
 				case 'search_all':
864
-					$updated_field['key'] = 'search_all';
865
-					$updated_field['input'] = 'search_all';
866
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
864
+					$updated_field[ 'key' ] = 'search_all';
865
+					$updated_field[ 'input' ] = 'search_all';
866
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
867 867
 					break;
868 868
 
869 869
 				case 'entry_date':
870
-					$updated_field['key'] = 'entry_date';
871
-					$updated_field['input'] = 'entry_date';
872
-					$updated_field['value'] = array(
870
+					$updated_field[ 'key' ] = 'entry_date';
871
+					$updated_field[ 'input' ] = 'entry_date';
872
+					$updated_field[ 'value' ] = array(
873 873
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
874 874
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
875 875
 					);
876 876
 					break;
877 877
 
878 878
 				case 'entry_id':
879
-					$updated_field['key'] = 'entry_id';
880
-					$updated_field['input'] = 'entry_id';
881
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
879
+					$updated_field[ 'key' ] = 'entry_id';
880
+					$updated_field[ 'input' ] = 'entry_id';
881
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
882 882
 					break;
883 883
 
884 884
 				case 'created_by':
885
-					$updated_field['key'] = 'created_by';
886
-					$updated_field['name'] = 'gv_by';
887
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
888
-					$updated_field['choices'] = self::get_created_by_choices();
885
+					$updated_field[ 'key' ] = 'created_by';
886
+					$updated_field[ 'name' ] = 'gv_by';
887
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
888
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
889 889
 					break;
890 890
 			}
891 891
 
@@ -903,16 +903,16 @@  discard block
 block discarded – undo
903 903
 		 */
904 904
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
905 905
 
906
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
906
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
907 907
 
908 908
 		/** @since 1.14 */
909
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
909
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
910 910
 
911
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
911
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
912 912
 
913 913
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
914 914
 
915
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
915
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
916 916
 
917 917
 		if ( $this->has_date_field( $search_fields ) ) {
918 918
 			// enqueue datepicker stuff only if needed!
@@ -934,10 +934,10 @@  discard block
 block discarded – undo
934 934
 	public static function get_search_class( $custom_class = '' ) {
935 935
 		$gravityview_view = GravityView_View::getInstance();
936 936
 
937
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
937
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
938 938
 
939
-		if ( ! empty( $custom_class )  ) {
940
-			$search_class .= ' '.$custom_class;
939
+		if ( ! empty( $custom_class ) ) {
940
+			$search_class .= ' ' . $custom_class;
941 941
 		}
942 942
 
943 943
 		/**
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 
980 980
 		$label = rgget( 'label', $field );
981 981
 
982
-		if( '' === $label ) {
982
+		if ( '' === $label ) {
983 983
 
984
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
984
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
985 985
 
986
-			switch( $field['field'] ) {
986
+			switch ( $field[ 'field' ] ) {
987 987
 				case 'search_all':
988 988
 					$label = __( 'Search Entries:', 'gravityview' );
989 989
 					break;
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
 					break;
996 996
 				default:
997 997
 					// If this is a field input, not a field
998
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
998
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
999 999
 
1000 1000
 						// Get the label for the field in question, which returns an array
1001
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1001
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1002 1002
 
1003 1003
 						// Get the item with the `label` key
1004 1004
 						$values = wp_list_pluck( $items, 'label' );
@@ -1037,32 +1037,32 @@  discard block
 block discarded – undo
1037 1037
 		$form = $gravityview_view->getForm();
1038 1038
 
1039 1039
 		// for advanced field ids (eg, first name / last name )
1040
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1040
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1041 1041
 
1042 1042
 		// get searched value from $_GET/$_POST (string or array)
1043 1043
 		$value = $this->rgget_or_rgpost( $name );
1044 1044
 
1045 1045
 		// get form field details
1046
-		$form_field = gravityview_get_field( $form, $field['field'] );
1046
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1047 1047
 
1048 1048
 		$filter = array(
1049
-			'key' => $field['field'],
1049
+			'key' => $field[ 'field' ],
1050 1050
 			'name' => $name,
1051 1051
 			'label' => self::get_field_label( $field, $form_field ),
1052
-			'input' => $field['input'],
1052
+			'input' => $field[ 'input' ],
1053 1053
 			'value' => $value,
1054
-			'type' => $form_field['type'],
1054
+			'type' => $form_field[ 'type' ],
1055 1055
 		);
1056 1056
 
1057 1057
 		// collect choices
1058
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1059
-			$filter['choices'] = gravityview_get_terms_choices();
1060
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1061
-			$filter['choices'] = $form_field['choices'];
1058
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1059
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1060
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1061
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1062 1062
 		}
1063 1063
 
1064
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1065
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1064
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1065
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1066 1066
 		}
1067 1067
 
1068 1068
 		return $filter;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 		$choices = array();
1088 1088
 		foreach ( $users as $user ) {
1089
-			$choices[] = array(
1089
+			$choices[ ] = array(
1090 1090
 				'value' => $user->ID,
1091 1091
 				'text' => $user->display_name,
1092 1092
 			);
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	 */
1142 1142
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1143 1143
 
1144
-		$js_dependencies[] = 'jquery-ui-datepicker';
1144
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1145 1145
 
1146 1146
 		return $js_dependencies;
1147 1147
 	}
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 			'isRTL'             => is_rtl(),
1186 1186
 		), $view_data );
1187 1187
 
1188
-		$localizations['datepicker'] = $datepicker_settings;
1188
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1189 1189
 
1190 1190
 		return $localizations;
1191 1191
 
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	 * @return void
1215 1215
 	 */
1216 1216
 	private function maybe_enqueue_flexibility() {
1217
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1217
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1218 1218
 			wp_enqueue_script( 'gv-flexibility' );
1219 1219
 		}
1220 1220
 	}
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1237 1237
 
1238 1238
 		$scheme = is_ssl() ? 'https://' : 'http://';
1239
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1239
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1240 1240
 
1241 1241
 		/**
1242 1242
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
includes/connector-functions.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
  * @param  mixed $field_id Field ID or Field array
329 329
  * @return string field type
330 330
  */
331
-function gravityview_get_field_type(  $form = null , $field_id = '' ) {
332
-	return GVCommon::get_field_type(  $form, $field_id );
331
+function gravityview_get_field_type( $form = null, $field_id = '' ) {
332
+	return GVCommon::get_field_type( $form, $field_id );
333 333
 }
334 334
 
335 335
 
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
  * @return string HTML of the output. Empty string if $view_id is empty.
343 343
  */
344 344
 function get_gravityview( $view_id = '', $atts = array() ) {
345
-	if( !empty( $view_id ) ) {
346
-		$atts['id'] = $view_id;
345
+	if ( ! empty( $view_id ) ) {
346
+		$atts[ 'id' ] = $view_id;
347 347
 		$args = wp_parse_args( $atts, defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? \GV\View_Settings::defaults() : GravityView_View_Data::get_default_args() );
348 348
 		$GravityView_frontend = GravityView_frontend::getInstance();
349 349
 		$GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) );
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) {
388 388
 
389
-	if( class_exists('GFFormsModel') && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) {
389
+	if ( class_exists( 'GFFormsModel' ) && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) {
390 390
 
391 391
 		/** @var GF_Field_Radio|GF_Field_Checkbox $form_field */
392
-		foreach( $form_fields as $form_field ) {
392
+		foreach ( $form_fields as $form_field ) {
393 393
 			$field_id = $form_field->id;
394
-			foreach( $view_fields as $zone ) {
394
+			foreach ( $view_fields as $zone ) {
395 395
 
396 396
 				// ACF compatibility; ACF-added fields aren't arrays
397 397
 				if ( ! is_array( $zone ) ) { continue; }
398 398
 
399
-				foreach( $zone as $field ) {
399
+				foreach ( $zone as $field ) {
400 400
 					// If it's an input, not the parent and the parent ID matches a checkbox or radio
401
-					if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) {
401
+					if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) {
402 402
 						return true;
403 403
 					}
404 404
 				}
Please login to merge, or discard this patch.
includes/class-admin-welcome.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 * @since 1.0
35 35
 	 */
36 36
 	public function __construct() {
37
-		add_action( 'admin_menu', array( $this, 'admin_menus'), 200 );
37
+		add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 );
38 38
 		add_action( 'admin_head', array( $this, 'admin_head' ) );
39
-		add_action( 'admin_init', array( $this, 'welcome'    ) );
40
-		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 );
39
+		add_action( 'admin_init', array( $this, 'welcome' ) );
40
+		add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 );
41 41
 	}
42 42
 
43 43
 	/**
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		// Add help page to GravityView menu
54 54
 		add_submenu_page(
55 55
 			'edit.php?post_type=gravityview',
56
-			__('GravityView: Getting Started', 'gravityview'),
57
-			__('Getting Started', 'gravityview'),
56
+			__( 'GravityView: Getting Started', 'gravityview' ),
57
+			__( 'Getting Started', 'gravityview' ),
58 58
 			$this->minimum_capability,
59 59
 			'gv-getting-started',
60 60
 			array( $this, 'getting_started_screen' )
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return boolean  $is_page   True: yep; false: nope
89 89
 	 */
90
-	public function is_dashboard_page($is_page = false, $hook = NULL) {
90
+	public function is_dashboard_page( $is_page = false, $hook = NULL ) {
91 91
 		global $plugin_page;
92 92
 
93
-		if($is_page) { return $is_page; }
93
+		if ( $is_page ) { return $is_page; }
94 94
 
95 95
 		return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) );
96 96
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' );
109 109
 		remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' );
110 110
 
111
-		if( !$this->is_dashboard_page() ) { return; }
111
+		if ( ! $this->is_dashboard_page() ) { return; }
112 112
 
113 113
 		?>
114 114
         <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html">
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		// Don't fetch -beta, etc.
133 133
 		list( $display_version ) = explode( '-', GravityView_Plugin::version );
134 134
 
135
-		$selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
135
+		$selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started';
136 136
 
137 137
 		echo gravityview_get_floaty( 132 );
138 138
 		?>
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 		<div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div>
142 142
 
143 143
 		<h2 class="nav-tab-wrapper clear">
144
-			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
144
+			<a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
145 145
 				<?php _e( "Getting Started", 'gravityview' ); ?>
146 146
 			</a>
147
-			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
147
+			<a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
148 148
 				<?php _e( "List of Changes", 'gravityview' ); ?>
149 149
 			</a>
150
-			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>">
150
+			<a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>">
151 151
 				<?php _e( 'Credits', 'gravityview' ); ?>
152 152
 			</a>
153 153
 		</h2>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 					<h3>Create a View</h3>
183 183
 
184 184
                     <ol class="ol-decimal">
185
-						<li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views &gt; New View</a></li>
185
+						<li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views &gt; New View</a></li>
186 186
 						<li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li>
187 187
 						<li>If you want to <strong>use an existing form&rsquo;s entries</strong>, select from the dropdown.</li>
188 188
 						<li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>.
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 					</ul>
465 465
 
466 466
 					<h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4>
467
-					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p>
467
+					<p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p>
468 468
 				</div>
469 469
 			</div>
470 470
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 		global $plugin_page;
508 508
 
509 509
 		// Bail if we're just editing the plugin
510
-		if( $plugin_page === 'plugin-editor.php' ) { return; }
510
+		if ( $plugin_page === 'plugin-editor.php' ) { return; }
511 511
 
512 512
 		// Bail if no activation redirect
513 513
 		if ( ! get_transient( '_gv_activation_redirect' ) ) { return; }
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		$upgrade = get_option( 'gv_version_upgraded_from' );
519 519
 
520 520
 		// Don't do anything if they've already seen the new version info
521
-		if( $upgrade === GravityView_Plugin::version ) {
521
+		if ( $upgrade === GravityView_Plugin::version ) {
522 522
 			return;
523 523
 		}
524 524
 
@@ -526,10 +526,10 @@  discard block
 block discarded – undo
526 526
 		update_option( 'gv_version_upgraded_from', GravityView_Plugin::version );
527 527
 
528 528
 		// Bail if activating from network, or bulk
529
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; }
529
+		if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; }
530 530
 
531 531
 		// First time install
532
-		if( ! $upgrade ) {
532
+		if ( ! $upgrade ) {
533 533
 			wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit;
534 534
 		}
535 535
 		// Update
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		/**
82 82
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
83 83
 		 */
84
-		foreach( $this->lead_db_columns as $column ) {
84
+		foreach ( $this->lead_db_columns as $column ) {
85 85
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
86 86
 		}
87 87
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 			return;
115 115
 		}
116 116
 
117
-		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
117
+		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
118 118
 
119
-		$this->blacklist_add( $entry['form_id'] );
119
+		$this->blacklist_add( $entry[ 'form_id' ] );
120 120
 	}
121 121
 
122 122
 	/**
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function entry_updated( $form, $lead_id ) {
131 131
 
132
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' );
132
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' );
133 133
 
134
-		$this->blacklist_add( $form['id'] );
134
+		$this->blacklist_add( $form[ 'id' ] );
135 135
 	}
136 136
 
137 137
 	/**
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function entry_created( $entry, $form ) {
148 148
 
149
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' );
149
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' );
150 150
 
151
-		$this->blacklist_add( $form['id'] );
151
+		$this->blacklist_add( $form[ 'id' ] );
152 152
 	}
153 153
 
154 154
 	/**
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 			return;
165 165
 		}
166 166
 
167
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was added' );
167
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_added] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was added' );
168 168
 
169
-		$this->blacklist_add( $form['id'] );
169
+		$this->blacklist_add( $form[ 'id' ] );
170 170
 	}
171 171
 
172 172
 	/**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		// Normally just one form, but supports multiple forms
186 186
 		//
187 187
 		// Array of IDs 12, 5, 14 would result in `f:12-f:5-f:14`
188
-		$forms = 'f:' . implode( '-f:', (array) $form_ids );
188
+		$forms = 'f:' . implode( '-f:', (array)$form_ids );
189 189
 
190 190
 		// Prefix for transient keys
191 191
 		// Now the prefix would be: `gv-cache-f:12-f:5-f:14-`
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		) );
243 243
 
244 244
 		// Add the passed form IDs
245
-		$blacklist = array_merge( (array) $blacklist, $form_ids );
245
+		$blacklist = array_merge( (array)$blacklist, $form_ids );
246 246
 
247 247
 		// Don't duplicate
248 248
 		$blacklist = array_unique( $blacklist );
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
 		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
267 267
 
268
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
268
+		$updated_list = array_diff( $blacklist, (array)$form_ids );
269 269
 
270 270
 		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
271 271
 			'$form_ids'     => $form_ids,
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			return false;
299 299
 		}
300 300
 
301
-		foreach ( (array) $form_ids as $form_id ) {
301
+		foreach ( (array)$form_ids as $form_id ) {
302 302
 
303 303
 			if ( in_array( $form_id, $blacklist ) ) {
304 304
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
371 371
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
372 372
 			 */
373
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
373
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
374 374
 
375 375
 			do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' );
376 376
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 			return;
407 407
 		}
408 408
 
409
-		foreach ( (array) $form_ids as $form_id ) {
409
+		foreach ( (array)$form_ids as $form_id ) {
410 410
 
411 411
 			$key = '_transient_gv-cache-';
412 412
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 
526 526
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
527 527
 
528
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
528
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
529 529
 
530 530
 				do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' );
531 531
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		 */
553 553
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
554 554
 
555
-		return (boolean) $use_cache;
555
+		return (boolean)$use_cache;
556 556
 	}
557 557
 
558 558
 }
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37
-		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' );
37
+		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 		
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
190 190
 		return '';
191 191
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 	$width = $height * 0.7586206897;
205 205
 
206
-	if( function_exists('is_rtl') && is_rtl() ) {
206
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
207 207
 		$style = 'margin:10px 10px 10px 0;';
208 208
 		$class = 'alignright';
209 209
 	} else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$class = 'alignleft';
212 212
 	}
213 213
 
214
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
214
+	return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
215 215
 }
216 216
 
217 217
 /**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 function gravityview_number_format( $number, $decimals = '' ) {
235 235
 	global $wp_locale;
236 236
 
237
-	if( '' === $decimals ) {
237
+	if ( '' === $decimals ) {
238 238
 
239
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
239
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
240 240
 
241 241
 		/**
242 242
 		 * Calculate the position of the decimal point in the number
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	$parts = parse_url( $value );
266 266
 
267 267
 	// No domain? Strange...show the original text.
268
-	if( empty( $parts['host'] ) ) {
268
+	if ( empty( $parts[ 'host' ] ) ) {
269 269
 		return $value;
270 270
 	}
271 271
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
279 279
 	 * If true: `http://example.com => example.com`
280 280
 	 */
281
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
281
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
282 282
 
283
-		if( isset( $parts['scheme'] ) ) {
284
-			$return .= $parts['scheme'];
283
+		if ( isset( $parts[ 'scheme' ] ) ) {
284
+			$return .= $parts[ 'scheme' ];
285 285
 		}
286 286
 
287 287
 	}
288 288
 
289 289
 	// The domain, which may contain a subdomain
290
-	$domain = $parts['host'];
290
+	$domain = $parts[ 'host' ];
291 291
 
292 292
 	/**
293 293
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
296 296
 	 * If true: `www.example.com => example.com`
297 297
 	 */
298
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
298
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
299 299
 
300
-	if( $strip_www ) {
301
-		$domain = str_replace('www.', '', $domain );
300
+	if ( $strip_www ) {
301
+		$domain = str_replace( 'www.', '', $domain );
302 302
 	}
303 303
 
304 304
 	/**
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	 * If true: `http://demo.example.com => example.com` \n
309 309
 	 * If false: `http://demo.example.com => demo.example.com`
310 310
 	 */
311
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
311
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
312 312
 
313
-	if( $strip_subdomains ) {
313
+	if ( $strip_subdomains ) {
314 314
 
315
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
315
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
316 316
 
317 317
 	}
318 318
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
327 327
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
328 328
 	 */
329
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
329
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
330 330
 
331
-	if( empty( $root_only ) ) {
331
+	if ( empty( $root_only ) ) {
332 332
 
333
-		if( isset( $parts['path'] ) ) {
334
-			$return .= $parts['path'];
333
+		if ( isset( $parts[ 'path' ] ) ) {
334
+			$return .= $parts[ 'path' ];
335 335
 		}
336 336
 	}
337 337
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
342 342
 	 * If true: `http://example.com/?query=example => example.com`
343 343
 	 */
344
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
344
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
345 345
 
346
-	if( empty( $strip_query_string ) ) {
346
+	if ( empty( $strip_query_string ) ) {
347 347
 
348
-		if( isset( $parts['query'] ) ) {
349
-			$return .= '?'.$parts['query'];
348
+		if ( isset( $parts[ 'query' ] ) ) {
349
+			$return .= '?' . $parts[ 'query' ];
350 350
 		}
351 351
 
352 352
 	}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
  */
364 364
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
365 365
 
366
-	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 ) ) {
367
-		return $matches['domain'];
366
+	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 ) ) {
367
+		return $matches[ 'domain' ];
368 368
 	} else {
369 369
 		return $string_maybe_has_subdomain;
370 370
 	}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
420 420
 			$value = true;
421
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
421
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
422 422
 			$value = false;
423 423
 		}
424 424
 	}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 
448 448
 	// Use the original function, if exists.
449 449
 	// Requires WP 4.4+
450
-	if( function_exists( 'map_deep') ) {
450
+	if ( function_exists( 'map_deep' ) ) {
451 451
 		return map_deep( $value, $callback );
452 452
 	}
453 453
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 	$exploded = explode( '.', "{$field_id}" );
514 514
 
515
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
515
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
516 516
 }
517 517
 
518 518
 /**
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 */
554 554
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
555 555
 
556
-	$terms = get_terms( $args['taxonomy'], $args );
556
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
557 557
 
558 558
 	$choices = array();
559 559
 
560 560
 	if ( is_array( $terms ) ) {
561 561
 		foreach ( $terms as $term_id => $term_name ) {
562
-			$choices[] = array(
562
+			$choices[ ] = array(
563 563
 				'text'  => $term_name,
564 564
 				'value' => $term_id
565 565
 			);
@@ -583,21 +583,21 @@  discard block
 block discarded – undo
583 583
 function _gravityview_process_posted_fields() {
584 584
 	$fields = array();
585 585
 
586
-	if( !empty( $_POST['gv_fields'] ) ) {
587
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
586
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
587
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
588 588
 
589 589
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
590 590
 			$fields_holder = array();
591
-			GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder );
591
+			GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder );
592 592
 
593
-			if ( isset( $fields_holder['fields'] ) ) {
594
-				$fields = $fields_holder['fields'];
593
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
594
+				$fields = $fields_holder[ 'fields' ];
595 595
 			} else {
596 596
 				do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder );
597 597
 			}
598 598
 
599 599
 		} else {
600
-			$fields = $_POST['gv_fields'];
600
+			$fields = $_POST[ 'gv_fields' ];
601 601
 		}
602 602
 	}
603 603
 
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +143 added lines, -143 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,17 +219,17 @@  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
-		if( $field && is_numeric( $field_id ) ) {
232
+		if ( $field && is_numeric( $field_id ) ) {
233 233
 			// Used as file name of field template in GV.
234 234
 			// 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
235 235
 			$field_type = $field->type;
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 
242 242
 		// If a Gravity Forms Field is found, get the field display
243
-		if( $field ) {
243
+		if ( $field ) {
244 244
 
245 245
 			// Prevent any PHP warnings that may be generated
246 246
 			ob_start();
247 247
 
248
-			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry["currency"], false, $format );
248
+			$display_value = GFCommon::get_lead_field_display( $field, $value, $entry[ "currency" ], false, $format );
249 249
 
250 250
 			if ( $errors = ob_get_clean() ) {
251 251
 				do_action( 'gravityview_log_error', 'GravityView_API[field_value] Errors when calling GFCommon::get_lead_field_display()', $errors );
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			$display_value = apply_filters( "gform_entry_field_value", $display_value, $field, $entry, $form );
255 255
 
256 256
 			// prevent the use of merge_tags for non-admin fields
257
-			if( !empty( $field->adminOnly ) ) {
257
+			if ( ! empty( $field->adminOnly ) ) {
258 258
 				$display_value = self::replace_variables( $display_value, $form, $entry );
259 259
 			}
260 260
 		} else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// Check whether the field exists in /includes/fields/{$field_type}.php
266 266
 		// This can be overridden by user template files.
267
-		$field_path = $gravityview_view->locate_template("fields/{$field_type}.php");
267
+		$field_path = $gravityview_view->locate_template( "fields/{$field_type}.php" );
268 268
 
269 269
 		// Set the field data to be available in the templates
270 270
 		$gravityview_view->setCurrentField( array(
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 			'entry' => $entry,
279 279
 			'field_type' => $field_type, /** {@since 1.6} */
280 280
 		    'field_path' => $field_path, /** {@since 1.16} */
281
-		));
281
+		) );
282 282
 
283
-		if( ! empty( $field_path ) ) {
283
+		if ( ! empty( $field_path ) ) {
284 284
 
285
-			do_action( 'gravityview_log_debug', sprintf('[field_value] Rendering %s', $field_path ) );
285
+			do_action( 'gravityview_log_debug', sprintf( '[field_value] Rendering %s', $field_path ) );
286 286
 
287 287
 			ob_start();
288 288
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		}
299 299
 
300 300
 		// Get the field settings again so that the field template can override the settings
301
-		$field_settings = $gravityview_view->getCurrentField('field_settings');
301
+		$field_settings = $gravityview_view->getCurrentField( 'field_settings' );
302 302
 
303 303
 		/**
304 304
 		 * @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`
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		 * Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.
328 328
 		 *
329 329
 		 */
330
-		if( !empty( $field_settings['show_as_link'] ) && ! gv_empty( $output, false, false ) ) {
330
+		if ( ! empty( $field_settings[ 'show_as_link' ] ) && ! gv_empty( $output, false, false ) ) {
331 331
 
332
-			$link_atts = empty( $field_settings['new_window'] ) ? array() : array( 'target' => '_blank' );
332
+			$link_atts = empty( $field_settings[ 'new_window' ] ) ? array() : array( 'target' => '_blank' );
333 333
 
334 334
 			$output = self::entry_link_html( $entry, $output, $link_atts, $field_settings );
335 335
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		 * @param  array $field_settings Settings for the particular GV field
344 344
 		 * @param array $field Current field being displayed
345 345
 		 */
346
-		$output = apply_filters( 'gravityview_field_entry_value_'.$field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
346
+		$output = apply_filters( 'gravityview_field_entry_value_' . $field_type, $output, $entry, $field_settings, $gravityview_view->getCurrentField() );
347 347
 
348 348
 		/**
349 349
 		 * @filter `gravityview_field_entry_value` Modify the field value output for all field types
@@ -372,14 +372,14 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array() ) {
374 374
 
375
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
375
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
376 376
 			do_action( 'gravityview_log_debug', 'GravityView_API[entry_link_tag] Entry not defined; returning null', $entry );
377 377
 			return NULL;
378 378
 		}
379 379
 
380 380
 		$href = self::entry_link( $entry );
381 381
 
382
-		if( '' === $href ) {
382
+		if ( '' === $href ) {
383 383
 			return NULL;
384 384
 		}
385 385
 
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 	 * @param  boolean     $wpautop Apply wpautop() to the output?
403 403
 	 * @return string               HTML of "no results" text
404 404
 	 */
405
-	public static function no_results($wpautop = true) {
405
+	public static function no_results( $wpautop = true ) {
406 406
 		$gravityview_view = GravityView_View::getInstance();
407 407
 
408 408
 		$is_search = false;
409 409
 
410
-		if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
410
+		if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
411 411
 			$is_search = true;
412 412
 		}
413 413
 
414
-		if($is_search) {
415
-			$output = __('This search returned no results.', 'gravityview');
414
+		if ( $is_search ) {
415
+			$output = __( 'This search returned no results.', 'gravityview' );
416 416
 		} else {
417
-			$output = __('No entries match your request.', 'gravityview');
417
+			$output = __( 'No entries match your request.', 'gravityview' );
418 418
 		}
419 419
 
420 420
 		/**
@@ -422,9 +422,9 @@  discard block
 block discarded – undo
422 422
 		 * @param string $output The existing "No Entries" text
423 423
 		 * @param boolean $is_search Is the current page a search result, or just a multiple entries screen?
424 424
 		 */
425
-		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search);
425
+		$output = apply_filters( 'gravitview_no_entries_text', $output, $is_search );
426 426
 
427
-		return $wpautop ? wpautop($output) : $output;
427
+		return $wpautop ? wpautop( $output ) : $output;
428 428
 	}
429 429
 
430 430
 	/**
@@ -441,37 +441,37 @@  discard block
 block discarded – undo
441 441
 
442 442
 		$gravityview_view = GravityView_View::getInstance();
443 443
 
444
-		if( empty( $post_id ) ) {
444
+		if ( empty( $post_id ) ) {
445 445
 
446 446
 			$post_id = false;
447 447
 
448 448
 			// DataTables passes the Post ID
449
-			if( defined('DOING_AJAX') && DOING_AJAX ) {
449
+			if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
450 450
 
451
-				$post_id = isset( $_POST['post_id'] ) ? (int)$_POST['post_id'] : false;
451
+				$post_id = isset( $_POST[ 'post_id' ] ) ? (int)$_POST[ 'post_id' ] : false;
452 452
 
453 453
 			} else {
454 454
 
455 455
 				// The Post ID has been passed via the shortcode
456
-				if( !empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
456
+				if ( ! empty( $gravityview_view ) && $gravityview_view->getPostId() ) {
457 457
 
458 458
 					$post_id = $gravityview_view->getPostId();
459 459
 
460 460
 				} else {
461 461
 
462 462
 					// This is a GravityView post type
463
-					if( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
463
+					if ( GravityView_frontend::getInstance()->isGravityviewPostType() ) {
464 464
 
465 465
 						$post_id = isset( $gravityview_view ) ? $gravityview_view->getViewId() : $post->ID;
466 466
 
467 467
 					} else {
468 468
 
469 469
 						// This is an embedded GravityView; use the embedded post's ID as the base.
470
-						if( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
470
+						if ( GravityView_frontend::getInstance()->isPostHasShortcode() && is_a( $post, 'WP_Post' ) ) {
471 471
 
472 472
 							$post_id = $post->ID;
473 473
 
474
-						} elseif( $gravityview_view->getViewId() ) {
474
+						} elseif ( $gravityview_view->getViewId() ) {
475 475
 
476 476
 							// The GravityView has been embedded in a widget or in a template, and
477 477
 							// is not in the current content. Thus, we defer to the View's own ID.
@@ -486,40 +486,40 @@  discard block
 block discarded – undo
486 486
 		}
487 487
 
488 488
 		// No post ID, get outta here.
489
-		if( empty( $post_id ) ) {
489
+		if ( empty( $post_id ) ) {
490 490
 			return NULL;
491 491
 		}
492 492
 
493 493
 		// If we've saved the permalink in memory, use it
494 494
 		// @since 1.3
495
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
495
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
496 496
 
497
-		if( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
497
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
498 498
 			$link = home_url();
499 499
 		}
500 500
 
501
-		if( empty( $link ) ) {
501
+		if ( empty( $link ) ) {
502 502
 
503 503
 			$link = get_permalink( $post_id );
504 504
 
505 505
 			// If not yet saved, cache the permalink.
506 506
 			// @since 1.3
507
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
507
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
508 508
 
509 509
 		}
510 510
 
511 511
 		// Deal with returning to proper pagination for embedded views
512
-		if( $link && $add_query_args ) {
512
+		if ( $link && $add_query_args ) {
513 513
 
514 514
 			$args = array();
515 515
 
516
-			if( $pagenum = rgget('pagenum') ) {
517
-				$args['pagenum'] = intval( $pagenum );
516
+			if ( $pagenum = rgget( 'pagenum' ) ) {
517
+				$args[ 'pagenum' ] = intval( $pagenum );
518 518
 			}
519 519
 
520
-			if( $sort = rgget('sort') ) {
521
-				$args['sort'] = $sort;
522
-				$args['dir'] = rgget('dir');
520
+			if ( $sort = rgget( 'sort' ) ) {
521
+				$args[ 'sort' ] = $sort;
522
+				$args[ 'dir' ] = rgget( 'dir' );
523 523
 			}
524 524
 
525 525
 			$link = add_query_arg( $args, $link );
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
551 551
 
552 552
 		// Generate an unique hash to use as the default value
553
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
553
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
554 554
 
555 555
 		/**
556 556
 		 * @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}`
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
562 562
 
563 563
 		// Make sure we have something - use the original ID as backup.
564
-		if( empty( $slug ) ) {
564
+		if ( empty( $slug ) ) {
565 565
 			$slug = $id;
566 566
 		}
567 567
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 		 * @filter `gravityview_custom_entry_slug` Whether to enable and use custom entry slugs.
591 591
 		 * @param boolean True: Allow for slugs based on entry values. False: always use entry IDs (default)
592 592
 		 */
593
-		$custom = apply_filters('gravityview_custom_entry_slug', false );
593
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
594 594
 
595 595
 		// If we're using custom slug...
596 596
 		if ( $custom ) {
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 			// If it does have a hash set, and the hash is expected, use it.
605 605
 			// This check allows users to change the hash structure using the
606 606
 			// gravityview_entry_hash filter and have the old hashes expire.
607
-			if( empty( $value ) || $value !== $hash ) {
608
-				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$id_or_string.'": ' . $hash );
607
+			if ( empty( $value ) || $value !== $hash ) {
608
+				do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $id_or_string . '": ' . $hash );
609 609
 				gform_update_meta( $id_or_string, 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
610 610
 			}
611 611
 
@@ -631,15 +631,15 @@  discard block
 block discarded – undo
631 631
          * @param boolean $custom Should we process the custom entry slug?
632 632
          */
633 633
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
634
-        if( $custom ) {
634
+        if ( $custom ) {
635 635
             // create the gravityview_unique_id and save it
636 636
 
637 637
             // Get the entry hash
638
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
638
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
639 639
 
640
-	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "'.$entry['id'].'": ' . $hash );
640
+	        do_action( 'gravityview_log_debug', __METHOD__ . ' - Setting hash for entry "' . $entry[ 'id' ] . '": ' . $hash );
641 641
 
642
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
642
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, rgar( $entry, 'form_id' ) );
643 643
 
644 644
         }
645 645
     }
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
 	 */
657 657
 	public static function entry_link( $entry, $post_id = NULL, $add_directory_args = true ) {
658 658
 
659
-		if( ! empty( $entry ) && ! is_array( $entry ) ) {
659
+		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
660 660
 			$entry = GVCommon::get_entry( $entry );
661
-		} else if( empty( $entry ) ) {
661
+		} else if ( empty( $entry ) ) {
662 662
 			$entry = GravityView_frontend::getInstance()->getEntry();
663 663
 		}
664 664
 
665 665
 		// Second parameter used to be passed as $field; this makes sure it's not an array
666
-		if( !is_numeric( $post_id ) ) {
666
+		if ( ! is_numeric( $post_id ) ) {
667 667
 			$post_id = NULL;
668 668
 		}
669 669
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		$directory_link = self::directory_link( $post_id, false );
672 672
 
673 673
 		// No post ID? Get outta here.
674
-		if( empty( $directory_link ) ) {
674
+		if ( empty( $directory_link ) ) {
675 675
 			return '';
676 676
 		}
677 677
 
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
 			$query_arg_name = GravityView_Post_Types::get_entry_var_name();
683 683
 		}
684 684
 
685
-		$entry_slug = self::get_entry_slug( $entry['id'], $entry );
685
+		$entry_slug = self::get_entry_slug( $entry[ 'id' ], $entry );
686 686
 
687
-		if( get_option('permalink_structure') && !is_preview() ) {
687
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
688 688
 
689 689
 			$args = array();
690 690
 
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 			 */
695 695
 			$link_parts = explode( '?', $directory_link );
696 696
 
697
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
697
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
698 698
 
699
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
699
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
700 700
 
701 701
 		} else {
702 702
 
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
 		/**
707 707
 		 * @since 1.7.3
708 708
 		 */
709
-		if( $add_directory_args ) {
709
+		if ( $add_directory_args ) {
710 710
 
711
-			if( !empty( $_GET['pagenum'] ) ) {
712
-				$args['pagenum'] = intval( $_GET['pagenum'] );
711
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
712
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
713 713
 			}
714 714
 
715 715
 			/**
716 716
 			 * @since 1.7
717 717
 			 */
718
-			if( $sort = rgget('sort') ) {
719
-				$args['sort'] = $sort;
720
-				$args['dir'] = rgget('dir');
718
+			if ( $sort = rgget( 'sort' ) ) {
719
+				$args[ 'sort' ] = $sort;
720
+				$args[ 'dir' ] = rgget( 'dir' );
721 721
 			}
722 722
 
723 723
 		}
@@ -729,12 +729,12 @@  discard block
 block discarded – undo
729 729
 		 */
730 730
 		if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) {
731 731
 			if ( gravityview()->views->count() > 1 ) {
732
-				$args['gvid'] = gravityview_get_view_id();
732
+				$args[ 'gvid' ] = gravityview_get_view_id();
733 733
 			}
734 734
 		} else {
735 735
 			/** Deprecated, do not use has_multiple_views(), please. */
736 736
 			if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() ) {
737
-				$args['gvid'] = gravityview_get_view_id();
737
+				$args[ 'gvid' ] = gravityview_get_view_id();
738 738
 			}
739 739
 		}
740 740
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 }
754 754
 
755 755
 function gv_class( $field, $form = NULL, $entry = array() ) {
756
-	return GravityView_API::field_class( $field, $form, $entry  );
756
+	return GravityView_API::field_class( $field, $form, $entry );
757 757
 }
758 758
 
759 759
 /**
@@ -775,15 +775,15 @@  discard block
 block discarded – undo
775 775
 
776 776
 	$default_css_class = ! empty( $view_id ) ? sprintf( 'gv-container gv-container-%d', $view_id ) : 'gv-container';
777 777
 
778
-	if( GravityView_View::getInstance()->isHideUntilSearched() ) {
778
+	if ( GravityView_View::getInstance()->isHideUntilSearched() ) {
779 779
 		$default_css_class .= ' hidden';
780 780
 	}
781 781
 
782
-	if( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
782
+	if ( 0 === GravityView_View::getInstance()->getTotalEntries() ) {
783 783
 		$default_css_class .= ' gv-container-no-results';
784 784
 	}
785 785
 
786
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
786
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
787 787
 
788 788
 	/**
789 789
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 
795 795
 	$css_class = gravityview_sanitize_html_class( $css_class );
796 796
 
797
-	if( $echo ) {
797
+	if ( $echo ) {
798 798
 		echo $css_class;
799 799
 	}
800 800
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 
806 806
 	$value = GravityView_API::field_value( $entry, $field );
807 807
 
808
-	if( $value === '' ) {
808
+	if ( $value === '' ) {
809 809
 		/**
810 810
 		 * @filter `gravityview_empty_value` What to display when a field is empty
811 811
 		 * @param string $value (empty string)
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 	return GravityView_API::entry_link( $entry, $post_id );
825 825
 }
826 826
 
827
-function gv_no_results($wpautop = true) {
827
+function gv_no_results( $wpautop = true ) {
828 828
 	return GravityView_API::no_results( $wpautop );
829 829
 }
830 830
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	 */
846 846
 	$href = apply_filters( 'gravityview_go_back_url', $href );
847 847
 
848
-	if( empty( $href ) ) { return NULL; }
848
+	if ( empty( $href ) ) { return NULL; }
849 849
 
850 850
 	// calculate link label
851 851
 	$gravityview_view = GravityView_View::getInstance();
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
 	$link = gravityview_get_link( $href, esc_html( $label ), array(
863 863
 		'data-viewid' => $gravityview_view->getViewId()
864
-	));
864
+	) );
865 865
 
866 866
 	return $link;
867 867
 }
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
  */
881 881
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
882 882
 
883
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
883
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
884 884
 
885 885
 		// For the complete field value as generated by Gravity Forms
886 886
 		return $display_value;
@@ -914,16 +914,16 @@  discard block
 block discarded – undo
914 914
 		$terms = explode( ', ', $value );
915 915
 	}
916 916
 
917
-	foreach ($terms as $term_name ) {
917
+	foreach ( $terms as $term_name ) {
918 918
 
919 919
 		// If we're processing a category,
920
-		if( $taxonomy === 'category' ) {
920
+		if ( $taxonomy === 'category' ) {
921 921
 
922 922
 			// Use rgexplode to prevent errors if : doesn't exist
923 923
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
924 924
 
925 925
 			// The explode was succesful; we have the category ID
926
-			if( !empty( $term_id )) {
926
+			if ( ! empty( $term_id ) ) {
927 927
 				$term = get_term_by( 'id', $term_id, $taxonomy );
928 928
 			} else {
929 929
 			// We have to fall back to the name
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 		}
937 937
 
938 938
 		// There's still a tag/category here.
939
-		if( $term ) {
939
+		if ( $term ) {
940 940
 
941 941
 			$term_link = get_term_link( $term, $taxonomy );
942 942
 
@@ -945,11 +945,11 @@  discard block
 block discarded – undo
945 945
 			    continue;
946 946
 			}
947 947
 
948
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
948
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
949 949
 		}
950 950
 	}
951 951
 
952
-	return implode(', ', $output );
952
+	return implode( ', ', $output );
953 953
 }
954 954
 
955 955
 /**
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 
964 964
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
965 965
 
966
-	if( empty( $link ) ) {
967
-		return strip_tags( $output);
966
+	if ( empty( $link ) ) {
967
+		return strip_tags( $output );
968 968
 	}
969 969
 
970 970
 	return $output;
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 	$fe = GravityView_frontend::getInstance();
984 984
 
985 985
 	// Solve problem when loading content via admin-ajax.php
986
-	if( ! $fe->getGvOutputData() ) {
986
+	if ( ! $fe->getGvOutputData() ) {
987 987
 
988 988
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not defined; parsing content.' );
989 989
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 	}
992 992
 
993 993
 	// Make 100% sure that we're dealing with a properly called situation
994
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
994
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
995 995
 
996 996
 		do_action( 'gravityview_log_debug', '[gravityview_get_current_views] gv_output_data not an object or get_view not callable.', $fe->getGvOutputData() );
997 997
 
@@ -1003,8 +1003,8 @@  discard block
 block discarded – undo
1003 1003
 			return array();
1004 1004
 		}
1005 1005
 		return array_combine(
1006
-			array_map( function ( $view ) { return $view->ID; }, gravityview()->views->all() ),
1007
-			array_map( function ( $view ) { return $view->as_data(); }, gravityview()->views->all() )
1006
+			array_map( function( $view ) { return $view->ID; }, gravityview()->views->all() ),
1007
+			array_map( function( $view ) { return $view->as_data(); }, gravityview()->views->all() )
1008 1008
 		);
1009 1009
 	}
1010 1010
 	/** \GravityView_View_Data::get_views is deprecated. */
@@ -1099,11 +1099,11 @@  discard block
 block discarded – undo
1099 1099
 	 */
1100 1100
 	$is_edit_entry = apply_filters( 'gravityview_is_edit_entry', false );
1101 1101
 
1102
-	if( $is_edit_entry ) {
1102
+	if ( $is_edit_entry ) {
1103 1103
 		$context = 'edit';
1104
-	} else if( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1104
+	} else if ( class_exists( 'GravityView_frontend' ) && $single = GravityView_frontend::is_single_entry() ) {
1105 1105
 		$context = 'single';
1106
-	} else if( class_exists( 'GravityView_View' ) ) {
1106
+	} else if ( class_exists( 'GravityView_View' ) ) {
1107 1107
 		$context = GravityView_View::getInstance()->getContext();
1108 1108
 	}
1109 1109
 
@@ -1131,12 +1131,12 @@  discard block
 block discarded – undo
1131 1131
 function gravityview_get_files_array( $value, $gv_class = '' ) {
1132 1132
 	/** @define "GRAVITYVIEW_DIR" "../" */
1133 1133
 
1134
-	if( !class_exists( 'GravityView_Field' ) ) {
1135
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1134
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1135
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1136 1136
 	}
1137 1137
 
1138
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1139
-		include_once( GRAVITYVIEW_DIR .'includes/fields/fileupload.php' );
1138
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1139
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/fileupload.php' );
1140 1140
 	}
1141 1141
 
1142 1142
 	return GravityView_Field_FileUpload::get_files_array( $value, $gv_class );
@@ -1214,12 +1214,12 @@  discard block
 block discarded – undo
1214 1214
 	$args = apply_filters( 'gravityview/field_output/args', $args, $passed_args );
1215 1215
 
1216 1216
 	// Required fields.
1217
-	if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1217
+	if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1218 1218
 		do_action( 'gravityview_log_error', '[gravityview_field_output] Field or form are empty.', $args );
1219 1219
 		return '';
1220 1220
 	}
1221 1221
 
1222
-	$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1222
+	$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1223 1223
 
1224 1224
 	/**
1225 1225
 	 * Create the content variables for replacing.
@@ -1235,37 +1235,37 @@  discard block
 block discarded – undo
1235 1235
 		'field_id' => '',
1236 1236
 	);
1237 1237
 
1238
-	$context['value'] = gv_value( $entry, $args['field'] );
1238
+	$context[ 'value' ] = gv_value( $entry, $args[ 'field' ] );
1239 1239
 
1240 1240
 	// If the value is empty and we're hiding empty, return empty.
1241
-	if ( $context['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1241
+	if ( $context[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1242 1242
 		return '';
1243 1243
 	}
1244 1244
 
1245
-	if ( $context['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1246
-		$context['value'] = wpautop( $context['value'] );
1245
+	if ( $context[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1246
+		$context[ 'value' ] = wpautop( $context[ 'value' ] );
1247 1247
 	}
1248 1248
 
1249 1249
 	// Get width setting, if exists
1250
-	$context['width'] = GravityView_API::field_width( $args['field'] );
1250
+	$context[ 'width' ] = GravityView_API::field_width( $args[ 'field' ] );
1251 1251
 
1252 1252
 	// If replacing with CSS inline formatting, let's do it.
1253
-	$context['width:style'] = GravityView_API::field_width( $args['field'], 'width:' . $context['width'] . '%;' );
1253
+	$context[ 'width:style' ] = GravityView_API::field_width( $args[ 'field' ], 'width:' . $context[ 'width' ] . '%;' );
1254 1254
 
1255 1255
 	// Grab the Class using `gv_class`
1256
-	$context['class'] = gv_class( $args['field'], $args['form'], $entry );
1257
-	$context['field_id'] = GravityView_API::field_html_attr_id( $args['field'], $args['form'], $entry );
1256
+	$context[ 'class' ] = gv_class( $args[ 'field' ], $args[ 'form' ], $entry );
1257
+	$context[ 'field_id' ] = GravityView_API::field_html_attr_id( $args[ 'field' ], $args[ 'form' ], $entry );
1258 1258
 
1259 1259
 	// Get field label if needed
1260
-	if ( ! empty( $args['label_markup'] ) && ! empty( $args['field']['show_label'] ) ) {
1261
-		$context['label'] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args['label_markup'] );
1260
+	if ( ! empty( $args[ 'label_markup' ] ) && ! empty( $args[ 'field' ][ 'show_label' ] ) ) {
1261
+		$context[ 'label' ] = str_replace( array( '{{label}}', '{{ label }}' ), '<span class="gv-field-label">{{ label_value }}</span>', $args[ 'label_markup' ] );
1262 1262
 	}
1263 1263
 
1264 1264
 	// Default Label value
1265
-	$context['label_value'] = gv_label( $args['field'], $entry );
1265
+	$context[ 'label_value' ] = gv_label( $args[ 'field' ], $entry );
1266 1266
 
1267
-	if ( empty( $context['label'] ) && ! empty( $context['label_value'] ) ){
1268
-		$context['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1267
+	if ( empty( $context[ 'label' ] ) && ! empty( $context[ 'label_value' ] ) ) {
1268
+		$context[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1269 1269
 	}
1270 1270
 
1271 1271
 	/**
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
 	 * @param string $markup The HTML for the markup
1275 1275
 	 * @param array $args All args for the field output
1276 1276
 	 */
1277
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args );
1277
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args );
1278 1278
 
1279 1279
 	/**
1280 1280
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	foreach ( $context as $tag => $value ) {
1298 1298
 
1299 1299
 		// If the tag doesn't exist just skip it
1300
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1300
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1301 1301
 			continue;
1302 1302
 		}
1303 1303
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-list.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$this->link_format = $link_format;
84 84
 		$this->after_link = $after_link;
85 85
 		$this->context = $context;
86
-		$this->empty_message = function_exists( 'gv_no_results' ) ? gv_no_results() : __('No entries match your request.', 'gravityview');
86
+		$this->empty_message = function_exists( 'gv_no_results' ) ? gv_no_results() : __( 'No entries match your request.', 'gravityview' );
87 87
 	}
88 88
 
89 89
 	/**
@@ -169,25 +169,25 @@  discard block
 block discarded – undo
169 169
 	public function get_output() {
170 170
 
171 171
 		// No Entries
172
-		if( empty( $this->entries ) ) {
173
-			return '<div class="gv-no-results">'.$this->empty_message.'</div>';
172
+		if ( empty( $this->entries ) ) {
173
+			return '<div class="gv-no-results">' . $this->empty_message . '</div>';
174 174
 		}
175 175
 
176 176
 		$output = '';
177 177
 		$current_entry = GravityView_View::getInstance()->getCurrentEntry();
178 178
 
179
-		$output .= '<'. $this->wrapper_tag .'>';
179
+		$output .= '<' . $this->wrapper_tag . '>';
180 180
 
181
-		foreach( $this->entries as $entry ) {
181
+		foreach ( $this->entries as $entry ) {
182 182
 
183
-			if( $this->skip_entry( $entry, $current_entry ) ) {
183
+			if ( $this->skip_entry( $entry, $current_entry ) ) {
184 184
 				continue;
185 185
 			}
186 186
 
187 187
 			$output .= $this->get_item_output( $entry );
188 188
 		}
189 189
 
190
-		$output .= '</'. $this->wrapper_tag .'>';
190
+		$output .= '</' . $this->wrapper_tag . '>';
191 191
 
192 192
 		/**
193 193
 		 * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	private function skip_entry( $entry, $current_entry ) {
211 211
 
212 212
 		// If skip entry is off, or there's no current entry, return false
213
-		if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
213
+		if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) {
214 214
 			return false;
215 215
 		}
216 216
 
217 217
 		// If in Single or Edit mode, $current_entry will be an array.
218
-		$current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry;
218
+		$current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry;
219 219
 
220 220
 		// If the entry ID matches the current entry, yes: skip
221
-		if( $entry['id'] === $current_entry_id ) {
221
+		if ( $entry[ 'id' ] === $current_entry_id ) {
222 222
 			return true;
223 223
 		}
224 224
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 		$item_output = gravityview_get_link( $link, $this->link_format );
247 247
 
248
-		if( !empty( $this->after_link ) ) {
248
+		if ( ! empty( $this->after_link ) ) {
249 249
 
250 250
 			/**
251 251
 			 * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 			 * @param array $entry Gravity Forms entry array
255 255
 			 * @param GravityView_Entry_List $this The current class instance
256 256
 			 */
257
-			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this );
257
+			$after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this );
258 258
 
259 259
 			$item_output .= $after_link;
260 260
 		}
261 261
 
262 262
 		$item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry );
263 263
 
264
-		$item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>';
264
+		$item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>';
265 265
 
266 266
 		/**
267 267
 		 * @filter `gravityview/entry-list/item` Modify each item's output in an entry list
Please login to merge, or discard this patch.