Completed
Pull Request — master (#1442)
by Zack
08:53 queued 06:21
created
includes/fields/class-gravityview-field-created-by.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 
38 38
 		$merge_tags = array(
39 39
 			array(
40
-				'label' => __('Entry Creator: Display Name', 'gravityview'),
40
+				'label' => __( 'Entry Creator: Display Name', 'gravityview' ),
41 41
 				'tag' => '{created_by:display_name}'
42 42
 			),
43 43
 			array(
44
-				'label' => __('Entry Creator: Email', 'gravityview'),
44
+				'label' => __( 'Entry Creator: Email', 'gravityview' ),
45 45
 				'tag' => '{created_by:user_email}'
46 46
 			),
47 47
 			array(
48
-				'label' => __('Entry Creator: Username', 'gravityview'),
48
+				'label' => __( 'Entry Creator: Username', 'gravityview' ),
49 49
 				'tag' => '{created_by:user_login}'
50 50
 			),
51 51
 			array(
52
-				'label' => __('Entry Creator: User ID', 'gravityview'),
52
+				'label' => __( 'Entry Creator: User ID', 'gravityview' ),
53 53
 				'tag' => '{created_by:ID}'
54 54
 			),
55 55
 			array(
56
-				'label' => __('Entry Creator: Roles', 'gravityview'),
56
+				'label' => __( 'Entry Creator: Roles', 'gravityview' ),
57 57
 				'tag' => '{created_by:roles}'
58 58
 			),
59 59
 		);
@@ -81,19 +81,19 @@  discard block
 block discarded – undo
81 81
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
82 82
 
83 83
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
84
-		if( empty( $matches ) ) {
84
+		if ( empty( $matches ) ) {
85 85
 			return $text;
86 86
 		}
87 87
 
88 88
 		// Get the creator of the entry
89
-		$entry_creator = new WP_User( $entry['created_by'] );
89
+		$entry_creator = new WP_User( $entry[ 'created_by' ] );
90 90
 
91 91
 		foreach ( $matches as $match ) {
92 92
 
93
-			$full_tag = $match[0];
94
-			$property = $match[1];
93
+			$full_tag = $match[ 0 ];
94
+			$property = $match[ 1 ];
95 95
 
96
-			switch( $property ) {
96
+			switch ( $property ) {
97 97
 				case '':
98 98
 					$value = $entry_creator->ID;
99 99
 					break;
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 
120 120
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
121 121
 
122
-		if( 'edit' === $context ) {
122
+		if ( 'edit' === $context ) {
123 123
 			return $field_options;
124 124
 		}
125 125
 
126
-		$field_options['name_display'] = array(
126
+		$field_options[ 'name_display' ] = array(
127 127
 			'type' => 'select',
128 128
 			'label' => __( 'User Format', 'gravityview' ),
129 129
 			'desc' => __( 'How should the User information be displayed?', 'gravityview' ),
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 		$form = $gravityview_view->getForm();
33 33
 
34
-		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS['GravityView_API_field_label_override'] ) ) {
34
+		if ( defined( 'DOING_GRAVITYVIEW_TESTS' ) && ! empty( $GLOBALS[ 'GravityView_API_field_label_override' ] ) ) {
35 35
 			/** Allow to fall through for back compatibility testing purposes. */
36 36
 		} else {
37 37
 			return \GV\Mocks\GravityView_API_field_label( $form, $field, $entry, $force_show_label );
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$label = '';
41 41
 
42
-		if( !empty( $field['show_label'] ) || $force_show_label ) {
42
+		if ( ! empty( $field[ 'show_label' ] ) || $force_show_label ) {
43 43
 
44
-			$label = $field['label'];
44
+			$label = $field[ 'label' ];
45 45
 
46 46
 			// Support Gravity Forms 1.9+
47
-			if( class_exists( 'GF_Field' ) ) {
47
+			if ( class_exists( 'GF_Field' ) ) {
48 48
 
49
-				$field_object = RGFormsModel::get_field( $form, $field['id'] );
49
+				$field_object = RGFormsModel::get_field( $form, $field[ 'id' ] );
50 50
 
51
-				if( $field_object ) {
51
+				if ( $field_object ) {
52 52
 
53
-					$input = GFFormsModel::get_input( $field_object, $field['id'] );
53
+					$input = GFFormsModel::get_input( $field_object, $field[ 'id' ] );
54 54
 
55 55
 					// This is a complex field, with labels on a per-input basis
56
-					if( $input ) {
56
+					if ( $input ) {
57 57
 
58 58
 						// Does the input have a custom label on a per-input basis? Otherwise, default label.
59
-						$label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label'];
59
+						$label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ];
60 60
 
61 61
 					} else {
62 62
 
63 63
 						// This is a field with one label
64
-						$label = $field_object->get_field_label( true, $field['label'] );
64
+						$label = $field_object->get_field_label( true, $field[ 'label' ] );
65 65
 
66 66
 					}
67 67
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 			}
71 71
 
72 72
 			// Use Gravity Forms label by default, but if a custom label is defined in GV, use it.
73
-			if ( !empty( $field['custom_label'] ) ) {
73
+			if ( ! empty( $field[ 'custom_label' ] ) ) {
74 74
 
75
-				$label = self::replace_variables( $field['custom_label'], $form, $entry );
75
+				$label = self::replace_variables( $field[ 'custom_label' ], $form, $entry );
76 76
 
77 77
 			}
78 78
 
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$width = NULL;
136 136
 
137
-		if( !empty( $field['width'] ) ) {
138
-			$width = absint( $field['width'] );
137
+		if ( ! empty( $field[ 'width' ] ) ) {
138
+			$width = absint( $field[ 'width' ] );
139 139
 
140 140
 			// If using percentages, limit to 100%
141
-			if( '%d%%' === $format && $width > 100 ) {
141
+			if ( '%d%%' === $format && $width > 100 ) {
142 142
 				$width = 100;
143 143
 			}
144 144
 
@@ -159,42 +159,42 @@  discard block
 block discarded – undo
159 159
 	public static function field_class( $field, $form = NULL, $entry = NULL ) {
160 160
 		$classes = array();
161 161
 
162
-		if( !empty( $field['custom_class'] ) ) {
162
+		if ( ! empty( $field[ 'custom_class' ] ) ) {
163 163
 
164
-            $custom_class = $field['custom_class'];
164
+            $custom_class = $field[ 'custom_class' ];
165 165
 
166
-            if( !empty( $entry ) ) {
166
+            if ( ! empty( $entry ) ) {
167 167
 
168 168
                 // We want the merge tag to be formatted as a class. The merge tag may be
169 169
                 // replaced by a multiple-word value that should be output as a single class.
170 170
                 // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
171
+                add_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
172 172
 
173
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
173
+                $custom_class = self::replace_variables( $custom_class, $form, $entry );
174 174
 
175 175
                 // And then we want life to return to normal
176
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
176
+                remove_filter( 'gform_merge_tag_filter', 'sanitize_html_class' );
177 177
             }
178 178
 
179 179
 			// And now we want the spaces to be handled nicely.
180
-			$classes[] = gravityview_sanitize_html_class( $custom_class );
180
+			$classes[ ] = gravityview_sanitize_html_class( $custom_class );
181 181
 
182 182
 		}
183 183
 
184
-		if(!empty($field['id'])) {
185
-			if( !empty( $form ) && !empty( $form['id'] ) ) {
186
-				$form_id = '-'.$form['id'];
184
+		if ( ! empty( $field[ 'id' ] ) ) {
185
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
186
+				$form_id = '-' . $form[ 'id' ];
187 187
 			} else {
188 188
 				// @deprecated path. Form should always be given.
189 189
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
190 190
 				$gravityview_view = GravityView_View::getInstance();
191
-				$form_id = $gravityview_view->getFormId() ? '-'. $gravityview_view->getFormId() : '';
191
+				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
192 192
 			}
193 193
 
194
-			$classes[] = 'gv-field'.$form_id.'-'.$field['id'];
194
+			$classes[ ] = 'gv-field' . $form_id . '-' . $field[ 'id' ];
195 195
 		}
196 196
 
197
-		return esc_attr(implode(' ', $classes));
197
+		return esc_attr( implode( ' ', $classes ) );
198 198
 	}
199 199
 
200 200
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @return string Sanitized unique HTML `id` attribute for the field
211 211
 	 */
212 212
 	public static function field_html_attr_id( $field, $form = array(), $entry = array() ) {
213
-		$id = $field['id'];
213
+		$id = $field[ 'id' ];
214 214
 
215 215
 		if ( ! empty( $id ) ) {
216
-			if ( ! empty( $form ) && ! empty( $form['id'] ) ) {
217
-				$form_id = '-' . $form['id'];
216
+			if ( ! empty( $form ) && ! empty( $form[ 'id' ] ) ) {
217
+				$form_id = '-' . $form[ 'id' ];
218 218
 			} else {
219 219
 				// @deprecated path. Form should always be given.
220 220
 				gravityview()->log->warning( 'GravityView_View::getInstance() legacy API called' );
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 				$form_id = $gravityview_view->getFormId() ? '-' . $gravityview_view->getFormId() : '';
223 223
 			}
224 224
 
225
-			$id = 'gv-field' . $form_id . '-' . $field['id'];
225
+			$id = 'gv-field' . $form_id . '-' . $field[ 'id' ];
226 226
 		}
227 227
 
228 228
 		return esc_attr( $id );
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	public static function entry_link_html( $entry = array(), $anchor_text = '', $passed_tag_atts = array(), $field_settings = array(), $base_id = null ) {
264 264
 
265
-		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry['id'] ) ) {
265
+		if ( empty( $entry ) || ! is_array( $entry ) || ! isset( $entry[ 'id' ] ) ) {
266 266
 			gravityview()->log->debug( 'Entry not defined; returning null', array( 'data' => $entry ) );
267 267
 			return NULL;
268 268
 		}
269 269
 
270 270
 		$href = self::entry_link( $entry, $base_id );
271 271
 
272
-		if( '' === $href ) {
272
+		if ( '' === $href ) {
273 273
 			return NULL;
274 274
 		}
275 275
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		} else {
307 307
 			$gravityview_view = GravityView_View::getInstance();
308 308
 
309
-			if( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
309
+			if ( $gravityview_view && ( $gravityview_view->curr_start || $gravityview_view->curr_end || $gravityview_view->curr_search ) ) {
310 310
 				$is_search = true;
311 311
 			}
312 312
 		}
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 
404 404
 		// If we've saved the permalink in memory, use it
405 405
 		// @since 1.3
406
-		$link = wp_cache_get( 'gv_directory_link_'.$post_id );
406
+		$link = wp_cache_get( 'gv_directory_link_' . $post_id );
407 407
 
408
-		if ( (int) $post_id === (int) get_option( 'page_on_front' ) ) {
408
+		if ( (int)$post_id === (int)get_option( 'page_on_front' ) ) {
409 409
 			$link = home_url();
410 410
 		}
411 411
 
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 			// If not yet saved, cache the permalink.
416 416
 			// @since 1.3
417
-			wp_cache_set( 'gv_directory_link_'.$post_id, $link );
417
+			wp_cache_set( 'gv_directory_link_' . $post_id, $link );
418 418
 		}
419 419
 
420 420
 		// Deal with returning to proper pagination for embedded views
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 
423 423
 			$args = array();
424 424
 
425
-			if( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
-				$args['pagenum'] = intval( $pagenum );
425
+			if ( $pagenum = \GV\Utils::_GET( 'pagenum' ) ) {
426
+				$args[ 'pagenum' ] = intval( $pagenum );
427 427
 			}
428 428
 
429
-			if( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
-				$args['sort'] = $sort;
431
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
429
+			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
430
+				$args[ 'sort' ] = $sort;
431
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
432 432
 			}
433 433
 
434 434
 			$link = add_query_arg( $args, $link );
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	private static function get_custom_entry_slug( $id, $entry = array() ) {
466 466
 
467 467
 		// Generate an unique hash to use as the default value
468
-		$slug = substr( wp_hash( $id, 'gravityview'.$id ), 0, 8 );
468
+		$slug = substr( wp_hash( $id, 'gravityview' . $id ), 0, 8 );
469 469
 
470 470
 		/**
471 471
 		 * @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}`
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$slug = apply_filters( 'gravityview_entry_slug', $slug, $id, $entry );
477 477
 
478 478
 		// Make sure we have something - use the original ID as backup.
479
-		if( empty( $slug ) ) {
479
+		if ( empty( $slug ) ) {
480 480
 			$slug = $id;
481 481
 		}
482 482
 
@@ -570,15 +570,15 @@  discard block
 block discarded – undo
570 570
          * @param boolean $custom Should we process the custom entry slug?
571 571
          */
572 572
         $custom = apply_filters( 'gravityview_custom_entry_slug', false );
573
-        if( $custom ) {
573
+        if ( $custom ) {
574 574
             // create the gravityview_unique_id and save it
575 575
 
576 576
             // Get the entry hash
577
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
577
+            $hash = self::get_custom_entry_slug( $entry[ 'id' ], $entry );
578 578
 
579
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
579
+	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry[ 'id' ], 'hash' => $hash ) );
580 580
 
581
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
581
+            gform_update_meta( $entry[ 'id' ], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
582 582
 
583 583
         }
584 584
     }
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		if ( ! empty( $entry ) && ! is_array( $entry ) ) {
605 605
 			$entry = GVCommon::get_entry( $entry );
606
-		} else if( empty( $entry ) ) {
606
+		} else if ( empty( $entry ) ) {
607 607
 			// @deprecated path
608 608
 			$entry = GravityView_frontend::getInstance()->getEntry();
609 609
 		}
@@ -623,38 +623,38 @@  discard block
 block discarded – undo
623 623
 
624 624
 		$query_arg_name = \GV\Entry::get_endpoint_name();
625 625
 
626
-		if ( ! empty( $entry['_multi'] ) ) {
626
+		if ( ! empty( $entry[ '_multi' ] ) ) {
627 627
 			$entry_slugs = array();
628 628
 
629
-			foreach ( $entry['_multi'] as $_multi ) {
629
+			foreach ( $entry[ '_multi' ] as $_multi ) {
630 630
 
631
-				if( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
632
-					$entry_slugs[] = $gv_multi->get_slug();
631
+				if ( $gv_multi = \GV\GF_Entry::from_entry( $_multi ) ) {
632
+					$entry_slugs[ ] = $gv_multi->get_slug();
633 633
 				} else {
634 634
 					// TODO: This path isn't covered by unit tests
635
-					$entry_slugs[] = \GravityView_API::get_entry_slug( $_multi['id'], $_multi );
635
+					$entry_slugs[ ] = \GravityView_API::get_entry_slug( $_multi[ 'id' ], $_multi );
636 636
 				}
637 637
 
638 638
 				unset( $gv_multi );
639 639
 
640
-				$forms[] = $_multi['form_id'];
640
+				$forms[ ] = $_multi[ 'form_id' ];
641 641
 			}
642 642
 
643 643
 			$entry_slug = implode( ',', $entry_slugs );
644 644
 		} else {
645 645
 
646 646
 			// Fallback when
647
-			if( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
647
+			if ( $gv_entry = \GV\GF_Entry::from_entry( $entry ) ) {
648 648
 				$entry_slug = $gv_entry->get_slug();
649 649
 			} else {
650 650
 				// TODO: This path isn't covered by unit tests
651
-				$entry_slug = \GravityView_API::get_entry_slug( $entry['id'], $entry );
651
+				$entry_slug = \GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
652 652
 			}
653 653
 
654 654
 			unset( $gv_entry );
655 655
 		}
656 656
 
657
-		if ( get_option('permalink_structure') && !is_preview() ) {
657
+		if ( get_option( 'permalink_structure' ) && ! is_preview() ) {
658 658
 
659 659
 			$args = array();
660 660
 
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
 			 */
665 665
 			$link_parts = explode( '?', $directory_link );
666 666
 
667
-			$query = !empty( $link_parts[1] ) ? '?'.$link_parts[1] : '';
667
+			$query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : '';
668 668
 
669
-			$directory_link = trailingslashit( $link_parts[0] ) . $query_arg_name . '/'. $entry_slug .'/' . $query;
669
+			$directory_link = trailingslashit( $link_parts[ 0 ] ) . $query_arg_name . '/' . $entry_slug . '/' . $query;
670 670
 
671 671
 		} else {
672 672
 
@@ -678,21 +678,21 @@  discard block
 block discarded – undo
678 678
 		 */
679 679
 		if ( $add_directory_args ) {
680 680
 
681
-			if ( ! empty( $_GET['pagenum'] ) ) {
682
-				$args['pagenum'] = intval( $_GET['pagenum'] );
681
+			if ( ! empty( $_GET[ 'pagenum' ] ) ) {
682
+				$args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] );
683 683
 			}
684 684
 
685 685
 			/**
686 686
 			 * @since 1.7
687 687
 			 */
688 688
 			if ( $sort = \GV\Utils::_GET( 'sort' ) ) {
689
-				$args['sort'] = $sort;
690
-				$args['dir'] = \GV\Utils::_GET( 'dir' );
689
+				$args[ 'sort' ] = $sort;
690
+				$args[ 'dir' ] = \GV\Utils::_GET( 'dir' );
691 691
 			}
692 692
 
693 693
 		}
694 694
 
695
-		if( $post_id ) {
695
+		if ( $post_id ) {
696 696
 			$passed_post = get_post( $post_id );
697 697
 			$views       = \GV\View_Collection::from_post( $passed_post );
698 698
 			$has_multiple_views = $views->count() > 1;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		}
702 702
 
703 703
 		if ( $has_multiple_views ) {
704
-			$args['gvid'] = $view_id ? $view_id : gravityview_get_view_id();
704
+			$args[ 'gvid' ] = $view_id ? $view_id : gravityview_get_view_id();
705 705
 		}
706 706
 
707 707
 		return add_query_arg( $args, $directory_link );
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 }
723 723
 
724 724
 function gv_class( $field, $form = NULL, $entry = array() ) {
725
-	return GravityView_API::field_class( $field, $form, $entry  );
725
+	return GravityView_API::field_class( $field, $form, $entry );
726 726
 }
727 727
 
728 728
 /**
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		$view_id = 0;
746 746
 		if ( $context->view ) {
747 747
 			$view_id = $context->view->ID;
748
-			if( $context->view->settings->get( 'hide_until_searched' ) ) {
748
+			if ( $context->view->settings->get( 'hide_until_searched' ) ) {
749 749
 				$hide_until_searched = ( empty( $context->entry ) && ! $context->request->is_search() );
750 750
 			}
751 751
 		}
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		$default_css_class .= ' gv-container-no-results';
774 774
 	}
775 775
 
776
-	$css_class = trim( $passed_css_class . ' '. $default_css_class );
776
+	$css_class = trim( $passed_css_class . ' ' . $default_css_class );
777 777
 
778 778
 	/**
779 779
 	 * @filter `gravityview/render/container/class` Modify the CSS class to be added to the wrapper <div> of a View
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
 	$value = GravityView_API::field_value( $entry, $field );
802 802
 
803
-	if( $value === '' ) {
803
+	if ( $value === '' ) {
804 804
 		/**
805 805
 		 * @filter `gravityview_empty_value` What to display when a field is empty
806 806
 		 * @param string $value (empty string)
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
  */
914 914
 function gravityview_get_field_value( $entry, $field_id, $display_value ) {
915 915
 
916
-	if( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
916
+	if ( floatval( $field_id ) === floor( floatval( $field_id ) ) ) {
917 917
 
918 918
 		// For the complete field value as generated by Gravity Forms
919 919
 		return $display_value;
@@ -947,16 +947,16 @@  discard block
 block discarded – undo
947 947
 		$terms = explode( ', ', $value );
948 948
 	}
949 949
 
950
-	foreach ($terms as $term_name ) {
950
+	foreach ( $terms as $term_name ) {
951 951
 
952 952
 		// If we're processing a category,
953
-		if( $taxonomy === 'category' ) {
953
+		if ( $taxonomy === 'category' ) {
954 954
 
955 955
 			// Use rgexplode to prevent errors if : doesn't exist
956 956
 			list( $term_name, $term_id ) = rgexplode( ':', $term_name, 2 );
957 957
 
958 958
 			// The explode was succesful; we have the category ID
959
-			if( !empty( $term_id )) {
959
+			if ( ! empty( $term_id ) ) {
960 960
 				$term = get_term_by( 'id', $term_id, $taxonomy );
961 961
 			} else {
962 962
 			// We have to fall back to the name
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 		}
970 970
 
971 971
 		// There's still a tag/category here.
972
-		if( $term ) {
972
+		if ( $term ) {
973 973
 
974 974
 			$term_link = get_term_link( $term, $taxonomy );
975 975
 
@@ -978,11 +978,11 @@  discard block
 block discarded – undo
978 978
 			    continue;
979 979
 			}
980 980
 
981
-			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
981
+			$output[ ] = gravityview_get_link( $term_link, esc_html( $term->name ) );
982 982
 		}
983 983
 	}
984 984
 
985
-	return implode(', ', $output );
985
+	return implode( ', ', $output );
986 986
 }
987 987
 
988 988
 /**
@@ -996,8 +996,8 @@  discard block
 block discarded – undo
996 996
 
997 997
 	$output = get_the_term_list( $post_id, $taxonomy, NULL, ', ' );
998 998
 
999
-	if( empty( $link ) ) {
1000
-		return strip_tags( $output);
999
+	if ( empty( $link ) ) {
1000
+		return strip_tags( $output );
1001 1001
 	}
1002 1002
 
1003 1003
 	return $output;
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 	$fe = GravityView_frontend::getInstance();
1017 1017
 
1018 1018
 	// Solve problem when loading content via admin-ajax.php
1019
-	if( ! $fe->getGvOutputData() ) {
1019
+	if ( ! $fe->getGvOutputData() ) {
1020 1020
 
1021 1021
 		gravityview()->log->debug( 'gv_output_data not defined; parsing content.' );
1022 1022
 
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	}
1025 1025
 
1026 1026
 	// Make 100% sure that we're dealing with a properly called situation
1027
-	if( !is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1027
+	if ( ! is_a( $fe->getGvOutputData(), 'GravityView_View_Data' ) ) {
1028 1028
 
1029 1029
 		gravityview()->log->debug( 'gv_output_data not an object or get_view not callable.', array( 'data' => $fe->getGvOutputData() ) );
1030 1030
 
@@ -1255,12 +1255,12 @@  discard block
 block discarded – undo
1255 1255
 function gravityview_get_files_array( $value, $gv_class = '', $context = null ) {
1256 1256
 	/** @define "GRAVITYVIEW_DIR" "../" */
1257 1257
 
1258
-	if( !class_exists( 'GravityView_Field' ) ) {
1259
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field.php' );
1258
+	if ( ! class_exists( 'GravityView_Field' ) ) {
1259
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field.php' );
1260 1260
 	}
1261 1261
 
1262
-	if( !class_exists( 'GravityView_Field_FileUpload' ) ) {
1263
-		include_once( GRAVITYVIEW_DIR .'includes/fields/class-gravityview-field-fileupload.php' );
1262
+	if ( ! class_exists( 'GravityView_Field_FileUpload' ) ) {
1263
+		include_once( GRAVITYVIEW_DIR . 'includes/fields/class-gravityview-field-fileupload.php' );
1264 1264
 	}
1265 1265
 
1266 1266
 	if ( is_null( $context ) ) {
@@ -1363,21 +1363,21 @@  discard block
 block discarded – undo
1363 1363
 	} else {
1364 1364
 		// @deprecated path
1365 1365
 		// Required fields.
1366
-		if ( empty( $args['field'] ) || empty( $args['form'] ) ) {
1366
+		if ( empty( $args[ 'field' ] ) || empty( $args[ 'form' ] ) ) {
1367 1367
 			gravityview()->log->error( 'Field or form are empty.', array( 'data' => $args ) );
1368 1368
 			return '';
1369 1369
 		}
1370 1370
 	}
1371 1371
 
1372 1372
 	if ( $context instanceof \GV\Template_Context ) {
1373
-		$entry = $args['entry'] ? : ( $context->entry ? $context->entry->as_entry() : array() );
1374
-		$field = $args['field'] ? : ( $context->field ? $context->field->as_configuration() : array() );
1375
-		$form = $args['form'] ? : ( $context->view->form ? $context->view->form->form : array() );
1373
+		$entry = $args[ 'entry' ] ?: ( $context->entry ? $context->entry->as_entry() : array() );
1374
+		$field = $args[ 'field' ] ?: ( $context->field ? $context->field->as_configuration() : array() );
1375
+		$form = $args[ 'form' ] ?: ( $context->view->form ? $context->view->form->form : array() );
1376 1376
 	} else {
1377 1377
 		// @deprecated path
1378
-		$entry = empty( $args['entry'] ) ? array() : $args['entry'];
1379
-		$field = $args['field'];
1380
-		$form = $args['form'];
1378
+		$entry = empty( $args[ 'entry' ] ) ? array() : $args[ 'entry' ];
1379
+		$field = $args[ 'field' ];
1380
+		$form = $args[ 'form' ];
1381 1381
 	}
1382 1382
 
1383 1383
 	/**
@@ -1397,43 +1397,43 @@  discard block
 block discarded – undo
1397 1397
 	);
1398 1398
 
1399 1399
 	if ( $context instanceof \GV\Template_Context ) {
1400
-		$placeholders['value'] = \GV\Utils::get( $args, 'value', '' );
1400
+		$placeholders[ 'value' ] = \GV\Utils::get( $args, 'value', '' );
1401 1401
 	} else {
1402 1402
 		// @deprecated path
1403
-		$placeholders['value'] = gv_value( $entry, $field );
1403
+		$placeholders[ 'value' ] = gv_value( $entry, $field );
1404 1404
 	}
1405 1405
 
1406 1406
 	// If the value is empty and we're hiding empty, return empty.
1407
-	if ( $placeholders['value'] === '' && ! empty( $args['hide_empty'] ) ) {
1407
+	if ( $placeholders[ 'value' ] === '' && ! empty( $args[ 'hide_empty' ] ) ) {
1408 1408
 		return '';
1409 1409
 	}
1410 1410
 
1411
-	if ( $placeholders['value'] !== '' && ! empty( $args['wpautop'] ) ) {
1412
-		$placeholders['value'] = wpautop( $placeholders['value'] );
1411
+	if ( $placeholders[ 'value' ] !== '' && ! empty( $args[ 'wpautop' ] ) ) {
1412
+		$placeholders[ 'value' ] = wpautop( $placeholders[ 'value' ] );
1413 1413
 	}
1414 1414
 
1415 1415
 	// Get width setting, if exists
1416
-	$placeholders['width'] = GravityView_API::field_width( $field );
1416
+	$placeholders[ 'width' ] = GravityView_API::field_width( $field );
1417 1417
 
1418 1418
 	// If replacing with CSS inline formatting, let's do it.
1419
-	$placeholders['width:style'] = GravityView_API::field_width( $field, 'width:' . $placeholders['width'] . '%;' );
1419
+	$placeholders[ 'width:style' ] = GravityView_API::field_width( $field, 'width:' . $placeholders[ 'width' ] . '%;' );
1420 1420
 
1421 1421
 	// Grab the Class using `gv_class`
1422
-	$placeholders['class'] = gv_class( $field, $form, $entry );
1423
-	$placeholders['field_id'] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1422
+	$placeholders[ 'class' ] = gv_class( $field, $form, $entry );
1423
+	$placeholders[ 'field_id' ] = GravityView_API::field_html_attr_id( $field, $form, $entry );
1424 1424
 
1425 1425
 	if ( $context instanceof \GV\Template_Context ) {
1426
-		$placeholders['label_value'] = \GV\Utils::get( $args, 'label' );
1426
+		$placeholders[ 'label_value' ] = \GV\Utils::get( $args, 'label' );
1427 1427
 	} else {
1428 1428
 		// Default Label value
1429
-		$placeholders['label_value'] = gv_label( $field, $entry );
1429
+		$placeholders[ 'label_value' ] = gv_label( $field, $entry );
1430 1430
 	}
1431 1431
 
1432
-	$placeholders['label_value:data-label'] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders['label_value'] ) ) ) );
1433
-	$placeholders['label_value:esc_attr'] = esc_attr( $placeholders['label_value'] );
1432
+	$placeholders[ 'label_value:data-label' ] = trim( esc_attr( strip_tags( str_replace( '>&nbsp;', '>', $placeholders[ 'label_value' ] ) ) ) );
1433
+	$placeholders[ 'label_value:esc_attr' ] = esc_attr( $placeholders[ 'label_value' ] );
1434 1434
 
1435
-	if ( empty( $placeholders['label'] ) && ! empty( $placeholders['label_value'] ) ){
1436
-		$placeholders['label'] = '<span class="gv-field-label">{{ label_value }}</span>';
1435
+	if ( empty( $placeholders[ 'label' ] ) && ! empty( $placeholders[ 'label_value' ] ) ) {
1436
+		$placeholders[ 'label' ] = '<span class="gv-field-label">{{ label_value }}</span>';
1437 1437
 	}
1438 1438
 
1439 1439
 	/**
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 	 * @since 2.0
1445 1445
 	 * @param \GV\Template_Context $context The context.
1446 1446
 	 */
1447
-	$html = apply_filters( 'gravityview/field_output/pre_html', $args['markup'], $args, $context );
1447
+	$html = apply_filters( 'gravityview/field_output/pre_html', $args[ 'markup' ], $args, $context );
1448 1448
 
1449 1449
 	/**
1450 1450
 	 * @filter `gravityview/field_output/open_tag` Modify the opening tags for the template content placeholders
@@ -1471,7 +1471,7 @@  discard block
 block discarded – undo
1471 1471
 	foreach ( $placeholders as $tag => $value ) {
1472 1472
 
1473 1473
 		// If the tag doesn't exist just skip it
1474
-		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ){
1474
+		if ( false === strpos( $html, $open_tag . $tag . $close_tag ) && false === strpos( $html, $open_tag . ' ' . $tag . ' ' . $close_tag ) ) {
1475 1475
 			continue;
1476 1476
 		}
1477 1477
 
Please login to merge, or discard this patch.
future/includes/rest/class-gv-rest-route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 		$format = '(?:\.(?P<format>html|json))?';
134 134
 
135
-		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array(
135
+		register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array(
136 136
 			array(
137 137
 				'methods'         => \WP_REST_Server::READABLE,
138 138
 				'callback'        => array( $this, 'get_sub_item' ),
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @return \WP_REST_Response
383 383
 	 */
384 384
 	protected function not_implemented() {
385
-		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' )  );
385
+		$error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) );
386 386
 		return new \WP_REST_Response( $error, 501 );
387 387
 	}
388 388
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-textarea.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@
 block discarded – undo
39 39
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
40 40
 		);
41 41
 
42
-        $field_options['make_clickable'] = array(
43
-            'type' => 'checkbox',
44
-            'merge_tags' => false,
45
-            'value' => 0,
46
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
47
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48
-        );
42
+		$field_options['make_clickable'] = array(
43
+			'type' => 'checkbox',
44
+			'merge_tags' => false,
45
+			'value' => 0,
46
+			'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
47
+			'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48
+		);
49 49
 
50 50
 		$field_options['allow_html'] = array(
51 51
 			'type' => 'checkbox',
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
29 29
 
30
-		if( 'edit' === $context ) {
30
+		if ( 'edit' === $context ) {
31 31
 			return $field_options;
32 32
 		}
33 33
 
34
-		$field_options['trim_words'] = array(
34
+		$field_options[ 'trim_words' ] = array(
35 35
 			'type' => 'number',
36 36
 			'merge_tags' => false,
37 37
 			'value' => null,
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
40 40
 		);
41 41
 
42
-        $field_options['make_clickable'] = array(
42
+        $field_options[ 'make_clickable' ] = array(
43 43
             'type' => 'checkbox',
44 44
             'merge_tags' => false,
45 45
             'value' => 0,
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
48 48
         );
49 49
 
50
-		$field_options['allow_html'] = array(
50
+		$field_options[ 'allow_html' ] = array(
51 51
 			'type' => 'checkbox',
52 52
 			'merge_tags' => false,
53 53
 			'value' => 1,
Please login to merge, or discard this patch.
includes/admin/field-types/type_number.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * number input type
4 4
  */
5 5
 
6
-if( !class_exists('GravityView_FieldType_text') ) {
6
+if ( ! class_exists( 'GravityView_FieldType_text' ) ) {
7 7
 	include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' );
8 8
 }
9 9
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 		$show_mt = $this->show_merge_tags();
22 22
 
23
-		if ( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
23
+		if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
24 24
 			$class = 'merge-tag-support mt-position-right mt-hide_all_fields ';
25 25
 		}
26 26
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 		$step = \GV\Utils::get( $this->field, 'step', null );
32 32
 
33 33
 		$atts = '';
34
-		$atts .= $max ? ' max="' . (int) $max . '"' : '';
35
-		$atts .= $min ? ' min="' . (int) $min . '"' : '';
36
-		$atts .= $step ? ' step="' . (int) $step . '"' : '';
34
+		$atts .= $max ? ' max="' . (int)$max . '"' : '';
35
+		$atts .= $min ? ' min="' . (int)$min . '"' : '';
36
+		$atts .= $step ? ' step="' . (int)$step . '"' : '';
37 37
 		?>
38 38
 		<input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number"
39 39
 		       value="<?php echo esc_attr( $this->value ); ?>"
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravityformspartialentries.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$partial_entries_addon = GF_Partial_Entries::get_instance();
55 55
 
56
-		$feed_settings = $partial_entries_addon->get_feed_settings( $form['id'] );
56
+		$feed_settings = $partial_entries_addon->get_feed_settings( $form[ 'id' ] );
57 57
 
58 58
 		$is_enabled = \GV\Utils::get( $feed_settings, 'enable', 0 );
59 59
 
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 		$partial_entry_id = \GV\Utils::get( $entry, 'partial_entry_id' );
67 67
 
68 68
 		// Set the expected $_POST key for the Add-On to use
69
-		$_POST['partial_entry_id'] = $partial_entry_id;
69
+		$_POST[ 'partial_entry_id' ] = $partial_entry_id;
70 70
 
71 71
 		gravityview()->log->debug( 'Saving partial entry (ID #{partial_entry_id}) for Entry #{entry_id}', array(
72 72
 			'partial_entry_id' => $partial_entry_id,
73 73
 			'entry_id'         => $entry_id
74 74
 		) );
75 75
 
76
-		$partial_entries_addon->maybe_save_partial_entry( $form['id'] );
76
+		$partial_entries_addon->maybe_save_partial_entry( $form[ 'id' ] );
77 77
 	}
78 78
 }
79 79
 
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 		$form = false;
127 127
 
128
-		if( $entry ) {
129
-			$form = GFAPI::get_form( $entry['form_id'] );
128
+		if ( $entry ) {
129
+			$form = GFAPI::get_form( $entry[ 'form_id' ] );
130 130
 		}
131 131
 
132 132
 		return $form;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 			}
203 203
 		}
204 204
 
205
-		return (bool) $has_transaction_data;
205
+		return (bool)$has_transaction_data;
206 206
 	}
207 207
 
208 208
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
242 242
 
243
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
243
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
244 244
 
245 245
 		return $result;
246 246
 	}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	 *
261 261
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
262 262
 	 */
263
-	public static function get_forms(  $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
263
+	public static function get_forms( $active = true, $trash = false, $order_by = 'id', $order = 'ASC' ) {
264 264
 		$forms = array();
265 265
 		if ( ! class_exists( 'GFAPI' ) ) {
266 266
 			return array();
267 267
 		}
268 268
 
269
-		if( 'any' === $active ) {
269
+		if ( 'any' === $active ) {
270 270
 			$active_forms = GFAPI::get_forms( true, $trash );
271 271
 			$inactive_forms = GFAPI::get_forms( false, $trash );
272 272
 			$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 		$has_post_fields = false;
300 300
 
301 301
 		if ( $form ) {
302
-			foreach ( $form['fields'] as $field ) {
303
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
304
-					$fields["{$field['id']}"] = array(
302
+			foreach ( $form[ 'fields' ] as $field ) {
303
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
304
+					$fields[ "{$field[ 'id' ]}" ] = array(
305 305
 						'label' => \GV\Utils::get( $field, 'label' ),
306 306
 						'parent' => null,
307 307
 						'type' => \GV\Utils::get( $field, 'type' ),
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 					);
311 311
 				}
312 312
 
313
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
314
-					foreach ( $field['inputs'] as $input ) {
313
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
314
+					foreach ( $field[ 'inputs' ] as $input ) {
315 315
 
316
-						if( ! empty( $input['isHidden'] ) ) {
316
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
317 317
 							continue;
318 318
 						}
319 319
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
                          * @hack
322 322
                          * In case of email/email confirmation, the input for email has the same id as the parent field
323 323
                          */
324
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
324
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
325 325
                             continue;
326 326
                         }
327
-						$fields["{$input['id']}"] = array(
327
+						$fields[ "{$input[ 'id' ]}" ] = array(
328 328
 							'label' => \GV\Utils::get( $input, 'label' ),
329 329
 							'customLabel' => \GV\Utils::get( $input, 'customLabel' ),
330 330
 							'parent' => $field,
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 				}
337 337
 
338 338
 
339
-				if( GFCommon::is_product_field( $field['type'] ) ){
339
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
340 340
 					$has_product_fields = true;
341 341
 				}
342 342
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 * @since 1.7
351 351
 		 */
352 352
 		if ( $has_post_fields ) {
353
-			$fields['post_id'] = array(
353
+			$fields[ 'post_id' ] = array(
354 354
 				'label' => __( 'Post ID', 'gravityview' ),
355 355
 				'type' => 'post_id',
356 356
 			);
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 			foreach ( $payment_fields as $payment_field ) {
364 364
 
365 365
 				// Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key
366
-				if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
366
+				if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) {
367 367
 					continue;
368 368
 				}
369 369
 
370
-				$fields["{$payment_field->name}"] = array(
370
+				$fields[ "{$payment_field->name}" ] = array(
371 371
 					'label' => $payment_field->label,
372 372
 					'desc' => $payment_field->description,
373 373
 					'type' => $payment_field->name,
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 
400 400
 		$fields = array();
401 401
 
402
-		foreach ( $extra_fields as $key => $field ){
403
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
404
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
402
+		foreach ( $extra_fields as $key => $field ) {
403
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
404
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
405 405
 			}
406 406
 		}
407 407
 
@@ -441,33 +441,33 @@  discard block
 block discarded – undo
441 441
 			'search_criteria' => null,
442 442
 			'sorting' => null,
443 443
 			'paging' => null,
444
-			'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true),
444
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ),
445 445
 			'context_view_id' => null,
446 446
 		);
447 447
 
448 448
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
449 449
 
450
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) && is_array( $criteria['search_criteria']['field_filters'] ) ) {
451
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
450
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) && is_array( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
451
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
452 452
 
453 453
 				if ( ! is_array( $filter ) ) {
454 454
 					continue;
455 455
 				}
456 456
 
457 457
 				// By default, we want searches to be wildcard for each field.
458
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
458
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
459 459
 
460 460
 				/**
461 461
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
462 462
 				 * @param string $operator Existing search operator
463 463
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
464 464
 				 */
465
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
465
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
466 466
 			}
467 467
 
468 468
 			// don't send just the [mode] without any field filter.
469
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
470
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
469
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
470
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
471 471
 			}
472 472
 
473 473
 		}
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
 		 * Prepare date formats to be in Gravity Forms DB format;
479 479
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
480 480
 		 */
481
-		foreach ( array('start_date', 'end_date' ) as $key ) {
481
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
482 482
 
483
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
483
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
484 484
 
485 485
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
486
-				$date = date_create( $criteria['search_criteria'][ $key ] );
486
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
487 487
 
488 488
 				if ( $date ) {
489 489
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
490
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
490
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
491 491
 				} else {
492
-					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) );
492
+					gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) );
493 493
 
494 494
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
495
-					unset( $criteria['search_criteria'][ $key ] );
495
+					unset( $criteria[ 'search_criteria' ][ $key ] );
496 496
 				}
497 497
 			}
498 498
 		}
499 499
 
500
-		if ( empty( $criteria['context_view_id'] ) ) {
500
+		if ( empty( $criteria[ 'context_view_id' ] ) ) {
501 501
 			// Calculate the context view id and send it to the advanced filter
502 502
 			if ( GravityView_frontend::getInstance()->getSingleEntry() ) {
503
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
503
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
504 504
 			} else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) {
505
-				$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
505
+				$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
506 506
 			} else if ( 'delete' === GFForms::get( 'action' ) ) {
507
-				$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
507
+				$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
508 508
 			}
509 509
 		}
510 510
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param array $form_ids Forms to search
515 515
 		 * @param int $view_id ID of the view being used to search
516 516
 		 */
517
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
517
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
518 518
 
519 519
 		return (array)$criteria;
520 520
 	}
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		/** Reduce # of database calls */
550 550
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
551 551
 
552
-		if ( ! empty( $criteria['cache'] ) ) {
552
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
553 553
 
554 554
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
555 555
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 				// Still update the total count when using cached results
559 559
 				if ( ! is_null( $total ) ) {
560
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
560
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
561 561
 				}
562 562
 
563 563
 				$return = $entries;
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 			$entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) );
580 580
 
581 581
 			// No entries returned from gravityview_before_get_entries
582
-			if( is_null( $entries ) ) {
582
+			if ( is_null( $entries ) ) {
583 583
 
584
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
584
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
585 585
 
586 586
 				if ( is_wp_error( $entries ) ) {
587 587
 					gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) );
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 				}
593 593
 			}
594 594
 
595
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
595
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
596 596
 
597 597
 				// Cache results
598 598
 				$Cache->set( $entries, 'entries' );
@@ -706,18 +706,18 @@  discard block
 block discarded – undo
706 706
 		$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry, $view );
707 707
 
708 708
 		// Is the entry allowed
709
-		if( $check_entry_display ) {
709
+		if ( $check_entry_display ) {
710 710
 
711 711
 			$gvid = \GV\Utils::_GET( 'gvid' );
712 712
 
713
-			if( $gvid ) {
713
+			if ( $gvid ) {
714 714
 				$view = \GV\View::by_id( $gvid );
715 715
 			}
716 716
 
717 717
 			$entry = self::check_entry_display( $entry, $view );
718 718
 		}
719 719
 
720
-		if( is_wp_error( $entry ) ) {
720
+		if ( is_wp_error( $entry ) ) {
721 721
 			gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) );
722 722
 			return false;
723 723
 		}
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
 
752 752
 		$value = false;
753 753
 
754
-		if( 'context' === $val1 ) {
754
+		if ( 'context' === $val1 ) {
755 755
 
756 756
 			$matching_contexts = array( $val2 );
757 757
 
758 758
 			// We allow for non-standard contexts.
759
-			switch( $val2 ) {
759
+			switch ( $val2 ) {
760 760
 				// Check for either single or edit
761 761
 				case 'singular':
762 762
 					$matching_contexts = array( 'single', 'edit' );
@@ -799,18 +799,18 @@  discard block
 block discarded – undo
799 799
 				$json_val_1 = json_decode( $val1, true );
800 800
 				$json_val_2 = json_decode( $val2, true );
801 801
 
802
-				if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
802
+				if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) {
803 803
 
804 804
 					$json_in = false;
805
-					$json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 );
806
-					$json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 );
805
+					$json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 );
806
+					$json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 );
807 807
 
808 808
 					// For JSON, we want to compare as "in" or "not in" rather than "contains"
809 809
 					foreach ( $json_val_1 as $item_1 ) {
810 810
 						foreach ( $json_val_2 as $item_2 ) {
811 811
 							$json_in = self::matches_operation( $item_1, $item_2, 'is' );
812 812
 
813
-							if( $json_in ) {
813
+							if ( $json_in ) {
814 814
 								break 2;
815 815
 							}
816 816
 						}
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 	public static function check_entry_display( $entry, $view = null ) {
862 862
 
863 863
 		if ( ! $entry || is_wp_error( $entry ) ) {
864
-			return new WP_Error('entry_not_found', 'Entry was not found.', $entry );
864
+			return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry );
865 865
 		}
866 866
 
867
-		if ( empty( $entry['form_id'] ) ) {
867
+		if ( empty( $entry[ 'form_id' ] ) ) {
868 868
 			return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry );
869 869
 		}
870 870
 
@@ -879,19 +879,19 @@  discard block
 block discarded – undo
879 879
 
880 880
 		$_gvid = \GV\Utils::_GET( 'gvid' );
881 881
 
882
-		if ( $_gvid && $view->ID !== (int) $_gvid ) {
882
+		if ( $_gvid && $view->ID !== (int)$_gvid ) {
883 883
 			return new WP_Error( 'view_id_not_match_gvid', 'View does not match passed $_GET["gvid"].', $view->ID );
884 884
 		}
885 885
 
886 886
 		$view_form_id = $view->form->ID;
887 887
 
888 888
 		if ( $view->joins ) {
889
-			if ( in_array( (int) $entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
-				$view_form_id = $entry['form_id'];
889
+			if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) {
890
+				$view_form_id = $entry[ 'form_id' ];
891 891
 			}
892 892
 		}
893 893
 
894
-		if ( (int) $view_form_id !== (int) $entry['form_id'] ) {
894
+		if ( (int)$view_form_id !== (int)$entry[ 'form_id' ] ) {
895 895
 			return new WP_Error( 'view_id_not_match', 'View form source does not match entry form source ID.', $entry );
896 896
 		}
897 897
 
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 		 * Check whether the entry is in the entries subset by running a modified query.
900 900
 		 */
901 901
 		add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) {
902
-			$_tmp_query       = new \GF_Query( $view_form_id, array(
902
+			$_tmp_query = new \GF_Query( $view_form_id, array(
903 903
 				'field_filters' => array(
904 904
 					'mode' => 'all',
905 905
 					array(
906 906
 						'key' => 'id',
907 907
 						'operation' => 'is',
908
-						'value' => $entry['id']
908
+						'value' => $entry[ 'id' ]
909 909
 					)
910 910
 				)
911 911
 			) );
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 			/** @var \GF_Query $query */
916 916
 			$query_parts      = $query->_introspect();
917 917
 
918
-			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) );
918
+			$query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) );
919 919
 
920 920
 		}, 10, 3 );
921 921
 
922 922
 		// Prevent page offset from being applied to the single entry query; it's used to return to the referring page number
923 923
 		add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) {
924 924
 
925
-			$criteria['paging'] = array(
925
+			$criteria[ 'paging' ] = array(
926 926
 				'offset' => 0,
927 927
 				'page_size' => 25
928 928
 			);
@@ -941,20 +941,20 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 		// This entry is on a View with joins
944
-		if ( $entries[0]->is_multi() ) {
944
+		if ( $entries[ 0 ]->is_multi() ) {
945 945
 
946 946
 			$multi_entry_ids = array();
947 947
 
948
-			foreach ( $entries[0]->entries as $multi_entry ) {
949
-				$multi_entry_ids[] = (int) $multi_entry->ID;
948
+			foreach ( $entries[ 0 ]->entries as $multi_entry ) {
949
+				$multi_entry_ids[ ] = (int)$multi_entry->ID;
950 950
 			}
951 951
 
952
-			if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) {
952
+			if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) {
953 953
 				remove_action( 'gravityview/view/query', $entry_subset_callback );
954 954
 				return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
955 955
 			}
956 956
 
957
-		} elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) {
957
+		} elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) {
958 958
 			remove_action( 'gravityview/view/query', $entry_subset_callback );
959 959
 			return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' );
960 960
 		}
@@ -999,18 +999,18 @@  discard block
 block discarded – undo
999 999
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
1000 1000
 		 * @see GFCommon::format_date() for original code
1001 1001
 		 */
1002
-		$date_gmt_time   = mysql2date( 'G', $date_string );
1002
+		$date_gmt_time = mysql2date( 'G', $date_string );
1003 1003
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
1004 1004
 
1005
-		$format  = \GV\Utils::get( $atts, 'format' );
1006
-		$is_human  = ! empty( $atts['human'] );
1007
-		$is_diff  = ! empty( $atts['diff'] );
1008
-		$is_raw = ! empty( $atts['raw'] );
1009
-		$is_timestamp = ! empty( $atts['timestamp'] );
1010
-		$include_time = ! empty( $atts['time'] );
1005
+		$format = \GV\Utils::get( $atts, 'format' );
1006
+		$is_human = ! empty( $atts[ 'human' ] );
1007
+		$is_diff = ! empty( $atts[ 'diff' ] );
1008
+		$is_raw = ! empty( $atts[ 'raw' ] );
1009
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
1010
+		$include_time = ! empty( $atts[ 'time' ] );
1011 1011
 
1012 1012
 		// If we're using time diff, we want to have a different default format
1013
-		if( empty( $format ) ) {
1013
+		if ( empty( $format ) ) {
1014 1014
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
1015 1015
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
1016 1016
 		}
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 		// If raw was specified, don't modify the stored value
1019 1019
 		if ( $is_raw ) {
1020 1020
 			$formatted_date = $date_string;
1021
-		} elseif( $is_timestamp ) {
1021
+		} elseif ( $is_timestamp ) {
1022 1022
 			$formatted_date = $date_local_timestamp;
1023 1023
 		} elseif ( $is_diff ) {
1024 1024
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 
1053 1053
 		$label = \GV\Utils::get( $field, 'label' );
1054 1054
 
1055
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
1055
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
1056 1056
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
1057 1057
 		}
1058 1058
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 			$form = GFAPI::get_form( $form );
1081 1081
 		}
1082 1082
 
1083
-		if ( class_exists( 'GFFormsModel' ) ){
1083
+		if ( class_exists( 'GFFormsModel' ) ) {
1084 1084
 			return GFFormsModel::get_field( $form, $field_id );
1085 1085
 		} else {
1086 1086
 			return null;
@@ -1127,19 +1127,19 @@  discard block
 block discarded – undo
1127 1127
 			$shortcodes = array();
1128 1128
 
1129 1129
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
1130
-			if ( empty( $matches ) ){
1130
+			if ( empty( $matches ) ) {
1131 1131
 				return false;
1132 1132
 			}
1133 1133
 
1134 1134
 			foreach ( $matches as $shortcode ) {
1135
-				if ( $tag === $shortcode[2] ) {
1135
+				if ( $tag === $shortcode[ 2 ] ) {
1136 1136
 
1137 1137
 					// Changed this to $shortcode instead of true so we get the parsed atts.
1138
-					$shortcodes[] = $shortcode;
1138
+					$shortcodes[ ] = $shortcode;
1139 1139
 
1140
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
1141
-					foreach( $results as $result ) {
1142
-						$shortcodes[] = $result;
1140
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
1141
+					foreach ( $results as $result ) {
1142
+						$shortcodes[ ] = $result;
1143 1143
 					}
1144 1144
 				}
1145 1145
 			}
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 			'post_type'      => 'gravityview',
1172 1172
 			'posts_per_page' => 100,
1173 1173
 			'meta_key'       => '_gravityview_form_id',
1174
-			'meta_value'     => (int) $form_id,
1174
+			'meta_value'     => (int)$form_id,
1175 1175
 		);
1176 1176
 		$args     = wp_parse_args( $args, $defaults );
1177 1177
 		$views    = get_posts( $args );
@@ -1183,21 +1183,21 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
 			$data = unserialize( $view->meta_value );
1185 1185
 
1186
-			if( ! $data || ! is_array( $data ) ) {
1186
+			if ( ! $data || ! is_array( $data ) ) {
1187 1187
 				continue;
1188 1188
 			}
1189 1189
 
1190 1190
 			foreach ( $data as $datum ) {
1191
-				if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) {
1192
-					$joined_forms[] = $view->post_id;
1191
+				if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) {
1192
+					$joined_forms[ ] = $view->post_id;
1193 1193
 				}
1194 1194
 			}
1195 1195
 		}
1196 1196
 
1197 1197
 		if ( $joined_forms ) {
1198
-			$joined_args  = array(
1198
+			$joined_args = array(
1199 1199
 				'post_type'      => 'gravityview',
1200
-				'posts_per_page' => $args['posts_per_page'],
1200
+				'posts_per_page' => $args[ 'posts_per_page' ],
1201 1201
 				'post__in'       => $joined_forms,
1202 1202
 			);
1203 1203
 			$views = array_merge( $views, get_posts( $joined_args ) );
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 		$directory_widgets = wp_parse_args( $view_widgets, $defaults );
1355 1355
 
1356
-		if( $json_decode ) {
1356
+		if ( $json_decode ) {
1357 1357
 			$directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' );
1358 1358
 		}
1359 1359
 
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 	 * @return string         html
1370 1370
 	 */
1371 1371
 	public static function get_sortable_fields( $formid, $current = '' ) {
1372
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1372
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1373 1373
 
1374 1374
 		if ( empty( $formid ) ) {
1375 1375
 			return $output;
@@ -1382,11 +1382,11 @@  discard block
 block discarded – undo
1382 1382
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1383 1383
 
1384 1384
 			foreach ( $fields as $id => $field ) {
1385
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1385
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1386 1386
 					continue;
1387 1387
 				}
1388 1388
 
1389
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1389
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1390 1390
 			}
1391 1391
 		}
1392 1392
 
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1422 1422
 
1423 1423
 		// TODO: Convert to using array_filter
1424
-		foreach( $fields as $id => $field ) {
1424
+		foreach ( $fields as $id => $field ) {
1425 1425
 
1426
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1426
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1427 1427
 				unset( $fields[ $id ] );
1428 1428
 			}
1429 1429
 
1430 1430
 			/**
1431 1431
 			 * Merge date and time subfields.
1432 1432
 			 */
1433
-			if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) {
1433
+			if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) {
1434 1434
 				$fields[ intval( $id ) ] = array(
1435 1435
 					'label' => \GV\Utils::get( $field, 'parent/label' ),
1436 1436
 					'parent' => null,
@@ -1480,14 +1480,14 @@  discard block
 block discarded – undo
1480 1480
 	 * @param  int|array  $field field key or field array
1481 1481
 	 * @return boolean
1482 1482
 	 */
1483
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1483
+	public static function is_field_numeric( $form = null, $field = '' ) {
1484 1484
 
1485 1485
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1486 1486
 			$form = self::get_form( $form );
1487 1487
 		}
1488 1488
 
1489 1489
 		// If entry meta, it's a string. Otherwise, numeric
1490
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1490
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1491 1491
 			$type = $field;
1492 1492
 		} else {
1493 1493
 			$type = self::get_field_type( $form, $field );
@@ -1501,9 +1501,9 @@  discard block
 block discarded – undo
1501 1501
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1502 1502
 
1503 1503
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1504
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1505
-			if( true === $gv_field->is_numeric ) {
1506
-				$numeric_types[] = $gv_field->is_numeric;
1504
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1505
+			if ( true === $gv_field->is_numeric ) {
1506
+				$numeric_types[ ] = $gv_field->is_numeric;
1507 1507
 			}
1508 1508
 		}
1509 1509
 
@@ -1653,18 +1653,18 @@  discard block
 block discarded – undo
1653 1653
 		$final_atts = array_filter( $final_atts );
1654 1654
 
1655 1655
 		// If the href wasn't passed as an attribute, use the value passed to the function
1656
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1657
-			$final_atts['href'] = $href;
1656
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1657
+			$final_atts[ 'href' ] = $href;
1658 1658
 		}
1659 1659
 
1660
-		$final_atts['href'] = esc_url_raw( $href );
1660
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1661 1661
 
1662 1662
 		/**
1663 1663
 		 * Fix potential security issue with target=_blank
1664 1664
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1665 1665
 		 */
1666
-		if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
-			$final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1666
+		if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) {
1667
+			$final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1668 1668
 		}
1669 1669
 
1670 1670
 		// Sort the attributes alphabetically, to help testing
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1677 1677
 		}
1678 1678
 
1679
-		if( '' !== $output ) {
1679
+		if ( '' !== $output ) {
1680 1680
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1681 1681
 		}
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1704 1704
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1705 1705
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1706
-				$merged[] = $value;
1706
+				$merged[ ] = $value;
1707 1707
 			} else {
1708 1708
 				$merged[ $key ] = $value;
1709 1709
 			}
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1737 1737
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1738 1738
 		 */
1739
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1739
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1740 1740
 
1741 1741
 		return get_users( $get_users_settings );
1742 1742
 	}
@@ -1756,11 +1756,11 @@  discard block
 block discarded – undo
1756 1756
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1757 1757
 
1758 1758
     	// If $cap is defined, only show notice if user has capability
1759
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1759
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1760 1760
     		return '';
1761 1761
 	    }
1762 1762
 
1763
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1763
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1764 1764
     }
1765 1765
 
1766 1766
 	/**
Please login to merge, or discard this patch.