Completed
Push — develop ( 365b4b...6c202f )
by Zack
04:37
created
includes/fields/class-gravityview-fields.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	/**
78 78
 	 * Alias for get_instance()
79 79
 	 *
80
-	 * @param $field_name
80
+	 * @param string $field_name
81 81
 	 *
82 82
 	 * @return GravityView_Field
83 83
 	 */
Please login to merge, or discard this patch.
includes/class-frontend-views.php 2 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 	/**
155 155
 	 * Sets the single entry ID and also the entry
156
-	 * @param bool|int|string $single_entry
156
+	 * @param boolean|string $single_entry
157 157
 	 */
158 158
 	public function setSingleEntry( $single_entry ) {
159 159
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 	/**
172 172
 	 * Set the current entry
173
-	 * @param array|int $entry Entry array or entry slug or ID
173
+	 * @param boolean|string $entry Entry array or entry slug or ID
174 174
 	 */
175 175
 	public function setEntry( $entry ) {
176 176
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *
229 229
 	 *
230 230
 	 *
231
-	 * @param null $view_id
231
+	 * @param string $view_id
232 232
 	 */
233 233
 	public function set_context_view_id( $view_id = null ) {
234 234
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 *
1106 1106
 	 * @uses  gravityview_get_entries()
1107 1107
 	 * @access public
1108
-	 * @param array $args\n
1108
+	 * @param array $args
1109 1109
 	 *   - $id - View id
1110 1110
 	 *   - $page_size - Page
1111 1111
 	 *   - $sort_field - form field id to sort
@@ -1193,7 +1193,6 @@  discard block
 block discarded – undo
1193 1193
 	 * @since 1.19.5
1194 1194
 	 *
1195 1195
 	 * @param $args
1196
-	 * @param int $form_id
1197 1196
 	 */
1198 1197
 	public static function get_search_criteria_paging( $args ) {
1199 1198
 
@@ -1588,7 +1587,7 @@  discard block
 block discarded – undo
1588 1587
 	/**
1589 1588
 	 * Checks if field (column) is sortable
1590 1589
 	 *
1591
-	 * @param string $field Field settings
1590
+	 * @param string $field_id Field settings
1592 1591
 	 * @param array $form Gravity Forms form array
1593 1592
 	 *
1594 1593
 	 * @since 1.7
Please login to merge, or discard this patch.
Spacing   +114 added lines, -114 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,15 +236,15 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 * @see GravityView_View_Data::getInstance()->has_multiple_views()
244 244
 			 */
245
-			$this->context_view_id = $_GET['gvid'];
245
+			$this->context_view_id = $_GET[ 'gvid' ];
246 246
 
247
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
247
+		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) {
248 248
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
249 249
 			$this->context_view_id = array_pop( $array_keys );
250 250
 			unset( $array_keys );
@@ -279,24 +279,24 @@  discard block
 block discarded – undo
279 279
 		global $wp_rewrite;
280 280
 
281 281
 		$is_front_page = ( $query->is_home || $query->is_page );
282
-		$show_on_front = ( 'page' === get_option('show_on_front') );
283
-		$front_page_id = get_option('page_on_front');
282
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
283
+		$front_page_id = get_option( 'page_on_front' );
284 284
 
285
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
285
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
286 286
 
287 287
 			// Force to be an array, potentially a query string ( entry=16 )
288 288
 			$_query = wp_parse_args( $query->query );
289 289
 
290 290
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
291
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
292
-				unset( $_query['pagename'] );
291
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
292
+				unset( $_query[ 'pagename' ] );
293 293
 			}
294 294
 
295 295
 			// this is where will break from core wordpress
296 296
 			$ignore = array( 'preview', 'page', 'paged', 'cpage' );
297 297
 			$endpoints = rgobj( $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
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		global $post;
339 339
 
340 340
 		// If in admin and NOT AJAX request, get outta here.
341
-		if ( GravityView_Plugin::is_admin() )  {
341
+		if ( GravityView_Plugin::is_admin() ) {
342 342
 			return;
343 343
 		}
344 344
 
@@ -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;
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
442 442
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
443 443
 		 * @param array $entry Current entry
444 444
 		 */
445
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
445
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
446 446
 
447 447
 		if ( ! $apply_outside_loop ) {
448 448
 			return $title;
449 449
 		}
450 450
 
451 451
 		// User reported WooCommerce doesn't pass two args.
452
-		if ( empty( $passed_post_id ) )  {
452
+		if ( empty( $passed_post_id ) ) {
453 453
 			return $title;
454 454
 		}
455 455
 
456 456
 		// Don't modify the title for anything other than the current view/post.
457 457
 		// This is true for embedded shortcodes and Views.
458
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
458
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
459 459
 			return $title;
460 460
 		}
461 461
 
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
466 466
 		} else {
467 467
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
468
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
468
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
469 469
 					$view_meta = $view_data;
470 470
 					break;
471 471
 				}
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
475
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
476 476
 
477
-			$title = $view_meta['atts']['single_title'];
477
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
478 478
 
479 479
 			// We are allowing HTML in the fields, so no escaping the output
480
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
480
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
481 481
 
482 482
 			$title = do_shortcode( $title );
483 483
 		}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		}
514 514
 
515 515
 		// Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar
516
-		if( ! in_the_loop() ) {
516
+		if ( ! in_the_loop() ) {
517 517
 			return $content;
518 518
 		}
519 519
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$context = GravityView_View::getInstance()->getContext();
583 583
 
584
-		switch( $context ) {
584
+		switch ( $context ) {
585 585
 			case 'directory':
586 586
 				$tab = __( 'Multiple Entries', 'gravityview' );
587 587
 				break;
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 		}
596 596
 
597 597
 
598
-		$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 );
598
+		$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 );
599 599
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
600
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
600
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
601 601
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
602 602
 
603 603
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	public function render_view( $passed_args ) {
631 631
 
632 632
 		// validate attributes
633
-		if ( empty( $passed_args['id'] ) ) {
633
+		if ( empty( $passed_args[ 'id' ] ) ) {
634 634
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
635 635
 			return null;
636 636
 		}
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 			return null;
653 653
 		}
654 654
 
655
-		$view_id = $passed_args['id'];
655
+		$view_id = $passed_args[ 'id' ];
656 656
 
657 657
 		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
658 658
 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 		$passed_args = array_filter( $passed_args, 'strlen' );
666 666
 
667 667
 		//Override shortcode args over View template settings
668
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
668
+		$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
669 669
 
670 670
 		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
671 671
 
@@ -688,14 +688,14 @@  discard block
 block discarded – undo
688 688
 		 * @since 1.15
689 689
 		 * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out.
690 690
 		 */
691
-		if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
691
+		if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
692 692
 
693 693
 			do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) );
694 694
 
695 695
 			return null;
696 696
 		}
697 697
 
698
-		if( $this->isGravityviewPostType() ) {
698
+		if ( $this->isGravityviewPostType() ) {
699 699
 
700 700
 			/**
701 701
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -707,9 +707,9 @@  discard block
 block discarded – undo
707 707
 			 */
708 708
 			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
709 709
 
710
-			$embed_only = ! empty( $atts['embed_only'] );
710
+			$embed_only = ! empty( $atts[ 'embed_only' ] );
711 711
 
712
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
712
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
713 713
 				return __( 'You are not allowed to view this content.', 'gravityview' );
714 714
 			}
715 715
 		}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
 		$gravityview_view = new GravityView_View( $view_data );
726 726
 
727
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
727
+		$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId();
728 728
 
729 729
 		$gravityview_view->setPostId( $post_id );
730 730
 
@@ -734,20 +734,20 @@  discard block
 block discarded – undo
734 734
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
735 735
 
736 736
 			//fetch template and slug
737
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
737
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' );
738 738
 
739 739
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
740 740
 
741 741
 			/**
742 742
 			 * Disable fetching initial entries for views that don't need it (DataTables)
743 743
 			 */
744
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
744
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
745 745
 
746 746
 			/**
747 747
 			 * Hide View data until search is performed
748 748
 			 * @since 1.5.4
749 749
 			 */
750
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
750
+			if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) {
751 751
 				$gravityview_view->setHideUntilSearched( true );
752 752
 				$get_entries = false;
753 753
 			}
@@ -755,23 +755,23 @@  discard block
 block discarded – undo
755 755
 
756 756
 			if ( $get_entries ) {
757 757
 
758
-				if ( ! empty( $atts['sort_columns'] ) ) {
758
+				if ( ! empty( $atts[ 'sort_columns' ] ) ) {
759 759
 					// add filter to enable column sorting
760
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
760
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
761 761
 				}
762 762
 
763
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
763
+				$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
764 764
 
765
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
765
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
766 766
 
767 767
 			} else {
768 768
 
769 769
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
770 770
 
771
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
771
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
772 772
 			}
773 773
 
774
-			$gravityview_view->setPaging( $view_entries['paging'] );
774
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
775 775
 			$gravityview_view->setContext( 'directory' );
776 776
 			$sections = array( 'header', 'body', 'footer' );
777 777
 
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			 * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID
786 786
 			 * @since 1.17
787 787
 			 */
788
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
788
+			do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
789 789
 
790 790
 			$entry = $this->getEntry();
791 791
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 				do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' );
796 796
 
797 797
 				// Only display warning once when multiple Views are embedded
798
-				if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) {
798
+				if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) {
799 799
 					return null;
800 800
 				}
801 801
 
@@ -817,20 +817,20 @@  discard block
 block discarded – undo
817 817
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
818 818
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
819 819
 			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
820
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
820
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
821 821
 				return null;
822 822
 			}
823 823
 
824 824
 			//fetch template and slug
825
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
825
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' );
826 826
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
827 827
 
828 828
 			//fetch entry detail
829
-			$view_entries['count'] = 1;
830
-			$view_entries['entries'][] = $entry;
831
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
829
+			$view_entries[ 'count' ] = 1;
830
+			$view_entries[ 'entries' ][ ] = $entry;
831
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
832 832
 
833
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
833
+			$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
834 834
 
835 835
 			// set back link label
836 836
 			$gravityview_view->setBackLinkLabel( $back_link_label );
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
 		}
841 841
 
842 842
 		// add template style
843
-		self::add_style( $view_data['template_id'] );
843
+		self::add_style( $view_data[ 'template_id' ] );
844 844
 
845 845
 		// Prepare to render view and set vars
846
-		$gravityview_view->setEntries( $view_entries['entries'] );
847
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
846
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
847
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
848 848
 
849 849
 		// If Edit
850 850
 		if ( 'edit' === gravityview_get_context() ) {
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
 
858 858
 		} else {
859 859
 			// finaly we'll render some html
860
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
860
+			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] );
861 861
 
862 862
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
863 863
 			foreach ( $sections as $section ) {
864
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
864
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
865 865
 				$gravityview_view->render( $view_slug, $section, false );
866 866
 			}
867 867
 		}
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 				$datetime_format = 'Y-m-d H:i:s';
916 916
 				$search_is_outside_view_bounds = false;
917 917
 
918
-				if( ! empty( $search_criteria[ $key ] ) ) {
918
+				if ( ! empty( $search_criteria[ $key ] ) ) {
919 919
 
920 920
 					$search_date = strtotime( $search_criteria[ $key ] );
921 921
 
@@ -943,14 +943,14 @@  discard block
 block discarded – undo
943 943
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
944 944
 
945 945
 					// Then we override the search and re-set the start date
946
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
946
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
947 947
 				}
948 948
 			}
949 949
 		}
950 950
 
951
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
951
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
952 952
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
953
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
953
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
954 954
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
955 955
 			}
956 956
 		}
@@ -969,19 +969,19 @@  discard block
 block discarded – undo
969 969
 	public static function process_search_only_approved( $args, $search_criteria ) {
970 970
 
971 971
 		/** @since 1.19 */
972
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
972
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
973 973
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' );
974 974
 			return $search_criteria;
975 975
 		}
976 976
 
977
-		if ( ! empty( $args['show_only_approved'] ) ) {
977
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
978 978
 
979
-			$search_criteria['field_filters'][] = array(
979
+			$search_criteria[ 'field_filters' ][ ] = array(
980 980
 				'key' => GravityView_Entry_Approval::meta_key,
981 981
 				'value' => GravityView_Entry_Approval_Status::APPROVED
982 982
 			);
983 983
 
984
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
984
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
985 985
 
986 986
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
987 987
 		}
@@ -1008,18 +1008,18 @@  discard block
 block discarded – undo
1008 1008
 	 */
1009 1009
 	public static function is_entry_approved( $entry, $args = array() ) {
1010 1010
 
1011
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
1011
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
1012 1012
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
1013 1013
 			return true;
1014 1014
 		}
1015 1015
 
1016 1016
 		/** @since 1.19 */
1017
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1017
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1018 1018
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' );
1019 1019
 			return true;
1020 1020
 		}
1021 1021
 
1022
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
1022
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
1023 1023
 
1024 1024
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
1025 1025
 	}
@@ -1053,26 +1053,26 @@  discard block
 block discarded – undo
1053 1053
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
1054 1054
 
1055 1055
 		// implicity search
1056
-		if ( ! empty( $args['search_value'] ) ) {
1056
+		if ( ! empty( $args[ 'search_value' ] ) ) {
1057 1057
 
1058 1058
 			// Search operator options. Options: `is` or `contains`
1059
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
1059
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
1060 1060
 
1061
-			$search_criteria['field_filters'][] = array(
1061
+			$search_criteria[ 'field_filters' ][ ] = array(
1062 1062
 				'key' => rgget( 'search_field', $args ), // The field ID to search
1063
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
1063
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
1064 1064
 				'operator' => $operator,
1065 1065
 			);
1066 1066
 		}
1067 1067
 
1068
-		if( $search_criteria !== $original_search_criteria ) {
1068
+		if ( $search_criteria !== $original_search_criteria ) {
1069 1069
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
1070 1070
 		}
1071 1071
 
1072 1072
 		// Handle setting date range
1073 1073
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
1074 1074
 
1075
-		if( $search_criteria !== $original_search_criteria ) {
1075
+		if ( $search_criteria !== $original_search_criteria ) {
1076 1076
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
1077 1077
 		}
1078 1078
 
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1084 1084
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1085 1085
 		 */
1086
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1086
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1087 1087
 
1088 1088
 		return $search_criteria;
1089 1089
 	}
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 			'search_criteria' => $search_criteria,
1135 1135
 			'sorting' => self::updateViewSorting( $args, $form_id ),
1136 1136
 			'paging' => $paging,
1137
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1137
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1138 1138
 		);
1139 1139
 
1140 1140
 		/**
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1160 1160
 		 * @param array $args View configuration args.
1161 1161
 		 */
1162
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1162
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1163 1163
 
1164 1164
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters );
1165 1165
 
@@ -1205,16 +1205,16 @@  discard block
 block discarded – undo
1205 1205
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1206 1206
 
1207 1207
 		// Paging & offset
1208
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1208
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1209 1209
 
1210 1210
 		if ( -1 === $page_size ) {
1211 1211
 			$page_size = PHP_INT_MAX;
1212 1212
 		}
1213 1213
 
1214
-		if ( isset( $args['offset'] ) ) {
1215
-			$offset = intval( $args['offset'] );
1214
+		if ( isset( $args[ 'offset' ] ) ) {
1215
+			$offset = intval( $args[ 'offset' ] );
1216 1216
 		} else {
1217
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1217
+			$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1218 1218
 			$offset = ( $curr_page - 1 ) * $page_size;
1219 1219
 		}
1220 1220
 
@@ -1239,8 +1239,8 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public static function updateViewSorting( $args, $form_id ) {
1241 1241
 		$sorting = array();
1242
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1243
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1242
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1243
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1244 1244
 
1245 1245
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1246 1246
 
@@ -1280,11 +1280,11 @@  discard block
 block discarded – undo
1280 1280
 
1281 1281
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1282 1282
 
1283
-		if( ! $sort_field ) {
1283
+		if ( ! $sort_field ) {
1284 1284
 			return $sort_field_id;
1285 1285
 		}
1286 1286
 
1287
-		switch ( $sort_field['type'] ) {
1287
+		switch ( $sort_field[ 'type' ] ) {
1288 1288
 
1289 1289
 			case 'address':
1290 1290
 				// Sorting by full address
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 					 */
1302 1302
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1303 1303
 
1304
-					switch( strtolower( $address_part ) ){
1304
+					switch ( strtolower( $address_part ) ) {
1305 1305
 						case 'street':
1306 1306
 							$sort_field_id .= '.1';
1307 1307
 							break;
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 		 */
1387 1387
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1388 1388
 
1389
-		if ( empty( $single_entry ) ){
1389
+		if ( empty( $single_entry ) ) {
1390 1390
 			return false;
1391 1391
 		} else {
1392 1392
 			return $single_entry;
@@ -1413,7 +1413,7 @@  discard block
 block discarded – undo
1413 1413
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1414 1414
 				 * @since 1.15
1415 1415
 				 */
1416
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1416
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1417 1417
 					continue;
1418 1418
 				}
1419 1419
 
@@ -1422,19 +1422,19 @@  discard block
 block discarded – undo
1422 1422
 				$css_dependencies = array();
1423 1423
 
1424 1424
 				// If the thickbox is enqueued, add dependencies
1425
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1425
+				if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) {
1426 1426
 
1427 1427
 					/**
1428 1428
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1429 1429
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1430 1430
 					 */
1431
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1431
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1432 1432
 
1433 1433
 					/**
1434 1434
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1435 1435
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1436 1436
 					 */
1437
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1437
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1438 1438
 				}
1439 1439
 
1440 1440
 				/**
@@ -1442,25 +1442,25 @@  discard block
 block discarded – undo
1442 1442
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1443 1443
 				 * @since 1.15
1444 1444
 				 */
1445
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1446
-					$css_dependencies[] = 'dashicons';
1445
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1446
+					$css_dependencies[ ] = 'dashicons';
1447 1447
 				}
1448 1448
 
1449 1449
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1450 1450
 
1451 1451
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1452 1452
 
1453
-				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 );
1453
+				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 );
1454 1454
 
1455 1455
 				wp_enqueue_script( 'gravityview-fe-view' );
1456 1456
 
1457
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1457
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1458 1458
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1459 1459
 				}
1460 1460
 
1461 1461
 				$this->enqueue_default_style( $css_dependencies );
1462 1462
 
1463
-				self::add_style( $data['template_id'] );
1463
+				self::add_style( $data[ 'template_id' ] );
1464 1464
 			}
1465 1465
 
1466 1466
 			if ( 'wp_print_footer_scripts' === current_filter() ) {
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 		} elseif ( empty( $template_id ) ) {
1523 1523
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1524 1524
 		} else {
1525
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1525
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1526 1526
 		}
1527 1527
 
1528 1528
 	}
@@ -1547,11 +1547,11 @@  discard block
 block discarded – undo
1547 1547
 		 * Not a table-based template; don't add sort icons
1548 1548
 		 * @since 1.12
1549 1549
 		 */
1550
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1550
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1551 1551
 			return $label;
1552 1552
 		}
1553 1553
 
1554
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1554
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1555 1555
 			return $label;
1556 1556
 		}
1557 1557
 
@@ -1559,29 +1559,29 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
 		$class = 'gv-sort';
1561 1561
 
1562
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1562
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1563 1563
 
1564 1564
 		$sort_args = array(
1565
-			'sort' => $field['id'],
1565
+			'sort' => $field[ 'id' ],
1566 1566
 			'dir' => 'asc',
1567 1567
 		);
1568 1568
 
1569
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1569
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1570 1570
 			//toggle sorting direction.
1571
-			if ( 'asc' === $sorting['direction'] ) {
1572
-				$sort_args['dir'] = 'desc';
1571
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1572
+				$sort_args[ 'dir' ] = 'desc';
1573 1573
 				$class .= ' gv-icon-sort-desc';
1574 1574
 			} else {
1575
-				$sort_args['dir'] = 'asc';
1575
+				$sort_args[ 'dir' ] = 'asc';
1576 1576
 				$class .= ' gv-icon-sort-asc';
1577 1577
 			}
1578 1578
 		} else {
1579 1579
 			$class .= ' gv-icon-caret-up-down';
1580 1580
 		}
1581 1581
 
1582
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1582
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1583 1583
 
1584
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1584
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1585 1585
 
1586 1586
 	}
1587 1587
 
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 		$field_type = $field_id;
1601 1601
 
1602
-		if( is_numeric( $field_id ) ) {
1602
+		if ( is_numeric( $field_id ) ) {
1603 1603
 			$field = GFFormsModel::get_field( $form, $field_id );
1604 1604
 			$field_type = $field->type;
1605 1605
 		}
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 			return false;
1623 1623
 		}
1624 1624
 
1625
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1625
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1626 1626
 
1627 1627
 	}
1628 1628
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with'  );
17
+	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' );
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
46 46
 
47 47
 		// It's not the parent field; it's an input
48
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
48
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
49 49
 
50
-			if( $this->is_choice_value_enabled() ) {
50
+			if ( $this->is_choice_value_enabled() ) {
51 51
 
52 52
 				$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
53 53
 				$default = 'value';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				);
66 66
 			}
67 67
 
68
-			$field_options['choice_display'] = array(
68
+			$field_options[ 'choice_display' ] = array(
69 69
 				'type'    => 'radio',
70 70
 				'class'   => 'vertical',
71 71
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.