Completed
Pull Request — develop (#1810)
by
unknown
19:28
created
includes/class-api.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$form = $gravityview_view->getForm();
32 32
 
33
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
33
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
34 34
 			/** Allow to fall through for back compatibility testing purposes. */
35 35
 		} else {
36 36
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
 
39 39
 		$label = '';
40 40
 
41
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
41
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
42 42
 
43
-			$label = $field['label'];
43
+			$label = $field[ 'label' ];
44 44
 
45 45
 			// Support Gravity Forms 1.9+
46
-			if( class_exists( 'GF_Field' ) ) {
46
+			if ( class_exists( 'GF_Field' ) ) {
47 47
 
48
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
48
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
49 49
 
50
-				if( $field_object ) {
50
+				if ( $field_object ) {
51 51
 
52
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
52
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
53 53
 
54 54
 					// This is a complex field, with labels on a per-input basis
55
-					if( $input ) {
55
+					if ( $input ) {
56 56
 
57 57
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
58
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
58
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
59 59
 
60 60
 					} else {
61 61
 
62 62
 						// This is a field with one label
63
-						$label = $field_object->get_field_label( true, $field['label'] );
63
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
64 64
 
65 65
 					}
66 66
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 			}
70 70
 
71 71
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
72
-			if ( !empty( $field['custom_label'] ) ) {
72
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
73 73
 
74
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
74
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
75 75
 
76 76
 			}
77 77
 
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 
134 134
 		$width = NULL;
135 135
 
136
-		if( !empty( $field['width'] ) ) {
137
-			$width = absint( $field['width'] );
136
+		if ( ! empty( $field[ 'width' ] ) ) {
137
+			$width = absint( $field[ 'width' ] );
138 138
 
139 139
 			// If using percentages, limit to 100%
140
-			if( '%d%%' === $format && $width > 100 ) {
140
+			if ( '%d%%' === $format && $width > 100 ) {
141 141
 				$width = 100;
142 142
 			}
143 143
 
@@ -157,42 +157,42 @@  discard block
 block discarded – undo
157 157
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
158 158
 		$classes = array();
159 159
 
160
-		if( !empty( $field['custom_class'] ) ) {
160
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
161 161
 
162
-            $custom_class = $field['custom_class'];
162
+            $custom_class = $field[ 'custom_class' ];
163 163
 
164
-            if( !empty( $entry ) ) {
164
+            if ( ! empty( $entry ) ) {
165 165
 
166 166
                 // We want the merge tag to be formatted as a class. The merge tag may be
167 167
                 // replaced by a multiple-word value that should be output as a single class.
168 168
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
169
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
169
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
170 170
 
171
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
171
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
172 172
 
173 173
                 // And then we want life to return to normal
174
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
174
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
175 175
             }
176 176
 
177 177
 			// And now we want the spaces to be handled nicely.
178
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
178
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
179 179
 
180 180
 		}
181 181
 
182
-		if(!empty($field['id'])) {
183
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
184
-				$form_id = '-'.$form['id'];
182
+		if ( ! empty( $field[ 'id' ] ) ) {
183
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
184
+				$form_id = '-' . $form[ 'id' ];
185 185
 			} else {
186 186
 				// @deprecated path. Form should always be given.
187 187
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
188 188
 				$gravityview_view = GravityView_View::getInstance();
189
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
189
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
190 190
 			}
191 191
 
192
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
192
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
193 193
 		}
194 194
 
195
-		return esc_attr(implode(' ', $classes));
195
+		return esc_attr( implode( ' ', $classes ) );
196 196
 	}
197 197
 
198 198
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 * @return string Sanitized unique HTML `id` attribute for the field
208 208
 	 */
209 209
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
210
-		$id = $field['id'];
210
+		$id = $field[ 'id' ];
211 211
 
212 212
 		if ( ! empty( $id ) ) {
213
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
214
-				$form_id = '-' . $form['id'];
213
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
214
+				$form_id = '-' . $form[ 'id' ];
215 215
 			} else {
216 216
 				// @deprecated path. Form should always be given.
217 217
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
220 220
 			}
221 221
 
222
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
222
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
223 223
 		}
224 224
 
225 225
 		return esc_attr( $id );
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
260 260
 
261
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
261
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
262 262
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
263 263
 			return NULL;
264 264
 		}
265 265
 
266 266
 		$href = self::entry_link( $entry, $base_id );
267 267
 
268
-		if( '' === $href ) {
268
+		if ( '' === $href ) {
269 269
 			return NULL;
270 270
 		}
271 271
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		} else {
303 303
 			$gravityview_view = GravityView_View::getInstance();
304 304
 
305
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
305
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
306 306
 				$is_search = true;
307 307
 			}
308 308
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 			$output = esc_html__( 'This search returned no results.', 'gk-gravityview' );
315 315
 
316
-			if( $context ) {
316
+			if ( $context ) {
317 317
 				$setting = $context->view->settings->get( 'no_search_results_text', $output );
318 318
 			}
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 			$output = esc_html__( 'No entries match your request.', 'gk-gravityview' );
323 323
 
324
-			if( $context ) {
324
+			if ( $context ) {
325 325
 				$setting = $context->view->settings->get( 'no_results_text', $output );
326 326
 			}
327 327
 		}
@@ -444,9 +444,9 @@  discard block
 block discarded – undo
444 444
 
445 445
 		// If we've saved the permalink in memory, use it
446 446
 		// @since 1.3
447
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
447
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
448 448
 
449
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
449
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
450 450
 			$link = home_url();
451 451
 		}
452 452
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 
456 456
 			// If not yet saved, cache the permalink.
457 457
 			// @since 1.3
458
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
458
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
459 459
 		}
460 460
 
461 461
 		// Deal with returning to proper pagination for embedded views
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
 
464 464
 			$args = array();
465 465
 
466
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
467
-				$args['pagenum'] = intval( $pagenum );
466
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
467
+				$args[ 'pagenum' ] = intval( $pagenum );
468 468
 			}
469 469
 
470
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
471
-				$args['sort'] = $sort;
472
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
470
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
471
+				$args[ 'sort' ] = $sort;
472
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
473 473
 			}
474 474
 
475 475
 			$link = add_query_arg( $args, $link );
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
507 507
 
508 508
 		// Generate an unique hash to use as the default value
509
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
509
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
510 510
 
511 511
 		/**
512 512
 		 * @filter `gravityview_entry_slug` Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as `{entryid}-{first-name}` or even, if unique, `{first-name}-{last-name}`
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
518 518
 
519 519
 		// Make sure we have something - use the original ID as backup.
520
-		if( empty( $slug ) ) {
520
+		if ( empty( $slug ) ) {
521 521
 			$slug = $id;
522 522
 		}
523 523
 
@@ -611,15 +611,15 @@  discard block
 block discarded – undo
611 611
          * @param boolean $custom Should we process the custom entry slug?
612 612
          */
613 613
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
614
-        if( $custom ) {
614
+        if ( $custom ) {
615 615
             // create the gravityview_unique_id and save it
616 616
 
617 617
             // Get the entry hash
618
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
618
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
619 619
 
620
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
620
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
621 621
 
622
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
622
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
623 623
 
624 624
         }
625 625
     }
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 
646 646
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
647 647
 			$entry = GVCommon::get_entry( $entry );
648
-		} else if( empty( $entry ) ) {
648
+		} else if ( empty( $entry ) ) {
649 649
 			// @deprecated path
650 650
 			$entry = GravityView_frontend::getInstance()->getEntry();
651 651
 		}
@@ -665,32 +665,32 @@  discard block
 block discarded – undo
665 665
 
666 666
 		$query_arg_name = \GV\Entry::get_endpoint_name();
667 667
 
668
-		if ( ! empty( $entry['_multi'] ) ) {
668
+		if ( ! empty( $entry[ '_multi' ] ) ) {
669 669
 			$entry_slugs = array();
670 670
 
671
-			foreach ( $entry['_multi'] as $_multi ) {
671
+			foreach ( $entry[ '_multi' ] as $_multi ) {
672 672
 
673
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
674
-					$entry_slugs[] = $gv_multi->get_slug();
673
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
674
+					$entry_slugs[ ] = $gv_multi->get_slug();
675 675
 				} else {
676 676
 					// TODO: This path isn't covered by unit tests
677
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
677
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
678 678
 				}
679 679
 
680 680
 				unset( $gv_multi );
681 681
 
682
-				$forms[] = $_multi['form_id'];
682
+				$forms[ ] = $_multi[ 'form_id' ];
683 683
 			}
684 684
 
685 685
 			$entry_slug = implode( ',', $entry_slugs );
686 686
 		} else {
687 687
 
688 688
 			// Fallback when
689
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
689
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
690 690
 				$entry_slug = $gv_entry->get_slug();
691 691
 			} else {
692 692
 				// TODO: This path isn't covered by unit tests
693
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
693
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
694 694
 			}
695 695
 
696 696
 			unset( $gv_entry );
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 			$args = gv_get_query_args();
710 710
 		}
711 711
 
712
-		if ( get_option('permalink_structure') && ! is_preview() ) {
712
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
713 713
 
714 714
 			/**
715 715
 			 * Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.
@@ -717,13 +717,13 @@  discard block
 block discarded – undo
717 717
 			 */
718 718
 			$link_parts = explode( '?', $directory_link );
719 719
 
720
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
720
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
721 721
 
722
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
722
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
723 723
 
724 724
 		} else {
725 725
 
726
-			$args[] = array( $query_arg_name => $entry_slug );
726
+			$args[ ] = array( $query_arg_name => $entry_slug );
727 727
 		}
728 728
 
729 729
 		/**
@@ -731,21 +731,21 @@  discard block
 block discarded – undo
731 731
 		 */
732 732
 		if ( $add_directory_args ) {
733 733
 
734
-			if ( ! empty( $_GET['pagenum'] ) ) {
735
-				$args['pagenum'] = intval( $_GET['pagenum'] );
734
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
735
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
736 736
 			}
737 737
 
738 738
 			/**
739 739
 			 * @since 1.7
740 740
 			 */
741 741
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
742
-				$args['sort'] = $sort;
743
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
742
+				$args[ 'sort' ] = $sort;
743
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
744 744
 			}
745 745
 
746 746
 		}
747 747
 
748
-		if( $post_id ) {
748
+		if ( $post_id ) {
749 749
 			$passed_post = get_post( $post_id );
750 750
 			$views       = \GV\View_Collection::from_post( $passed_post );
751 751
 			$has_multiple_views = $views->count() > 1;
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 		}
755 755
 
756 756
 		if ( $has_multiple_views ) {
757
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
757
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
758 758
 		}
759 759
 
760 760
 		return add_query_arg( $args, $directory_link );
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 }
827 827
 
828 828
 function gv_class( $field, $form = NULL, $entry = array() ) {
829
-	return GravityView_API::field_class( $field, $form, $entry  );
829
+	return GravityView_API::field_class( $field, $form, $entry );
830 830
 }
831 831
 
832 832
 /**
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 		$view_id = 0;
850 850
 		if ( $context->view ) {
851 851
 			$view_id = $context->view->ID;
852
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
852
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
853 853
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
854 854
 			}
855 855
 		}
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 		$default_css_class .= ' ' . $context->view->settings->get( 'class', '' );
882 882
 	}
883 883
 
884
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
884
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
885 885
 
886 886
 	/**
887 887
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 
909 909
 	$value = GravityView_API::field_value( $entry, $field );
910 910
 
911
-	if( $value === '' ) {
911
+	if ( $value === '' ) {
912 912
 		/**
913 913
 		 * @filter `gravityview_empty_value` What to display when a field is empty
914 914
 		 * @param string $value (empty string)
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 }
929 929
 
930 930
 function gv_no_results( $wpautop = true, $context = null ) {
931
-	return apply_filters('gravityview/template/no_entries',GravityView_API::no_results( $wpautop, $context ),$context);
931
+	return apply_filters( 'gravityview/template/no_entries', GravityView_API::no_results( $wpautop, $context ), $context );
932 932
 }
933 933
 
934 934
 /**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
  */
1022 1022
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
1023 1023
 
1024
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1024
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
1025 1025
 
1026 1026
 		// For the complete field value as generated by Gravity Forms
1027 1027
 		return $display_value;
@@ -1055,16 +1055,16 @@  discard block
 block discarded – undo
1055 1055
 		$terms = explode( ', ', $value );
1056 1056
 	}
1057 1057
 
1058
-	foreach ($terms as $term_name ) {
1058
+	foreach ( $terms as $term_name ) {
1059 1059
 
1060 1060
 		// If we're processing a category,
1061
-		if( $taxonomy === 'category' ) {
1061
+		if ( $taxonomy === 'category' ) {
1062 1062
 
1063 1063
 			// Use rgexplode to prevent errors if : doesn't exist
1064 1064
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
1065 1065
 
1066 1066
 			// The explode was succesful; we have the category ID
1067
-			if( !empty( $term_id )) {
1067
+			if ( ! empty( $term_id ) ) {
1068 1068
 				$term = get_term_by( 'id', $term_id, $taxonomy );
1069 1069
 			} else {
1070 1070
 			// We have to fall back to the name
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 		}
1078 1078
 
1079 1079
 		// There's still a tag/category here.
1080
-		if( $term ) {
1080
+		if ( $term ) {
1081 1081
 
1082 1082
 			$term_link = get_term_link( $term, $taxonomy );
1083 1083
 
@@ -1086,11 +1086,11 @@  discard block
 block discarded – undo
1086 1086
 			    continue;
1087 1087
 			}
1088 1088
 
1089
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1089
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
1090 1090
 		}
1091 1091
 	}
1092 1092
 
1093
-	return implode(', ', $output );
1093
+	return implode( ', ', $output );
1094 1094
 }
1095 1095
 
1096 1096
 /**
@@ -1104,8 +1104,8 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
1106 1106
 
1107
-	if( empty( $link ) ) {
1108
-		return strip_tags( $output);
1107
+	if ( empty( $link ) ) {
1108
+		return strip_tags( $output );
1109 1109
 	}
1110 1110
 
1111 1111
 	return $output;
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 	$fe = GravityView_frontend::getInstance();
1125 1125
 
1126 1126
 	// Solve problem when loading content via admin-ajax.php
1127
-	if( ! $fe->getGvOutputData() ) {
1127
+	if ( ! $fe->getGvOutputData() ) {
1128 1128
 
1129 1129
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1130 1130
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 	}
1133 1133
 
1134 1134
 	// Make 100% sure that we're dealing with a properly called situation
1135
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1135
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1136 1136
 
1137 1137
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1138 1138
 
@@ -1363,12 +1363,12 @@  discard block
 block discarded – undo
1363 1363
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1364 1364
 	/** @define "GRAVITYVIEW_DIR" "../" */
1365 1365
 
1366
-	if( !class_exists( 'GravityView_Field' ) ) {
1367
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1366
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1367
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1368 1368
 	}
1369 1369
 
1370
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1371
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1370
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1371
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1372 1372
 	}
1373 1373
 
1374 1374
 	if ( is_null( $context ) ) {
@@ -1479,21 +1479,21 @@  discard block
 block discarded – undo
1479 1479
 	} else {
1480 1480
 		// @deprecated path
1481 1481
 		// Required fields.
1482
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1482
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1483 1483
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1484 1484
 			return '';
1485 1485
 		}
1486 1486
 	}
1487 1487
 
1488 1488
 	if ( $context instanceof \GV\Template_Context ) {
1489
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1490
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1491
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1489
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1490
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1491
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1492 1492
 	} else {
1493 1493
 		// @deprecated path
1494
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1495
-		$field = $args['field'];
1496
-		$form = $args['form'];
1494
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1495
+		$field = $args[ 'field' ];
1496
+		$form = $args[ 'form' ];
1497 1497
 	}
1498 1498
 
1499 1499
 	/**
@@ -1513,43 +1513,43 @@  discard block
 block discarded – undo
1513 1513
 	);
1514 1514
 
1515 1515
 	if ( $context instanceof \GV\Template_Context ) {
1516
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1516
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1517 1517
 	} else {
1518 1518
 		// @deprecated path
1519
-		$placeholders['value'] = gv_value( $entry, $field );
1519
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1520 1520
 	}
1521 1521
 
1522 1522
 	// If the value is empty and we're hiding empty, return empty.
1523
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1523
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1524 1524
 		return '';
1525 1525
 	}
1526 1526
 
1527
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1528
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1527
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1528
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1529 1529
 	}
1530 1530
 
1531 1531
 	// Get width setting, if exists
1532
-	$placeholders['width'] = GravityView_API::field_width( $field );
1532
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1533 1533
 
1534 1534
 	// If replacing with CSS inline formatting, let's do it.
1535
-	$placeholders['width:style'] = (string) GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1535
+	$placeholders[ 'width:style' ] = (string)GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1536 1536
 
1537 1537
 	// Grab the Class using `gv_class`
1538
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1539
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1538
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1539
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1540 1540
 
1541 1541
 	if ( $context instanceof \GV\Template_Context ) {
1542
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label', '' );
1542
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label', '' );
1543 1543
 	} else {
1544 1544
 		// Default Label value
1545
-		$placeholders['label_value'] = gv_label( $field, $entry );
1545
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1546 1546
 	}
1547 1547
 
1548
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1549
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1548
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1549
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1550 1550
 
1551
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1552
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1551
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1552
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1553 1553
 	}
1554 1554
 
1555 1555
 	/**
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 	 * @since 2.0
1561 1561
 	 * @param \GV\Template_Context $context The context.
1562 1562
 	 */
1563
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1563
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1564 1564
 
1565 1565
 	/**
1566 1566
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 	foreach ( $placeholders as $tag => $value ) {
1588 1588
 
1589 1589
 		// If the tag doesn't exist just skip it
1590
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1590
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1591 1591
 			continue;
1592 1592
 		}
1593 1593
 
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 		$value = apply_filters( 'gravityview/field_output/context/' . $tag, $value, $args, $context );
1609 1609
 
1610 1610
 		// Finally do the replace
1611
-		$html = str_replace( $search, (string) $value, $html );
1611
+		$html = str_replace( $search, (string)$value, $html );
1612 1612
 	}
1613 1613
 
1614 1614
 	/**
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 			return $no_entries_text;
124 124
 		}
125 125
 
126
-		$no_entries_option = (int) $context->view->settings->get( 'no_entries_options' );
126
+		$no_entries_option = (int)$context->view->settings->get( 'no_entries_options' );
127 127
 		if ( $no_entries_option === 1 ) {
128
-			$form_id = (int) $context->view->settings->get( 'no_entries_form' );
128
+			$form_id = (int)$context->view->settings->get( 'no_entries_form' );
129 129
 			if ( $form_id !== 0 ) {
130 130
 				return \GFForms::get_form( $form_id );
131 131
 			}
@@ -276,19 +276,19 @@  discard block
 block discarded – undo
276 276
 
277 277
 		if ( ! empty( $view_id ) ) {
278 278
 
279
-			$this->context_view_id = (int) $view_id;
279
+			$this->context_view_id = (int)$view_id;
280 280
 
281
-		} elseif ( isset( $_GET['gvid'] ) && $multiple_views ) {
281
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) {
282 282
 			/**
283 283
 			 * used on a has_multiple_views context
284 284
 			 *
285 285
 			 * @see GravityView_API::entry_link
286 286
 			 */
287
-			$this->context_view_id = (int) $_GET['gvid'];
287
+			$this->context_view_id = (int)$_GET[ 'gvid' ];
288 288
 
289 289
 		} elseif ( ! $multiple_views ) {
290 290
 			$array_keys            = array_keys( $this->getGvOutputData()->get_views() );
291
-			$this->context_view_id = (int) array_pop( $array_keys );
291
+			$this->context_view_id = (int)array_pop( $array_keys );
292 292
 			unset( $array_keys );
293 293
 		}
294 294
 
@@ -330,16 +330,16 @@  discard block
 block discarded – undo
330 330
 			$_query = wp_parse_args( $query->query );
331 331
 
332 332
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
333
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
334
-				unset( $_query['pagename'] );
333
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
334
+				unset( $_query[ 'pagename' ] );
335 335
 			}
336 336
 
337 337
 			// this is where will break from core WordPress
338 338
 			/** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */
339 339
 			$ignore    = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query );
340 340
 			$endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' );
341
-			foreach ( (array) $endpoints as $endpoint ) {
342
-				$ignore[] = $endpoint[1];
341
+			foreach ( (array)$endpoints as $endpoint ) {
342
+				$ignore[ ] = $endpoint[ 1 ];
343 343
 			}
344 344
 			unset( $endpoints );
345 345
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
350 350
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
351 351
 
352
-				$qv =& $query->query_vars;
352
+				$qv = & $query->query_vars;
353 353
 
354 354
 				// Prevent redirect when on the single entry endpoint
355 355
 				if ( self::is_single_entry() ) {
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 
359 359
 				$query->is_page = true;
360 360
 				$query->is_home = false;
361
-				$qv['page_id']  = $front_page_id;
361
+				$qv[ 'page_id' ]  = $front_page_id;
362 362
 
363 363
 				// Correct <!--nextpage--> for page_on_front
364
-				if ( ! empty( $qv['paged'] ) ) {
365
-					$qv['page'] = $qv['paged'];
366
-					unset( $qv['paged'] );
364
+				if ( ! empty( $qv[ 'paged' ] ) ) {
365
+					$qv[ 'page' ] = $qv[ 'paged' ];
366
+					unset( $qv[ 'paged' ] );
367 367
 				}
368 368
 			}
369 369
 
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
 			$blocks = parse_blocks( $post_content );
427 427
 
428 428
 			foreach ( $blocks as $block ) {
429
-				if ( empty( $block['attrs']['ref'] ) ) {
429
+				if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) {
430 430
 					continue;
431 431
 				}
432 432
 
433
-				$block_post = get_post( $block['attrs']['ref'] );
433
+				$block_post = get_post( $block[ 'attrs' ][ 'ref' ] );
434 434
 
435 435
 				if ( $block_post ) {
436 436
 					$post_content .= $block_post->post_content;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
 		// Don't modify the title for anything other than the current view/post.
561 561
 		// This is true for embedded shortcodes and Views.
562
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
562
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
563 563
 			return $passed_title;
564 564
 		}
565 565
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 		$title = $view->settings->get( 'single_title', $passed_title );
635 635
 
636
-		$form = GVCommon::get_form( $entry['form_id'] );
636
+		$form = GVCommon::get_form( $entry[ 'form_id' ] );
637 637
 
638 638
 		// We are allowing HTML in the fields, so no escaping the output
639 639
 		$title = GravityView_API::replace_variables( $title, $form, $entry );
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
 			}
856 856
 		}
857 857
 
858
-		if ( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
858
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
859 859
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
860
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
860
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
861 861
 				gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) );
862 862
 			}
863 863
 		}
@@ -876,19 +876,19 @@  discard block
 block discarded – undo
876 876
 	public static function process_search_only_approved( $args, $search_criteria ) {
877 877
 
878 878
 		/** @since 1.19 */
879
-		if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
879
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
880 880
 			gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' );
881 881
 			return $search_criteria;
882 882
 		}
883 883
 
884
-		if ( ! empty( $args['show_only_approved'] ) ) {
884
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
885 885
 
886
-			$search_criteria['field_filters'][] = array(
886
+			$search_criteria[ 'field_filters' ][ ] = array(
887 887
 				'key'   => GravityView_Entry_Approval::meta_key,
888 888
 				'value' => GravityView_Entry_Approval_Status::APPROVED,
889 889
 			);
890 890
 
891
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
891
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
892 892
 
893 893
 			gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) );
894 894
 		}
@@ -915,18 +915,18 @@  discard block
 block discarded – undo
915 915
 	 */
916 916
 	public static function is_entry_approved( $entry, $args = array() ) {
917 917
 
918
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
918
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
919 919
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
920 920
 			return true;
921 921
 		}
922 922
 
923 923
 		/** @since 1.19 */
924
-		if ( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
924
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
925 925
 			gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' );
926 926
 			return true;
927 927
 		}
928 928
 
929
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
929
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
930 930
 
931 931
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
932 932
 	}
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 		 * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`.
951 951
 		 */
952 952
 		$criteria        = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) );
953
-		$search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() );
953
+		$search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() );
954 954
 
955 955
 		/**
956 956
 		 * @filter `gravityview_fe_search_criteria` Modify the search criteria
@@ -970,19 +970,19 @@  discard block
 block discarded – undo
970 970
 		gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' => $search_criteria ) );
971 971
 
972 972
 		// implicity search
973
-		if ( ! empty( $args['search_value'] ) ) {
973
+		if ( ! empty( $args[ 'search_value' ] ) ) {
974 974
 
975 975
 			// Search operator options. Options: `is` or `contains`
976
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
976
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
977 977
 
978
-			$search_criteria['field_filters'][] = array(
978
+			$search_criteria[ 'field_filters' ][ ] = array(
979 979
 				'key'      => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search
980
-				'value'    => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
980
+				'value'    => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
981 981
 				'operator' => $operator,
982 982
 			);
983 983
 
984 984
 			// Lock search mode to "all" with implicit presearch filter.
985
-			$search_criteria['field_filters']['mode'] = 'all';
985
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
986 986
 		}
987 987
 
988 988
 		if ( $search_criteria !== $original_search_criteria ) {
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1004 1004
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1005 1005
 		 */
1006
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1006
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1007 1007
 
1008 1008
 		return $search_criteria;
1009 1009
 	}
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 			'search_criteria' => $search_criteria,
1120 1120
 			'sorting'         => self::updateViewSorting( $args, $form_id ),
1121 1121
 			'paging'          => $paging,
1122
-			'cache'           => isset( $args['cache'] ) ? $args['cache'] : true,
1122
+			'cache'           => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1123 1123
 		);
1124 1124
 
1125 1125
 		/**
@@ -1169,17 +1169,17 @@  discard block
 block discarded – undo
1169 1169
 		$default_page_size = apply_filters( 'gravityview_default_page_size', 25 );
1170 1170
 
1171 1171
 		// Paging & offset
1172
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size;
1172
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size;
1173 1173
 
1174 1174
 		if ( -1 === $page_size ) {
1175 1175
 			$page_size = PHP_INT_MAX;
1176 1176
 		}
1177 1177
 
1178
-		$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1178
+		$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1179 1179
 		$offset    = ( $curr_page - 1 ) * $page_size;
1180 1180
 
1181
-		if ( ! empty( $args['offset'] ) ) {
1182
-			$offset += intval( $args['offset'] );
1181
+		if ( ! empty( $args[ 'offset' ] ) ) {
1182
+			$offset += intval( $args[ 'offset' ] );
1183 1183
 		}
1184 1184
 
1185 1185
 		$paging = array(
@@ -1204,11 +1204,11 @@  discard block
 block discarded – undo
1204 1204
 	public static function updateViewSorting( $args, $form_id ) {
1205 1205
 		$sorting = array();
1206 1206
 
1207
-		$has_values = isset( $_GET['sort'] );
1207
+		$has_values = isset( $_GET[ 'sort' ] );
1208 1208
 
1209
-		if ( $has_values && is_array( $_GET['sort'] ) ) {
1210
-			$sorts = array_keys( $_GET['sort'] );
1211
-			$dirs  = array_values( $_GET['sort'] );
1209
+		if ( $has_values && is_array( $_GET[ 'sort' ] ) ) {
1210
+			$sorts = array_keys( $_GET[ 'sort' ] );
1211
+			$dirs  = array_values( $_GET[ 'sort' ] );
1212 1212
 
1213 1213
 			if ( $has_values = array_filter( $dirs ) ) {
1214 1214
 				$sort_field_id  = end( $sorts );
@@ -1217,11 +1217,11 @@  discard block
 block discarded – undo
1217 1217
 		}
1218 1218
 
1219 1219
 		if ( ! isset( $sort_field_id ) ) {
1220
-			$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' );
1220
+			$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' );
1221 1221
 		}
1222 1222
 
1223 1223
 		if ( ! isset( $sort_direction ) ) {
1224
-			$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' );
1224
+			$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' );
1225 1225
 		}
1226 1226
 
1227 1227
 		if ( is_array( $sort_field_id ) ) {
@@ -1253,10 +1253,10 @@  discard block
 block discarded – undo
1253 1253
 				$form = GFAPI::get_form( $form_id );
1254 1254
 
1255 1255
 				// Get the first GF_Field field ID, set as the key for entry randomization
1256
-				if ( ! empty( $form['fields'] ) ) {
1256
+				if ( ! empty( $form[ 'fields' ] ) ) {
1257 1257
 
1258 1258
 					/** @var GF_Field $field */
1259
-					foreach ( $form['fields'] as $field ) {
1259
+					foreach ( $form[ 'fields' ] as $field ) {
1260 1260
 						if ( ! is_a( $field, 'GF_Field' ) ) {
1261 1261
 							continue;
1262 1262
 						}
@@ -1305,7 +1305,7 @@  discard block
 block discarded – undo
1305 1305
 		if ( is_array( $sort_field_id ) ) {
1306 1306
 			$modified_ids = array();
1307 1307
 			foreach ( $sort_field_id as $_sort_field_id ) {
1308
-				$modified_ids [] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1308
+				$modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id );
1309 1309
 			}
1310 1310
 			return $modified_ids;
1311 1311
 		}
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 			return $sort_field_id;
1319 1319
 		}
1320 1320
 
1321
-		switch ( $sort_field['type'] ) {
1321
+		switch ( $sort_field[ 'type' ] ) {
1322 1322
 
1323 1323
 			case 'address':
1324 1324
 				// Sorting by full address
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 			$views = $this->getGvOutputData()->get_views();
1446 1446
 
1447 1447
 			foreach ( $views as $view_id => $data ) {
1448
-				$view        = \GV\View::by_id( $data['id'] );
1448
+				$view        = \GV\View::by_id( $data[ 'id' ] );
1449 1449
 				$view_id     = $view->ID;
1450 1450
 				$template_id = gravityview_get_template_id( $view->ID );
1451 1451
 				$data        = $view->as_data();
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 					 * @param \GV\View The View.
1476 1476
 					 */
1477 1477
 					$js_dependency     = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view );
1478
-					$js_dependencies[] = $js_dependency;
1478
+					$js_dependencies[ ] = $js_dependency;
1479 1479
 
1480 1480
 					/**
1481 1481
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 					 * @param \GV\View The View.
1492 1492
 					 */
1493 1493
 					$css_dependency     = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view );
1494
-					$css_dependencies[] = $css_dependency;
1494
+					$css_dependencies[ ] = $css_dependency;
1495 1495
 				}
1496 1496
 
1497 1497
 				/**
@@ -1500,8 +1500,8 @@  discard block
 block discarded – undo
1500 1500
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1501 1501
 				 * @since 1.15
1502 1502
 				 */
1503
-				if ( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1504
-					$css_dependencies[] = 'dashicons';
1503
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1504
+					$css_dependencies[ ] = 'dashicons';
1505 1505
 				}
1506 1506
 
1507 1507
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GV_PLUGIN_VERSION, true );
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 
1513 1513
 				wp_enqueue_script( 'gravityview-fe-view' );
1514 1514
 
1515
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1515
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1516 1516
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GV_PLUGIN_VERSION, 'all' );
1517 1517
 				}
1518 1518
 
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 			return $label;
1614 1614
 		}
1615 1615
 
1616
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1616
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1617 1617
 			return $label;
1618 1618
 		}
1619 1619
 
@@ -1621,20 +1621,20 @@  discard block
 block discarded – undo
1621 1621
 
1622 1622
 		$class = 'gv-sort';
1623 1623
 
1624
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1624
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1625 1625
 
1626 1626
 		$sort_args = array(
1627
-			'sort' => $field['id'],
1627
+			'sort' => $field[ 'id' ],
1628 1628
 			'dir'  => 'asc',
1629 1629
 		);
1630 1630
 
1631
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1631
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1632 1632
 			// toggle sorting direction.
1633
-			if ( 'asc' === $sorting['direction'] ) {
1634
-				$sort_args['dir'] = 'desc';
1633
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1634
+				$sort_args[ 'dir' ] = 'desc';
1635 1635
 				$class           .= ' gv-icon-sort-desc';
1636 1636
 			} else {
1637
-				$sort_args['dir'] = 'asc';
1637
+				$sort_args[ 'dir' ] = 'asc';
1638 1638
 				$class           .= ' gv-icon-sort-asc';
1639 1639
 			}
1640 1640
 		} else {
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
 			return false;
1691 1691
 		}
1692 1692
 
1693
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1693
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1694 1694
 
1695 1695
 	}
1696 1696
 
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$form = false;
147 147
 
148 148
 		if ( $entry ) {
149
-			$form = GFAPI::get_form( $entry['form_id'] );
149
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
150 150
 		}
151 151
 
152 152
 		return $form;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			}
223 223
 		}
224 224
 
225
-		return (bool) $has_transaction_data;
225
+		return (bool)$has_transaction_data;
226 226
 	}
227 227
 
228 228
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
262 262
 
263
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
263
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
264 264
 
265 265
 		return $result;
266 266
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
 		$form_options = array();
281 281
 		foreach ( $forms as $form ) {
282
-			$form_options[ $form['id'] ] = $form['title'];
282
+			$form_options[ $form[ 'id' ] ] = $form[ 'title' ];
283 283
 		}
284 284
 		return $form_options;
285 285
 	}
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 		$has_post_fields    = false;
338 338
 
339 339
 		if ( $form ) {
340
-			foreach ( $form['fields'] as $field ) {
341
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
342
-					$fields[ "{$field['id']}" ] = array(
340
+			foreach ( $form[ 'fields' ] as $field ) {
341
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
342
+					$fields[ "{$field[ 'id' ]}" ] = array(
343 343
 						'label'      => \GV\Utils::get( $field, 'label' ),
344 344
 						'parent'     => null,
345 345
 						'type'       => \GV\Utils::get( $field, 'type' ),
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 					);
349 349
 				}
350 350
 
351
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
352
-					foreach ( $field['inputs'] as $input ) {
351
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
352
+					foreach ( $field[ 'inputs' ] as $input ) {
353 353
 
354
-						if ( ! empty( $input['isHidden'] ) ) {
354
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
355 355
 							continue;
356 356
 						}
357 357
 
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 						 * @hack
360 360
 						 * In case of email/email confirmation, the input for email has the same id as the parent field
361 361
 						 */
362
-						if ( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
362
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
363 363
 							continue;
364 364
 						}
365
-						$fields[ "{$input['id']}" ] = array(
365
+						$fields[ "{$input[ 'id' ]}" ] = array(
366 366
 							'label'       => \GV\Utils::get( $input, 'label' ),
367 367
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
368 368
 							'parent'      => $field,
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					}
374 374
 				}
375 375
 
376
-				if ( GFCommon::is_product_field( $field['type'] ) ) {
376
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
377 377
 					$has_product_fields = true;
378 378
 				}
379 379
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		 * @since 1.7
388 388
 		 */
389 389
 		if ( $has_post_fields ) {
390
-			$fields['post_id'] = array(
390
+			$fields[ 'post_id' ] = array(
391 391
 				'label' => __( 'Post ID', 'gk-gravityview' ),
392 392
 				'type'  => 'post_id',
393 393
 			);
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 		$fields = array();
439 439
 
440 440
 		foreach ( $extra_fields as $key => $field ) {
441
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
441
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
442 442
 				$fields[ $key ] = array(
443
-					'label' => $field['label'],
443
+					'label' => $field[ 'label' ],
444 444
 					'type'  => 'entry_meta',
445 445
 				);
446 446
 			}
@@ -482,33 +482,33 @@  discard block
 block discarded – undo
482 482
 			'search_criteria' => null,
483 483
 			'sorting'         => null,
484 484
 			'paging'          => null,
485
-			'cache'           => ( isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true ),
485
+			'cache'           => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
486 486
 			'context_view_id' => null,
487 487
 		);
488 488
 
489 489
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
490 490
 
491
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
492
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
491
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
492
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
493 493
 
494 494
 				if ( ! is_array( $filter ) ) {
495 495
 					continue;
496 496
 				}
497 497
 
498 498
 				// By default, we want searches to be wildcard for each field.
499
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
499
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
500 500
 
501 501
 				/**
502 502
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
503 503
 				 * @param string $operator Existing search operator
504 504
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
505 505
 				 */
506
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
506
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
507 507
 			}
508 508
 
509 509
 			// don't send just the [mode] without any field filter.
510
-			if ( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode', $criteria['search_criteria']['field_filters'] ) ) {
511
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
510
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
511
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
512 512
 			}
513 513
 		}
514 514
 
@@ -518,37 +518,37 @@  discard block
 block discarded – undo
518 518
 		 */
519 519
 		foreach ( array( 'start_date', 'end_date' ) as $key ) {
520 520
 
521
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
521
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
522 522
 
523 523
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
524
-				$date = date_create( $criteria['search_criteria'][ $key ] );
524
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
525 525
 
526 526
 				if ( $date ) {
527 527
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
528
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
528
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
529 529
 				} else {
530 530
 					gravityview()->log->error(
531 531
 						'{key} Date format not valid:',
532 532
 						array(
533 533
 							'key' => $key,
534
-							$criteria['search_criteria'][ $key ],
534
+							$criteria[ 'search_criteria' ][ $key ],
535 535
 						)
536 536
 					);
537 537
 
538 538
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
539
-					unset( $criteria['search_criteria'][ $key ] );
539
+					unset( $criteria[ 'search_criteria' ][ $key ] );
540 540
 				}
541 541
 			}
542 542
 		}
543 543
 
544
-		if ( empty( $criteria['context_view_id'] ) ) {
544
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
545 545
 			// Calculate the context view id and send it to the advanced filter
546 546
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
547
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
547
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
548 548
 			} elseif ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
549
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
549
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
550 550
 			} elseif ( 'delete' === GFForms::get( 'action' ) ) {
551
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
551
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
552 552
 			}
553 553
 		}
554 554
 
@@ -558,9 +558,9 @@  discard block
 block discarded – undo
558 558
 		 * @param array $form_ids Forms to search
559 559
 		 * @param int $view_id ID of the view being used to search
560 560
 		 */
561
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
561
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
562 562
 
563
-		return (array) $criteria;
563
+		return (array)$criteria;
564 564
 	}
565 565
 
566 566
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		/** Reduce # of database calls */
593 593
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
594 594
 
595
-		if ( ! empty( $criteria['cache'] ) ) {
595
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
596 596
 
597 597
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
598 598
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
 				// Still update the total count when using cached results
602 602
 				if ( ! is_null( $total ) ) {
603
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
603
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
604 604
 				}
605 605
 
606 606
 				$return = $entries;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 			// No entries returned from gravityview_before_get_entries
625 625
 			if ( is_null( $entries ) ) {
626 626
 
627
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
627
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
628 628
 
629 629
 				if ( is_wp_error( $entries ) ) {
630 630
 					gravityview()->log->error(
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 				}
642 642
 			}
643 643
 
644
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
644
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
645 645
 
646 646
 				// Cache results
647 647
 				$Cache->set( $entries, 'entries' );
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 
828 828
 		// If both are timestamps, cast to string so we can use the > and < comparisons below.
829 829
 		if ( $timestamp_1 && $timestamp_2 ) {
830
-			$val1 = (string) $timestamp_1;
831
-			$val2 = (string) $timestamp_2;
830
+			$val1 = (string)$timestamp_1;
831
+			$val2 = (string)$timestamp_2;
832 832
 		}
833 833
 
834 834
 		switch ( $operation ) {
@@ -862,8 +862,8 @@  discard block
 block discarded – undo
862 862
 				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
863 863
 
864 864
 					$json_in    = false;
865
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
866
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
865
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
866
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
867 867
 
868 868
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
869 869
 					foreach ( $json_val_1 as $item_1 ) {
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
925 925
 		}
926 926
 
927
-		if ( empty( $entry['form_id'] ) ) {
927
+		if ( empty( $entry[ 'form_id' ] ) ) {
928 928
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
929 929
 		}
930 930
 
@@ -939,19 +939,19 @@  discard block
 block discarded – undo
939 939
 
940 940
 		$_gvid = \GV\Utils::_GET( 'gvid' );
941 941
 
942
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
942
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
943 943
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
944 944
 		}
945 945
 
946 946
 		$view_form_id = $view->form->ID;
947 947
 
948 948
 		if ( $view->joins ) {
949
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
950
-				$view_form_id = $entry['form_id'];
949
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
950
+				$view_form_id = $entry[ 'form_id' ];
951 951
 			}
952 952
 		}
953 953
 
954
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
954
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
955 955
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
956 956
 		}
957 957
 
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 							array(
970 970
 								'key'       => 'id',
971 971
 								'operation' => 'is',
972
-								'value'     => $entry['id'],
972
+								'value'     => $entry[ 'id' ],
973 973
 							),
974 974
 						),
975 975
 					)
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 				/** @type \GF_Query $query */
981 981
 				$query_parts = $query->_introspect();
982 982
 
983
-				$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
983
+				$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
984 984
 
985 985
 			},
986 986
 			10,
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 			'gravityview_search_criteria',
993 993
 			$remove_pagenum = function( $criteria ) {
994 994
 
995
-				$criteria['paging'] = array(
995
+				$criteria[ 'paging' ] = array(
996 996
 					'offset'    => 0,
997 997
 					'page_size' => 25,
998 998
 				);
@@ -1012,19 +1012,19 @@  discard block
 block discarded – undo
1012 1012
 		}
1013 1013
 
1014 1014
 		// This entry is on a View with joins
1015
-		if ( $entries[0]->is_multi() ) {
1015
+		if ( $entries[ 0 ]->is_multi() ) {
1016 1016
 
1017 1017
 			$multi_entry_ids = array();
1018 1018
 
1019
-			foreach ( $entries[0]->entries as $multi_entry ) {
1020
-				$multi_entry_ids[] = (int) $multi_entry->ID;
1019
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
1020
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
1021 1021
 			}
1022 1022
 
1023
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
1023
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
1024 1024
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
1025 1025
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
1026 1026
 			}
1027
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
1027
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
1028 1028
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
1029 1029
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
1030 1030
 		}
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1075 1075
 
1076 1076
 		$format       = \GV\Utils::get( $atts, 'format' );
1077
-		$is_human     = ! empty( $atts['human'] );
1078
-		$is_diff      = ! empty( $atts['diff'] );
1079
-		$is_raw       = ! empty( $atts['raw'] );
1080
-		$is_timestamp = ! empty( $atts['timestamp'] );
1081
-		$include_time = ! empty( $atts['time'] );
1077
+		$is_human     = ! empty( $atts[ 'human' ] );
1078
+		$is_diff      = ! empty( $atts[ 'diff' ] );
1079
+		$is_raw       = ! empty( $atts[ 'raw' ] );
1080
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1081
+		$include_time = ! empty( $atts[ 'time' ] );
1082 1082
 
1083 1083
 		// If we're using time diff, we want to have a different default format
1084 1084
 		if ( empty( $format ) ) {
@@ -1196,14 +1196,14 @@  discard block
 block discarded – undo
1196 1196
 			}
1197 1197
 
1198 1198
 			foreach ( $matches as $shortcode ) {
1199
-				if ( $tag === $shortcode[2] ) {
1199
+				if ( $tag === $shortcode[ 2 ] ) {
1200 1200
 
1201 1201
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1202
-					$shortcodes[] = $shortcode;
1202
+					$shortcodes[ ] = $shortcode;
1203 1203
 
1204
-				} elseif ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1204
+				} elseif ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1205 1205
 					foreach ( $results as $result ) {
1206
-						$shortcodes[] = $result;
1206
+						$shortcodes[ ] = $result;
1207 1207
 					}
1208 1208
 				}
1209 1209
 			}
@@ -1235,7 +1235,7 @@  discard block
 block discarded – undo
1235 1235
 			'post_type'      => 'gravityview',
1236 1236
 			'posts_per_page' => 100,
1237 1237
 			'meta_key'       => '_gravityview_form_id',
1238
-			'meta_value'     => (int) $form_id,
1238
+			'meta_value'     => (int)$form_id,
1239 1239
 		);
1240 1240
 		$args     = wp_parse_args( $args, $defaults );
1241 1241
 		$views    = get_posts( $args );
@@ -1252,8 +1252,8 @@  discard block
 block discarded – undo
1252 1252
 			}
1253 1253
 
1254 1254
 			foreach ( $data as $datum ) {
1255
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1256
-					$joined_forms[] = $view->post_id;
1255
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1256
+					$joined_forms[ ] = $view->post_id;
1257 1257
 				}
1258 1258
 			}
1259 1259
 		}
@@ -1261,10 +1261,10 @@  discard block
 block discarded – undo
1261 1261
 		if ( $joined_forms ) {
1262 1262
 			$joined_args = array(
1263 1263
 				'post_type'      => 'gravityview',
1264
-				'posts_per_page' => $args['posts_per_page'],
1264
+				'posts_per_page' => $args[ 'posts_per_page' ],
1265 1265
 				'post__in'       => $joined_forms,
1266 1266
 			);
1267
-			$views       = array_merge( $views, get_posts( $joined_args ) );
1267
+			$views = array_merge( $views, get_posts( $joined_args ) );
1268 1268
 		}
1269 1269
 
1270 1270
 		return $views;
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
 		if ( class_exists( '\GV\View_Settings' ) ) {
1310 1310
 
1311
-			return wp_parse_args( (array) $settings, \GV\View_Settings::defaults() );
1311
+			return wp_parse_args( (array)$settings, \GV\View_Settings::defaults() );
1312 1312
 
1313 1313
 		}
1314 1314
 
@@ -1454,11 +1454,11 @@  discard block
 block discarded – undo
1454 1454
 			$blocklist_field_types = apply_filters( 'gravityview_blocklist_field_types', $blocklist_field_types, null );
1455 1455
 
1456 1456
 			foreach ( $fields as $id => $field ) {
1457
-				if ( in_array( $field['type'], $blocklist_field_types ) ) {
1457
+				if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1458 1458
 					continue;
1459 1459
 				}
1460 1460
 
1461
-				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field['label'] ) . '</option>';
1461
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1462 1462
 			}
1463 1463
 		}
1464 1464
 
@@ -1503,14 +1503,14 @@  discard block
 block discarded – undo
1503 1503
 		// TODO: Convert to using array_filter
1504 1504
 		foreach ( $fields as $id => $field ) {
1505 1505
 
1506
-			if ( in_array( $field['type'], $blocklist_field_types ) ) {
1506
+			if ( in_array( $field[ 'type' ], $blocklist_field_types ) ) {
1507 1507
 				unset( $fields[ $id ] );
1508 1508
 			}
1509 1509
 
1510 1510
 			/**
1511 1511
 			 * Merge date and time subfields.
1512 1512
 			 */
1513
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1513
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1514 1514
 				$fields[ intval( $id ) ] = array(
1515 1515
 					'label'      => \GV\Utils::get( $field, 'parent/label' ),
1516 1516
 					'parent'     => null,
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1585 1585
 		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1586 1586
 			if ( true === $gv_field->is_numeric ) {
1587
-				$numeric_types[] = $gv_field->is_numeric;
1587
+				$numeric_types[ ] = $gv_field->is_numeric;
1588 1588
 			}
1589 1589
 		}
1590 1590
 
@@ -1736,12 +1736,12 @@  discard block
 block discarded – undo
1736 1736
 		$final_atts = array_filter( $final_atts );
1737 1737
 
1738 1738
 		// If the href wasn't passed as an attribute, use the value passed to the function
1739
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1740
-			$final_atts['href'] = $href;
1739
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1740
+			$final_atts[ 'href' ] = $href;
1741 1741
 		}
1742 1742
 
1743
-		if ( isset( $final_atts['href'] ) ) {
1744
-			$final_atts['href'] = esc_url_raw( $final_atts['href'] );
1743
+		if ( isset( $final_atts[ 'href' ] ) ) {
1744
+			$final_atts[ 'href' ] = esc_url_raw( $final_atts[ 'href' ] );
1745 1745
 		}
1746 1746
 
1747 1747
 		/**
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1751 1751
 		 */
1752 1752
 		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1753
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1753
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1754 1754
 		}
1755 1755
 
1756 1756
 		// Sort the attributes alphabetically, to help testing
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1790 1790
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1791 1791
 			} elseif ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1792
-				$merged[] = $value;
1792
+				$merged[ ] = $value;
1793 1793
 			} else {
1794 1794
 				$merged[ $key ] = $value;
1795 1795
 			}
Please login to merge, or discard this patch.