Completed
Push — develop ( 3edd81...936044 )
by Zack
16:26
created
includes/class-frontend-views.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 */
244
-			$this->context_view_id = $_GET['gvid'];
244
+			$this->context_view_id = $_GET[ 'gvid' ];
245 245
 
246 246
 		} elseif ( ! $multiple_views ) {
247 247
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
 		global $wp_rewrite;
279 279
 
280 280
 		$is_front_page = ( $query->is_home || $query->is_page );
281
-		$show_on_front = ( 'page' === get_option('show_on_front') );
282
-		$front_page_id = get_option('page_on_front');
281
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
282
+		$front_page_id = get_option( 'page_on_front' );
283 283
 
284
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
284
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
285 285
 
286 286
 			// Force to be an array, potentially a query string ( entry=16 )
287 287
 			$_query = wp_parse_args( $query->query );
288 288
 
289 289
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
290
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
291
-				unset( $_query['pagename'] );
290
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
291
+				unset( $_query[ 'pagename' ] );
292 292
 			}
293 293
 
294 294
 			// this is where will break from core wordpress
295 295
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
296 296
 			$ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
297 297
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -443,20 +443,20 @@  discard block
 block discarded – undo
443 443
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
444 444
 		 * @param array $entry Current entry
445 445
 		 */
446
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
446
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
447 447
 
448 448
 		if ( ! $apply_outside_loop ) {
449 449
 			return $title;
450 450
 		}
451 451
 
452 452
 		// User reported WooCommerce doesn't pass two args.
453
-		if ( empty( $passed_post_id ) )  {
453
+		if ( empty( $passed_post_id ) ) {
454 454
 			return $title;
455 455
 		}
456 456
 
457 457
 		// Don't modify the title for anything other than the current view/post.
458 458
 		// This is true for embedded shortcodes and Views.
459
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
459
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
460 460
 			return $title;
461 461
 		}
462 462
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
469 469
 		} else {
470 470
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
471
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
471
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
472 472
 					$view_meta = $view_data;
473 473
 					break;
474 474
 				}
@@ -476,12 +476,12 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		/** Deprecated stuff in the future. See the branch above. */
479
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
479
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
480 480
 
481
-			$title = $view_meta['atts']['single_title'];
481
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
482 482
 
483 483
 			// We are allowing HTML in the fields, so no escaping the output
484
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
484
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
485 485
 
486 486
 			$title = do_shortcode( $title );
487 487
 		}
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 
553 553
 		$context = GravityView_View::getInstance()->getContext();
554 554
 
555
-		switch( $context ) {
555
+		switch ( $context ) {
556 556
 			case 'directory':
557 557
 				$tab = __( 'Multiple Entries', 'gravityview' );
558 558
 				break;
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 		}
567 567
 
568 568
 
569
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
569
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
570 570
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
571
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
571
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
572 572
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
573 573
 
574
-		$image =  sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
574
+		$image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) );
575 575
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
576 576
 
577 577
 		echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id );
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		$direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID );
620 620
 		$embed_only = $view->settings->get( 'embed_only' );
621 621
 
622
-		if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
622
+		if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
623 623
 			return __( 'You are not allowed to view this content.', 'gravityview' );
624 624
 		}
625 625
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 				$datetime_format = 'Y-m-d H:i:s';
667 667
 				$search_is_outside_view_bounds = false;
668 668
 
669
-				if( ! empty( $search_criteria[ $key ] ) ) {
669
+				if ( ! empty( $search_criteria[ $key ] ) ) {
670 670
 
671 671
 					$search_date = strtotime( $search_criteria[ $key ] );
672 672
 
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
695 695
 
696 696
 					// Then we override the search and re-set the start date
697
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
697
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
698 698
 				}
699 699
 			}
700 700
 		}
701 701
 
702
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
702
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
703 703
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
704
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
704
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
705 705
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
706 706
 			}
707 707
 		}
@@ -720,19 +720,19 @@  discard block
 block discarded – undo
720 720
 	public static function process_search_only_approved( $args, $search_criteria ) {
721 721
 
722 722
 		/** @since 1.19 */
723
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
723
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
724 724
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
725 725
 			return $search_criteria;
726 726
 		}
727 727
 
728
-		if ( ! empty( $args['show_only_approved'] ) ) {
728
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
729 729
 
730
-			$search_criteria['field_filters'][] = array(
730
+			$search_criteria[ 'field_filters' ][ ] = array(
731 731
 				'key' => GravityView_Entry_Approval::meta_key,
732 732
 				'value' => GravityView_Entry_Approval_Status::APPROVED
733 733
 			);
734 734
 
735
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
735
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
736 736
 
737 737
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
738 738
 		}
@@ -759,18 +759,18 @@  discard block
 block discarded – undo
759 759
 	 */
760 760
 	public static function is_entry_approved( $entry, $args = array() ) {
761 761
 
762
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
762
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
763 763
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
764 764
 			return true;
765 765
 		}
766 766
 
767 767
 		/** @since 1.19 */
768
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
768
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
769 769
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
770 770
 			return true;
771 771
 		}
772 772
 
773
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
773
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
774 774
 
775 775
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
776 776
 	}
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
795 795
 		 */
796 796
 		$criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
797
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
797
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
798 798
 
799 799
 		/**
800 800
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -810,29 +810,29 @@  discard block
 block discarded – undo
810 810
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) );
811 811
 
812 812
 		// implicity search
813
-		if ( ! empty( $args['search_value'] ) ) {
813
+		if ( ! empty( $args[ 'search_value' ] ) ) {
814 814
 
815 815
 			// Search operator options. Options: `is` or `contains`
816
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
816
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
817 817
 
818
-			$search_criteria['field_filters'][] = array(
818
+			$search_criteria[ 'field_filters' ][ ] = array(
819 819
 				'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
820
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
820
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
821 821
 				'operator' => $operator,
822 822
 			);
823 823
 
824 824
 			// Lock search mode to "all" with implicit presearch filter.
825
-			$search_criteria['field_filters']['mode'] = 'all';
825
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
826 826
 		}
827 827
 
828
-		if( $search_criteria !== $original_search_criteria ) {
828
+		if ( $search_criteria !== $original_search_criteria ) {
829 829
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) );
830 830
 		}
831 831
 
832 832
 		// Handle setting date range
833 833
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
834 834
 
835
-		if( $search_criteria !== $original_search_criteria ) {
835
+		if ( $search_criteria !== $original_search_criteria ) {
836 836
 			gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) );
837 837
 		}
838 838
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
844 844
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
845 845
 		 */
846
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
846
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
847 847
 
848 848
 		return $search_criteria;
849 849
 	}
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			'search_criteria' => $search_criteria,
957 957
 			'sorting' => self::updateViewSorting( $args, $form_id ),
958 958
 			'paging' => $paging,
959
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
959
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
960 960
 		);
961 961
 
962 962
 		/**
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
982 982
 		 * @param array $args View configuration args.
983 983
 		 */
984
-		$parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
984
+		$parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id );
985 985
 
986 986
 		gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) );
987 987
 
@@ -1006,17 +1006,17 @@  discard block
 block discarded – undo
1006 1006
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1007 1007
 
1008 1008
 		// Paging & offset
1009
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1009
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1010 1010
 
1011 1011
 		if ( -1 === $page_size ) {
1012 1012
 			$page_size = PHP_INT_MAX;
1013 1013
 		}
1014 1014
 
1015
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1015
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1016 1016
 		$offset = ( $curr_page - 1 ) * $page_size;
1017 1017
 
1018
-		if ( ! empty( $args['offset'] ) ) {
1019
-			$offset += intval( $args['offset'] );
1018
+		if ( ! empty( $args[ 'offset' ] ) ) {
1019
+			$offset += intval( $args[ 'offset' ] );
1020 1020
 		}
1021 1021
 
1022 1022
 		$paging = array(
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	public static function updateViewSorting( $args, $form_id ) {
1042 1042
 		$sorting = array();
1043
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1044
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1043
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1044
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1045 1045
 
1046 1046
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1047 1047
 
@@ -1058,12 +1058,12 @@  discard block
 block discarded – undo
1058 1058
 			$form = GFAPI::get_form( $form_id );
1059 1059
 
1060 1060
 			// Get the first GF_Field field ID, set as the key for entry randomization
1061
-			if( ! empty( $form['fields'] ) ) {
1061
+			if ( ! empty( $form[ 'fields' ] ) ) {
1062 1062
 
1063 1063
 				/** @var GF_Field $field */
1064
-				foreach ( $form['fields'] as $field ) {
1064
+				foreach ( $form[ 'fields' ] as $field ) {
1065 1065
 
1066
-					if( ! is_a( $field, 'GF_Field' ) ) {
1066
+					if ( ! is_a( $field, 'GF_Field' ) ) {
1067 1067
 						continue;
1068 1068
 					}
1069 1069
 
@@ -1107,11 +1107,11 @@  discard block
 block discarded – undo
1107 1107
 
1108 1108
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1109 1109
 
1110
-		if( ! $sort_field ) {
1110
+		if ( ! $sort_field ) {
1111 1111
 			return $sort_field_id;
1112 1112
 		}
1113 1113
 
1114
-		switch ( $sort_field['type'] ) {
1114
+		switch ( $sort_field[ 'type' ] ) {
1115 1115
 
1116 1116
 			case 'address':
1117 1117
 				// Sorting by full address
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 					 */
1129 1129
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1130 1130
 
1131
-					switch( strtolower( $address_part ) ){
1131
+					switch ( strtolower( $address_part ) ) {
1132 1132
 						case 'street':
1133 1133
 							$sort_field_id .= '.1';
1134 1134
 							break;
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		 */
1209 1209
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1210 1210
 
1211
-		if ( empty( $single_entry ) ){
1211
+		if ( empty( $single_entry ) ) {
1212 1212
 			return false;
1213 1213
 		} else {
1214 1214
 			return $single_entry;
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
 			$views = $this->getGvOutputData()->get_views();
1231 1231
 
1232 1232
 			foreach ( $views as $view_id => $data ) {
1233
-				$view = \GV\View::by_id( $data['id'] );
1233
+				$view = \GV\View::by_id( $data[ 'id' ] );
1234 1234
 				$view_id = $view->ID;
1235 1235
 				$template_id = gravityview_get_template_id( $view->ID );
1236 1236
 				$data = $view->as_data();
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1240 1240
 				 * @since 1.15
1241 1241
 				 */
1242
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1242
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1243 1243
 					continue;
1244 1244
 				}
1245 1245
 
@@ -1256,13 +1256,13 @@  discard block
 block discarded – undo
1256 1256
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1257 1257
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1258 1258
 					 */
1259
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1259
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1260 1260
 
1261 1261
 					/**
1262 1262
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1263 1263
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1264 1264
 					 */
1265
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1265
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1266 1266
 				}
1267 1267
 
1268 1268
 				/**
@@ -1270,19 +1270,19 @@  discard block
 block discarded – undo
1270 1270
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1271 1271
 				 * @since 1.15
1272 1272
 				 */
1273
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1274
-					$css_dependencies[] = 'dashicons';
1273
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1274
+					$css_dependencies[ ] = 'dashicons';
1275 1275
 				}
1276 1276
 
1277 1277
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1278 1278
 
1279 1279
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1280 1280
 
1281
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1281
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1282 1282
 
1283 1283
 				wp_enqueue_script( 'gravityview-fe-view' );
1284 1284
 
1285
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1285
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1286 1286
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1287 1287
 				}
1288 1288
 
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
 	public static function add_style( $template_id ) {
1346 1346
 
1347 1347
 		if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) {
1348
-			gravityview()->log->debug(  'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1348
+			gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) );
1349 1349
 			wp_enqueue_style( 'gravityview_style_' . $template_id );
1350 1350
 		} elseif ( empty( $template_id ) ) {
1351 1351
 			gravityview()->log->error( 'Cannot add template style; template_id is empty' );
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
 		 * Not a table-based template; don't add sort icons
1377 1377
 		 * @since 1.12
1378 1378
 		 */
1379
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1379
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1380 1380
 			return $label;
1381 1381
 		}
1382 1382
 
1383
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1383
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1384 1384
 			return $label;
1385 1385
 		}
1386 1386
 
@@ -1388,29 +1388,29 @@  discard block
 block discarded – undo
1388 1388
 
1389 1389
 		$class = 'gv-sort';
1390 1390
 
1391
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1391
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1392 1392
 
1393 1393
 		$sort_args = array(
1394
-			'sort' => $field['id'],
1394
+			'sort' => $field[ 'id' ],
1395 1395
 			'dir' => 'asc',
1396 1396
 		);
1397 1397
 
1398
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1398
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1399 1399
 			//toggle sorting direction.
1400
-			if ( 'asc' === $sorting['direction'] ) {
1401
-				$sort_args['dir'] = 'desc';
1400
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1401
+				$sort_args[ 'dir' ] = 'desc';
1402 1402
 				$class .= ' gv-icon-sort-desc';
1403 1403
 			} else {
1404
-				$sort_args['dir'] = 'asc';
1404
+				$sort_args[ 'dir' ] = 'asc';
1405 1405
 				$class .= ' gv-icon-sort-asc';
1406 1406
 			}
1407 1407
 		} else {
1408 1408
 			$class .= ' gv-icon-caret-up-down';
1409 1409
 		}
1410 1410
 
1411
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1411
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1412 1412
 
1413
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1413
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1414 1414
 
1415 1415
 	}
1416 1416
 
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
 		$field_type = $field_id;
1430 1430
 
1431
-		if( is_numeric( $field_id ) ) {
1431
+		if ( is_numeric( $field_id ) ) {
1432 1432
 			$field = GFFormsModel::get_field( $form, $field_id );
1433 1433
 			$field_type = $field->type;
1434 1434
 		}
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
 			return false;
1452 1452
 		}
1453 1453
 
1454
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1454
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1455 1455
 
1456 1456
 	}
1457 1457
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				'type' => 'radio',
65 65
 				'full_width' => true,
66 66
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
67
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
67
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
68 68
 				'value' => 'any',
69 69
 				'class' => 'hide-if-js',
70 70
 				'options' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 			// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
88 88
 			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
89
-			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
89
+			add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
90 90
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
91 91
 
92 92
 			// ajax - get the searchable fields
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
225 225
 		$script_source = empty( $script_min ) ? '/source' : '';
226 226
 
227
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
227
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version );
228 228
 
229 229
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
230 230
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
247 247
 	 */
248 248
 	public function register_no_conflict( $allowed ) {
249
-		$allowed[] = 'gravityview_searchwidget_admin';
249
+		$allowed[ ] = 'gravityview_searchwidget_admin';
250 250
 		return $allowed;
251 251
 	}
252 252
 
@@ -259,24 +259,24 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public static function get_searchable_fields() {
261 261
 
262
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
262
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
263 263
 			exit( '0' );
264 264
 		}
265 265
 
266 266
 		$form = '';
267 267
 
268 268
 		// Fetch the form for the current View
269
-		if ( ! empty( $_POST['view_id'] ) ) {
269
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
270 270
 
271
-			$form = gravityview_get_form_id( $_POST['view_id'] );
271
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
272 272
 
273
-		} elseif ( ! empty( $_POST['formid'] ) ) {
273
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
274 274
 
275
-			$form = (int) $_POST['formid'];
275
+			$form = (int)$_POST[ 'formid' ];
276 276
 
277
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
277
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
278 278
 
279
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
279
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
280 280
 
281 281
 		}
282 282
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 			),
326 326
 		);
327 327
 
328
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
329
-			$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'] );
328
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
329
+			$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' ] );
330 330
 		}
331 331
 
332 332
 		// Get fields with sub-inputs and no parent
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 
349 349
 			foreach ( $fields as $id => $field ) {
350 350
 
351
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
351
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
352 352
 					continue;
353 353
 				}
354 354
 
355
-				$types = self::get_search_input_types( $id, $field['type'] );
355
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
356 356
 
357
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
357
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
358 358
 			}
359 359
 		}
360 360
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
378 378
 
379 379
 		// @todo - This needs to be improved - many fields have . including products and addresses
380
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
380
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
381 381
 			$input_type = 'boolean'; // on/off checkbox
382 382
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
383 383
 			$input_type = 'multi'; //multiselect
@@ -421,19 +421,19 @@  discard block
 block discarded – undo
421 421
 			$post_id = 0;
422 422
 
423 423
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
424
-			if ( ! empty( $widget_args['post_id'] ) ) {
425
-				$post_id = absint( $widget_args['post_id'] );
424
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
425
+				$post_id = absint( $widget_args[ 'post_id' ] );
426 426
 			}
427 427
 			// We're in the WordPress Widget context, and the base View ID should be used
428
-			else if ( ! empty( $widget_args['view_id'] ) ) {
429
-				$post_id = absint( $widget_args['view_id'] );
428
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
429
+				$post_id = absint( $widget_args[ 'view_id' ] );
430 430
 			}
431 431
 
432 432
 			$args = gravityview_get_permalink_query_args( $post_id );
433 433
 
434 434
 			// Add hidden fields to the search form
435 435
 			foreach ( $args as $key => $value ) {
436
-				$search_fields[] = array(
436
+				$search_fields[ ] = array(
437 437
 					'name'  => $key,
438 438
 					'input' => 'hidden',
439 439
 					'value' => $value,
@@ -472,22 +472,22 @@  discard block
 block discarded – undo
472 472
 		/**
473 473
 		 * Include the sidebar Widgets.
474 474
 		 */
475
-		$widgets = (array) get_option( 'widget_gravityview_search', array() );
475
+		$widgets = (array)get_option( 'widget_gravityview_search', array() );
476 476
 
477 477
 		foreach ( $widgets as $widget ) {
478
-			if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) {
479
-				if( $_fields = json_decode( $widget['search_fields'], true ) ) {
478
+			if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) {
479
+				if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) {
480 480
 					foreach ( $_fields as $field ) {
481
-						$searchable_fields [] = $with_full_field ? $field : $field['field'];
481
+						$searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ];
482 482
 					}
483 483
 				}
484 484
 			}
485 485
 		}
486 486
 
487 487
 		foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) {
488
-			if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
488
+			if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) {
489 489
 				foreach ( $_fields as $field ) {
490
-					$searchable_fields [] = $with_full_field ? $field : $field['field'];
490
+					$searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ];
491 491
 				}
492 492
 			}
493 493
 		}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 */
505 505
 	public function filter_entries( $search_criteria, $form_id = null, $args = array() ) {
506 506
 
507
-		if( 'post' === $this->search_method ) {
507
+		if ( 'post' === $this->search_method ) {
508 508
 			$get = $_POST;
509 509
 		} else {
510 510
 			$get = $_GET;
@@ -523,14 +523,14 @@  discard block
 block discarded – undo
523 523
 		$get = gv_map_deep( $get, 'rawurldecode' );
524 524
 
525 525
 		// Make sure array key is set up
526
-		$search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
526
+		$search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() );
527 527
 
528 528
 		$searchable_fields = $this->get_view_searchable_fields( $view );
529 529
 
530 530
 		// add free search
531
-		if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) {
531
+		if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) {
532 532
 
533
-			$search_all_value = trim( $get['gv_search'] );
533
+			$search_all_value = trim( $get[ 'gv_search' ] );
534 534
 
535 535
 			/**
536 536
 			 * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase?
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			}
556 556
 
557 557
 			foreach ( $words as $word ) {
558
-				$search_criteria['field_filters'][] = array(
558
+				$search_criteria[ 'field_filters' ][ ] = array(
559 559
 					'key' => null, // The field ID to search
560 560
 					'value' => $word, // The value to search
561 561
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -565,19 +565,19 @@  discard block
 block discarded – undo
565 565
 
566 566
 		// start date & end date
567 567
 		if ( in_array( 'entry_date', $searchable_fields ) ) {
568
-			$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
569
-			$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
568
+			$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
569
+			$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
570 570
 
571 571
 			if ( $view ) {
572 572
 				/**
573 573
 				 * Override start and end dates if View is limited to some already.
574 574
 				 */
575
-				if ( $start_date =$view->settings->get( 'start_date' ) ) {
575
+				if ( $start_date = $view->settings->get( 'start_date' ) ) {
576 576
 					if ( $start_timestamp = strtotime( $curr_start ) ) {
577 577
 						$curr_start = $start_timestamp < strtotime( $start_date ) ? $start_date : $curr_start;
578 578
 					}
579 579
 				}
580
-				if ( $end_date =$view->settings->get( 'end_date' ) ) {
580
+				if ( $end_date = $view->settings->get( 'end_date' ) ) {
581 581
 					if ( $end_timestamp = strtotime( $curr_end ) ) {
582 582
 						$curr_end = $end_timestamp > strtotime( $end_date ) ? $end_date : $curr_end;
583 583
 					}
@@ -598,22 +598,22 @@  discard block
 block discarded – undo
598 598
 			 */
599 599
 			if ( ! empty( $curr_start ) ) {
600 600
 				$curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) );
601
-				$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
601
+				$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
602 602
 			}
603 603
 
604 604
 			if ( ! empty( $curr_end ) ) {
605 605
 				// Fast-forward 24 hour on the end time
606 606
 				$curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS );
607
-				$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
608
-				if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
609
-					$search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 );
607
+				$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
608
+				if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056
609
+					$search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 );
610 610
 				}
611 611
 			}
612 612
 		}
613 613
 
614 614
 		// search for a specific entry ID
615 615
 		if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) {
616
-			$search_criteria['field_filters'][] = array(
616
+			$search_criteria[ 'field_filters' ][ ] = array(
617 617
 				'key' => 'id',
618 618
 				'value' => absint( $get[ 'gv_id' ] ),
619 619
 				'operator' => '=',
@@ -622,42 +622,42 @@  discard block
 block discarded – undo
622 622
 
623 623
 		// search for a specific Created_by ID
624 624
 		if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) {
625
-			$search_criteria['field_filters'][] = array(
625
+			$search_criteria[ 'field_filters' ][ ] = array(
626 626
 				'key' => 'created_by',
627
-				'value' => absint( $get['gv_by'] ),
627
+				'value' => absint( $get[ 'gv_by' ] ),
628 628
 				'operator' => '=',
629 629
 			);
630 630
 		}
631 631
 
632 632
 
633 633
 		// Get search mode passed in URL
634
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
634
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
635 635
 
636 636
 		// get the other search filters
637 637
 		foreach ( $get as $key => $value ) {
638 638
 
639
-			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) {
639
+			if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) {
640 640
 				continue;
641 641
 			}
642 642
 
643 643
 			$filter_key = $this->convert_request_key_to_filter_key( $key );
644 644
 
645 645
 			// could return simple filter or multiple filters
646
-			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) {
646
+			if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) {
647 647
 				continue;
648 648
 			}
649 649
 
650 650
 			$filter = $this->prepare_field_filter( $filter_key, $value, $view );
651 651
 
652
-			if ( isset( $filter[0]['value'] ) ) {
653
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
652
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
653
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
654 654
 
655 655
 				// if date range type, set search mode to ALL
656
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
656
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
657 657
 					$mode = 'all';
658 658
 				}
659
-			} elseif( !empty( $filter ) ) {
660
-				$search_criteria['field_filters'][] = $filter;
659
+			} elseif ( ! empty( $filter ) ) {
660
+				$search_criteria[ 'field_filters' ][ ] = $filter;
661 661
 			}
662 662
 		}
663 663
 
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 		 * @since 1.5.1
667 667
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
668 668
 		 */
669
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
669
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
670 670
 
671 671
 		gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) );
672 672
 
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 		$field_id = str_replace( 'filter_', '', $key );
695 695
 
696 696
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
697
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
697
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
698 698
 			$field_id = str_replace( '_', '.', $field_id );
699 699
 		}
700 700
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 
730 730
 			case 'select':
731 731
 			case 'radio':
732
-				$filter['operator'] = 'is';
732
+				$filter[ 'operator' ] = 'is';
733 733
 				break;
734 734
 
735 735
 			case 'post_category':
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 
744 744
 				foreach ( $value as $val ) {
745 745
 					$cat = get_term( $val, 'category' );
746
-					$filter[] = array(
746
+					$filter[ ] = array(
747 747
 						'key'      => $filter_key,
748 748
 						'value'    => esc_attr( $cat->name ) . ':' . $val,
749 749
 						'operator' => 'is',
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 				$filter = array();
763 763
 
764 764
 				foreach ( $value as $val ) {
765
-					$filter[] = array( 'key' => $filter_key, 'value' => $val );
765
+					$filter[ ] = array( 'key' => $filter_key, 'value' => $val );
766 766
 				}
767 767
 
768 768
 				break;
@@ -771,9 +771,9 @@  discard block
 block discarded – undo
771 771
 				// convert checkbox on/off into the correct search filter
772 772
 				if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) {
773 773
 					foreach ( $form_field->inputs as $k => $input ) {
774
-						if ( $input['id'] == $filter_key ) {
775
-							$filter['value'] = $form_field->choices[ $k ]['value'];
776
-							$filter['operator'] = 'is';
774
+						if ( $input[ 'id' ] == $filter_key ) {
775
+							$filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ];
776
+							$filter[ 'operator' ] = 'is';
777 777
 							break;
778 778
 						}
779 779
 					}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 					$filter = array();
784 784
 
785 785
 					foreach ( $value as $val ) {
786
-						$filter[] = array(
786
+						$filter[ ] = array(
787 787
 							'key'      => $filter_key,
788 788
 							'value'    => $val,
789 789
 							'operator' => 'is',
@@ -804,9 +804,9 @@  discard block
 block discarded – undo
804 804
 					foreach ( $words as $word ) {
805 805
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
806 806
 							// Keep the same key for each filter
807
-							$filter['value'] = $word;
807
+							$filter[ 'value' ] = $word;
808 808
 							// Add a search for the value
809
-							$filters[] = $filter;
809
+							$filters[ ] = $filter;
810 810
 						}
811 811
 					}
812 812
 
@@ -820,19 +820,19 @@  discard block
 block discarded – undo
820 820
 
821 821
 					foreach ( $searchable_fields as $searchable_field ) {
822 822
 
823
-						if( $form_field->ID !== $searchable_field['field'] ) {
823
+						if ( $form_field->ID !== $searchable_field[ 'field' ] ) {
824 824
 							continue;
825 825
 						}
826 826
 
827 827
 						// Only exact-match dropdowns, not text search
828
-						if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) {
828
+						if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) {
829 829
 							continue;
830 830
 						}
831 831
 
832 832
 						$input_id = gravityview_get_input_id_from_id( $form_field->ID );
833 833
 
834 834
 						if ( 4 === $input_id ) {
835
-							$filter['operator'] = 'is';
835
+							$filter[ 'operator' ] = 'is';
836 836
 						};
837 837
 					}
838 838
 				}
@@ -857,19 +857,19 @@  discard block
 block discarded – undo
857 857
 						 * @since 1.16.3
858 858
 						 * Safeguard until GF implements '<=' operator
859 859
 						 */
860
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
860
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
861 861
 							$operator = '<';
862 862
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
863 863
 						}
864 864
 
865
-						$filter[] = array(
865
+						$filter[ ] = array(
866 866
 							'key'      => $filter_key,
867 867
 							'value'    => self::get_formatted_date( $date, 'Y-m-d' ),
868 868
 							'operator' => $operator,
869 869
 						);
870 870
 					}
871 871
 				} else {
872
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
872
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
873 873
 				}
874 874
 
875 875
 				break;
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 			'ymd_dot' => 'Y.m.d',
901 901
 		);
902 902
 
903
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
903
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
904 904
 			$format = $datepicker[ $field->dateFormat ];
905 905
 		}
906 906
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 	public function add_template_path( $file_paths ) {
932 932
 
933 933
 		// Index 100 is the default GravityView template path.
934
-		$file_paths[102] = self::$file . 'templates/';
934
+		$file_paths[ 102 ] = self::$file . 'templates/';
935 935
 
936 936
 		return $file_paths;
937 937
 	}
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 		$has_date = false;
951 951
 
952 952
 		foreach ( $search_fields as $k => $field ) {
953
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
953
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
954 954
 				$has_date = true;
955 955
 				break;
956 956
 			}
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 		}
978 978
 
979 979
 		// get configured search fields
980
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
980
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
981 981
 
982 982
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
983 983
 			gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) );
@@ -992,34 +992,34 @@  discard block
 block discarded – undo
992 992
 
993 993
 			$updated_field = $this->get_search_filter_details( $updated_field );
994 994
 
995
-			switch ( $field['field'] ) {
995
+			switch ( $field[ 'field' ] ) {
996 996
 
997 997
 				case 'search_all':
998
-					$updated_field['key'] = 'search_all';
999
-					$updated_field['input'] = 'search_all';
1000
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
998
+					$updated_field[ 'key' ] = 'search_all';
999
+					$updated_field[ 'input' ] = 'search_all';
1000
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
1001 1001
 					break;
1002 1002
 
1003 1003
 				case 'entry_date':
1004
-					$updated_field['key'] = 'entry_date';
1005
-					$updated_field['input'] = 'entry_date';
1006
-					$updated_field['value'] = array(
1004
+					$updated_field[ 'key' ] = 'entry_date';
1005
+					$updated_field[ 'input' ] = 'entry_date';
1006
+					$updated_field[ 'value' ] = array(
1007 1007
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
1008 1008
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
1009 1009
 					);
1010 1010
 					break;
1011 1011
 
1012 1012
 				case 'entry_id':
1013
-					$updated_field['key'] = 'entry_id';
1014
-					$updated_field['input'] = 'entry_id';
1015
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
1013
+					$updated_field[ 'key' ] = 'entry_id';
1014
+					$updated_field[ 'input' ] = 'entry_id';
1015
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
1016 1016
 					break;
1017 1017
 
1018 1018
 				case 'created_by':
1019
-					$updated_field['key'] = 'created_by';
1020
-					$updated_field['name'] = 'gv_by';
1021
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
1022
-					$updated_field['choices'] = self::get_created_by_choices();
1019
+					$updated_field[ 'key' ] = 'created_by';
1020
+					$updated_field[ 'name' ] = 'gv_by';
1021
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
1022
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
1023 1023
 					break;
1024 1024
 			}
1025 1025
 
@@ -1038,16 +1038,16 @@  discard block
 block discarded – undo
1038 1038
 		 */
1039 1039
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context );
1040 1040
 
1041
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
1041
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
1042 1042
 
1043 1043
 		/** @since 1.14 */
1044
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
1044
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
1045 1045
 
1046
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
1046
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
1047 1047
 
1048 1048
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
1049 1049
 
1050
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
1050
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
1051 1051
 
1052 1052
 		if ( $this->has_date_field( $search_fields ) ) {
1053 1053
 			// enqueue datepicker stuff only if needed!
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
 	public static function get_search_class( $custom_class = '' ) {
1070 1070
 		$gravityview_view = GravityView_View::getInstance();
1071 1071
 
1072
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
1072
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
1073 1073
 
1074
-		if ( ! empty( $custom_class )  ) {
1075
-			$search_class .= ' '.$custom_class;
1074
+		if ( ! empty( $custom_class ) ) {
1075
+			$search_class .= ' ' . $custom_class;
1076 1076
 		}
1077 1077
 
1078 1078
 		/**
@@ -1116,9 +1116,9 @@  discard block
 block discarded – undo
1116 1116
 
1117 1117
 		if ( ! $label ) {
1118 1118
 
1119
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
1119
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
1120 1120
 
1121
-			switch( $field['field'] ) {
1121
+			switch ( $field[ 'field' ] ) {
1122 1122
 				case 'search_all':
1123 1123
 					$label = __( 'Search Entries:', 'gravityview' );
1124 1124
 					break;
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 					break;
1131 1131
 				default:
1132 1132
 					// If this is a field input, not a field
1133
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
1133
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
1134 1134
 
1135 1135
 						// Get the label for the field in question, which returns an array
1136
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
1136
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
1137 1137
 
1138 1138
 						// Get the item with the `label` key
1139 1139
 						$values = wp_list_pluck( $items, 'label' );
@@ -1172,32 +1172,32 @@  discard block
 block discarded – undo
1172 1172
 		$form = $gravityview_view->getForm();
1173 1173
 
1174 1174
 		// for advanced field ids (eg, first name / last name )
1175
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1175
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1176 1176
 
1177 1177
 		// get searched value from $_GET/$_POST (string or array)
1178 1178
 		$value = $this->rgget_or_rgpost( $name );
1179 1179
 
1180 1180
 		// get form field details
1181
-		$form_field = gravityview_get_field( $form, $field['field'] );
1181
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1182 1182
 
1183 1183
 		$filter = array(
1184
-			'key' => $field['field'],
1184
+			'key' => $field[ 'field' ],
1185 1185
 			'name' => $name,
1186 1186
 			'label' => self::get_field_label( $field, $form_field ),
1187
-			'input' => $field['input'],
1187
+			'input' => $field[ 'input' ],
1188 1188
 			'value' => $value,
1189
-			'type' => $form_field['type'],
1189
+			'type' => $form_field[ 'type' ],
1190 1190
 		);
1191 1191
 
1192 1192
 		// collect choices
1193
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1194
-			$filter['choices'] = gravityview_get_terms_choices();
1195
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1196
-			$filter['choices'] = $form_field['choices'];
1193
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1194
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1195
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1196
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1197 1197
 		}
1198 1198
 
1199
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1200
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1199
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1200
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1201 1201
 		}
1202 1202
 
1203 1203
 		return $filter;
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 
1222 1222
 		$choices = array();
1223 1223
 		foreach ( $users as $user ) {
1224
-			$choices[] = array(
1224
+			$choices[ ] = array(
1225 1225
 				'value' => $user->ID,
1226 1226
 				'text' => $user->display_name,
1227 1227
 			);
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 	 */
1277 1277
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1278 1278
 
1279
-		$js_dependencies[] = 'jquery-ui-datepicker';
1279
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1280 1280
 
1281 1281
 		return $js_dependencies;
1282 1282
 	}
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 			'isRTL'             => is_rtl(),
1321 1321
 		), $view_data );
1322 1322
 
1323
-		$localizations['datepicker'] = $datepicker_settings;
1323
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1324 1324
 
1325 1325
 		return $localizations;
1326 1326
 
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 	 * @return void
1348 1348
 	 */
1349 1349
 	private function maybe_enqueue_flexibility() {
1350
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1350
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1351 1351
 			wp_enqueue_script( 'gv-flexibility' );
1352 1352
 		}
1353 1353
 	}
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1370 1370
 
1371 1371
 		$scheme = is_ssl() ? 'https://' : 'http://';
1372
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1372
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1373 1373
 
1374 1374
 		/**
1375 1375
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-item.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected $form_id;
46 46
 
47
-	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null) {
47
+	function __construct( $title = '', $item_id, $item = array(), $settings = array(), $form_id = null ) {
48 48
 
49 49
 		// Backward compat
50
-		if ( ! empty( $item['type'] ) ) {
51
-			$item['input_type'] = $item['type'];
52
-			unset( $item['type'] );
50
+		if ( ! empty( $item[ 'type' ] ) ) {
51
+			$item[ 'input_type' ] = $item[ 'type' ];
52
+			unset( $item[ 'type' ] );
53 53
 		}
54 54
 
55 55
 		// Prevent items from not having index set
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		$this->id         = $item_id;
72 72
 		$this->form_id    = $form_id;
73 73
 		$this->settings   = $settings;
74
-		$this->label_type = $item['label_type'];
74
+		$this->label_type = $item[ 'label_type' ];
75 75
 	}
76 76
 
77 77
 	/**
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 		if ( $html ) {
115 115
 
116 116
 			foreach ( $field_info_items as $item ) {
117
-				$class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description';
117
+				$class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description';
118 118
 				// Add the title in case the value's long, in which case, it'll be truncated by CSS.
119 119
 				$output .= '<span class="' . $class . '">';
120
-				$output .= esc_html( $item['value'] );
120
+				$output .= esc_html( $item[ 'value' ] );
121 121
 				$output .= '</span>';
122 122
 			}
123 123
 
@@ -145,29 +145,29 @@  discard block
 block discarded – undo
145 145
 
146 146
 		// $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know.
147 147
 		// TODO: Un-hack this
148
-		$hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
148
+		$hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : '';
149 149
 		$settings_link      = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) );
150 150
 
151 151
 		// Should we show the icon that the field is being used as a link to single entry?
152
-		$hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : '';
152
+		$hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : '';
153 153
 		$show_as_link            = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>';
154 154
 
155 155
 		// When a field label is empty, use the Field ID
156 156
 		$label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title;
157 157
 
158 158
 		// If there's a custom label, and show label is checked, use that as the field heading
159
-		if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) {
160
-			$label = $this->settings['custom_label'];
161
-		} else if ( ! empty( $this->item['customLabel'] ) ) {
162
-			$label = $this->item['customLabel'];
159
+		if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) {
160
+			$label = $this->settings[ 'custom_label' ];
161
+		} else if ( ! empty( $this->item[ 'customLabel' ] ) ) {
162
+			$label = $this->item[ 'customLabel' ];
163 163
 		}
164 164
 
165 165
 		$output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">';
166 166
 
167 167
 		$label = esc_attr( $label );
168 168
 
169
-		if ( ! empty( $this->item['parent'] ) ) {
170
-			$label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>';
169
+		if ( ! empty( $this->item[ 'parent' ] ) ) {
170
+			$label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>';
171 171
 		}
172 172
 
173 173
 		// Name of field / widget
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 
184 184
 		$output .= '</h5>';
185 185
 
186
-		$container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : '';
187
-		$data_form_id   = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
186
+		$container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : '';
187
+		$data_form_id = ! empty( $this->form_id ) ? 'data-formid="' . esc_attr( $this->form_id ) . '"' : '';
188 188
 
189
-		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>';
189
+		$output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>';
190 190
 
191 191
 		return $output;
192 192
 	}
Please login to merge, or discard this patch.
includes/admin/metaboxes/views/view-configuration.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,32 +10,32 @@  discard block
 block discarded – undo
10 10
 
11 11
 		<div id="directory-fields" class="gv-section">
12 12
 
13
-			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview'); ?></span></h4>
13
+			<h4><?php esc_html_e( 'Above Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown above entries.', 'gravityview' ); ?></span></h4>
14 14
 
15
-			<?php do_action('gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
15
+			<?php do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'header', $post->ID ); ?>
16 16
 
17
-			<h4><?php esc_html_e( 'Entries Fields', 'gravityview'); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview'); ?></span></h4>
17
+			<h4><?php esc_html_e( 'Entries Fields', 'gravityview' ); ?> <span><?php esc_html_e( 'These fields will be shown for each entry.', 'gravityview' ); ?></span></h4>
18 18
 
19 19
 			<div id="directory-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
20
-				<?php if(!empty( $curr_template ) ) {
21
-					do_action('gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
20
+				<?php if ( ! empty( $curr_template ) ) {
21
+					do_action( 'gravityview_render_directory_active_areas', $curr_template, 'directory', $post->ID, true );
22 22
 				} ?>
23 23
 			</div>
24 24
 
25
-			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview'); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview'); ?></span></h4>
25
+			<h4><?php esc_html_e( 'Below Entries Widgets', 'gravityview' ); ?> <span><?php esc_html_e( 'These widgets will be shown below entries.', 'gravityview' ); ?></span></h4>
26 26
 
27 27
 			<?php
28 28
 
29
-                do_action('gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
29
+                do_action( 'gravityview_render_widgets_active_areas', $curr_template, 'footer', $post->ID );
30 30
 
31
-    			do_action('gravityview_render_field_pickers', 'directory' );
31
+    			do_action( 'gravityview_render_field_pickers', 'directory' );
32 32
 
33 33
             ?>
34 34
 
35 35
 			<?php // list of available widgets to be shown in the popup ?>
36 36
             <div id="directory-available-widgets" class="hide-if-js gv-tooltip">
37 37
                 <span class="close"><i class="dashicons dashicons-dismiss"></i></span>
38
-				<?php do_action('gravityview_render_available_widgets' ); ?>
38
+				<?php do_action( 'gravityview_render_available_widgets' ); ?>
39 39
             </div>
40 40
 
41 41
 		</div>
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 
52 52
 		<div id="single-fields" class="gv-section">
53 53
 
54
-			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview'); ?></h4>
54
+			<h4><?php esc_html_e( 'These fields will be shown in Single Entry view.', 'gravityview' ); ?></h4>
55 55
 
56 56
 			<div id="single-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
57 57
 				<?php
58
-                if(!empty( $curr_template ) ) {
59
-				    do_action('gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
58
+                if ( ! empty( $curr_template ) ) {
59
+				    do_action( 'gravityview_render_directory_active_areas', $curr_template, 'single', $post->ID, true );
60 60
                 }
61 61
 			    ?>
62 62
 			</div>
63 63
             <?php
64
-                do_action('gravityview_render_field_pickers', 'single' );
64
+                do_action( 'gravityview_render_field_pickers', 'single' );
65 65
 			?>
66 66
 		</div>
67 67
 
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 
72 72
 		<div id="edit-fields" class="gv-section">
73 73
 
74
-			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview'); ?> <span><?php esc_html_e('If not configured, all form fields will be displayed.', 'gravityview'); ?></span></h4>
74
+			<h4><?php esc_html_e( 'Fields shown when editing an entry.', 'gravityview' ); ?> <span><?php esc_html_e( 'If not configured, all form fields will be displayed.', 'gravityview' ); ?></span></h4>
75 75
 
76 76
 			<div id="edit-active-fields" class="gv-grid gv-grid-pad gv-grid-border">
77 77
 				<?php
78
-				do_action('gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
78
+				do_action( 'gravityview_render_directory_active_areas', apply_filters( 'gravityview/template/edit', 'default_table_edit' ), 'edit', $post->ID, true );
79 79
 				?>
80 80
 			</div>
81 81
 
82 82
 			<?php
83
-			    do_action('gravityview_render_field_pickers', 'edit' );
83
+			    do_action( 'gravityview_render_field_pickers', 'edit' );
84 84
 			?>
85 85
 
86 86
 		</div>
Please login to merge, or discard this patch.
future/includes/class-gv-template-legacy-override.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 		$additional = array();
99 99
 
100 100
 		// form-19-table-body.php
101
-		$additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
101
+		$additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name );
102 102
 
103 103
 		// view-3-table-body.php
104
-		$additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
104
+		$additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name );
105 105
 
106 106
 		global $post;
107 107
 		if ( $post ) {
108 108
 			// page-19-table-body.php
109
-			$additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
109
+			$additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name );
110 110
 		}
111 111
 
112 112
 		// Combine with existing table-body.php and table.php
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		ob_start();
131 131
 
132 132
 		$request = new Mock_Request();
133
-		$request->returns['is_view'] = $this->view;
133
+		$request->returns[ 'is_view' ] = $this->view;
134 134
 
135 135
 		/**
136 136
 		 * You got one shot. One opportunity. To render all the widgets you have ever wanted.
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 		foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) {
145 145
 			/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
146 146
 			if ( is_array( $wp_filter[ $hook ] ) ) {
147
-				if ( ! empty( $wp_filter[ $hook ][10] ) ) {
148
-					foreach ( $wp_filter[ $hook ][10] as $function_key => $callback ) {
147
+				if ( ! empty( $wp_filter[ $hook ][ 10 ] ) ) {
148
+					foreach ( $wp_filter[ $hook ][ 10 ] as $function_key => $callback ) {
149 149
 						if ( strpos( $function_key, 'render_widget_hooks' ) ) {
150
-							unset( $wp_filter[ $hook ][10][ $function_key ] );
150
+							unset( $wp_filter[ $hook ][ 10 ][ $function_key ] );
151 151
 						}
152 152
 					}
153 153
 				}
154 154
 			} else {
155
-				foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) {
155
+				foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) {
156 156
 					if ( strpos( $function_key, 'render_widget_hooks' ) ) {
157
-						unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] );
157
+						unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] );
158 158
 					}
159 159
 				}
160 160
 			}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		 */
166 166
 		if ( $this->entry ) {
167 167
 
168
-			$request->returns['is_entry'] = $this->entry;
168
+			$request->returns[ 'is_entry' ] = $this->entry;
169 169
 
170 170
 			global $post;
171 171
 
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 					'fields' => $this->view->fields->by_visible(),
210 210
 					'in_the_loop' => true,
211 211
 				), empty( $parameters ) ? array() : array(
212
-					'paging' => $parameters['paging'],
213
-					'sorting' => $parameters['sorting'],
212
+					'paging' => $parameters[ 'paging' ],
213
+					'sorting' => $parameters[ 'sorting' ],
214 214
 				), $post ? array(
215 215
 					'post' => $post,
216 216
 				) : array() ) );
Please login to merge, or discard this patch.
future/includes/class-gv-plugin.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * @var string The REST API functionality identifier.
86 86
 	 */
87
-	const FEATURE_REST  = 'rest_api';
87
+	const FEATURE_REST = 'rest_api';
88 88
 
89 89
 	/**
90 90
 	 * Get the global instance of \GV\Plugin.
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		include_once $this->dir( 'includes/class-frontend-views.php' );
211 211
 		include_once $this->dir( 'includes/class-gravityview-admin-bar.php' );
212 212
 		include_once $this->dir( 'includes/class-gravityview-entry-list.php' );
213
-		include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */
213
+		include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */
214 214
 		include_once $this->dir( 'includes/class-data.php' );
215 215
 		include_once $this->dir( 'includes/class-gravityview-shortcode.php' );
216 216
 		include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' );
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 
245 245
 			$locale = get_locale();
246 246
 
247
-			if ( function_exists('get_user_locale') && is_admin() ) {
247
+			if ( function_exists( 'get_user_locale' ) && is_admin() ) {
248 248
 				$locale = get_user_locale();
249 249
 			}
250 250
 
251 251
 			$locale = apply_filters( 'plugin_locale', $locale, 'gravityview' );
252
-			$mofile = $this->dir( 'languages' ) . '/gravityview-'. $locale .'.mo';
252
+			$mofile = $this->dir( 'languages' ) . '/gravityview-' . $locale . '.mo';
253 253
 			load_textdomain( 'gravityview', $mofile );
254 254
 		}
255 255
 	}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function is_compatible_wordpress( $version = null ) {
384 384
 
385
-		if( ! $version ) {
385
+		if ( ! $version ) {
386 386
 			$version = self::$min_wp_version;
387 387
 		}
388 388
 
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 	 * @return string The version of PHP.
424 424
 	 */
425 425
 	private function get_php_version() {
426
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
427
-			$GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
426
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ?
427
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion();
428 428
 	}
429 429
 
430 430
 	/**
@@ -435,8 +435,8 @@  discard block
 block discarded – undo
435 435
 	 * @return string The version of WordPress.
436 436
 	 */
437 437
 	private function get_wordpress_version() {
438
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
439
-			$GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
438
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ?
439
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ];
440 440
 	}
441 441
 
442 442
 	/**
@@ -447,13 +447,13 @@  discard block
 block discarded – undo
447 447
 	 * @return string|null The version of Gravity Forms or null if inactive.
448 448
 	 */
449 449
 	private function get_gravityforms_version() {
450
-		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
450
+		if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) {
451 451
 			gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
452 452
 			return null;
453 453
 		}
454 454
 
455
-		return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
456
-			$GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
455
+		return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ?
456
+			$GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version;
457 457
 	}
458 458
 
459 459
 	/**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 		$tables = array();
510 510
 
511 511
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
512
-			$tables []= \GFFormsModel::get_entry_meta_table_name();
512
+			$tables [ ] = \GFFormsModel::get_entry_meta_table_name();
513 513
 		}
514
-		$tables []= \GFFormsModel::get_lead_meta_table_name();
514
+		$tables [ ] = \GFFormsModel::get_lead_meta_table_name();
515 515
 
516 516
 		foreach ( $tables as $meta_table ) {
517 517
 			$sql = "
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 		$tables = array();
530 530
 
531 531
 		if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
532
-			$tables[] = \GFFormsModel::get_entry_notes_table_name();
532
+			$tables[ ] = \GFFormsModel::get_entry_notes_table_name();
533 533
 		}
534 534
 
535
-		$tables[] = \GFFormsModel::get_lead_notes_table_name();
535
+		$tables[ ] = \GFFormsModel::get_lead_notes_table_name();
536 536
 
537
-		$disapproved = __('Disapproved the Entry for GravityView', 'gravityview');
538
-		$approved = __('Approved the Entry for GravityView', 'gravityview');
537
+		$disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' );
538
+		$approved = __( 'Approved the Entry for GravityView', 'gravityview' );
539 539
 
540 540
 		$suppress = $wpdb->suppress_errors();
541 541
 		foreach ( $tables as $notes_table ) {
Please login to merge, or discard this patch.
future/includes/class-gv-renderer-entry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 
45 45
 
46 46
 		/** Entry does not belong to this view. */
47
-		if ( $view->form && $view->form->ID != $entry['form_id'] ) {
47
+		if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) {
48 48
 			gravityview()->log->error( 'The requested entry does not belong to this View. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) );
49 49
 			return null;
50 50
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-form-gravityforms.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		$self = new self();
56 56
 		$self->form = $form;
57 57
 
58
-		$self->ID = intval( $self->form['id'] );
58
+		$self->ID = intval( $self->form[ 'id' ] );
59 59
 
60 60
 		return $self;
61 61
 	}
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 * @return \GV\GF_Form|null An instance of this form or null if not found.
71 71
 	 */
72 72
 	public static function from_form( $form ) {
73
-		if ( empty( $form['id'] ) ) {
73
+		if ( empty( $form[ 'id' ] ) ) {
74 74
 			return null;
75 75
 		}
76 76
 
77 77
 		$self = new self();
78 78
 		$self->form = $form;
79
-		$self->ID = $self->form['id'];
79
+		$self->ID = $self->form[ 'id' ];
80 80
 
81 81
 		return $self;
82 82
 	}
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
 			/** The offset and limit */
121 121
 			if ( ! empty( $offset->limit ) ) {
122
-				$paging['page_size'] = $offset->limit;
122
+				$paging[ 'page_size' ] = $offset->limit;
123 123
 			}
124 124
 
125 125
 			if ( ! empty( $offset->offset ) ) {
126
-				$paging['offset'] = $offset->offset;
126
+				$paging[ 'offset' ] = $offset->offset;
127 127
 			}
128 128
 
129 129
 			foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) {
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function get_fields() {
182 182
 		$fields = array();
183
-		foreach ( $this['fields'] as $field ) {
184
-			foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) {
183
+		foreach ( $this[ 'fields' ] as $field ) {
184
+			foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) {
185 185
 				if ( is_numeric( $id ) ) {
186 186
 					$fields[ $id ] = self::get_field( $this, $id );
187 187
 				} else {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool Whether the offset exists or not.
219 219
 	 */
220 220
 	public function offsetExists( $offset ) {
221
-		return isset( $this->form[$offset] );
221
+		return isset( $this->form[ $offset ] );
222 222
 	}
223 223
 
224 224
 	/**
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 * @return mixed The value of the requested form data.
234 234
 	 */
235 235
 	public function offsetGet( $offset ) {
236
-		return $this->form[$offset];
236
+		return $this->form[ $offset ];
237 237
 	}
238 238
 
239 239
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-entry-gravityforms.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 	 * @return \GV\GF_Entry|null An instance of this entry or null if not found.
106 106
 	 */
107 107
 	public static function from_entry( $entry ) {
108
-		if ( empty( $entry['id'] ) ) {
108
+		if ( empty( $entry[ 'id' ] ) ) {
109 109
 			return null;
110 110
 		}
111 111
 
112 112
 		$self = new self();
113 113
 		$self->entry = $entry;
114 114
 
115
-		$self->ID = $self->entry['id'];
115
+		$self->ID = $self->entry[ 'id' ];
116 116
 		$self->slug = \GravityView_API::get_entry_slug( $self->ID, $self->as_entry() );
117 117
 
118 118
 		return $self;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return bool Whether the offset exists or not.
128 128
 	 */
129 129
 	public function offsetExists( $offset ) {
130
-		return isset( $this->entry[$offset] );
130
+		return isset( $this->entry[ $offset ] );
131 131
 	}
132 132
 
133 133
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return mixed The value of the requested entry data.
143 143
 	 */
144 144
 	public function offsetGet( $offset ) {
145
-		return $this->entry[$offset];
145
+		return $this->entry[ $offset ];
146 146
 	}
147 147
 
148 148
 	/**
Please login to merge, or discard this patch.